From 4ed9117799b44611fe978c0de8f5c483df600191 Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Tue, 7 Jun 2022 15:31:26 -0500 Subject: [PATCH] Forge 1.19 * Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle Co-authored-by: sciwhiz12 Signed-off-by: SizableShrimp --- .gitignore | 1 + build.gradle | 170 ++- buildSrc/build.gradle | 5 +- docs/CONTRIBUTING.md | 6 +- docs/README.md | 21 +- docs/SUPPORT.md | 5 +- fmlcore/build.gradle | 8 +- .../minecraftforge/fml/IExtensionPoint.java | 95 +- .../minecraftforge/fml/IModLoadingState.java | 64 +- .../minecraftforge/fml/IModStateProvider.java | 9 + .../fml/IModStateTransition.java | 66 +- .../net/minecraftforge/fml/LogicalSide.java | 35 +- .../java/net/minecraftforge/fml/ModList.java | 9 +- .../net/minecraftforge/fml/ModLoader.java | 2 +- .../minecraftforge/fml/ModLoadingPhase.java | 26 +- .../minecraftforge/fml/ModLoadingStage.java | 50 + .../minecraftforge/fml/ModLoadingState.java | 80 +- .../fml/config/ConfigFileTypeHandler.java | 6 +- .../fml/config/ConfigTracker.java | 12 +- fmlloader/build.gradle | 43 +- .../common/asm/ObjectHolderDefinalize.java | 22 +- .../fml/common/asm/RuntimeEnumExtender.java | 47 +- .../loading/AdvancedLogMessageAdapter.java | 48 - .../minecraftforge/fml/loading/FMLConfig.java | 19 +- .../minecraftforge/fml/loading/FMLLoader.java | 32 +- .../minecraftforge/fml/loading/FMLPaths.java | 11 +- .../fml/loading/FMLServiceProvider.java | 6 +- .../minecraftforge/fml/loading/FileUtils.java | 16 +- .../fml/loading/LanguageLoadingProvider.java | 10 +- .../fml/loading/LauncherVersion.java | 6 +- .../fml/loading/LibraryFinder.java | 6 +- .../fml/loading/LogMarkers.java | 12 +- .../fml/loading/MCPNamingService.java | 6 +- .../loading/ModDirTransformerDiscoverer.java | 9 +- .../fml/loading/ModJarURLHandler.java | 6 +- .../minecraftforge/fml/loading/ModSorter.java | 15 +- .../fml/loading/RuntimeDistCleaner.java | 14 +- .../fml/loading/TracingPrintStream.java | 3 +- .../moddiscovery/AbstractJarFileLocator.java | 19 +- .../moddiscovery/AbstractModLocator.java | 6 +- .../moddiscovery/BackgroundScanHandler.java | 6 +- .../moddiscovery/ClasspathLocator.java | 10 +- .../ExplodedDirectoryLocator.java | 6 +- .../moddiscovery/MinecraftLocator.java | 7 +- .../loading/moddiscovery/ModDiscoverer.java | 12 +- .../fml/loading/moddiscovery/ModFile.java | 6 +- .../fml/loading/moddiscovery/ModFileInfo.java | 17 +- .../loading/moddiscovery/ModFileParser.java | 6 +- .../fml/loading/moddiscovery/ModInfo.java | 12 +- .../loading/moddiscovery/ModListHandler.java | 6 +- .../loading/moddiscovery/ModValidator.java | 10 +- .../moddiscovery/ModsFolderLocator.java | 6 +- .../fml/loading/moddiscovery/Scanner.java | 6 +- .../loading/progress/ClientVisualization.java | 2 - .../fml/loading/targets/ArgumentList.java | 6 +- .../targets/CommonClientLaunchHandler.java | 5 - .../loading/targets/CommonLaunchHandler.java | 6 +- .../targets/CommonServerLaunchHandler.java | 4 - gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 59821 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 10 +- javafmllanguage/build.gradle | 2 +- .../fml/javafmlmod/FMLModContainer.java | 5 +- l4jManifest.xml | 26 - .../fml/lowcodemod/LowCodeModContainer.java | 6 +- mclanguage/build.gradle | 2 +- mdk/build.gradle | 14 +- mdk/settings.gradle | 6 + mdk/src/main/resources/pack.mcmeta | 4 +- .../blaze3d/pipeline/RenderTarget.java.patch | 2 +- .../mojang/blaze3d/platform/Window.java.patch | 4 +- .../blaze3d/vertex/BufferBuilder.java.patch | 10 +- .../blaze3d/vertex/VertexFormat.java.patch | 2 +- .../RealmsGenericErrorScreen.java.patch | 4 +- .../net/minecraft/SharedConstants.java.patch | 2 +- .../minecraft/net/minecraft/Util.java.patch | 10 +- .../advancements/Advancement.java.patch | 7 +- .../advancements/AdvancementList.java.patch | 2 +- .../AdvancementRewards.java.patch | 4 +- .../client/ClientRecipeBook.java.patch | 2 +- .../minecraft/client/KeyMapping.java.patch | 18 +- .../client/KeyboardHandler.java.patch | 10 +- .../net/minecraft/client/Minecraft.java.patch | 260 ++-- .../minecraft/client/MouseHandler.java.patch | 4 +- .../net/minecraft/client/Options.java.patch | 14 +- .../client/RecipeBookCategories.java.patch | 8 +- .../minecraft/client/Screenshot.java.patch | 10 +- .../client/color/block/BlockColors.java.patch | 10 +- .../client/color/item/ItemColors.java.patch | 16 +- .../net/minecraft/client/gui/Gui.java.patch | 16 +- .../gui/components/AbstractWidget.java.patch | 6 +- .../components/DebugScreenOverlay.java.patch | 2 +- .../client/gui/screens/DeathScreen.java.patch | 6 +- .../gui/screens/OptionsScreen.java.patch | 2 +- .../client/gui/screens/Screen.java.patch | 41 +- .../client/gui/screens/TitleScreen.java.patch | 26 +- .../AdvancementsScreen.java.patch | 18 +- .../screens/controls/KeyBindsList.java.patch | 16 +- .../controls/KeyBindsScreen.java.patch | 2 +- .../AbstractContainerScreen.java.patch | 8 +- .../CreativeModeInventoryScreen.java.patch | 28 +- .../EffectRenderingInventoryScreen.java.patch | 4 +- .../inventory/EnchantmentScreen.java.patch | 16 +- .../screens/inventory/LoomScreen.java.patch | 44 - .../JoinMultiplayerScreen.java.patch | 2 +- .../ServerSelectionList.java.patch | 4 +- .../packs/PackSelectionScreen.java.patch | 2 +- .../recipebook/RecipeBookComponent.java.patch | 4 +- .../CreateWorldScreen.java.patch | 11 +- .../WorldGenSettingsComponent.java.patch | 19 - .../worldselection/WorldOpenFlows.java.patch | 33 + .../worldselection/WorldPreset.java.patch | 21 - .../WorldSelectionList.java.patch | 20 +- .../model/geom/LayerDefinitions.java.patch | 4 +- .../client/model/geom/ModelLayers.java.patch | 2 +- ...ientHandshakePacketListenerImpl.java.patch | 10 +- .../client/multiplayer/ClientLevel.java.patch | 59 +- .../ClientPacketListener.java.patch | 46 +- .../MultiPlayerGameMode.java.patch | 174 +-- .../client/multiplayer/PlayerInfo.java.patch | 2 +- .../ProfileKeyPairManager.java.patch | 11 + .../client/multiplayer/ServerData.java.patch | 6 +- .../multiplayer/ServerStatusPinger.java.patch | 2 +- .../particle/BreakingItemParticle.java.patch | 2 +- .../client/particle/ParticleEngine.java.patch | 18 +- .../player/AbstractClientPlayer.java.patch | 4 +- .../client/player/LocalPlayer.java.patch | 45 +- .../client/player/RemotePlayer.java.patch | 2 +- .../DimensionSpecialEffects.java.patch | 4 +- .../client/renderer/EffectInstance.java.patch | 10 +- .../client/renderer/FogRenderer.java.patch | 38 +- .../client/renderer/GameRenderer.java.patch | 30 +- .../renderer/ItemBlockRenderTypes.java.patch | 32 +- .../client/renderer/LevelRenderer.java.patch | 86 +- .../client/renderer/LightTexture.java.patch | 2 +- .../client/renderer/PostChain.java.patch | 10 +- .../client/renderer/RenderType.java.patch | 2 +- .../renderer/ScreenEffectRenderer.java.patch | 8 +- .../client/renderer/ShaderInstance.java.patch | 13 +- .../client/renderer/Sheets.java.patch | 8 +- .../block/BlockModelShaper.java.patch | 2 +- .../block/BlockRenderDispatcher.java.patch | 43 +- .../block/LiquidBlockRenderer.java.patch | 112 +- .../block/ModelBlockRenderer.java.patch | 127 +- .../block/model/BlockModel.java.patch | 16 +- .../block/model/ItemTransforms.java.patch | 23 +- .../BlockEntityRenderers.java.patch | 2 +- .../blockentity/ChestRenderer.java.patch | 4 +- .../blockentity/PistonHeadRenderer.java.patch | 2 +- .../blockentity/SkullBlockRenderer.java.patch | 2 +- .../chunk/ChunkRenderDispatcher.java.patch | 104 +- .../renderer/entity/BoatRenderer.java.patch | 4 +- .../entity/EntityRenderDispatcher.java.patch | 10 +- .../entity/FallingBlockRenderer.java.patch | 10 +- .../entity/ItemEntityRenderer.java.patch | 10 +- .../entity/ItemFrameRenderer.java.patch | 26 +- .../renderer/entity/ItemRenderer.java.patch | 16 +- .../entity/player/PlayerRenderer.java.patch | 10 +- .../renderer/item/ItemProperties.java.patch | 116 +- .../renderer/texture/Stitcher.java.patch | 10 +- .../renderer/texture/TextureAtlas.java.patch | 19 +- .../texture/TextureManager.java.patch | 2 +- .../language/ClientLanguage.java.patch | 2 +- .../resources/model/BakedModel.java.patch | 2 +- .../resources/model/ModelBakery.java.patch | 14 +- .../model/MultiPartBakedModel.java.patch | 12 +- .../model/WeightedBakedModel.java.patch | 20 +- .../resources/sounds/SoundInstance.java.patch | 2 +- .../client/server/IntegratedServer.java.patch | 10 +- .../client/sounds/SoundEngine.java.patch | 8 +- .../commands/CommandSourceStack.java.patch | 6 +- .../minecraft/commands/Commands.java.patch | 18 +- .../arguments/ObjectiveArgument.java.patch | 10 +- .../selector/EntitySelectorParser.java.patch | 6 +- .../ArgumentTypeInfos.java.patch | 32 + .../synchronization/ArgumentTypes.java.patch | 21 - .../net/minecraft/core/Holder.java.patch | 9 +- .../minecraft/core/MappedRegistry.java.patch | 2 +- .../net/minecraft/core/Registry.java.patch | 110 +- .../minecraft/core/RegistryAccess.java.patch | 8 +- .../minecraft/core/RegistryCodecs.java.patch | 6 +- .../dispenser/DispenseItemBehavior.java.patch | 2 +- .../particles/ItemParticleOption.java.patch | 2 +- .../core/particles/ParticleType.java.patch | 11 - .../core/particles/ParticleTypes.java.patch | 10 - .../data/BuiltinRegistries.java.patch | 26 +- .../minecraft/data/DataGenerator.java.patch | 42 +- .../net/minecraft/data/HashCache.java.patch | 22 +- .../net/minecraft/data/Main.java.patch | 10 +- .../AdvancementProvider.java.patch | 26 +- .../minecraft/data/loot/BlockLoot.java.patch | 10 +- .../minecraft/data/loot/EntityLoot.java.patch | 12 +- .../data/loot/LootTableProvider.java.patch | 12 +- .../data/recipes/RecipeProvider.java.patch | 16 +- .../tags/BannerPatternTagsProvider.java.patch | 16 + .../data/tags/BiomeTagsProvider.java.patch | 4 +- .../tags/CatVariantTagsProvider.java.patch | 16 + ...ConfiguredStructureTagsProvider.java.patch | 16 - ...evelGeneratorPresetTagsProvider.java.patch | 16 + .../tags/GameEventTagsProvider.java.patch | 6 +- .../tags/InstrumentTagsProvider.java.patch | 16 + .../data/tags/ItemTagsProvider.java.patch | 6 +- .../PaintingVariantTagsProvider.java.patch | 16 + .../data/tags/PoiTypeTagsProvider.java.patch | 16 + .../tags/StructureTagsProvider.java.patch | 16 + .../data/tags/TagsProvider.java.patch | 88 +- .../tags/WorldPresetTagsProvider.java.patch | 16 + .../worldgen/biome/OverworldBiomes.java.patch | 2 +- .../framework/GameTestServer.java.patch | 3 +- .../net/minecraft/locale/Language.java.patch | 10 +- .../net/minecraft/nbt/CompoundTag.java.patch | 6 +- .../net/minecraft/nbt/StringTag.java.patch | 2 +- .../minecraft/network/Connection.java.patch | 12 +- .../network/FriendlyByteBuf.java.patch | 16 +- .../network/chat/PlayerChatMessage.java.patch | 13 + .../minecraft/network/chat/Style.java.patch | 33 - .../chat/TranslatableComponent.java.patch | 13 - .../contents/TranslatableContents.java.patch | 14 + ...ServerboundContainerClickPacket.java.patch | 2 +- .../protocol/status/ServerStatus.java.patch | 20 +- .../syncher/EntityDataSerializers.java.patch | 4 +- .../recipebook/PlaceRecipe.java.patch | 5 +- .../RegistryResourceAccess.java.patch | 47 +- .../resources/ResourceKey.java.patch | 21 +- .../resources/ResourceLocation.java.patch | 2 +- .../net/minecraft/server/Bootstrap.java.patch | 6 +- .../net/minecraft/server/Main.java.patch | 33 +- .../server/MinecraftServer.java.patch | 95 +- .../server/PlayerAdvancements.java.patch | 8 +- .../ReloadableServerResources.java.patch | 27 +- .../dedicated/DedicatedServer.java.patch | 20 +- .../server/level/ChunkMap.java.patch | 10 +- .../server/level/DistanceManager.java.patch | 10 +- .../server/level/ServerChunkCache.java.patch | 6 +- .../server/level/ServerEntity.java.patch | 37 +- .../server/level/ServerLevel.java.patch | 174 +-- .../server/level/ServerPlayer.java.patch | 72 +- .../level/ServerPlayerGameMode.java.patch | 38 +- .../ServerConnectionListener.java.patch | 6 +- .../ServerGamePacketListenerImpl.java.patch | 49 +- ...rverHandshakePacketListenerImpl.java.patch | 8 +- .../ServerLoginPacketListenerImpl.java.patch | 44 +- .../packs/VanillaPackResources.java.patch | 8 +- .../server/packs/repository/Pack.java.patch | 16 +- .../repository/PackCompatibility.java.patch | 2 +- .../repository/PackRepository.java.patch | 4 +- ...impleJsonResourceReloadListener.java.patch | 2 +- .../server/players/PlayerList.java.patch | 56 +- .../server/rcon/RconConsoleSource.java.patch | 8 +- .../minecraft/sounds/SoundEvent.java.patch | 11 - .../minecraft/sounds/SoundEvents.java.patch | 10 - .../net/minecraft/stats/StatType.java.patch | 11 - .../net/minecraft/tags/BlockTags.java.patch | 2 +- .../net/minecraft/tags/ItemTags.java.patch | 2 +- .../net/minecraft/tags/Tag.java.patch | 72 -- .../net/minecraft/tags/TagBuilder.java.patch | 38 + .../net/minecraft/tags/TagEntry.java.patch | 17 + .../net/minecraft/tags/TagLoader.java.patch | 16 +- .../net/minecraft/tags/TagManager.java.patch | 2 +- .../StructuresBecomeConfiguredFix.java.patch | 2 +- .../world/effect/MobEffect.java.patch | 8 +- .../world/effect/MobEffectInstance.java.patch | 35 +- .../world/effect/MobEffects.java.patch | 10 - .../minecraft/world/entity/Entity.java.patch | 106 +- .../world/entity/EntityType.java.patch | 25 +- .../world/entity/ExperienceOrb.java.patch | 4 +- .../world/entity/FlyingMob.java.patch | 28 +- .../world/entity/LivingEntity.java.patch | 132 +- .../net/minecraft/world/entity/Mob.java.patch | 12 +- .../world/entity/MobCategory.java.patch | 26 +- .../world/entity/SpawnPlacements.java.patch | 4 +- .../world/entity/TamableAnimal.java.patch | 8 +- .../entity/ai/attributes/Attribute.java.patch | 10 - .../attributes/DefaultAttributes.java.patch | 4 +- .../ai/behavior/HarvestFarmland.java.patch | 8 +- .../entity/ai/control/MoveControl.java.patch | 2 +- .../entity/ai/goal/EatBlockGoal.java.patch | 6 +- .../entity/ai/goal/MeleeAttackGoal.java.patch | 4 +- .../ai/goal/RunAroundLikeCrazyGoal.java.patch | 4 +- .../ai/memory/MemoryModuleType.java.patch | 11 - .../ai/navigation/PathNavigation.java.patch | 2 +- .../entity/ai/sensing/SensorType.java.patch | 11 - .../entity/ai/village/VillageSiege.java.patch | 2 +- .../entity/ai/village/poi/PoiType.java.patch | 41 - .../entity/ai/village/poi/PoiTypes.java.patch | 32 + .../world/entity/animal/Animal.java.patch | 2 +- .../world/entity/animal/Bee.java.patch | 2 +- .../world/entity/animal/Cat.java.patch | 8 +- .../world/entity/animal/Fox.java.patch | 6 +- .../world/entity/animal/IronGolem.java.patch | 6 +- .../entity/animal/MushroomCow.java.patch | 8 +- .../world/entity/animal/Ocelot.java.patch | 4 +- .../world/entity/animal/Parrot.java.patch | 6 +- .../world/entity/animal/Pig.java.patch | 4 +- .../world/entity/animal/Rabbit.java.patch | 2 +- .../world/entity/animal/Sheep.java.patch | 10 +- .../world/entity/animal/SnowGolem.java.patch | 12 +- .../world/entity/animal/Wolf.java.patch | 13 +- .../animal/horse/AbstractHorse.java.patch | 10 +- .../entity/animal/horse/Horse.java.patch | 2 +- .../animal/horse/SkeletonTrapGoal.java.patch | 6 +- .../boss/enderdragon/EnderDragon.java.patch | 22 +- .../entity/boss/wither/WitherBoss.java.patch | 2 +- .../decoration/HangingEntity.java.patch | 2 +- .../world/entity/decoration/Motive.java.patch | 11 - .../world/entity/item/ItemEntity.java.patch | 30 +- .../monster/AbstractSkeleton.java.patch | 4 +- .../world/entity/monster/Creeper.java.patch | 2 +- .../world/entity/monster/EnderMan.java.patch | 25 +- .../world/entity/monster/Evoker.java.patch | 2 +- .../world/entity/monster/MagmaCube.java.patch | 2 +- .../world/entity/monster/Monster.java.patch | 2 +- .../world/entity/monster/Ravager.java.patch | 4 +- .../entity/monster/Silverfish.java.patch | 10 +- .../world/entity/monster/Slime.java.patch | 6 +- .../world/entity/monster/Zombie.java.patch | 44 +- .../entity/monster/ZombieVillager.java.patch | 6 +- .../entity/monster/hoglin/Hoglin.java.patch | 2 +- .../entity/monster/piglin/PiglinAi.java.patch | 2 +- .../world/entity/npc/CatSpawner.java.patch | 2 +- .../world/entity/npc/Villager.java.patch | 12 +- .../entity/npc/VillagerProfession.java.patch | 11 - .../world/entity/player/Inventory.java.patch | 8 +- .../world/entity/player/Player.java.patch | 120 +- .../projectile/AbstractArrow.java.patch | 2 +- .../entity/projectile/FishingHook.java.patch | 10 +- .../projectile/SmallFireball.java.patch | 4 +- .../projectile/ThrownEnderpearl.java.patch | 2 +- .../world/entity/raid/Raid.java.patch | 4 +- .../world/entity/schedule/Activity.java.patch | 11 - .../world/entity/schedule/Schedule.java.patch | 11 - .../vehicle/AbstractMinecart.java.patch | 90 +- .../AbstractMinecartContainer.java.patch | 21 +- .../world/entity/vehicle/Boat.java.patch | 4 +- .../entity/vehicle/ContainerEntity.java.patch | 12 + .../world/entity/vehicle/Minecart.java.patch | 2 +- .../vehicle/MinecartCommandBlock.java.patch | 2 +- .../entity/vehicle/MinecartFurnace.java.patch | 26 +- .../entity/vehicle/MinecartSpawner.java.patch | 4 +- .../minecraft/world/food/FoodData.java.patch | 2 +- .../AbstractContainerMenu.java.patch | 12 +- .../world/inventory/AnvilMenu.java.patch | 6 +- .../world/inventory/BeaconMenu.java.patch | 2 +- .../inventory/EnchantmentMenu.java.patch | 8 +- .../world/inventory/GrindstoneMenu.java.patch | 2 +- .../world/inventory/InventoryMenu.java.patch | 2 +- .../world/inventory/LoomMenu.java.patch | 22 - .../world/inventory/MenuType.java.patch | 2 +- .../minecraft/world/inventory/Slot.java.patch | 4 +- .../minecraft/world/item/ArmorItem.java.patch | 2 +- .../minecraft/world/item/AxeItem.java.patch | 6 +- .../world/item/BannerItem.java.patch | 16 +- .../minecraft/world/item/BlockItem.java.patch | 4 +- .../world/item/BoneMealItem.java.patch | 2 +- .../minecraft/world/item/BowItem.java.patch | 8 +- .../world/item/BucketItem.java.patch | 2 +- .../world/item/ChorusFruitItem.java.patch | 5 +- .../world/item/CreativeModeTab.java.patch | 10 +- .../world/item/DiggerItem.java.patch | 4 +- .../minecraft/world/item/DyeColor.java.patch | 6 +- .../world/item/ElytraItem.java.patch | 2 +- .../minecraft/world/item/HoeItem.java.patch | 14 +- .../net/minecraft/world/item/Item.java.patch | 40 +- .../minecraft/world/item/ItemStack.java.patch | 68 +- .../net/minecraft/world/item/Items.java.patch | 10 +- .../minecraft/world/item/MapItem.java.patch | 2 +- .../world/item/MilkBucketItem.java.patch | 10 +- .../world/item/MinecartItem.java.patch | 2 +- .../world/item/MobBucketItem.java.patch | 12 +- .../world/item/RecordItem.java.patch | 8 +- .../world/item/ShovelItem.java.patch | 6 +- .../world/item/SpawnEggItem.java.patch | 4 +- .../world/item/SuspiciousStewItem.java.patch | 4 +- .../minecraft/world/item/SwordItem.java.patch | 2 +- .../net/minecraft/world/item/Tier.java.patch | 2 +- .../net/minecraft/world/item/Tiers.java.patch | 2 +- .../world/item/alchemy/Potion.java.patch | 11 - .../item/alchemy/PotionBrewing.java.patch | 31 +- .../world/item/crafting/Ingredient.java.patch | 6 +- .../item/crafting/RecipeManager.java.patch | 4 +- .../item/crafting/RecipeSerializer.java.patch | 4 +- .../item/crafting/ShapedRecipe.java.patch | 16 +- .../item/crafting/ShapelessRecipe.java.patch | 6 +- .../SimpleCookingSerializer.java.patch | 9 - .../SimpleRecipeSerializer.java.patch | 11 - .../item/crafting/SingleItemRecipe.java.patch | 11 - .../item/crafting/UpgradeRecipe.java.patch | 7 +- .../item/enchantment/Enchantment.java.patch | 10 +- .../enchantment/EnchantmentHelper.java.patch | 18 +- .../item/enchantment/Enchantments.java.patch | 10 - .../FrostWalkerEnchantment.java.patch | 2 +- .../world/level/BaseSpawner.java.patch | 8 +- .../world/level/ClipContext.java.patch | 2 +- .../world/level/Explosion.java.patch | 24 +- .../minecraft/world/level/Level.java.patch | 91 +- .../world/level/LevelReader.java.patch | 4 +- .../world/level/NaturalSpawner.java.patch | 44 +- .../world/level/biome/Biome.java.patch | 91 +- .../biome/BiomeGenerationSettings.java.patch | 4 +- .../world/level/biome/BiomeSource.java.patch | 30 + .../biome/BiomeSpecialEffects.java.patch | 18 +- .../level/biome/MobSpawnSettings.java.patch | 2 +- .../world/level/block/BambooBlock.java.patch | 24 +- .../level/block/BambooSaplingBlock.java.patch | 2 +- .../level/block/BaseFireBlock.java.patch | 2 +- .../level/block/BaseRailBlock.java.patch | 2 +- .../world/level/block/BeehiveBlock.java.patch | 4 +- .../world/level/block/Block.java.patch | 40 +- .../world/level/block/Blocks.java.patch | 12 +- .../world/level/block/CactusBlock.java.patch | 30 +- .../level/block/CampfireBlock.java.patch | 4 +- .../world/level/block/ChestBlock.java.patch | 2 +- .../level/block/ChorusFlowerBlock.java.patch | 14 +- .../world/level/block/CocoaBlock.java.patch | 13 +- .../level/block/ComparatorBlock.java.patch | 2 +- .../world/level/block/CropBlock.java.patch | 24 +- .../world/level/block/DiodeBlock.java.patch | 2 +- .../block/DropExperienceBlock.java.patch | 18 + .../world/level/block/DropperBlock.java.patch | 2 +- .../block/EnchantmentTableBlock.java.patch | 4 +- .../world/level/block/FarmBlock.java.patch | 2 +- .../world/level/block/FireBlock.java.patch | 107 +- .../level/block/FlowerPotBlock.java.patch | 8 +- .../block/GrowingPlantHeadBlock.java.patch | 14 +- .../world/level/block/LeavesBlock.java.patch | 6 +- .../world/level/block/LiquidBlock.java.patch | 4 +- .../level/block/NetherWartBlock.java.patch | 14 +- .../world/level/block/NoteBlock.java.patch | 6 +- .../world/level/block/OreBlock.java.patch | 19 - .../level/block/PowderSnowBlock.java.patch | 2 +- .../level/block/PoweredRailBlock.java.patch | 12 +- .../world/level/block/RailBlock.java.patch | 12 +- .../level/block/RedStoneOreBlock.java.patch | 18 +- .../level/block/RedStoneWireBlock.java.patch | 4 +- .../world/level/block/SaplingBlock.java.patch | 16 +- .../level/block/SculkCatalystBlock.java.patch | 18 + .../level/block/SculkSensorBlock.java.patch | 18 + .../level/block/SculkShriekerBlock.java.patch | 19 + .../world/level/block/SoundType.java.patch | 2 +- .../world/level/block/SpawnerBlock.java.patch | 18 +- .../block/SpreadingSnowyDirtBlock.java.patch | 12 +- .../world/level/block/StemBlock.java.patch | 36 +- .../level/block/SugarCaneBlock.java.patch | 10 +- .../block/SweetBerryBushBlock.java.patch | 16 +- .../level/block/TripWireHookBlock.java.patch | 2 +- .../level/block/TurtleEggBlock.java.patch | 2 +- .../world/level/block/VineBlock.java.patch | 14 +- .../AbstractFurnaceBlockEntity.java.patch | 48 +- .../block/entity/BannerPattern.java.patch | 58 - .../BaseContainerBlockEntity.java.patch | 4 +- .../block/entity/BeaconBlockEntity.java.patch | 2 +- .../block/entity/BlockEntityType.java.patch | 11 - .../entity/BrewingStandBlockEntity.java.patch | 8 +- .../block/entity/ChestBlockEntity.java.patch | 2 +- .../entity/ConduitBlockEntity.java.patch | 2 +- .../block/entity/HopperBlockEntity.java.patch | 8 +- .../entity/ShulkerBoxBlockEntity.java.patch | 2 +- .../entity/SpawnerBlockEntity.java.patch | 2 +- .../block/piston/PistonBaseBlock.java.patch | 10 +- .../piston/PistonStructureResolver.java.patch | 2 +- .../block/state/BlockBehaviour.java.patch | 41 +- .../state/properties/WoodType.java.patch | 2 +- .../world/level/chunk/ChunkAccess.java.patch | 2 +- .../world/level/chunk/ChunkStatus.java.patch | 11 - .../world/level/chunk/LevelChunk.java.patch | 40 +- .../level/chunk/PalettedContainer.java.patch | 4 +- .../world/level/chunk/ProtoChunk.java.patch | 2 +- .../chunk/storage/ChunkSerializer.java.patch | 23 +- .../level/dimension/LevelStem.java.patch | 25 - .../dimension/end/EndDragonFight.java.patch | 14 +- .../PersistentEntitySectionManager.java.patch | 10 +- .../TransientEntitySectionManager.java.patch | 4 +- .../levelgen/DebugLevelSource.java.patch | 6 +- .../level/levelgen/PatrolSpawner.java.patch | 8 +- .../levelgen/WorldGenSettings.java.patch | 19 - .../levelgen/carver/WorldCarver.java.patch | 11 - .../level/levelgen/feature/Feature.java.patch | 11 +- .../feature/MonsterRoomFeature.java.patch | 6 +- .../feature/StructureFeature.java.patch | 11 - .../TreeConfiguration.java.patch | 6 +- .../FoliagePlacerType.java.patch | 11 - .../BlockStateProviderType.java.patch | 11 - .../TreeDecoratorType.java.patch | 11 - .../FlatLevelGeneratorSettings.java.patch | 11 - .../structure/StructurePiece.java.patch | 2 +- .../structure/StructureStart.java.patch | 8 +- .../StructureTemplate.java.patch | 25 +- .../level/material/FlowingFluid.java.patch | 4 +- .../world/level/material/Fluid.java.patch | 2 +- .../world/level/material/LavaFluid.java.patch | 20 +- .../AmphibiousNodeEvaluator.java.patch | 2 +- .../pathfinder/BlockPathTypes.java.patch | 2 +- .../pathfinder/WalkNodeEvaluator.java.patch | 4 +- .../storage/LevelStorageSource.java.patch | 18 +- .../level/storage/LevelSummary.java.patch | 2 +- .../level/storage/PrimaryLevelData.java.patch | 28 +- .../level/storage/loot/LootContext.java.patch | 14 +- .../level/storage/loot/LootTable.java.patch | 22 +- .../level/storage/loot/LootTables.java.patch | 9 +- .../LootItemRandomChanceCondition.java.patch | 4 +- ...andomChanceWithLootingCondition.java.patch | 2 +- server_files/run.bat | 1 + settings.gradle | 1 + src/docs/stylesheet.css | 892 +++++++++++++ .../fml/core/ModStateProvider.java | 120 +- .../fml/core/ParallelTransition.java | 12 +- .../event/lifecycle/FMLCommonSetupEvent.java | 5 +- .../data/forge/tags/blocks/barrels.json | 1 - .../forge/tags/blocks/barrels/wooden.json | 1 - .../data/forge/tags/blocks/chests.json | 1 - .../data/forge/tags/blocks/chests/ender.json | 1 - .../forge/tags/blocks/chests/trapped.json | 1 - .../data/forge/tags/blocks/chests/wooden.json | 1 - .../data/forge/tags/blocks/cobblestone.json | 1 - .../tags/blocks/cobblestone/deepslate.json | 1 - .../tags/blocks/cobblestone/infested.json | 1 - .../forge/tags/blocks/cobblestone/mossy.json | 1 - .../forge/tags/blocks/cobblestone/normal.json | 1 - .../data/forge/tags/blocks/end_stones.json | 1 - .../blocks/enderman_place_on_blacklist.json | 1 - .../data/forge/tags/blocks/fence_gates.json | 1 - .../forge/tags/blocks/fence_gates/wooden.json | 1 - .../data/forge/tags/blocks/fences.json | 1 - .../tags/blocks/fences/nether_brick.json | 1 - .../data/forge/tags/blocks/fences/wooden.json | 1 - .../data/forge/tags/blocks/glass.json | 1 - .../data/forge/tags/blocks/glass/black.json | 1 - .../data/forge/tags/blocks/glass/blue.json | 1 - .../data/forge/tags/blocks/glass/brown.json | 1 - .../forge/tags/blocks/glass/colorless.json | 1 - .../data/forge/tags/blocks/glass/cyan.json | 1 - .../data/forge/tags/blocks/glass/gray.json | 1 - .../data/forge/tags/blocks/glass/green.json | 1 - .../forge/tags/blocks/glass/light_blue.json | 1 - .../forge/tags/blocks/glass/light_gray.json | 1 - .../data/forge/tags/blocks/glass/lime.json | 1 - .../data/forge/tags/blocks/glass/magenta.json | 1 - .../data/forge/tags/blocks/glass/orange.json | 1 - .../data/forge/tags/blocks/glass/pink.json | 1 - .../data/forge/tags/blocks/glass/purple.json | 1 - .../data/forge/tags/blocks/glass/red.json | 1 - .../data/forge/tags/blocks/glass/silica.json | 1 - .../data/forge/tags/blocks/glass/tinted.json | 1 - .../data/forge/tags/blocks/glass/white.json | 1 - .../data/forge/tags/blocks/glass/yellow.json | 1 - .../data/forge/tags/blocks/glass_panes.json | 1 - .../forge/tags/blocks/glass_panes/black.json | 1 - .../forge/tags/blocks/glass_panes/blue.json | 1 - .../forge/tags/blocks/glass_panes/brown.json | 1 - .../tags/blocks/glass_panes/colorless.json | 1 - .../forge/tags/blocks/glass_panes/cyan.json | 1 - .../forge/tags/blocks/glass_panes/gray.json | 1 - .../forge/tags/blocks/glass_panes/green.json | 1 - .../tags/blocks/glass_panes/light_blue.json | 1 - .../tags/blocks/glass_panes/light_gray.json | 1 - .../forge/tags/blocks/glass_panes/lime.json | 1 - .../tags/blocks/glass_panes/magenta.json | 1 - .../forge/tags/blocks/glass_panes/orange.json | 1 - .../forge/tags/blocks/glass_panes/pink.json | 1 - .../forge/tags/blocks/glass_panes/purple.json | 1 - .../forge/tags/blocks/glass_panes/red.json | 1 - .../forge/tags/blocks/glass_panes/white.json | 1 - .../forge/tags/blocks/glass_panes/yellow.json | 1 - .../data/forge/tags/blocks/gravel.json | 1 - .../data/forge/tags/blocks/netherrack.json | 1 - .../data/forge/tags/blocks/obsidian.json | 1 - .../blocks/ore_bearing_ground/deepslate.json | 1 - .../blocks/ore_bearing_ground/netherrack.json | 1 - .../tags/blocks/ore_bearing_ground/stone.json | 1 - .../forge/tags/blocks/ore_rates/dense.json | 1 - .../forge/tags/blocks/ore_rates/singular.json | 1 - .../forge/tags/blocks/ore_rates/sparse.json | 1 - .../data/forge/tags/blocks/ores.json | 1 - .../data/forge/tags/blocks/ores/coal.json | 1 - .../data/forge/tags/blocks/ores/copper.json | 1 - .../data/forge/tags/blocks/ores/diamond.json | 1 - .../data/forge/tags/blocks/ores/emerald.json | 1 - .../data/forge/tags/blocks/ores/gold.json | 1 - .../data/forge/tags/blocks/ores/iron.json | 1 - .../data/forge/tags/blocks/ores/lapis.json | 1 - .../tags/blocks/ores/netherite_scrap.json | 1 - .../data/forge/tags/blocks/ores/quartz.json | 1 - .../data/forge/tags/blocks/ores/redstone.json | 1 - .../tags/blocks/ores_in_ground/deepslate.json | 1 - .../blocks/ores_in_ground/netherrack.json | 1 - .../tags/blocks/ores_in_ground/stone.json | 1 - .../data/forge/tags/blocks/sand.json | 1 - .../forge/tags/blocks/sand/colorless.json | 1 - .../data/forge/tags/blocks/sand/red.json | 1 - .../data/forge/tags/blocks/sandstone.json | 1 - .../data/forge/tags/blocks/stained_glass.json | 1 - .../tags/blocks/stained_glass_panes.json | 1 - .../data/forge/tags/blocks/stone.json | 1 - .../forge/tags/blocks/storage_blocks.json | 1 - .../tags/blocks/storage_blocks/amethyst.json | 1 - .../tags/blocks/storage_blocks/coal.json | 1 - .../tags/blocks/storage_blocks/copper.json | 1 - .../tags/blocks/storage_blocks/diamond.json | 1 - .../tags/blocks/storage_blocks/emerald.json | 1 - .../tags/blocks/storage_blocks/gold.json | 1 - .../tags/blocks/storage_blocks/iron.json | 1 - .../tags/blocks/storage_blocks/lapis.json | 1 - .../tags/blocks/storage_blocks/netherite.json | 1 - .../tags/blocks/storage_blocks/quartz.json | 1 - .../blocks/storage_blocks/raw_copper.json | 1 - .../tags/blocks/storage_blocks/raw_gold.json | 1 - .../tags/blocks/storage_blocks/raw_iron.json | 1 - .../tags/blocks/storage_blocks/redstone.json | 1 - .../data/forge/tags/fluids/milk.json | 1 - .../data/forge/tags/items/barrels.json | 1 - .../data/forge/tags/items/barrels/wooden.json | 1 - .../data/forge/tags/items/bones.json | 1 - .../data/forge/tags/items/bookshelves.json | 1 - .../data/forge/tags/items/chests.json | 1 - .../data/forge/tags/items/chests/ender.json | 1 - .../data/forge/tags/items/chests/trapped.json | 1 - .../data/forge/tags/items/chests/wooden.json | 1 - .../data/forge/tags/items/cobblestone.json | 1 - .../tags/items/cobblestone/deepslate.json | 1 - .../tags/items/cobblestone/infested.json | 1 - .../forge/tags/items/cobblestone/mossy.json | 1 - .../forge/tags/items/cobblestone/normal.json | 1 - .../data/forge/tags/items/crops.json | 1 - .../data/forge/tags/items/crops/beetroot.json | 1 - .../data/forge/tags/items/crops/carrot.json | 1 - .../forge/tags/items/crops/nether_wart.json | 1 - .../data/forge/tags/items/crops/potato.json | 1 - .../data/forge/tags/items/crops/wheat.json | 1 - .../data/forge/tags/items/dusts.json | 1 - .../forge/tags/items/dusts/glowstone.json | 1 - .../forge/tags/items/dusts/prismarine.json | 1 - .../data/forge/tags/items/dusts/redstone.json | 1 - .../resources/data/forge/tags/items/dyes.json | 1 - .../data/forge/tags/items/dyes/black.json | 1 - .../data/forge/tags/items/dyes/blue.json | 1 - .../data/forge/tags/items/dyes/brown.json | 1 - .../data/forge/tags/items/dyes/cyan.json | 1 - .../data/forge/tags/items/dyes/gray.json | 1 - .../data/forge/tags/items/dyes/green.json | 1 - .../forge/tags/items/dyes/light_blue.json | 1 - .../forge/tags/items/dyes/light_gray.json | 1 - .../data/forge/tags/items/dyes/lime.json | 1 - .../data/forge/tags/items/dyes/magenta.json | 1 - .../data/forge/tags/items/dyes/orange.json | 1 - .../data/forge/tags/items/dyes/pink.json | 1 - .../data/forge/tags/items/dyes/purple.json | 1 - .../data/forge/tags/items/dyes/red.json | 1 - .../data/forge/tags/items/dyes/white.json | 1 - .../data/forge/tags/items/dyes/yellow.json | 1 - .../resources/data/forge/tags/items/eggs.json | 1 - .../forge/tags/items/enchanting_fuels.json | 1 - .../data/forge/tags/items/end_stones.json | 1 - .../data/forge/tags/items/ender_pearls.json | 1 - .../data/forge/tags/items/feathers.json | 1 - .../data/forge/tags/items/fence_gates.json | 1 - .../forge/tags/items/fence_gates/wooden.json | 1 - .../data/forge/tags/items/fences.json | 1 - .../forge/tags/items/fences/nether_brick.json | 1 - .../data/forge/tags/items/fences/wooden.json | 1 - .../resources/data/forge/tags/items/gems.json | 1 - .../data/forge/tags/items/gems/amethyst.json | 1 - .../data/forge/tags/items/gems/diamond.json | 1 - .../data/forge/tags/items/gems/emerald.json | 1 - .../data/forge/tags/items/gems/lapis.json | 1 - .../forge/tags/items/gems/prismarine.json | 1 - .../data/forge/tags/items/gems/quartz.json | 1 - .../data/forge/tags/items/glass.json | 1 - .../data/forge/tags/items/glass/black.json | 1 - .../data/forge/tags/items/glass/blue.json | 1 - .../data/forge/tags/items/glass/brown.json | 1 - .../forge/tags/items/glass/colorless.json | 1 - .../data/forge/tags/items/glass/cyan.json | 1 - .../data/forge/tags/items/glass/gray.json | 1 - .../data/forge/tags/items/glass/green.json | 1 - .../forge/tags/items/glass/light_blue.json | 1 - .../forge/tags/items/glass/light_gray.json | 1 - .../data/forge/tags/items/glass/lime.json | 1 - .../data/forge/tags/items/glass/magenta.json | 1 - .../data/forge/tags/items/glass/orange.json | 1 - .../data/forge/tags/items/glass/pink.json | 1 - .../data/forge/tags/items/glass/purple.json | 1 - .../data/forge/tags/items/glass/red.json | 1 - .../data/forge/tags/items/glass/silica.json | 1 - .../data/forge/tags/items/glass/tinted.json | 1 - .../data/forge/tags/items/glass/white.json | 1 - .../data/forge/tags/items/glass/yellow.json | 1 - .../data/forge/tags/items/glass_panes.json | 1 - .../forge/tags/items/glass_panes/black.json | 1 - .../forge/tags/items/glass_panes/blue.json | 1 - .../forge/tags/items/glass_panes/brown.json | 1 - .../tags/items/glass_panes/colorless.json | 1 - .../forge/tags/items/glass_panes/cyan.json | 1 - .../forge/tags/items/glass_panes/gray.json | 1 - .../forge/tags/items/glass_panes/green.json | 1 - .../tags/items/glass_panes/light_blue.json | 1 - .../tags/items/glass_panes/light_gray.json | 1 - .../forge/tags/items/glass_panes/lime.json | 1 - .../forge/tags/items/glass_panes/magenta.json | 1 - .../forge/tags/items/glass_panes/orange.json | 1 - .../forge/tags/items/glass_panes/pink.json | 1 - .../forge/tags/items/glass_panes/purple.json | 1 - .../forge/tags/items/glass_panes/red.json | 1 - .../forge/tags/items/glass_panes/white.json | 1 - .../forge/tags/items/glass_panes/yellow.json | 1 - .../data/forge/tags/items/gravel.json | 1 - .../data/forge/tags/items/gunpowder.json | 1 - .../data/forge/tags/items/heads.json | 1 - .../data/forge/tags/items/ingots.json | 1 - .../data/forge/tags/items/ingots/brick.json | 1 - .../data/forge/tags/items/ingots/copper.json | 1 - .../data/forge/tags/items/ingots/gold.json | 1 - .../data/forge/tags/items/ingots/iron.json | 1 - .../forge/tags/items/ingots/nether_brick.json | 1 - .../forge/tags/items/ingots/netherite.json | 1 - .../data/forge/tags/items/leather.json | 1 - .../data/forge/tags/items/mushrooms.json | 1 - .../data/forge/tags/items/nether_stars.json | 1 - .../data/forge/tags/items/netherrack.json | 1 - .../data/forge/tags/items/nuggets.json | 1 - .../data/forge/tags/items/nuggets/gold.json | 1 - .../data/forge/tags/items/nuggets/iron.json | 1 - .../data/forge/tags/items/obsidian.json | 1 - .../items/ore_bearing_ground/deepslate.json | 1 - .../items/ore_bearing_ground/netherrack.json | 1 - .../tags/items/ore_bearing_ground/stone.json | 1 - .../forge/tags/items/ore_rates/dense.json | 1 - .../forge/tags/items/ore_rates/singular.json | 1 - .../forge/tags/items/ore_rates/sparse.json | 1 - .../resources/data/forge/tags/items/ores.json | 1 - .../data/forge/tags/items/ores/coal.json | 1 - .../data/forge/tags/items/ores/copper.json | 1 - .../data/forge/tags/items/ores/diamond.json | 1 - .../data/forge/tags/items/ores/emerald.json | 1 - .../data/forge/tags/items/ores/gold.json | 1 - .../data/forge/tags/items/ores/iron.json | 1 - .../data/forge/tags/items/ores/lapis.json | 1 - .../tags/items/ores/netherite_scrap.json | 1 - .../data/forge/tags/items/ores/quartz.json | 1 - .../data/forge/tags/items/ores/redstone.json | 1 - .../tags/items/ores_in_ground/deepslate.json | 1 - .../tags/items/ores_in_ground/netherrack.json | 1 - .../tags/items/ores_in_ground/stone.json | 1 - .../data/forge/tags/items/raw_materials.json | 1 - .../tags/items/raw_materials/copper.json | 1 - .../forge/tags/items/raw_materials/gold.json | 1 - .../forge/tags/items/raw_materials/iron.json | 1 - .../resources/data/forge/tags/items/rods.json | 1 - .../data/forge/tags/items/rods/blaze.json | 1 - .../data/forge/tags/items/rods/wooden.json | 1 - .../resources/data/forge/tags/items/sand.json | 1 - .../data/forge/tags/items/sand/colorless.json | 1 - .../data/forge/tags/items/sand/red.json | 1 - .../data/forge/tags/items/sandstone.json | 1 - .../data/forge/tags/items/seeds.json | 1 - .../data/forge/tags/items/seeds/beetroot.json | 1 - .../data/forge/tags/items/seeds/melon.json | 1 - .../data/forge/tags/items/seeds/pumpkin.json | 1 - .../data/forge/tags/items/seeds/wheat.json | 1 - .../data/forge/tags/items/shears.json | 1 - .../data/forge/tags/items/slimeballs.json | 1 - .../data/forge/tags/items/stained_glass.json | 1 - .../forge/tags/items/stained_glass_panes.json | 1 - .../data/forge/tags/items/stone.json | 1 - .../data/forge/tags/items/storage_blocks.json | 1 - .../tags/items/storage_blocks/amethyst.json | 1 - .../forge/tags/items/storage_blocks/coal.json | 1 - .../tags/items/storage_blocks/copper.json | 1 - .../tags/items/storage_blocks/diamond.json | 1 - .../tags/items/storage_blocks/emerald.json | 1 - .../forge/tags/items/storage_blocks/gold.json | 1 - .../forge/tags/items/storage_blocks/iron.json | 1 - .../tags/items/storage_blocks/lapis.json | 1 - .../tags/items/storage_blocks/netherite.json | 1 - .../tags/items/storage_blocks/quartz.json | 1 - .../tags/items/storage_blocks/raw_copper.json | 1 - .../tags/items/storage_blocks/raw_gold.json | 1 - .../tags/items/storage_blocks/raw_iron.json | 1 - .../tags/items/storage_blocks/redstone.json | 1 - .../data/forge/tags/items/string.json | 1 - .../forge/tags/worldgen/biome/is_beach.json | 1 - .../forge/tags/worldgen/biome/is_cold.json | 1 - .../tags/worldgen/biome/is_cold/end.json | 1 - .../worldgen/biome/is_cold/overworld.json | 1 - .../tags/worldgen/biome/is_coniferous.json | 1 - .../forge/tags/worldgen/biome/is_dense.json | 1 - .../worldgen/biome/is_dense/overworld.json | 1 - .../forge/tags/worldgen/biome/is_dry.json | 1 - .../forge/tags/worldgen/biome/is_dry/end.json | 1 - .../tags/worldgen/biome/is_dry/nether.json | 1 - .../tags/worldgen/biome/is_dry/overworld.json | 1 - .../forge/tags/worldgen/biome/is_end.json | 1 - .../forge/tags/worldgen/biome/is_hot.json | 1 - .../tags/worldgen/biome/is_hot/nether.json | 1 - .../tags/worldgen/biome/is_hot/overworld.json | 1 - .../forge/tags/worldgen/biome/is_lush.json | 1 - .../tags/worldgen/biome/is_mushroom.json | 1 - .../tags/worldgen/biome/is_overworld.json | 1 - .../forge/tags/worldgen/biome/is_peak.json | 1 - .../forge/tags/worldgen/biome/is_plains.json | 1 - .../forge/tags/worldgen/biome/is_plateau.json | 1 - .../forge/tags/worldgen/biome/is_rare.json | 1 - .../forge/tags/worldgen/biome/is_sandy.json | 1 - .../forge/tags/worldgen/biome/is_savanna.json | 1 - .../forge/tags/worldgen/biome/is_slope.json | 1 - .../forge/tags/worldgen/biome/is_snowy.json | 1 - .../forge/tags/worldgen/biome/is_sparse.json | 1 - .../worldgen/biome/is_sparse/overworld.json | 1 - .../forge/tags/worldgen/biome/is_spooky.json | 1 - .../forge/tags/worldgen/biome/is_swamp.json | 1 - .../tags/worldgen/biome/is_underground.json | 1 - .../forge/tags/worldgen/biome/is_void.json | 1 - .../tags/worldgen/biome/is_wasteland.json | 1 - .../forge/tags/worldgen/biome/is_water.json | 1 - .../forge/tags/worldgen/biome/is_wet.json | 1 - .../tags/worldgen/biome/is_wet/overworld.json | 1 - .../loot_tables/blocks/acacia_leaves.json | 84 +- .../loot_tables/blocks/azalea_leaves.json | 84 +- .../loot_tables/blocks/birch_leaves.json | 84 +- .../minecraft/loot_tables/blocks/cobweb.json | 8 +- .../loot_tables/blocks/dark_oak_leaves.json | 104 +- .../loot_tables/blocks/dead_bush.json | 16 +- .../minecraft/loot_tables/blocks/fern.json | 14 +- .../blocks/flowering_azalea_leaves.json | 84 +- .../loot_tables/blocks/glow_lichen.json | 56 +- .../minecraft/loot_tables/blocks/grass.json | 14 +- .../loot_tables/blocks/hanging_roots.json | 14 +- .../loot_tables/blocks/jungle_leaves.json | 84 +- .../loot_tables/blocks/large_fern.json | 92 +- .../loot_tables/blocks/mangrove_leaves.json | 75 ++ .../loot_tables/blocks/nether_sprouts.json | 14 +- .../loot_tables/blocks/oak_leaves.json | 104 +- .../loot_tables/blocks/seagrass.json | 14 +- .../loot_tables/blocks/small_dripleaf.json | 14 +- .../loot_tables/blocks/spruce_leaves.json | 84 +- .../loot_tables/blocks/tall_grass.json | 92 +- .../loot_tables/blocks/tall_seagrass.json | 18 +- .../loot_tables/blocks/twisting_vines.json | 14 +- .../minecraft/loot_tables/blocks/vine.json | 14 +- .../loot_tables/blocks/weeping_vines.json | 14 +- .../minecraft/recipes/acacia_chest_boat.json | 15 + .../data/minecraft/recipes/acacia_fence.json | 18 +- .../minecraft/recipes/acacia_fence_gate.json | 8 +- .../data/minecraft/recipes/acacia_sign.json | 14 +- .../minecraft/recipes/activator_rail.json | 14 +- .../data/minecraft/recipes/andesite.json | 4 +- .../data/minecraft/recipes/anvil.json | 10 +- .../data/minecraft/recipes/armor_stand.json | 10 +- .../data/minecraft/recipes/arrow.json | 14 +- .../minecraft/recipes/birch_chest_boat.json | 15 + .../data/minecraft/recipes/birch_fence.json | 18 +- .../minecraft/recipes/birch_fence_gate.json | 8 +- .../data/minecraft/recipes/birch_sign.json | 14 +- .../data/minecraft/recipes/black_banner.json | 10 +- .../data/minecraft/recipes/blast_furnace.json | 16 +- .../data/minecraft/recipes/blue_banner.json | 10 +- .../resources/data/minecraft/recipes/bow.json | 10 +- .../data/minecraft/recipes/brown_banner.json | 10 +- .../data/minecraft/recipes/bucket.json | 8 +- .../data/minecraft/recipes/campfire.json | 16 +- .../data/minecraft/recipes/cauldron.json | 10 +- .../data/minecraft/recipes/chain.json | 10 +- .../minecraft/recipes/chest_minecart.json | 14 +- .../data/minecraft/recipes/clock.json | 10 +- .../data/minecraft/recipes/compass.json | 10 +- .../data/minecraft/recipes/crimson_fence.json | 18 +- .../minecraft/recipes/crimson_fence_gate.json | 8 +- .../data/minecraft/recipes/crimson_sign.json | 14 +- .../data/minecraft/recipes/crossbow.json | 22 +- .../data/minecraft/recipes/cyan_banner.json | 10 +- .../recipes/dark_oak_chest_boat.json | 15 + .../minecraft/recipes/dark_oak_fence.json | 18 +- .../recipes/dark_oak_fence_gate.json | 8 +- .../data/minecraft/recipes/dark_oak_sign.json | 14 +- .../data/minecraft/recipes/detector_rail.json | 20 +- .../data/minecraft/recipes/diamond_axe.json | 10 +- .../data/minecraft/recipes/diamond_boots.json | 8 +- .../minecraft/recipes/diamond_chestplate.json | 10 +- .../minecraft/recipes/diamond_helmet.json | 8 +- .../data/minecraft/recipes/diamond_hoe.json | 10 +- .../minecraft/recipes/diamond_leggings.json | 10 +- .../minecraft/recipes/diamond_pickaxe.json | 10 +- .../minecraft/recipes/diamond_shovel.json | 10 +- .../data/minecraft/recipes/diamond_sword.json | 10 +- .../data/minecraft/recipes/diorite.json | 18 +- .../data/minecraft/recipes/dispenser.json | 16 +- .../data/minecraft/recipes/dropper.json | 16 +- .../minecraft/recipes/enchanting_table.json | 16 +- .../data/minecraft/recipes/fishing_rod.json | 10 +- .../data/minecraft/recipes/golden_apple.json | 10 +- .../data/minecraft/recipes/golden_axe.json | 10 +- .../data/minecraft/recipes/golden_boots.json | 8 +- .../minecraft/recipes/golden_chestplate.json | 10 +- .../data/minecraft/recipes/golden_helmet.json | 8 +- .../data/minecraft/recipes/golden_hoe.json | 10 +- .../minecraft/recipes/golden_leggings.json | 10 +- .../minecraft/recipes/golden_pickaxe.json | 10 +- .../data/minecraft/recipes/golden_shovel.json | 10 +- .../data/minecraft/recipes/golden_sword.json | 10 +- .../data/minecraft/recipes/gray_banner.json | 10 +- .../data/minecraft/recipes/green_banner.json | 10 +- .../data/minecraft/recipes/grindstone.json | 16 +- .../heavy_weighted_pressure_plate.json | 6 +- .../data/minecraft/recipes/hopper.json | 10 +- .../data/minecraft/recipes/iron_axe.json | 10 +- .../data/minecraft/recipes/iron_bars.json | 12 +- .../data/minecraft/recipes/iron_boots.json | 8 +- .../minecraft/recipes/iron_chestplate.json | 10 +- .../data/minecraft/recipes/iron_door.json | 14 +- .../data/minecraft/recipes/iron_helmet.json | 8 +- .../data/minecraft/recipes/iron_hoe.json | 10 +- .../data/minecraft/recipes/iron_leggings.json | 10 +- .../data/minecraft/recipes/iron_pickaxe.json | 10 +- .../data/minecraft/recipes/iron_shovel.json | 10 +- .../data/minecraft/recipes/iron_sword.json | 10 +- .../data/minecraft/recipes/iron_trapdoor.json | 8 +- .../data/minecraft/recipes/item_frame.json | 10 +- .../data/minecraft/recipes/jukebox.json | 10 +- .../minecraft/recipes/jungle_chest_boat.json | 15 + .../data/minecraft/recipes/jungle_fence.json | 18 +- .../minecraft/recipes/jungle_fence_gate.json | 8 +- .../data/minecraft/recipes/jungle_sign.json | 14 +- .../data/minecraft/recipes/ladder.json | 14 +- .../data/minecraft/recipes/lever.json | 8 +- .../minecraft/recipes/light_blue_banner.json | 10 +- .../minecraft/recipes/light_gray_banner.json | 10 +- .../light_weighted_pressure_plate.json | 6 +- .../data/minecraft/recipes/lightning_rod.json | 10 +- .../data/minecraft/recipes/lime_banner.json | 10 +- .../data/minecraft/recipes/lodestone.json | 16 +- .../minecraft/recipes/magenta_banner.json | 10 +- .../recipes/mangrove_chest_boat.json | 15 + .../minecraft/recipes/mangrove_fence.json | 20 + .../recipes/mangrove_fence_gate.json | 19 + .../data/minecraft/recipes/mangrove_sign.json | 21 + .../data/minecraft/recipes/minecart.json | 8 +- .../minecraft/recipes/oak_chest_boat.json | 15 + .../data/minecraft/recipes/oak_fence.json | 18 +- .../minecraft/recipes/oak_fence_gate.json | 8 +- .../data/minecraft/recipes/oak_sign.json | 14 +- .../data/minecraft/recipes/observer.json | 16 +- .../data/minecraft/recipes/orange_banner.json | 10 +- .../data/minecraft/recipes/painting.json | 10 +- .../data/minecraft/recipes/pink_banner.json | 10 +- .../data/minecraft/recipes/piston.json | 16 +- .../minecraft/recipes/polished_deepslate.json | 12 +- .../data/minecraft/recipes/powered_rail.json | 20 +- .../data/minecraft/recipes/purple_banner.json | 10 +- .../data/minecraft/recipes/rail.json | 14 +- .../data/minecraft/recipes/red_banner.json | 10 +- .../minecraft/recipes/redstone_torch.json | 8 +- .../data/minecraft/recipes/shears.json | 8 +- .../data/minecraft/recipes/shield.json | 10 +- .../data/minecraft/recipes/shulker_box.json | 10 +- .../minecraft/recipes/smithing_table.json | 10 +- .../data/minecraft/recipes/soul_campfire.json | 16 +- .../data/minecraft/recipes/soul_torch.json | 28 +- .../minecraft/recipes/spruce_chest_boat.json | 15 + .../data/minecraft/recipes/spruce_fence.json | 18 +- .../minecraft/recipes/spruce_fence_gate.json | 8 +- .../data/minecraft/recipes/spruce_sign.json | 14 +- .../data/minecraft/recipes/spyglass.json | 10 +- .../data/minecraft/recipes/stone_axe.json | 10 +- .../data/minecraft/recipes/stone_hoe.json | 10 +- .../data/minecraft/recipes/stone_pickaxe.json | 10 +- .../data/minecraft/recipes/stone_shovel.json | 10 +- .../data/minecraft/recipes/stone_sword.json | 10 +- .../data/minecraft/recipes/stonecutter.json | 14 +- .../data/minecraft/recipes/tinted_glass.json | 14 +- .../data/minecraft/recipes/torch.json | 12 +- .../data/minecraft/recipes/tripwire_hook.json | 20 +- .../data/minecraft/recipes/warped_fence.json | 18 +- .../minecraft/recipes/warped_fence_gate.json | 8 +- .../data/minecraft/recipes/warped_sign.json | 14 +- .../data/minecraft/recipes/white_banner.json | 10 +- .../data/minecraft/recipes/wooden_axe.json | 10 +- .../data/minecraft/recipes/wooden_hoe.json | 10 +- .../minecraft/recipes/wooden_pickaxe.json | 10 +- .../data/minecraft/recipes/wooden_shovel.json | 10 +- .../data/minecraft/recipes/wooden_sword.json | 10 +- .../data/minecraft/recipes/yellow_banner.json | 10 +- .../tags/worldgen/biome/is_mountain.json | 1 - src/generated_test/resources/.cache/cache | 131 -- .../blockstates/item_hanger.json | 8 +- .../assets/data_gen_test/lang/en_us.json | 2 +- .../models/block/acacia_door_bottom.json | 7 - .../block/acacia_door_bottom_hinge.json | 7 - .../models/block/acacia_door_top.json | 7 - .../models/block/acacia_door_top_hinge.json | 7 - .../models/block/acacia_fence_post.json | 6 - .../models/block/acacia_fence_side.json | 6 - .../models/block/acacia_log.json | 4 +- .../models/block/acacia_log_horizontal.json | 4 +- .../models/block/acacia_slab.json | 2 +- .../models/block/acacia_slab_top.json | 2 +- .../models/block/acacia_stairs.json | 2 +- .../models/block/acacia_stairs_inner.json | 2 +- .../models/block/acacia_stairs_outer.json | 2 +- .../data_gen_test/models/block/barrel.json | 2 +- .../models/block/barrel_open.json | 2 +- .../data_gen_test/models/block/block.json | 72 +- .../models/block/cobblestone_wall_post.json | 6 - .../models/block/cobblestone_wall_side.json | 6 - .../block/cobblestone_wall_side_tall.json | 6 - .../data_gen_test/models/block/cube.json | 52 +- .../data_gen_test/models/block/furnace.json | 2 +- .../models/block/furnace_on.json | 2 +- .../models/block/glass_pane_post.json | 4 +- .../models/block/glass_pane_side.json | 4 +- .../models/block/glass_pane_side_alt.json | 4 +- .../models/item/fishing_rod.json | 12 +- .../models/item/test_block_model.json | 64 +- .../assets/data_gen_test/sounds.json | 46 +- .../minecraft/blockstates/acacia_button.json | 124 +- .../minecraft/blockstates/acacia_door.json | 124 -- .../minecraft/blockstates/acacia_fence.json | 48 - .../blockstates/acacia_fence_gate.json | 100 +- .../minecraft/blockstates/acacia_slab.json | 6 +- .../minecraft/blockstates/acacia_stairs.json | 280 ++-- .../blockstates/acacia_trapdoor.json | 70 +- .../assets/minecraft/blockstates/barrel.json | 48 +- .../blockstates/birch_fence_gate.json | 120 +- .../blockstates/cobblestone_wall.json | 90 -- .../assets/minecraft/blockstates/furnace.json | 30 +- .../minecraft/blockstates/glass_pane.json | 48 +- .../minecraft/blockstates/oak_trapdoor.json | 56 +- .../minecraft/blockstates/wall_torch.json | 6 +- .../assets/minecraft/models/item/stick.json | 10 +- .../blockstates/obj_block.json | 8 +- .../models/block/obj_block.json | 10 +- .../models/item/item_layers.json | 10 +- .../models/item/separate_perspective.json | 8 +- .../forge/biome_modifier/modify_badlands.json | 14 + .../placed_feature/large_basalt_columns.json | 12 + .../advancements/conditional.json | 90 +- .../advancements/obtain_dirt.json | 36 +- .../compound_ingredient_custom_types.json | 20 +- .../compound_ingredient_only_vanilla.json | 20 +- .../intersection_ingredient.json | 20 +- .../advancements/recipes/conditional2.json | 70 +- .../advancements/recipes/conditional3.json | 72 +- .../contains_nbt_ingredient_item_set.json | 20 +- .../contains_nbt_ingredient_single_item.json | 20 +- .../recipes/tools/difference_ingredient.json | 20 +- .../recipes/tools/exact_nbt_ingredient.json | 20 +- .../compound_ingredient_custom_types.json | 10 +- .../compound_ingredient_only_vanilla.json | 8 +- .../data_gen_test/recipes/conditional.json | 30 +- .../data_gen_test/recipes/conditional2.json | 34 +- .../data_gen_test/recipes/conditional3.json | 32 +- .../contains_nbt_ingredient_item_set.json | 2 +- .../recipes/difference_ingredient.json | 10 +- .../recipes/exact_nbt_ingredient.json | 2 +- .../recipes/intersection_ingredient.json | 10 +- .../data/data_gen_test/tags/blocks/test.json | 1 - .../data_gen_test/tags/blocks/thing/one.json | 1 - .../tags/blocks/thing/three.json | 1 - .../data_gen_test/tags/blocks/thing/two.json | 1 - .../data_gen_test/tags/blocks/things.json | 1 - .../loot_modifiers/global_loot_modifiers.json | 4 +- .../loot_modifiers/dungeon_loot.json | 4 +- .../loot_modifiers/smelting.json | 4 +- .../loot_modifiers/wheat_harvest.json | 8 +- .../minecraft/advancements/good_parent.json | 36 +- .../advancements/obtain_diamond_block.json | 36 +- .../minecraft/advancements/story/root.json | 36 +- .../data/minecraft/tags/blocks/test_tag.json | 14 +- .../loot_tables/blocks/test_stone.json | 12 +- .../tags/blocks/minable/my_tool.json | 1 - .../tags/blocks/needs_my_tier_tool.json | 1 - .../client/ClientCommandHandler.java | 58 +- .../client/ClientCommandSourceStack.java | 2 +- .../client/FluidContainerColorer.java | 5 +- .../client/ForgeHooksClient.java | 136 +- .../client/ForgeRenderTypes.java | 10 - .../client/ForgeWorldPresetScreens.java | 102 -- .../client/IItemRenderProperties.java | 9 +- .../client/ItemModelMesherForge.java | 22 +- .../client/MinecraftForgeClient.java | 21 +- .../client/RecipeBookRegistry.java | 2 +- .../client/event/ClientChatEvent.java | 38 +- .../client/event/ClientChatReceivedEvent.java | 53 +- .../ClientPlayerChangeGameTypeEvent.java | 24 +- .../event/ClientPlayerNetworkEvent.java | 117 +- .../client/event/ColorHandlerEvent.java | 63 +- .../client/event/ContainerScreenEvent.java | 75 +- .../client/event/DrawSelectionEvent.java | 72 +- .../client/event/EntityRenderersEvent.java | 138 +- .../client/event/EntityViewRenderEvent.java | 250 ++-- .../client/event/FOVModifierEvent.java | 55 +- .../client/event/InputEvent.java | 225 +++- .../client/event/ModelBakeEvent.java | 22 + .../client/event/ModelRegistryEvent.java | 17 +- .../event/MovementInputUpdateEvent.java | 19 +- .../event/ParticleFactoryRegisterEvent.java | 27 +- .../client/event/RecipesUpdatedEvent.java | 22 +- .../event/RegisterClientCommandsEvent.java | 28 +- .../RegisterClientReloadListenersEvent.java | 24 + .../client/event/RegisterShadersEvent.java | 30 + .../client/event/RenderArmEvent.java | 37 +- .../client/event/RenderBlockOverlayEvent.java | 52 +- .../client/event/RenderGameOverlayEvent.java | 256 +++- .../client/event/RenderHandEvent.java | 60 +- .../client/event/RenderItemInFrameEvent.java | 47 +- .../client/event/RenderLevelLastEvent.java | 36 + .../client/event/RenderLivingEvent.java | 72 ++ .../client/event/RenderNameplateEvent.java | 63 +- .../client/event/RenderPlayerEvent.java | 56 + .../client/event/RenderTooltipEvent.java | 201 ++- .../client/event/ScreenEvent.java | 554 ++++++-- .../client/event/ScreenOpenEvent.java | 26 +- .../client/event/ScreenshotEvent.java | 57 +- .../client/event/TextureStitchEvent.java | 51 +- .../client/event/package-info.java | 17 + .../client/event/sound/PlaySoundEvent.java | 43 +- .../event/sound/PlaySoundSourceEvent.java | 22 +- .../event/sound/PlayStreamingSourceEvent.java | 22 +- .../event/sound/SoundEngineLoadEvent.java | 32 + .../client/event/sound/SoundEvent.java | 47 +- .../client/event/sound/SoundLoadEvent.java | 21 - .../client/event/sound/SoundSetupEvent.java | 20 - .../client/event/sound/package-info.java | 17 + .../client/extensions/IForgeBakedModel.java | 18 +- .../client/extensions/IForgeKeyMapping.java | 17 +- .../client/extensions/IForgeMinecraft.java | 16 +- .../client/extensions/IForgeModelState.java | 19 +- .../extensions/IForgeTransformation.java | 55 +- .../extensions/IForgeVertexConsumer.java | 10 +- .../client/extensions/package-info.java | 26 + .../client/gui/ForgeIngameGui.java | 5 +- .../minecraftforge/client/gui/GuiUtils.java | 1 - .../client/gui/LoadingErrorScreen.java | 24 +- .../client/gui/ModListScreen.java | 15 +- .../gui/ModMismatchDisconnectedScreen.java | 32 +- .../gui/NotificationModUpdateScreen.java | 4 +- .../client/gui/OverlayRegistry.java | 18 +- .../client/gui/widget/ExtendedButton.java | 3 +- .../client/gui/widget/ForgeSlider.java | 7 +- .../client/gui/widget/ModListWidget.java | 8 +- .../client/gui/widget/Slider.java | 207 --- .../client/gui/widget/UnicodeGlyphButton.java | 5 +- .../client/loading/ClientModLoader.java | 4 +- .../client/loading/EarlyLoaderGUI.java | 2 +- .../client/model/BakedItemModel.java | 9 +- .../client/model/BakedModelWrapper.java | 18 +- .../client/model/BlockModelConfiguration.java | 2 +- .../client/model/CompositeModel.java | 13 +- .../client/model/DynamicBucketModel.java | 8 +- .../client/model/FluidModel.java | 9 +- .../client/model/ForgeModelBakery.java | 3 +- .../client/model/IModelConfiguration.java | 3 +- .../client/model/ItemLayerModel.java | 2 +- .../model/ItemMultiLayerBakedModel.java | 6 +- .../client/model/ModelDataManager.java | 21 +- .../client/model/ModelLoaderRegistry.java | 2 +- .../client/model/MultiLayerModel.java | 10 +- .../client/model/PerspectiveMapWrapper.java | 7 +- .../model/SeparatePerspectiveModel.java | 9 +- .../model/StandaloneModelConfiguration.java | 2 +- .../client/model/b3d/B3DLoader.java | 787 ------------ .../client/model/b3d/B3DModel.java | 1140 ----------------- .../client/model/data/IDynamicBakedModel.java | 17 +- .../client/model/data/IModelData.java | 6 +- .../client/model/data/MultipartModelData.java | 2 +- .../model/generators/BlockModelProvider.java | 5 +- .../model/generators/BlockStateProvider.java | 48 +- .../model/generators/ConfiguredModel.java | 30 +- .../model/generators/ItemModelProvider.java | 10 +- .../client/model/generators/ModelBuilder.java | 4 +- .../model/generators/ModelProvider.java | 7 +- .../generators/VariantBlockStateBuilder.java | 17 +- .../loaders/DynamicBucketModelBuilder.java | 3 +- .../client/model/obj/LineReader.java | 7 +- .../client/model/obj/OBJLoader.java | 11 +- .../client/model/obj/OBJModel.java | 6 +- .../pipeline/ForgeBlockModelRenderer.java | 15 +- .../model/renderable/BakedRenderable.java | 3 +- .../renderable/IMultipartRenderValues.java | 2 +- .../model/renderable/MultipartTransforms.java | 3 +- .../client/settings/KeyBindingMap.java | 2 +- .../client/settings/KeyModifier.java | 10 +- .../client/textures/ForgeTextureMetadata.java | 19 +- .../textures/ITextureAtlasSpriteLoader.java | 5 +- .../common/BasicItemListing.java | 11 +- .../common/BiomeDictionary.java | 389 ------ .../minecraftforge/common/DungeonHooks.java | 3 +- .../common/ForgeConfigSpec.java | 7 +- .../net/minecraftforge/common/ForgeHooks.java | 251 +--- .../net/minecraftforge/common/ForgeMod.java | 147 ++- .../common/ForgeSpawnEggItem.java | 4 +- .../common/ForgeStatesProvider.java | 59 +- .../net/minecraftforge/common/ForgeTier.java | 13 +- .../common/IExtensibleEnum.java | 6 +- .../common/IForgeShearable.java | 11 +- .../java/net/minecraftforge/common/Tags.java | 4 - .../common/TierSortingRegistry.java | 16 +- .../minecraftforge/common/UsernameCache.java | 3 +- .../common/brewing/BrewingRecipe.java | 11 +- .../common/capabilities/Capability.java | 5 +- .../capabilities/CapabilityDispatcher.java | 2 +- .../capabilities/CapabilityProvider.java | 9 +- .../capabilities/ICapabilityProvider.java | 9 +- .../capabilities/ICapabilityProviderImpl.java | 2 +- .../common/crafting/AbstractIngredient.java | 2 +- .../common/crafting/CompoundIngredient.java | 12 +- .../crafting/ConditionalAdvancement.java | 12 +- .../common/crafting/ConditionalRecipe.java | 32 +- .../common/crafting/CraftingHelper.java | 21 +- .../common/crafting/DifferenceIngredient.java | 2 +- .../crafting/IntersectionIngredient.java | 2 +- .../common/crafting/MultiItemValue.java | 3 +- .../common/crafting/NBTIngredient.java | 6 +- .../common/crafting/PartialNBTIngredient.java | 4 +- .../crafting/conditions/AndCondition.java | 6 - .../crafting/conditions/ConditionContext.java | 13 +- .../crafting/conditions/FalseCondition.java | 2 +- .../crafting/conditions/ICondition.java | 22 +- .../conditions/ItemExistsCondition.java | 2 +- .../conditions/ModLoadedCondition.java | 2 +- .../crafting/conditions/NotCondition.java | 6 - .../crafting/conditions/OrCondition.java | 6 - .../conditions/TagEmptyCondition.java | 8 +- .../crafting/conditions/TrueCondition.java | 2 +- .../common/data/ExistingFileHelper.java | 19 +- .../common/data/ForgeBlockTagsProvider.java | 1 - .../common/data/ForgeItemTagsProvider.java | 1 - .../common/data/ForgeRecipeProvider.java | 57 +- .../data/ForgeRegistryTagsProvider.java | 5 +- .../data/GlobalLootModifierProvider.java | 10 +- .../common/data/LanguageProvider.java | 24 +- .../common/data/SoundDefinition.java | 2 +- .../common/data/SoundDefinitionsProvider.java | 9 +- .../extensions/IForgeAbstractMinecart.java | 16 - .../extensions/IForgeAdvancementBuilder.java | 17 +- .../extensions/IForgeBaseRailBlock.java | 3 +- .../common/extensions/IForgeBlock.java | 60 +- .../common/extensions/IForgeBlockEntity.java | 7 +- .../common/extensions/IForgeBlockState.java | 30 +- .../common/extensions/IForgeEntity.java | 2 +- .../common/extensions/IForgeFluid.java | 6 +- .../extensions/IForgeFriendlyByteBuf.java | 38 +- .../common/extensions/IForgeItem.java | 21 +- .../common/extensions/IForgeItemStack.java | 13 +- .../extensions/IForgeRawTagBuilder.java | 25 +- .../common/extensions/IForgeTagAppender.java | 2 - .../common/loot/CanToolPerformAction.java | 12 +- .../loot/GlobalLootModifierSerializer.java | 39 +- .../common/loot/IGlobalLootModifier.java | 10 +- .../common/loot/LootModifier.java | 19 +- .../common/loot/LootModifierManager.java | 40 +- .../modloading/ForgeModStateProvider.java | 18 - .../common/ticket/AABBTicket.java | 7 +- .../common/ticket/SimpleTicket.java | 6 +- .../common/util/BlockSnapshot.java | 3 +- .../common/util/FakePlayer.java | 6 +- .../common/util/ForgeSoundType.java | 12 +- .../common/util/ITeleporter.java | 15 +- .../minecraftforge/common/util/JsonUtils.java | 3 +- .../net/minecraftforge/common/util/Lazy.java | 8 +- .../common/util/LazyOptional.java | 16 +- .../common/util/NonNullConsumer.java | 6 +- .../common/util/NonNullFunction.java | 8 +- .../common/util/NonNullLazy.java | 6 +- .../common/util/NonNullPredicate.java | 6 +- .../common/util/NonNullSupplier.java | 6 +- .../minecraftforge/common/util/TextTable.java | 4 +- .../common/util/WorldCapabilityData.java | 4 +- .../common/world/BiomeModifier.java | 95 ++ .../world/BiomeSpecialEffectsBuilder.java | 110 ++ .../common/world/ClimateSettingsBuilder.java | 131 ++ .../common/world/ForgeWorldPreset.java | 14 +- .../common/world/MobSpawnSettingsBuilder.java | 3 +- .../common/world/ModifiableBiomeInfo.java | 166 +++ .../common/world/NoneBiomeModifier.java | 29 + .../event/AnvilUpdateEvent.java | 11 +- .../event/ForgeEventFactory.java | 162 +-- .../event/GameShuttingDownEvent.java | 23 + .../event/ItemAttributeModifierEvent.java | 2 +- .../event/OnDatapackSyncEvent.java | 3 +- .../event/PlayLevelSoundEvent.java | 212 +++ .../minecraftforge/event/RegistryEvent.java | 296 ----- .../minecraftforge/event/ServerChatEvent.java | 24 +- .../net/minecraftforge/event/TickEvent.java | 25 +- .../event/VanillaGameEvent.java | 27 +- .../brewing/PlayerBrewedPotionEvent.java | 7 +- .../event/brewing/PotionBrewEvent.java | 7 +- .../enchanting/EnchantmentLevelSetEvent.java | 25 +- .../event/entity/EntityEvent.java | 32 - .../event/entity/EntityLeaveWorldEvent.java | 2 +- .../event/entity/PlaySoundAtEntityEvent.java | 68 - .../entity/living/BabyEntitySpawnEvent.java | 2 +- .../entity/living/EnderManAngerEvent.java | 1 + .../living/LivingEntityUseItemEvent.java | 21 +- .../living/LivingEquipmentChangeEvent.java | 9 +- .../event/entity/living/LivingEvent.java | 3 +- .../living/LivingExperienceDropEvent.java | 3 +- .../event/entity/living/LivingSpawnEvent.java | 19 +- .../entity/living/LootingLevelEvent.java | 3 +- .../event/entity/living/PotionEvent.java | 37 +- .../event/entity/player/AnvilRepairEvent.java | 17 +- .../event/entity/player/ArrowLooseEvent.java | 7 +- .../event/entity/player/ArrowNockEvent.java | 7 +- .../event/entity/player/BonemealEvent.java | 7 +- .../event/entity/player/FillBucketEvent.java | 13 +- .../event/entity/player/ItemTooltipEvent.java | 11 +- .../entity/player/PlayerDestroyItemEvent.java | 15 +- .../event/entity/player/PlayerEvent.java | 21 +- .../entity/player/PlayerInteractEvent.java | 13 +- .../entity/player/PlayerSetSpawnEvent.java | 5 +- .../event/entity/player/UseHoeEvent.java | 42 - .../furnace/FurnaceFuelBurnTimeEvent.java | 11 +- .../event/world/BiomeLoadingEvent.java | 101 -- .../event/world/BlockEvent.java | 82 +- .../event/world/ChunkDataEvent.java | 1 - .../event/world/PistonEvent.java | 3 +- .../event/world/SaplingGrowTreeEvent.java | 9 +- .../world/StructureSpawnListGatherEvent.java | 10 +- .../event/world/WorldEvent.java | 2 +- .../fluids/DispenseFluidContainer.java | 15 +- .../fluids/FluidActionResult.java | 11 +- .../fluids/FluidAttributes.java | 9 +- .../net/minecraftforge/fluids/FluidStack.java | 23 +- .../net/minecraftforge/fluids/FluidUtil.java | 47 +- .../fluids/ForgeFlowingFluid.java | 6 +- .../minecraftforge/fluids/IFluidBlock.java | 7 +- .../net/minecraftforge/fluids/IFluidTank.java | 9 +- .../fluids/capability/IFluidHandler.java | 11 +- .../fluids/capability/IFluidHandlerItem.java | 5 +- .../fluids/capability/ItemFluidContainer.java | 7 +- .../fluids/capability/TileFluidHandler.java | 13 +- .../templates/EmptyFluidHandler.java | 12 +- .../templates/FluidHandlerItemStack.java | 26 +- .../FluidHandlerItemStackSimple.java | 28 +- .../capability/templates/FluidTank.java | 15 +- .../templates/VoidFluidHandler.java | 12 +- .../wrappers/BucketPickupHandlerWrapper.java | 14 +- .../wrappers/FluidBlockWrapper.java | 11 +- .../wrappers/FluidBucketWrapper.java | 31 +- .../event/lifecycle/GatherDataEvent.java | 5 +- .../TextComponentMessageFormatHandler.java | 10 +- .../minecraftforge/items/IItemHandler.java | 14 +- .../items/IItemHandlerModifiable.java | 5 +- .../items/ItemHandlerHelper.java | 25 +- .../items/ItemStackHandler.java | 19 +- .../minecraftforge/items/SlotItemHandler.java | 14 +- .../items/VanillaHopperItemHandler.java | 7 +- .../items/VanillaInventoryCodeHooks.java | 6 +- .../items/wrapper/CombinedInvWrapper.java | 15 +- .../items/wrapper/EmptyHandler.java | 15 +- .../wrapper/EntityEquipmentInvWrapper.java | 17 +- .../items/wrapper/InvWrapper.java | 15 +- .../items/wrapper/PlayerArmorInvWrapper.java | 7 +- .../items/wrapper/PlayerMainInvWrapper.java | 7 +- .../items/wrapper/RangedWrapper.java | 15 +- .../items/wrapper/SidedInvWrapper.java | 17 +- .../logging/ModelLoaderErrorMessage.java | 6 +- .../network/HandshakeHandler.java | 13 +- .../network/HandshakeMessages.java | 17 +- .../minecraftforge/network/NetworkEvent.java | 3 +- .../minecraftforge/network/NetworkHooks.java | 9 +- .../minecraftforge/network/PlayMessages.java | 5 +- .../filters/ForgeConnectionNetworkFilter.java | 3 +- .../VanillaConnectionNetworkFilter.java | 20 +- .../network/filters/VanillaPacketFilter.java | 7 +- .../registries/DataSerializerEntry.java | 23 - .../registries/DeferredRegister.java | 165 +-- .../ForgeDeferredRegistriesSetup.java | 2 + .../registries/ForgeRegistries.java | 39 +- .../registries/ForgeRegistry.java | 188 +-- .../registries/ForgeRegistryEntry.java | 72 -- .../registries/ForgeRegistryTag.java | 5 +- .../registries/ForgeRegistryTagManager.java | 2 +- .../minecraftforge/registries/GameData.java | 436 +++---- .../registries/IForgeRegistry.java | 36 +- .../registries/IForgeRegistryEntry.java | 47 - .../registries/IForgeRegistryInternal.java | 2 +- .../registries/IForgeRegistryModifiable.java | 2 +- .../registries/IHolderHelperHolder.java | 2 +- .../registries/IRegistryDelegate.java | 45 - .../registries/IdMappingEvent.java | 84 ++ .../registries/MissingMappingsEvent.java | 180 +++ .../NamespacedDefaultedWrapper.java | 27 +- .../registries/NamespacedHolderHelper.java | 16 +- .../registries/NamespacedWrapper.java | 29 +- .../registries/NewRegistryEvent.java | 82 +- .../registries/ObjectHolder.java | 20 +- .../registries/ObjectHolderRef.java | 86 +- .../registries/ObjectHolderRegistry.java | 98 +- .../registries/RegisterEvent.java | 150 +++ .../registries/RegistryBuilder.java | 21 +- .../registries/RegistryDelegate.java | 53 - .../registries/RegistryManager.java | 78 +- .../registries/RegistryObject.java | 163 +-- .../registries/VanillaRegisterEvent.java | 29 - .../minecraftforge/registries/tags/ITag.java | 3 +- .../registries/tags/ITagManager.java | 3 +- .../resource/DelegatingResourcePack.java | 4 +- .../resource/PathResourcePack.java | 6 +- .../resource/ResourcePackLoader.java | 6 +- .../minecraftforge/server/LanguageHook.java | 11 +- .../server/ServerLifecycleHooks.java | 52 +- .../server/command/ChunkGenWorker.java | 12 +- .../server/command/ConfigCommand.java | 11 +- .../server/command/DimensionsCommand.java | 7 +- .../server/command/EntityCommand.java | 19 +- .../server/command/EnumArgument.java | 51 +- .../server/command/ModListCommand.java | 4 +- .../server/command/TPSCommand.java | 6 +- .../server/command/TagsCommand.java | 41 +- .../server/command/TextComponentHelper.java | 12 +- .../server/command/TrackCommand.java | 26 +- .../server/permission/PermissionAPI.java | 2 +- .../permission/nodes/PermissionNode.java | 20 +- .../permission/nodes/PermissionTypes.java | 3 +- .../versions/forge/ForgeVersion.java | 3 +- .../resources/META-INF/accesstransformer.cfg | 59 +- src/main/resources/META-INF/coremods.json | 3 +- .../resources/coremods/field_to_method.js | 11 + .../coremods/registry_object_binary_compat.js | 61 - src/main/resources/forge.exc | 27 +- src/main/resources/pack.mcmeta | 4 +- .../debug/AddPackFinderEventTest.java | 4 +- .../debug/CapabilitiesTest.java | 9 +- .../debug/DataGeneratorTest.java | 76 +- .../debug/DeferredRegistryTest.java | 32 +- .../debug/DuplicateOptionalTagTest.java | 9 +- .../debug/ManyMobEffectsTest.java | 4 +- .../minecraftforge/debug/PermissionTest.java | 11 +- .../debug/RegistryObjectTest.java | 2 +- .../debug/RemoveTagDatagenTest.java | 8 +- .../debug/block/BannerPatternTest.java | 35 - .../debug/block/BlockEntityOnLoadTest.java | 2 +- .../debug/block/CustomPlantTypeTest.java | 26 +- .../debug/block/CustomRespawnTest.java | 2 +- .../debug/block/FlowerPotTest.java | 20 +- .../debug/block/FullPotsAccessorDemo.java | 17 +- .../debug/block/PistonEventTest.java | 17 +- .../block/RedstoneSidedConnectivityTest.java | 3 +- .../debug/block/ScaffoldingTest.java | 2 +- .../debug/block/SlipperinessTest.java | 15 +- .../debug/block/StickyBlockTest.java | 15 +- .../debug/chat/ClientCommandTest.java | 26 +- .../debug/chat/CommandEventTest.java | 4 +- .../debug/chat/EntitySelectorTest.java | 5 +- .../debug/client/AudioStreamTest.java | 2 +- .../debug/client/CustomArmorModelTest.java | 6 +- .../debug/client/CustomTASTest.java | 5 +- .../debug/client/CustomTooltipTest.java | 43 +- .../debug/client/GuiLayeringTest.java | 17 +- .../client/model/CompositeModelTest.java | 3 +- .../client/model/CustomTransformTypeTest.java | 9 +- .../client/model/MultiLayerModelTest.java | 28 +- .../client/model/NewModelLoaderTest.java | 13 +- .../client/model/TRSRTransformerTest.java | 7 +- .../rendering/EntityRendererEventsTest.java | 14 +- .../NameplateRenderingEventTest.java | 4 +- .../debug/command/EnumArgumentTest.java | 6 +- .../debug/entity/GravityAttributeTest.java | 13 +- .../debug/entity/PartEntityTest.java | 48 +- .../entity/player/PlayerNameEventTest.java | 4 +- .../debug/fluid/MilkFluidTest.java | 4 +- .../debug/fluid/NewFluidTest.java | 4 +- .../loot/GlobalLootModifiersTest.java | 23 +- .../debug/item/CustomElytraTest.java | 5 +- .../debug/item/TagBasedToolTypesTest.java | 106 +- .../debug/misc/ContainerTypeTest.java | 32 +- .../debug/misc/DataPackRegistriesTest.java | 55 +- .../debug/misc/RegistryCodecTest.java | 3 +- .../RecipeBookExtensionClientHelper.java | 2 +- .../recipebook/RecipeBookExtensionTest.java | 41 +- .../recipe/recipebook/RecipeBookTestMenu.java | 5 +- .../recipebook/RecipeBookTestRecipe.java | 7 +- .../RecipeBookTestRecipeSerializer.java | 6 +- .../debug/world/BiomeLoadingEventTest.java | 31 - .../debug/world/BiomeModifierTest.java | 227 ++++ .../debug/world/ChunkWatchEventTest.java | 2 +- .../debug/world/DimensionSettingsTest.java | 1 - .../debug/world/ForgeWorldTypeTest.java | 94 +- .../StructureSpawnListGatherEventTest.java | 8 +- .../eventtest/internal/EventTest.java | 116 ++ .../eventtest/internal/TestFramework.java | 200 +++ .../eventtest/internal/TestHolder.java | 23 + .../forge/client/EntityJoinedWorldTest.java | 44 + src/test/resources/META-INF/mods.toml | 226 +--- src/test/resources/pack.mcmeta | 4 +- .../test_nested_resource_pack/pack.mcmeta | 4 +- 1485 files changed, 14786 insertions(+), 15272 deletions(-) delete mode 100644 fmlloader/src/main/java/net/minecraftforge/fml/loading/AdvancedLogMessageAdapter.java delete mode 100644 l4jManifest.xml create mode 100644 mdk/settings.gradle delete mode 100644 patches/minecraft/net/minecraft/client/gui/screens/inventory/LoomScreen.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch create mode 100644 patches/minecraft/net/minecraft/client/multiplayer/ProfileKeyPairManager.java.patch create mode 100644 patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch delete mode 100644 patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch delete mode 100644 patches/minecraft/net/minecraft/core/particles/ParticleType.java.patch delete mode 100644 patches/minecraft/net/minecraft/core/particles/ParticleTypes.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/CatVariantTagsProvider.java.patch delete mode 100644 patches/minecraft/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/network/chat/PlayerChatMessage.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/chat/Style.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/chat/TranslatableComponent.java.patch create mode 100644 patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch delete mode 100644 patches/minecraft/net/minecraft/sounds/SoundEvent.java.patch delete mode 100644 patches/minecraft/net/minecraft/sounds/SoundEvents.java.patch delete mode 100644 patches/minecraft/net/minecraft/stats/StatType.java.patch delete mode 100644 patches/minecraft/net/minecraft/tags/Tag.java.patch create mode 100644 patches/minecraft/net/minecraft/tags/TagBuilder.java.patch create mode 100644 patches/minecraft/net/minecraft/tags/TagEntry.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/effect/MobEffects.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/ai/attributes/Attribute.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/ai/memory/MemoryModuleType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/ai/sensing/SensorType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiType.java.patch create mode 100644 patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/decoration/Motive.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/npc/VillagerProfession.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/schedule/Activity.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/entity/schedule/Schedule.java.patch create mode 100644 patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/inventory/LoomMenu.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/item/crafting/SingleItemRecipe.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/item/enchantment/Enchantments.java.patch create mode 100644 patches/minecraft/net/minecraft/world/level/biome/BiomeSource.java.patch create mode 100644 patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/block/OreBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/block/entity/BannerPattern.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/chunk/ChunkStatus.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch create mode 100644 src/docs/stylesheet.css create mode 100644 src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json create mode 100644 src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/birch_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/mangrove_fence.json create mode 100644 src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json create mode 100644 src/generated/resources/data/minecraft/recipes/mangrove_sign.json create mode 100644 src/generated/resources/data/minecraft/recipes/oak_chest_boat.json create mode 100644 src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json delete mode 100644 src/generated_test/resources/.cache/cache delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom_hinge.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top_hinge.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_post.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_side.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_post.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side.json delete mode 100644 src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side_tall.json delete mode 100644 src/generated_test/resources/assets/minecraft/blockstates/acacia_door.json delete mode 100644 src/generated_test/resources/assets/minecraft/blockstates/acacia_fence.json delete mode 100644 src/generated_test/resources/assets/minecraft/blockstates/cobblestone_wall.json create mode 100644 src/generated_test/resources/data/biome_modifiers_test/forge/biome_modifier/modify_badlands.json create mode 100644 src/generated_test/resources/data/biome_modifiers_test/worldgen/placed_feature/large_basalt_columns.json delete mode 100644 src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java create mode 100644 src/main/java/net/minecraftforge/client/event/package-info.java create mode 100644 src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java delete mode 100644 src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java create mode 100644 src/main/java/net/minecraftforge/client/event/sound/package-info.java create mode 100644 src/main/java/net/minecraftforge/client/extensions/package-info.java delete mode 100644 src/main/java/net/minecraftforge/client/gui/widget/Slider.java delete mode 100644 src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java delete mode 100644 src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java delete mode 100644 src/main/java/net/minecraftforge/common/BiomeDictionary.java delete mode 100644 src/main/java/net/minecraftforge/common/modloading/ForgeModStateProvider.java create mode 100644 src/main/java/net/minecraftforge/common/world/BiomeModifier.java create mode 100644 src/main/java/net/minecraftforge/common/world/BiomeSpecialEffectsBuilder.java create mode 100644 src/main/java/net/minecraftforge/common/world/ClimateSettingsBuilder.java create mode 100644 src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java create mode 100644 src/main/java/net/minecraftforge/common/world/NoneBiomeModifier.java create mode 100644 src/main/java/net/minecraftforge/event/GameShuttingDownEvent.java create mode 100644 src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java delete mode 100644 src/main/java/net/minecraftforge/event/RegistryEvent.java delete mode 100644 src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java delete mode 100644 src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java delete mode 100644 src/main/java/net/minecraftforge/event/world/BiomeLoadingEvent.java delete mode 100644 src/main/java/net/minecraftforge/registries/DataSerializerEntry.java delete mode 100644 src/main/java/net/minecraftforge/registries/ForgeRegistryEntry.java delete mode 100644 src/main/java/net/minecraftforge/registries/IForgeRegistryEntry.java delete mode 100644 src/main/java/net/minecraftforge/registries/IRegistryDelegate.java create mode 100644 src/main/java/net/minecraftforge/registries/IdMappingEvent.java create mode 100644 src/main/java/net/minecraftforge/registries/MissingMappingsEvent.java create mode 100644 src/main/java/net/minecraftforge/registries/RegisterEvent.java delete mode 100644 src/main/java/net/minecraftforge/registries/RegistryDelegate.java delete mode 100644 src/main/java/net/minecraftforge/registries/VanillaRegisterEvent.java delete mode 100644 src/main/resources/coremods/registry_object_binary_compat.js delete mode 100644 src/test/java/net/minecraftforge/debug/block/BannerPatternTest.java delete mode 100644 src/test/java/net/minecraftforge/debug/world/BiomeLoadingEventTest.java create mode 100644 src/test/java/net/minecraftforge/debug/world/BiomeModifierTest.java create mode 100644 src/test/java/net/minecraftforge/eventtest/internal/EventTest.java create mode 100644 src/test/java/net/minecraftforge/eventtest/internal/TestFramework.java create mode 100644 src/test/java/net/minecraftforge/eventtest/internal/TestHolder.java create mode 100644 src/test/java/net/minecraftforge/eventtest/tests/forge/client/EntityJoinedWorldTest.java diff --git a/.gitignore b/.gitignore index 2872cfca1bb..37d4c9b7a2f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ /projects/**/*.launch /repo/ src/generated/resources/.cache/ +src/generated_test/resources/.cache/ #Patch rejects /patches-/ diff --git a/build.gradle b/build.gradle index c2ca3fed7be..609e72c73cc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - mavenLocal() - maven { url = 'https://maven.minecraftforge.net/' } - mavenCentral() - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.39,)' - } -} - import groovy.json.JsonBuilder import java.nio.file.Files @@ -31,6 +20,8 @@ plugins { id 'net.minecraftforge.gradleutils' version '2.+' id 'eclipse' id 'de.undercouch.download' version '4.1.2' + id 'net.minecraftforge.gradle.patcher' version '[5.1.39,)' apply false + id 'net.minecraftforge.gradle.mcp' version '[5.1.39,)' apply false } Util.init() //Init all our extension methods! @@ -45,9 +36,9 @@ ext { ] } MAPPING_CHANNEL = 'official' - MAPPING_VERSION = '1.18.2' - MC_VERSION = '1.18.2' - MCP_VERSION = '20220404.173914' + MAPPING_VERSION = '1.19' + MC_VERSION = '1.19' + MCP_VERSION = '20220607.102129' SPI_VERSION = '4.0.10' ACCESSTRANSFORMERS_VERSION = '8.0.4' COREMODS_VERSION = '5.0.1' @@ -55,22 +46,36 @@ ext { MODLAUNCHER_VERSION = '9.1.3' SECUREJARHANDLER_VERSION = '1.0.3' BOOTSTRAPLAUNCHER_VERSION = '1.0.0' - ASM_VERSION = '9.2' + ASM_VERSION = '9.3' INSTALLER_VERSION = '2.1.+' MIXIN_VERSION = '0.8.5' + TERMINALCONSOLEAPPENDER_VERSION = '1.2.0' + JLINE_VERSION = '3.12.+' + NIGHTCONFIG_VERSION = '3.6.4' + JETBRAINS_ANNOTATIONS_VERSION = '23.0.0' + SLF4J_API_VERSION = '1.8.0-beta4' + APACHE_MAVEN_ARTIFACT_VERSION = '3.8.5' + + // These versions should be kept in sync with the version manifest JSON + // To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration + MOJANG_LOGGING_VERSION = '1.0.0' + LOG4J_VERSION = '2.17.0' + GUAVA_VERSION = '31.0.1-jre' + GSON_VERSION = '2.8.9' + APACHE_COMMONS_LANG3_VERSION = '3.12.0' + JOPT_SIMPLE_VERSION = '5.0.4' + COMMONS_IO_VERSION = '2.11.0' GIT_INFO = gradleutils.gitInfo VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION) // FML_VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, 'FML', MC_VERSION) FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1) - SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0' - BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar' + BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.1.1:fatjar' INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0' JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4' FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all' MIN_TAG_FOR_CHANGELOG = "39.0" - LAST_RB = GIT_INFO.tag.rsplit('.', 1)[1] as int >= 1 ? GIT_INFO.tag + '.0' : null } println('Version: ' + VERSION + @@ -138,6 +143,10 @@ subprojects { name = 'forge' url = 'https://maven.minecraftforge.net/' } + maven { + name = 'minecraft' + url = 'https://libraries.minecraft.net/' + } } java.toolchain.languageVersion = JavaLanguageVersion.of(17) @@ -259,19 +268,19 @@ def sharedDeps = { installer "org.ow2.asm:asm-util:${ASM_VERSION}" installer "org.ow2.asm:asm-analysis:${ASM_VERSION}" installer "net.minecraftforge:accesstransformers:${ACCESSTRANSFORMERS_VERSION}" - installer 'org.antlr:antlr4-runtime:4.9.1' //Dep of AccessTransformer + installer 'org.antlr:antlr4-runtime:4.9.1' // Dep of AccessTransformer installer "net.minecraftforge:eventbus:${EVENTBUS_VERSION}" installer "net.minecraftforge:forgespi:${SPI_VERSION}" installer "net.minecraftforge:coremods:${COREMODS_VERSION}" installer "cpw.mods:modlauncher:${MODLAUNCHER_VERSION}" installer 'net.minecraftforge:unsafe:0.2.+' - installer 'com.electronwill.night-config:core:3.6.4' - installer 'com.electronwill.night-config:toml:3.6.4' - installer 'org.apache.maven:maven-artifact:3.6.3' + installer "com.electronwill.night-config:core:${NIGHTCONFIG_VERSION}" + installer "com.electronwill.night-config:toml:${NIGHTCONFIG_VERSION}" + installer "org.apache.maven:maven-artifact:${APACHE_MAVEN_ARTIFACT_VERSION}" installer 'net.jodah:typetools:0.8.3' - installer 'net.minecrell:terminalconsoleappender:1.2.0' - installer 'org.jline:jline-reader:3.12.+' //Dep of TerminaalConsoleeAppender - installer 'org.jline:jline-terminal:3.12.+' //Dep of TerminaalConsoleeAppender + installer "net.minecrell:terminalconsoleappender:${TERMINALCONSOLEAPPENDER_VERSION}" + installer "org.jline:jline-reader:${JLINE_VERSION}" // Dep of TerminalConsoleAppender + installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender installer "org.spongepowered:mixin:${MIXIN_VERSION}" installer 'org.openjdk.nashorn:nashorn-core:15.3' @@ -1049,6 +1058,7 @@ project(':forge') { '--mod', 'tag_based_tool_types', '--mod', 'custom_transformtype_test', '--mod', 'data_pack_registries_test', + '--mod', 'biome_modifiers_test', '--output', rootProject.file('src/generated_test/resources/'), '--existing', sourceSets.main.resources.srcDirs[0], '--existing', sourceSets.test.resources.srcDirs[0] @@ -1180,18 +1190,28 @@ project(':forge') { lineEnding = '\n' } - def baseForgeVersion = LAST_RB == null ? null : "${MC_VERSION}-${LAST_RB}" + def baseForgeVersion = System.getProperty("forge.compatibility_check_version") + if (baseForgeVersion == null) + baseForgeVersion = "${MC_VERSION}-${GIT_INFO.tag}.0" + if (baseForgeVersion == "null") + baseForgeVersion = null // Allow disabling from system property if not wanted + def baseForgeUniversal = null + if (baseForgeVersion != null) + baseForgeUniversal = project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal") + def jarCompatibilityTaskSetup = { task -> + task.group = 'jar compatibility' + task.onlyIf { + baseForgeVersion != null + } + task.inputs.property 'baseForgeVersion', baseForgeVersion + } task downloadBaseCompatibilityBinPatches(type: DownloadBaseCompatibilityBinPatches) { inputVersion = baseForgeVersion } task applyBaseCompatibilityJarBinPatches(type: ApplyBinPatches) { - group = 'jar compatibility' - onlyIf { - baseForgeVersion != null - } - inputs.property 'baseForgeVersion', baseForgeVersion + jarCompatibilityTaskSetup(it) clean = createJoinedSRG.output patch = downloadBaseCompatibilityBinPatches.output @@ -1199,23 +1219,16 @@ project(':forge') { } task checkJarCompatibility(type: CheckJarCompatibility) { - group = 'jar compatibility' - onlyIf { - baseForgeVersion != null - } - inputs.property 'baseForgeVersion', baseForgeVersion + jarCompatibilityTaskSetup(it) if (baseForgeVersion != null) { - def baseForgeUniversal = project.configurations.detachedConfiguration(project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal")) def fmlLibs = project.configurations.detachedConfiguration(PACKED_DEPS.collect { def artifactId = it.split(':')[1] return project.dependencies.create("net.minecraftforge:${artifactId}:${baseForgeVersion}") }.toArray(Dependency[]::new)) baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output - baseLibraries.from(project.file(project.provider { - baseForgeUniversal.resolve().iterator().next() - })) + baseLibraries.from(baseForgeUniversal) baseLibraries.from(project.tasks.createJoinedSRG.output) baseLibraries.from(fmlLibs) @@ -1578,6 +1591,83 @@ project(':forge') { sourceSets.test.java.srcDirs.each { extractMappedNew.addTarget it } } + tasks.named('javadoc', Javadoc).configure { + description 'Generates the combined javadocs for the FML projects and the main Forge project' + var includedProjects = [ ':fmlcore', ':fmlloader', ':javafmllanguage', ':mclanguage' ] + source includedProjects.collect { project(it).sourceSets.main.allJava } + classpath = classpath + files(includedProjects.collect { project(it).sourceSets.main.compileClasspath }) + + var docsDir = rootProject.file('src/docs/') + inputs.dir(docsDir) + .withPropertyName('docs resources directory') + .withPathSensitivity(PathSensitivity.RELATIVE) + .optional() + + failOnError = false + + // Exclude the Minecraft classes if not enabled + if (!project.hasProperty('generateAllDocumentation')) { + exclude 'net/minecraft/**' + exclude 'com/mojang/**' + } + exclude 'mcp/**' + + options.addStringOption('Xdoclint:all,-missing', '-public') + options { + stylesheetFile = new File(docsDir, 'stylesheet.css') + + tags = [ + 'apiNote:a:API Note:', + 'implSpec:a:Implementation Requirements:', + 'implNote:a:Implementation Note:' + ] + + groups = [ + 'Forge Mod Loader': [ + 'net.minecraftforge.fml.common.asm*', + 'net.minecraftforge.fml.loading*', + 'net.minecraftforge.fml.server*' + ], + 'FML Core': [ + 'net.minecraftforge.fml', + 'net.minecraftforge.fml.config*', + 'net.minecraftforge.fml.event*', + 'net.minecraftforge.fml.util*' + ], + 'FML Common': [ + 'net.minecraftforge.fml.core', + 'net.minecraftforge.fml.event.config', + 'net.minecraftforge.fml.event.lifecycle' + ], + 'FML Java/MC Language Providers': [ + 'net.minecraftforge.fml.common', + 'net.minecraftforge.fml.javafmlmod', + 'net.minecraftforge.fml.mclanguageprovider' + ], + 'Minecraft Forge API': [ + 'net.minecraftforge*' + ] + ] + + author = false + noSince = true + noHelp = true + + bottom = "Minecraft Forge is an open source modding API for Minecraft: Java Edition, licensed under the Lesser GNU General Public License, version 2.1." + windowTitle = "Minecraft Forge API ${VERSION}" + docTitle = "Minecraft Forge API - ${FORGE_VERSION} for Minecraft ${MC_VERSION}" + header = "
${FORGE_VERSION} for Minecraft ${MC_VERSION}
" + } + + doLast { + project.copy { + from docsDir + exclude '/stylesheet.css' + into destinationDir + } + } + } + publishing { publications { mavenJava(MavenPublication) { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index f2d3e1fe1a2..51c040bd5f2 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -2,8 +2,9 @@ repositories { maven { url = 'https://maven.minecraftforge.net/' } mavenCentral() } + dependencies { - implementation 'org.ow2.asm:asm:9.1' - implementation 'org.ow2.asm:asm-tree:9.1' + implementation 'org.ow2.asm:asm:9.3' + implementation 'org.ow2.asm:asm-tree:9.3' implementation 'net.minecraftforge:srgutils:0.4.+' } \ No newline at end of file diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 1d7fe8459b3..93eecc697fc 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,11 +1,11 @@ Contributing to Forge ===================== -1) Keep patches to Minecraft classes minimal. If you need a lot of things done, you may either add to relevant forge classes or make a new class. +1) Keep patches to Minecraft classes together. If you need a lot of things done, you may either add to relevant forge classes or make a new class. Try not to spread out your patches across multiple disjoint lines, as this makes maintenance of your patches difficult. -2) An example mod must be provided for all PRs adding events/hooks to Forge. Whether it's a full mod using your proposed hooks, or just a pastebin containing a simple example, an example mod is required. Please also explain in detail what your new hook does. +2) TODO: Test Mods -3) Follow Forge coding guidelines (braces on newlines, spaces instead of tabs, etc) +3) Follow the code style of the class you're working in (braces on newlines & spaces instead of tabs in Forge classes, inline brackets in patches, etc). For more information, refer to [the wiki](https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge) diff --git a/docs/README.md b/docs/README.md index fb898162515..a126800743b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,10 +8,10 @@ MinecraftForge Forge is a free, open-source modding API all of your favourite mods use! -| Version | Support | -| ------------- | ------------- | -| 1.18.x | Active | -| 1.16.x | LTS | +| Version | Support | +|---------| ------------- | +| 1.19.x | Active | +| 1.18.x | LTS | * [Download] * [Forum] @@ -29,7 +29,7 @@ You can download the installer for the *Recommended Build* or the into your vanilla launcher environment, where you can then create a new profile using that version and play the game! -For support and questions, visit [the Support Forum](https://www.minecraftforge.net/forum/forum/18-support-bug-reports/). +For support and questions, visit [the Support Forum](https://www.minecraftforge.net/forum/forum/18-support-bug-reports/) or [the Forge Discord server](https://discord.gg/forge). [Here is a short video from Rorax showing how to install and setup Forge.](https://www.youtube.com/watch?v=lB3ArN_-3Oc) @@ -41,7 +41,7 @@ For support and questions, visit [the Support Forum](https://www.minecraftforge. If you wish to actually inspect Forge, submit PRs or otherwise work with Forge itself, you're in the right place! - + [See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/). ### Pull requests @@ -51,13 +51,14 @@ If you wish to actually inspect Forge, submit PRs or otherwise work Please read the contributing guidelines found [here](CONTRIBUTING.md) before making a pull request. ### Contributor License Agreement -We require all contributors to acknowledge the [Forge Contributor - License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge). Please ensure you have a valid email address - associated with your GitHub account to do this. If you have previously +We require all contributors to acknowledge the [Forge Contributor License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge). +Please ensure you have a valid email address associated with your GitHub account to do this. If you have previously signed it, you should be OK. #### Donate -*Forge is a large project with many collaborators working on it around the clock. Forge is and will always remain free to use and modify. However, it costs money to run such a large project as this, so please consider [becoming a patron](https://www.patreon.com/LexManos).* +*Forge is a large project with many collaborators working on it around the clock. Forge is and will always remain free + to use and modify. However, it costs money to run such a large project as this, so please consider + [becoming a patron](https://www.patreon.com/LexManos).* [Download]: https://files.minecraftforge.net/ [Forum]: https://www.minecraftforge.net/forum/ diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md index f6a1804944a..976702c21c0 100644 --- a/docs/SUPPORT.md +++ b/docs/SUPPORT.md @@ -76,7 +76,7 @@ If you're certain you've found an issue that is directly caused by Forge, you ha 1. **Forge Forums:** There's a dedicated [Support & Bug Report](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/) section on the Forge forums, which is led by team of moderators and volunteers who will try to deal with your reports as quickly as possible. *As a player you should probably report here first.* - For modders, there also is a separate [Modder Support](http://www.minecraftforge.net/forum/forum/70-modder-support/) section where you can ask all your development-related questions. *You should prefer this section for coding help.* - 2. **Forge IRC Channel:** You can find a lot of help on the official [`#minecraftforge`](irc://irc.esper.net:6667/minecraftforge) channel on EsperNet. Especially smaller issues that you quickly need help with could be reported there. *Be aware that the channel is more suited towards development questions, so while you may get support there as a player, you should almost always prefer the forums.* + 2. **Forge Discord Server:** You can find a lot of help on the official [Discord Server](https://discord.gg/forge), especially smaller issues that you quickly need help with. *Be aware that the channel is more suited towards development questions, so while you may get support there as a player, you should almost always prefer the forums.* 3. **Forge Issue Tracker:** If you're absolutely certain that you've found an issue in the Forge codebase (e.g. you're a modder yourself and have analyzed the stacktrace and relevant code), don't refrain from reporting it on this repository's [issue tracker](https://github.com/MinecraftForge/MinecraftForge/issues). *Please do not use the issues as a means of getting coding help. For developers, the IRC and the [official documentation](https://mcforge.readthedocs.io) are the best sources of information.* ### Mod Support @@ -84,7 +84,8 @@ If you're certain you've found an issue that is directly caused by Forge, you ha A lot of mods also use GitHub or other source management systems and their integrated issue trackers. The following options will give you the best chances of reporting your issue in the right place: - **CurseForge:** Many mods are hosted on the [CurseForge platform](https://minecraft.curseforge.com) nowadays. Chances are you already downloaded them from there or as a part of a modpack hosted there. Projects may specify an issue reporting link on their own page, so simply look for it on the mod's project page and you should be directed to the preferred means of error reporting. - - **Searching for a repository directly:** You may need to try and find a repository directly on source control sites. The most common ones are [GitHub](https://github.com) and [BitBucket](https://bitbucket.org). Both come with search capabilities, so simply try to search for the mod's name. + - **Modrinth:** Some modders use [Modrinth](https://modrinth.com/mods) to host their mods, but be mindful that not all mods on this platform are for the Forge modloader. + - **Searching for a repository directly:** You may need to try and find a repository directly on source control sites. The most common ones are [GitHub](https://github.com), [GitLab](https://gitlab.com), and [BitBucket](https://bitbucket.org). Both come with search capabilities, so simply try to search for the mod's name. ### Vanilla Support diff --git a/fmlcore/build.gradle b/fmlcore/build.gradle index ece8e6cbe63..19d73203d0a 100644 --- a/fmlcore/build.gradle +++ b/fmlcore/build.gradle @@ -10,10 +10,12 @@ apply plugin: 'org.javamodularity.moduleplugin' dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencies { - compileOnly('org.jetbrains:annotations:21.0.1') + compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + + api("net.minecraftforge:eventbus:${EVENTBUS_VERSION}") + implementation(project(':fmlloader')) - api('net.minecraftforge:eventbus:5.0.+') - implementation('commons-io:commons-io:2.5') + implementation("commons-io:commons-io:${COMMONS_IO_VERSION}") } task sourcesJar(type: Jar) { diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IExtensionPoint.java b/fmlcore/src/main/java/net/minecraftforge/fml/IExtensionPoint.java index ff14349e713..d91661010f6 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IExtensionPoint.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IExtensionPoint.java @@ -8,41 +8,90 @@ import java.util.function.BiPredicate; import java.util.function.Supplier; +/** + * An extension point for a mod container. + * + *

An extension point can be registered for a mod container using {@link ModContainer#registerExtensionPoint(Class, Supplier)} + * and retrieved (if present) using {@link ModContainer#getCustomExtension(Class)}. An extension point allows a mod to + * supply an arbitrary value as a record class to another mod or framework through their mod container class, avoiding + * the use of {@link InterModComms} or other external frameworks to pass around these values.

+ * + *

The usual way to declare an extension point is to implement this interface on a record class, with the type + * parameter being a reference to the class itself. For example, {@code record MyExtension(...) extends + * IExtensionPoint} would declare an extension point which supplies a {@code MyExtension} object. However, + * there is no hard requirement that an extension point's type parameter must be in reference to itself; the type + * parameter may reference another record class instead.

+ * + * @param the type of the record which is held by the extension point + */ +@SuppressWarnings("unused") // Type parameter T public interface IExtensionPoint { /** - * Compatibility display test for the mod. - * Used for displaying compatibility with remote servers with the same mod, and on disk saves. + * Extension point for the compatibility display test used on the server selection screen. + * + * Note: "server" and "client" refers to the {@linkplain net.minecraftforge.api.distmarker.Dist#DEDICATED_SERVER dedicated server} + * and {@linkplain net.minecraftforge.api.distmarker.Dist#CLIENT game client} physical distributions, rather than the + * {@linkplain LogicalSide logical server and client}. + * + *

The {@link Supplier} provides the local compatibility version, which is sent from the server to the client + * for multiplayer connections or stored to disk for the world save. The {@link BiPredicate} accepts the remote + * compatibility version and a boolean indicating whether the remote version is from the server or a world save, + * where {@code true} means it is from the server and {@code false} means it is from the world save. The return + * value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.

* - * The supplier provides my "local" version for sending across the impl or writing to disk - * The predicate tests the version from a remote instance or save for acceptability (Boolean is true for impl, false for local save) - * and returns true if the version is compatible. + *

The local compatibility version may be of the value {@link net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY}, + * in which case clients will ignore the mod's presence if it is present on the server but not on the client. + * However, the remote version test predicate must still accept this value as a remote version in order to display + * as compatible if the mod is present on the client.

* - *

Return {@code net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY} in the supplier, if you wish to be ignored - * as a server side only mod.

- *

Return true in the predicate for all values of the input string (when impl boolean is true) if you are client side, - * and don't care about matching any potential server version.

+ *

The compatibility display test does not necessarily indicate the success or failure of an actual + * connection attempt. Factors such as display test extension misconfiguration, truncation of ping data, + * difference of registry data or network channels between server and client, and others may cause the result of the + * compatibility test to not reflect the actual likelihood of a connection successfully being established between + * the server and the client.

+ * + *

An example declaration of a display test extension registration for a regular mod (requires to be present on + * server and client) is as follows:

+ *
{@code
+     * String compatibilityVersion = "1"; // Could be linked with a network channel version or mod version
+     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
+     *         () -> new IExtensionPoint.DisplayTest(
+     *                 () -> compatibilityVersion,
+     *                 (remoteVersion, isFromServer) -> remoteVersion.equals(compatibilityVersion)
+     *         )
+     * );
+     * }
* - *

- * Examples: A server only mod - *

+ *

An example declaration of a display test extension registration for a server-side-only mod (does not + * require to be present on the client) is as follows:

*
{@code
-     *     registerExtensionPoint(DisplayTest.class, ()->new DisplayTest(
-     *      ()->NetworkConstants.IGNORESERVERONLY, // ignore me, I'm a server only mod
-     *      (s,b)->true // i accept anything from the server or the save, if I'm asked
-     *     )
+     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
+     *         () -> new IExtensionPoint.DisplayTest(
+     *                 // Ignore this mod if not present on the client
+     *                 () -> NetworkConstants.IGNORESERVERONLY,
+     *                 // If present on the client, accept any version if from a server
+     *                 (remoteVersion, isFromServer) -> isFromServer
+     *         )
+     * );
      * }
* - *

- * Examples: A client only mod - *

+ *

An example declaration of a display test extension registration for a client-side-only mod (does not + * require to be present on the server) is as follows:

*
{@code
-     *     registerExtensionPoint(DisplayTest.class, ()->new DisplayTest(
-     *      ()->"anything. i don't care", // if i'm actually on the server, this string is sent but i'm a client only mod, so it won't be
-     *      (remoteversionstring,networkbool)->networkbool // i accept anything from the server, by returning true if it's asking about the server
-     *     )
+     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
+     *         () -> new IExtensionPoint.DisplayTest(
+     *                 // Send any version from server to client, since we will be accepting any version as well
+     *                 () -> "dQw4w9WgXcQ",
+     *                 // Accept any version on the client, from server or from save
+     *                 (remoteVersion, isFromServer) -> true
+     *         )
+     * );
      * }
* + * @see net.minecraftforge.network.ServerStatusPing + * @see net.minecraftforge.client.ForgeHooksClient#processForgeListPingData(net.minecraft.network.protocol.status.ServerStatus, net.minecraft.client.multiplayer.ServerData) */ + @SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient record DisplayTest(Supplier suppliedVersion, BiPredicate remoteVersionTest) implements IExtensionPoint {} } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java b/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java index da033ff4a00..864c5120265 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java @@ -8,23 +8,79 @@ import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.event.IModBusEvent; -import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Function; +/** + * A mod loading state. During mod loading, the mod loader transitions between states in a defined sorted list of states, + * grouped into various {@link ModLoadingPhase phases}. + * + * @see IModStateProvider + */ public interface IModLoadingState { + /** + * {@return the name of this state} + */ String name(); + + /** + * {@return the name of the state immediately previous to this state} This may be a blank name, which indicates this + * is either the first mod loading state or an exceptional mod loading state (such as a situation where errors + * prevent the loading process from continuing normally). + */ String previous(); + + /** + * {@return the mod loading phase this state belongs to} For exceptional mod loading states, this should be + * {@link ModLoadingPhase#ERROR}. + */ ModLoadingPhase phase(); + + /** + * {@return a function returning a human-friendly message for this state} + */ Function message(); + + /** + * {@return an optional runnable, which runs before starting the transition from this state to the next} + * @see #buildTransition(Executor, Executor, Function, Function) + */ Optional> inlineRunnable(); - default Optional>> buildTransition(final Executor syncExecutor, final Executor parallelExecutor) { - return buildTransition(syncExecutor, parallelExecutor, e->CompletableFuture.runAsync(()->{}, e), e->CompletableFuture.runAsync(()->{}, e)); + /** + * Builds the transition task for this state with a blank pre-sync and post-sync task. + * + * @param syncExecutor a synchronous executor + * @param parallelExecutor a parallel executor + * @param a type of event fired on the mod-specific event bus + * @return a transition task for this state + * @see #buildTransition(Executor, Executor, Function, Function) + */ + default + Optional> buildTransition(final Executor syncExecutor, + final Executor parallelExecutor) { + return buildTransition(syncExecutor, parallelExecutor, + e -> CompletableFuture.runAsync(() -> {}, e), + e -> CompletableFuture.runAsync(() -> {}, e)); } - Optional>> buildTransition(Executor syncExecutor, Executor parallelExecutor, Function> preSyncTask, Function> postSyncTask); + /** + * Builds the transition task for this state. The pre-sync and post-sync task functions allow the transition builder + * to run these tasks on the same executor as the actual event dispatch and pre/post hooks. + * + * @param syncExecutor a synchronous executor + * @param parallelExecutor a parallel executor + * @param preSyncTask a function which returns a task to run before event pre-dispatch hook + * @param postSyncTask a function which returns a task to run after event post-dispatch hook + * @param a type of event fired on the mod-specific event bus + * @return a transition task for this state + */ + + Optional> buildTransition(final Executor syncExecutor, + final Executor parallelExecutor, + final Function> preSyncTask, + final Function> postSyncTask); } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateProvider.java b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateProvider.java index 6983cb9caa7..05ff1125ad7 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateProvider.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateProvider.java @@ -7,6 +7,15 @@ import java.util.List; +/** + * Provides a list of mod loading states which the mod loader may transition between. + * + *

There may be multiple mod state providers in a single application, where all states from each provider is + * combined into a single list and ordered.

+ */ public interface IModStateProvider { + /** + * {@return the list of mod loading states known to this provider} + */ List getAllStates(); } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java index 1f0b37c7d10..941a7019242 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java @@ -9,7 +9,6 @@ import net.minecraftforge.fml.event.IModBusEvent; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -24,18 +23,26 @@ static IModStateTransition buildNoopTransition() { return new NoopTransition(); } - default CompletableFuture> build(Executor syncExecutor, Executor parallelExecutor, Function> preSyncTask, Function> postSyncTask) { - List>> cfs = new ArrayList<>(); + default + CompletableFuture build(final Executor syncExecutor, + final Executor parallelExecutor, + final Function> preSyncTask, + final Function> postSyncTask) { + List> futures = new ArrayList<>(); + this.eventFunctionStream().get() - .map(f->(EventGenerator)f) - .reduce((head, tail)-> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, cfs, head, ModLoadingStage::currentState, tail)) - .ifPresent(last-> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, cfs, last, nextModLoadingStage(), null)); + .map(f -> (EventGenerator) f) + .reduce((head, tail) -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, head, ModLoadingStage::currentState, tail)) + .ifPresent(last -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, last, nextModLoadingStage(), null)); + final CompletableFuture preSyncTaskCF = preSyncTask.apply(syncExecutor); - final CompletableFuture> eventDispatchCF = ModList.gather(cfs).thenCompose(ModList::completableFutureFromExceptionList); - final CompletableFuture> postEventDispatchCF = preSyncTaskCF.thenComposeAsync(n -> eventDispatchCF, parallelExecutor).thenApply(r -> { - postSyncTask.apply(syncExecutor); - return r; - }); + final CompletableFuture eventDispatchCF = ModList.gather(futures).thenCompose(ModList::completableFutureFromExceptionList); + final CompletableFuture postEventDispatchCF = preSyncTaskCF + .thenComposeAsync(n -> eventDispatchCF, parallelExecutor) + .thenApply(r -> { + postSyncTask.apply(syncExecutor); + return null; + }); return this.finalActivityGenerator().apply(syncExecutor, postEventDispatchCF); } @@ -43,18 +50,31 @@ default BiFunction nextModLoadingSt return ModLoadingStage::nextState; } - private EventGenerator addCompletableFutureTaskForModDispatch(final Executor syncExecutor, final Executor parallelExecutor, final List>> completeableFutures, final EventGenerator eventGenerator, BiFunction nextState, final EventGenerator nextGenerator) { - completeableFutures.add(((BiFunction, CompletableFuture>>)preDispatchHook()).apply(threadSelector().apply(syncExecutor, parallelExecutor), eventGenerator)); - completeableFutures.add(ModList.get().futureVisitor(eventGenerator, nextState).apply(threadSelector().apply(syncExecutor, parallelExecutor))); - completeableFutures.add(((BiFunction, CompletableFuture>>)postDispatchHook()).apply(threadSelector().apply(syncExecutor, parallelExecutor), eventGenerator)); + private + EventGenerator addCompletableFutureTaskForModDispatch(final Executor syncExecutor, + final Executor parallelExecutor, + final List> completableFutures, + final EventGenerator eventGenerator, + final BiFunction nextState, + final EventGenerator nextGenerator) { + final Executor selectedExecutor = threadSelector().apply(syncExecutor, parallelExecutor); + + var preDispatchHook = (BiFunction, CompletableFuture>) preDispatchHook(); + completableFutures.add(preDispatchHook.apply(selectedExecutor, eventGenerator)); + + completableFutures.add(ModList.get().futureVisitor(eventGenerator, nextState).apply(threadSelector().apply(syncExecutor, parallelExecutor))); + + var postDispatchHook = (BiFunction, CompletableFuture>) postDispatchHook(); + completableFutures.add(postDispatchHook.apply(selectedExecutor, eventGenerator)); + return nextGenerator; } Supplier>> eventFunctionStream(); ThreadSelector threadSelector(); - BiFunction>, CompletableFuture>> finalActivityGenerator(); - BiFunction, CompletableFuture>> preDispatchHook(); - BiFunction, CompletableFuture>> postDispatchHook(); + BiFunction, CompletableFuture> finalActivityGenerator(); + BiFunction, CompletableFuture> preDispatchHook(); + BiFunction, CompletableFuture> postDispatchHook(); interface EventGenerator extends Function { static EventGenerator fromFunction(Function fn) { @@ -76,17 +96,17 @@ public ThreadSelector threadSelector() { } @Override - public BiFunction>, CompletableFuture>> finalActivityGenerator() { + public BiFunction, CompletableFuture> finalActivityGenerator() { return (e, t) -> t.thenApplyAsync(Function.identity(), e); } @Override - public BiFunction, CompletableFuture>> preDispatchHook() { - return (t, f)-> CompletableFuture.completedFuture(Collections.emptyList()); + public BiFunction, CompletableFuture> preDispatchHook() { + return (t, f)-> CompletableFuture.completedFuture(null); } @Override - public BiFunction, CompletableFuture>> postDispatchHook() { - return (t, f)-> CompletableFuture.completedFuture(Collections.emptyList()); + public BiFunction, CompletableFuture> postDispatchHook() { + return (t, f)-> CompletableFuture.completedFuture(null); } } \ No newline at end of file diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/LogicalSide.java b/fmlcore/src/main/java/net/minecraftforge/fml/LogicalSide.java index a21fee7a296..d492b6c7fa2 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/LogicalSide.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/LogicalSide.java @@ -5,12 +5,41 @@ package net.minecraftforge.fml; +import net.minecraftforge.api.distmarker.Dist; + +/** + * A logical side of the Minecraft game. + *

+ * The {@linkplain Dist#CLIENT client distribution} has a copy of the logical client and the logical server, while the + * {@linkplain Dist#DEDICATED_SERVER dedicated server distribution} only holds + * the logical server. + * + * @see Dist + */ public enum LogicalSide { - CLIENT, SERVER; + /** + * The logical client of the Minecraft game, which interfaces with the player's inputs and renders the player's + * viewpoint. + *

+ * The logical client is only shipped with the client distribution of the game. + * + * @see Dist#CLIENT + */ + CLIENT, + /** + * The logical server of the Minecraft game, responsible for connecting to clients and running the simulation logic + * on the level. + *

+ * The logical server is shipped with both client and dedicated server distributions. The client distribution runs + * the logical server for singleplayer mode and LAN play. + * + * @see Dist#DEDICATED_SERVER + */ + SERVER; /** - * @return if the logical side is a server. + * {@return if this logical side is the server} */ public boolean isServer() { @@ -18,7 +47,7 @@ public boolean isServer() } /** - * @return if the logical side is a client. + * {@return if the logical side is the client} */ public boolean isClient() { diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java index 1638a2f1cce..d529ad2d379 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Map; @@ -111,7 +110,7 @@ public IModFileInfo getModFileById(String modid) return this.fileById.get(modid); } - Function>> futureVisitor( + Function> futureVisitor( final IModStateTransition.EventGenerator eventGenerator, final BiFunction stateChange) { return executor -> gather( @@ -120,12 +119,12 @@ Function> completableFutureFromExceptionList(List> t) { + static CompletionStage completableFutureFromExceptionList(List> t) { if (t.stream().noneMatch(e->e.getValue()!=null)) { - return CompletableFuture.completedFuture(Collections.emptyList()); + return CompletableFuture.completedFuture(null); } else { final List throwables = t.stream().filter(e -> e.getValue() != null).map(Map.Entry::getValue).collect(Collectors.toList()); - CompletableFuture> cf = new CompletableFuture<>(); + CompletableFuture cf = new CompletableFuture<>(); final RuntimeException accumulator = new RuntimeException(); cf.completeExceptionally(accumulator); throwables.forEach(exception -> { diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java index 521ab8acb09..b2d4c43f2c9 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -196,7 +196,7 @@ private void dispatchAndHandleError(IModLoadingState state, ModWorkManager.Drive state.buildTransition(syncExecutor, parallelExecutor, preSyncTask, postSyncTask).ifPresent(t->waitForTransition(state, syncExecutor, ticker, t)); } - private void waitForTransition(final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker, final CompletableFuture> transition) { + private void waitForTransition(final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker, final CompletableFuture transition) { while (!transition.isDone()) { syncExecutor.drive(ticker); } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingPhase.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingPhase.java index 80017c66832..c04e20308f8 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingPhase.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingPhase.java @@ -5,10 +5,34 @@ package net.minecraftforge.fml; +/** + * Phases of mod loading, for grouping mod loading states. + */ public enum ModLoadingPhase { + /** + * Special phase for exceptional situations and error handling, where mod loading cannot continue normally. + * + *

There is conventionally only one state with this phase.

+ */ ERROR, // Special state for error handling + /** + * Phase for discovering and gathering mods for loading. + */ GATHER, + /** + * Phase for the loading of mods found from mod discovery. + * + * @see #GATHER + */ LOAD, + /** + * Phase after mod loading has completed, for post-loading tasks. + * + * @see #LOAD + */ COMPLETE, - DONE; + /** + * Marker phase for the last state in the full mod loading process. + */ + DONE } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingStage.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingStage.java index b5d8053631a..ece8b55cec3 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingStage.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingStage.java @@ -5,16 +5,53 @@ package net.minecraftforge.fml; +/** + * Mod loading stage of mod containers during the mod loading process. These will have a corresponding {@link ModLoadingState} + * in the basic mod loading process provided by FML. + * + *

Each mod loading stage has a global {@link DeferredWorkQueue}, which is populated during the execution of the state + * associated with this stage and emptied at the end of the state's execution.

+ */ public enum ModLoadingStage { + /** + * Special stage for exceptional situations and error handling. + */ ERROR, + /** + * Validation of the mod list. + * TODO: figure out where this is used and why this exists instead of CONSTRUCT being the first normal stage + */ VALIDATE, + /** + * Default stage of mod containers after construction. + */ CONSTRUCT, + /** + * Common (non-side-specific) setup and initialization. + */ COMMON_SETUP, + /** + * Side-specific setup and initialization. + * + * @see net.minecraftforge.api.distmarker.Dist + */ SIDED_SETUP, + /** + * Stage for enqueuing {@link net.minecraftforge.fml.InterModComms} messages for later processing. + */ ENQUEUE_IMC, + /** + * Stage for processing received messages though {@link net.minecraftforge.fml.InterModComms}. + */ PROCESS_IMC, + /** + * Marks the completion of mod loading for this container. + */ COMPLETE, + /** + * Marks the completion of the full mod loading process. + */ DONE; private final DeferredWorkQueue deferredWorkQueue; @@ -23,14 +60,27 @@ public enum ModLoadingStage deferredWorkQueue = new DeferredWorkQueue(this); } + /** + * {@return the next stage after this stage, or {@link #ERROR} if the exception is not {@code null}} + * + * @param exception the exception that occurred during this stage, may be {@code null} + */ ModLoadingStage nextState(Throwable exception) { return exception != null ? ERROR : values()[this.ordinal()+1]; } + /** + * {@return this stage, or {@link #ERROR} if the exception is not {@code null}} + * + * @param exception the exception that occurred during this stage, may be {@code null} + */ public ModLoadingStage currentState(Throwable exception) { return exception != null ? ERROR : this; } + /** + * {@return the deferred work queue for this stage} + */ public DeferredWorkQueue getDeferredWorkQueue() { return deferredWorkQueue; } diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java index aa604dde4d4..b68f182b5d9 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/ModLoadingState.java @@ -8,31 +8,91 @@ import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.event.IModBusEvent; -import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Function; -public record ModLoadingState(String name, String previous, Function message, ModLoadingPhase phase, Optional> inlineRunnable, Optional transition) implements IModLoadingState { +/** + * Implementation of the {@link IModLoadingState} interface. + * + * @param name the name of this state + * @param previous the name of the state immediately previous to this state + * @param message a function returning a human-friendly message for this state + * @param phase the mod loading phase this state belongs to + * @param inlineRunnable an optional runnable, which runs before starting the transition from this state to the next + * @param transition optional state transition information + */ +public record ModLoadingState(String name, String previous, + Function message, + ModLoadingPhase phase, + Optional> inlineRunnable, + Optional transition) implements IModLoadingState { @Override - public Optional>> buildTransition(final Executor syncExecutor, final Executor parallelExecutor, Function> preSyncTask, Function> postSyncTask) { - return transition.map(t->t.build(syncExecutor, parallelExecutor, preSyncTask, postSyncTask)); + public + Optional> buildTransition(final Executor syncExecutor, + final Executor parallelExecutor, + final Function> preSyncTask, + final Function> postSyncTask) { + return transition.map(t -> t.build(syncExecutor, parallelExecutor, preSyncTask, postSyncTask)); } + /** + * {@return an empty mod loading state} The mod loading state has a blank human-readable message, no inline runnable, + * and no state transition information. + * + * @param name the name of the state + * @param previous the name of the immediately previous state to this state + * @param phase the mod loading phase the state belongs to + */ public static ModLoadingState empty(final String name, final String previous, final ModLoadingPhase phase) { - return new ModLoadingState(name, previous, ml->"", phase, Optional.empty(), Optional.empty()); + return new ModLoadingState(name, previous, ml -> "", phase, Optional.empty(), Optional.empty()); } - public static ModLoadingState withTransition(final String name, final String previous, final ModLoadingPhase phase, IModStateTransition transition) { - return new ModLoadingState(name, previous, ml->"Processing transition "+name, phase, Optional.empty(), Optional.of(transition)); + /** + * Returns a mod loading state with state transition information and a default human-friendly message of + * {@code Processing transition [name]}. + * + * @param name the name of the state + * @param previous the name of the immediately previous state to this state + * @param phase the mod loading phase the state belongs to + * @param transition the state transition information + * @return a mod loading state with state transition information and a default message + */ + public static ModLoadingState withTransition(final String name, final String previous, final ModLoadingPhase phase, + final IModStateTransition transition) { + return new ModLoadingState(name, previous, ml -> "Processing transition " + name, phase, Optional.empty(), Optional.of(transition)); } - public static ModLoadingState withTransition(final String name, final String previous, final Function message, final ModLoadingPhase phase, IModStateTransition transition) { + /** + * Returns a mod loading state with state transition information and a custom human-friendly message function. + * + * @param name the name of the state + * @param previous the name of the immediately previous state to this state + * @param message a function returning a human-friendly message for this state + * @param phase the mod loading phase the state belongs to + * @param transition the state transition information + * @return a mod loading state with state transition information and a custom message + */ + public static ModLoadingState withTransition(final String name, final String previous, + final Function message, final ModLoadingPhase phase, + final IModStateTransition transition) { return new ModLoadingState(name, previous, message, phase, Optional.empty(), Optional.of(transition)); } - public static ModLoadingState withInline(final String name, final String previous, final ModLoadingPhase phase, Consumer inline) { - return new ModLoadingState(name, previous, ml->"Processing work "+name, phase, Optional.of(inline), Optional.empty()); + + /** + * Returns a mod loading state with an inline runnable and a default human-friendly message of {@code Processing + * work [name]}. + * + * @param name the name of the state + * @param previous the name of the immediately previous state to this state + * @param phase the mod loading phase the state belongs to + * @param inline an optional runnable, which runs before starting the transition from this state to the next + * @return a mod loading state with an inline runnable and default message + */ + public static ModLoadingState withInline(final String name, final String previous, final ModLoadingPhase phase, + final Consumer inline) { + return new ModLoadingState(name, previous, ml -> "Processing work " + name, phase, Optional.of(inline), Optional.empty()); } } \ No newline at end of file diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java index 53a86807d59..8633d78049b 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java @@ -10,11 +10,11 @@ import com.electronwill.nightconfig.core.file.FileWatcher; import com.electronwill.nightconfig.core.io.ParsingException; import com.electronwill.nightconfig.core.io.WritingMode; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.FMLConfig; import net.minecraftforge.fml.loading.FMLPaths; import org.apache.commons.io.FilenameUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.nio.file.Files; @@ -24,7 +24,7 @@ import static net.minecraftforge.fml.config.ConfigTracker.CONFIG; public class ConfigFileTypeHandler { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); static ConfigFileTypeHandler TOML = new ConfigFileTypeHandler(); private static final Path defaultConfigPath = FMLPaths.GAMEDIR.get().resolve(FMLConfig.defaultConfigPath()); diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java index 32904ef5bfe..53107720fce 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java @@ -7,18 +7,18 @@ import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.file.CommentedFileConfig; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; import java.nio.file.Path; import java.util.*; import java.util.concurrent.ConcurrentHashMap; public class ConfigTracker { - private static final Logger LOGGER = LogManager.getLogger(); - static final Marker CONFIG = MarkerManager.getMarker("CONFIG"); + private static final Logger LOGGER = LogUtils.getLogger(); + static final Marker CONFIG = MarkerFactory.getMarker("CONFIG"); public static final ConfigTracker INSTANCE = new ConfigTracker(); private final ConcurrentHashMap fileMap; private final EnumMap> configSets; diff --git a/fmlloader/build.gradle b/fmlloader/build.gradle index d32b45e915e..2b13f4e2f50 100644 --- a/fmlloader/build.gradle +++ b/fmlloader/build.gradle @@ -11,29 +11,34 @@ dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } configurations.forEach{ it.transitive = false } dependencies { - implementation('net.sf.jopt-simple:jopt-simple:5.0.4') - compileOnly('org.jetbrains:annotations:23.0.0') + compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + api("org.ow2.asm:asm:${ASM_VERSION}") api("org.ow2.asm:asm-tree:${ASM_VERSION}") api("org.ow2.asm:asm-commons:${ASM_VERSION}") - api('net.minecraftforge:forgespi:4.0.+') - api('org.apache.logging.log4j:log4j-api:2.17.0') - api('org.slf4j:slf4j-api:1.8.0-beta4') - api('com.google.guava:guava:21.0') - api('com.google.code.gson:gson:2.8.9') - api('org.apache.maven:maven-artifact:3.8.1') - api('org.apache.commons:commons-lang3:3.12.0') - api('com.electronwill.night-config:core:3.6.4') - api('com.electronwill.night-config:toml:3.6.4') - api('cpw.mods:modlauncher:9.0.+') - api('net.minecraftforge:coremods:5.0.+') + api("net.minecraftforge:forgespi:${SPI_VERSION}") + api("org.apache.logging.log4j:log4j-api:${LOG4J_VERSION}") + api("org.slf4j:slf4j-api:${SLF4J_API_VERSION}") + api("com.google.guava:guava:${GUAVA_VERSION}") + api("com.google.code.gson:gson:${GSON_VERSION}") + api("org.apache.maven:maven-artifact:${APACHE_MAVEN_ARTIFACT_VERSION}") + api("org.apache.commons:commons-lang3:${APACHE_COMMONS_LANG3_VERSION}") + api("com.electronwill.night-config:core:${NIGHTCONFIG_VERSION}") + api("com.electronwill.night-config:toml:${NIGHTCONFIG_VERSION}") + api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}") + api("net.minecraftforge:coremods:${COREMODS_VERSION}") + api("com.mojang:logging:${MOJANG_LOGGING_VERSION}") + + implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}") implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}") - implementation('org.apache.logging.log4j:log4j-core:2.17.0') - annotationProcessor('org.apache.logging.log4j:log4j-core:2.17.0') - implementation('net.minecraftforge:accesstransformers:8.0.4') - implementation('net.minecrell:terminalconsoleappender:1.2.0') -// implementation('org.jline:jline:3.12.+') - testCompileOnly('org.jetbrains:annotations:21.0.0') + implementation("net.minecraftforge:accesstransformers:${ACCESSTRANSFORMERS_VERSION}") + implementation("net.minecrell:terminalconsoleappender:${TERMINALCONSOLEAPPENDER_VERSION}") + // implementation("org.jline:jline:${JLINE_VERSION}") + + implementation("org.apache.logging.log4j:log4j-core:${LOG4J_VERSION}") + annotationProcessor("org.apache.logging.log4j:log4j-core:${LOG4J_VERSION}") + + testCompileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") testRuntimeOnly("cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}") } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/ObjectHolderDefinalize.java b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/ObjectHolderDefinalize.java index 776c8784cc6..1337ec2f468 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/ObjectHolderDefinalize.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/ObjectHolderDefinalize.java @@ -7,7 +7,11 @@ import java.util.EnumSet; import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; @@ -20,7 +24,17 @@ * Will also de-finalize all fields in on class level annotations. */ public class ObjectHolderDefinalize implements ILaunchPluginService { - + // Hardcoded map of vanilla classes that should have object holders for each field of the given registry type. + // IMPORTANT: Updates to this collection must be reflected in ObjectHolderRegistry. Duplicated cuz classloaders, yay! + // Classnames are validated in ObjectHolderRegistry. + private static final Map VANILLA_OBJECT_HOLDERS = Stream.of( + new VanillaObjectHolderData("net.minecraft.world.level.block.Blocks", "block", "net.minecraft.world.level.block.Block"), + new VanillaObjectHolderData("net.minecraft.world.item.Items", "item", "net.minecraft.world.item.Item"), + new VanillaObjectHolderData("net.minecraft.world.item.enchantment.Enchantments", "enchantment", "net.minecraft.world.item.enchantment.Enchantment"), + new VanillaObjectHolderData("net.minecraft.world.effect.MobEffects", "mob_effect", "net.minecraft.world.effect.MobEffect"), + new VanillaObjectHolderData("net.minecraft.core.particles.ParticleTypes", "particle_type", "net.minecraft.core.particles.ParticleType"), + new VanillaObjectHolderData("net.minecraft.sounds.SoundEvents", "sound_event", "net.minecraft.sounds.SoundEvent") + ).collect(Collectors.toMap(VanillaObjectHolderData::holderClass, Function.identity())); private final String OBJECT_HOLDER = "Lnet/minecraftforge/registries/ObjectHolder;"; //Don't directly reference this to prevent class loading. @Override @@ -28,7 +42,6 @@ public String name() { return "object_holder_definalize"; } - private static final EnumSet YAY = EnumSet.of(Phase.AFTER); private static final EnumSet NAY = EnumSet.noneOf(Phase.class); @@ -73,10 +86,8 @@ public int processClassWithFlags(final Phase phase, final ClassNode classNode, f changes.compareAndSet(false, prev != f.access); }); - if (hasHolder(classNode.visibleAnnotations)) //Class level, de-finalize all fields and add @ObjectHolder to them! + if (VANILLA_OBJECT_HOLDERS.containsKey(classType.getClassName())) //Class level, de-finalize all fields and add @ObjectHolder to them! { - @SuppressWarnings("unused") - String value = getValue(classNode.visibleAnnotations); classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L")).forEach(f -> { int prev = f.access; @@ -95,4 +106,5 @@ public int processClassWithFlags(final Phase phase, final ClassNode classNode, f return changes.get() ? ComputeFlags.SIMPLE_REWRITE : ComputeFlags.NO_REWRITE; } + private record VanillaObjectHolderData(String holderClass, String registryName, String registryType) {} } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java index 41869e1ee1b..f92012eca74 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/common/asm/RuntimeEnumExtender.java @@ -9,9 +9,7 @@ import java.util.List; import java.util.stream.Collectors; -import net.minecraftforge.fml.loading.AdvancedLogMessageAdapter; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; import org.objectweb.asm.Label; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; @@ -21,6 +19,9 @@ import org.objectweb.asm.tree.MethodNode; import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; +import org.slf4j.Logger; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; /** * Modifies specified enums to allow runtime extension by making the $VALUES field non-final and @@ -28,7 +29,7 @@ */ public class RuntimeEnumExtender implements ILaunchPluginService { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final Type STRING = Type.getType(String.class); private final Type ENUM = Type.getType(Enum.class); private final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;"); @@ -63,43 +64,49 @@ public int processClassWithFlags(final Phase phase, final ClassNode classNode, f final int flags = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC; FieldNode values = classNode.fields.stream().filter(f -> f.desc.contentEquals(array.getDescriptor()) && ((f.access & flags) == flags)).findFirst().orElse(null); - + if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName())) { return ComputeFlags.NO_REWRITE; } - + //Static methods named "create" with first argument as a string List candidates = classNode.methods.stream() .filter(m -> ((m.access & Opcodes.ACC_STATIC) != 0) && m.name.equals("create")) .collect(Collectors.toList()); - + if (candidates.isEmpty()) { throw new IllegalStateException("IExtensibleEnum has no candidate factory methods: " + classType.getClassName()); } - + candidates.forEach(mtd -> { Type[] args = Type.getArgumentTypes(mtd.desc); if (args.length == 0 || !args[0].equals(STRING)) { - LOGGER.fatal(()->new AdvancedLogMessageAdapter(sb-> { + if (LOGGER.isErrorEnabled(LogUtils.FATAL_MARKER)) + { + StringBuilder sb = new StringBuilder(); sb.append("Enum has create method without String as first parameter:\n"); sb.append(" Enum: ").append(classType.getDescriptor()).append("\n"); sb.append(" Target: ").append(mtd.name).append(mtd.desc).append("\n"); - })); + LOGGER.error(LogUtils.FATAL_MARKER, sb.toString()); + } throw new IllegalStateException("Enum has create method without String as first parameter: " + mtd.name + mtd.desc); } Type ret = Type.getReturnType(mtd.desc); if (!ret.equals(classType)) { - LOGGER.fatal(()->new AdvancedLogMessageAdapter(sb-> { + if (LOGGER.isErrorEnabled(LogUtils.FATAL_MARKER)) + { + StringBuilder sb = new StringBuilder(); sb.append("Enum has create method with incorrect return type:\n"); sb.append(" Enum: ").append(classType.getDescriptor()).append("\n"); sb.append(" Target: ").append(mtd.name).append(mtd.desc).append("\n"); sb.append(" Found: ").append(ret.getClassName()).append(", Expected: ").append(classType.getClassName()); - })); + LOGGER.error(LogUtils.FATAL_MARKER, sb.toString()); + } throw new IllegalStateException("Enum has create method with incorrect return type: " + mtd.name + mtd.desc); } - + Type[] ctrArgs = new Type[args.length + 1]; ctrArgs[0] = STRING; ctrArgs[1] = Type.INT_TYPE; @@ -111,23 +118,29 @@ public int processClassWithFlags(final Phase phase, final ClassNode classNode, f MethodNode ctr = classNode.methods.stream().filter(m -> m.name.equals("") && m.desc.equals(desc)).findFirst().orElse(null); if (ctr == null) { - LOGGER.fatal(()->new AdvancedLogMessageAdapter(sb-> { + if (LOGGER.isErrorEnabled(LogUtils.FATAL_MARKER)) + { + StringBuilder sb = new StringBuilder(); sb.append("Enum has create method with no matching constructor:\n"); sb.append(" Enum: ").append(classType.getDescriptor()).append("\n"); sb.append(" Candidate: ").append(mtd.desc).append("\n"); sb.append(" Target: ").append(desc).append("\n"); classNode.methods.stream().filter(m -> m.name.equals("")).forEach(m -> sb.append(" : ").append(m.desc).append("\n")); - })); + LOGGER.error(LogUtils.FATAL_MARKER, sb.toString()); + } throw new IllegalStateException("Enum has create method with no matching constructor: " + desc); } if (values == null) { - LOGGER.fatal(()->new AdvancedLogMessageAdapter(sb-> { + if (LOGGER.isErrorEnabled(LogUtils.FATAL_MARKER)) + { + StringBuilder sb = new StringBuilder(); sb.append("Enum has create method but we could not find $VALUES. Found:\n"); classNode.fields.stream().filter(f -> (f.access & Opcodes.ACC_STATIC) != 0). forEach(m -> sb.append(" ").append(m.name).append(" ").append(m.desc).append("\n")); - })); + LOGGER.error(LogUtils.FATAL_MARKER, sb.toString()); + } throw new IllegalStateException("Enum has create method but we could not find $VALUES"); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/AdvancedLogMessageAdapter.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/AdvancedLogMessageAdapter.java deleted file mode 100644 index 97829ae940b..00000000000 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/AdvancedLogMessageAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.fml.loading; - -import org.apache.logging.log4j.message.Message; -import org.apache.logging.log4j.util.StringBuilderFormattable; - -import java.util.function.Consumer; - -public class AdvancedLogMessageAdapter implements Message, StringBuilderFormattable { - private static final long serialVersionUID = -8291754833965087436L; - - private static final Object[] EMPTY = new Object[0]; - - private final Consumer logMessageBuilder; - - public AdvancedLogMessageAdapter(final Consumer logMessageBuilder) { - this.logMessageBuilder = logMessageBuilder; - } - - @Override - public String getFormattedMessage() { - return ""; - } - - @Override - public String getFormat() { - return ""; - } - - @Override - public Object[] getParameters() { - return EMPTY; - } - - @Override - public Throwable getThrowable() { - return null; - } - - @Override - public void formatTo(final StringBuilder buffer) { - logMessageBuilder.accept(buffer); - } -} diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java index 85c2069e68c..62a23d04dc9 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java @@ -10,8 +10,8 @@ import com.electronwill.nightconfig.core.file.FileNotFoundAction; import com.electronwill.nightconfig.core.io.ParsingException; import com.electronwill.nightconfig.core.io.WritingMode; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; import java.nio.file.Path; import java.nio.file.Paths; @@ -21,7 +21,7 @@ public class FMLConfig { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static FMLConfig INSTANCE = new FMLConfig(); private static ConfigSpec configSpec = new ConfigSpec(); static { @@ -60,11 +60,14 @@ public static void load() { final Path configFile = FMLPaths.FMLCONFIG.get(); INSTANCE.loadFrom(configFile); - LOGGER.trace(CORE, "Loaded FML config from {}", FMLPaths.FMLCONFIG.get()); - LOGGER.trace(CORE, "Splash screen is {}", FMLConfig::splashScreenEnabled); - LOGGER.trace(CORE, "Max threads for mod loading computed at {}", FMLConfig::loadingThreadCount); - LOGGER.trace(CORE, "Version check is {}", FMLConfig::runVersionCheck); - LOGGER.trace(CORE, "Default config paths at {}", FMLConfig::defaultConfigPath); + if (LOGGER.isTraceEnabled(CORE)) + { + LOGGER.trace(CORE, "Loaded FML config from {}", FMLPaths.FMLCONFIG.get()); + LOGGER.trace(CORE, "Splash screen is {}", FMLConfig.splashScreenEnabled()); + LOGGER.trace(CORE, "Max threads for mod loading computed at {}", FMLConfig.loadingThreadCount()); + LOGGER.trace(CORE, "Version check is {}", FMLConfig.runVersionCheck()); + LOGGER.trace(CORE, "Default config paths at {}", FMLConfig.defaultConfigPath()); + } FMLPaths.getOrCreateGameRelativePath(Paths.get(FMLConfig.defaultConfigPath()), "default config directory"); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java index 52939c4a3c2..7cf191366f3 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLLoader.java @@ -5,6 +5,7 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.Launcher; import cpw.mods.modlauncher.api.*; import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; @@ -21,8 +22,7 @@ import net.minecraftforge.forgespi.Environment; import net.minecraftforge.forgespi.coremod.ICoreModProvider; import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.nio.file.Path; import java.nio.file.Paths; @@ -35,7 +35,7 @@ public class FMLLoader { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static AccessTransformerService accessTransformer; private static ModDiscoverer modDiscoverer; private static ICoreModProvider coreModProvider; @@ -62,47 +62,47 @@ static void onInitialLoad(IEnvironment environment, Set otherServices) t final Package modLauncherPackage = ITransformationService.class.getPackage(); LOGGER.debug(CORE,"FML found ModLauncher version : {}", modLauncherPackage.getImplementationVersion()); if (!modLauncherPackage.isCompatibleWith("4.0")) { - LOGGER.fatal(CORE,"Found incompatible ModLauncher specification : {}, version {} from {}", modLauncherPackage.getSpecificationVersion(), modLauncherPackage.getImplementationVersion(), modLauncherPackage.getImplementationVendor()); + LOGGER.error(CORE, "Found incompatible ModLauncher specification : {}, version {} from {}", modLauncherPackage.getSpecificationVersion(), modLauncherPackage.getImplementationVersion(), modLauncherPackage.getImplementationVendor()); throw new IncompatibleEnvironmentException("Incompatible modlauncher found "+modLauncherPackage.getSpecificationVersion()); } accessTransformer = (AccessTransformerService) environment.findLaunchPlugin("accesstransformer").orElseThrow(()-> { - LOGGER.fatal(CORE,"Access Transformer library is missing, we need this to run"); + LOGGER.error(CORE, "Access Transformer library is missing, we need this to run"); return new IncompatibleEnvironmentException("Missing AccessTransformer, cannot run"); }); final Package atPackage = accessTransformer.getClass().getPackage(); LOGGER.debug(CORE,"FML found AccessTransformer version : {}", atPackage.getImplementationVersion()); if (!atPackage.isCompatibleWith("1.0")) { - LOGGER.fatal(CORE,"Found incompatible AccessTransformer specification : {}, version {} from {}", atPackage.getSpecificationVersion(), atPackage.getImplementationVersion(), atPackage.getImplementationVendor()); + LOGGER.error(CORE, "Found incompatible AccessTransformer specification : {}, version {} from {}", atPackage.getSpecificationVersion(), atPackage.getImplementationVersion(), atPackage.getImplementationVendor()); throw new IncompatibleEnvironmentException("Incompatible accesstransformer found "+atPackage.getSpecificationVersion()); } eventBus = environment.findLaunchPlugin("eventbus").orElseThrow(()-> { - LOGGER.fatal(CORE,"Event Bus library is missing, we need this to run"); + LOGGER.error(CORE, "Event Bus library is missing, we need this to run"); return new IncompatibleEnvironmentException("Missing EventBus, cannot run"); }); final Package eventBusPackage = eventBus.getClass().getPackage(); LOGGER.debug(CORE,"FML found EventBus version : {}", eventBusPackage.getImplementationVersion()); if (!eventBusPackage.isCompatibleWith("1.0")) { - LOGGER.fatal(CORE,"Found incompatible EventBus specification : {}, version {} from {}", eventBusPackage.getSpecificationVersion(), eventBusPackage.getImplementationVersion(), eventBusPackage.getImplementationVendor()); + LOGGER.error(CORE, "Found incompatible EventBus specification : {}, version {} from {}", eventBusPackage.getSpecificationVersion(), eventBusPackage.getImplementationVersion(), eventBusPackage.getImplementationVendor()); throw new IncompatibleEnvironmentException("Incompatible eventbus found "+eventBusPackage.getSpecificationVersion()); } runtimeDistCleaner = (RuntimeDistCleaner)environment.findLaunchPlugin("runtimedistcleaner").orElseThrow(()-> { - LOGGER.fatal(CORE,"Dist Cleaner is missing, we need this to run"); + LOGGER.error(CORE, "Dist Cleaner is missing, we need this to run"); return new IncompatibleEnvironmentException("Missing DistCleaner, cannot run!"); }); LOGGER.debug(CORE, "Found Runtime Dist Cleaner"); - var coreModProviders = ServiceLoaderUtils.streamWithErrorHandling(ServiceLoader.load(FMLLoader.class.getModule().getLayer(), ICoreModProvider.class), sce -> LOGGER.fatal(CORE, "Failed to load a coremod library, expect problems", sce)).toList(); + var coreModProviders = ServiceLoaderUtils.streamWithErrorHandling(ServiceLoader.load(FMLLoader.class.getModule().getLayer(), ICoreModProvider.class), sce -> LOGGER.error(CORE, "Failed to load a coremod library, expect problems", sce)).toList(); if (coreModProviders.isEmpty()) { - LOGGER.fatal(CORE, "Found no coremod provider. Cannot run"); + LOGGER.error(CORE, "Found no coremod provider. Cannot run"); throw new IncompatibleEnvironmentException("No coremod library found"); } else if (coreModProviders.size() > 1) { - LOGGER.fatal(CORE, "Found multiple coremod providers : {}. Cannot run", coreModProviders.stream().map(p -> p.getClass().getName()).collect(Collectors.toList())); + LOGGER.error(CORE, "Found multiple coremod providers : {}. Cannot run", coreModProviders.stream().map(p -> p.getClass().getName()).collect(Collectors.toList())); throw new IncompatibleEnvironmentException("Multiple coremod libraries found"); } @@ -114,7 +114,7 @@ static void onInitialLoad(IEnvironment environment, Set otherServices) t LOGGER.debug(CORE, "Found ForgeSPI package implementation version {}", Environment.class.getPackage().getImplementationVersion()); LOGGER.debug(CORE, "Found ForgeSPI package specification {}", Environment.class.getPackage().getSpecificationVersion()); if (Integer.parseInt(Environment.class.getPackage().getSpecificationVersion()) < 2) { - LOGGER.fatal(CORE, "Found an out of date ForgeSPI implementation: {}, loading cannot continue", Environment.class.getPackage().getSpecificationVersion()); + LOGGER.error(CORE, "Found an out of date ForgeSPI implementation: {}, loading cannot continue", Environment.class.getPackage().getSpecificationVersion()); throw new IncompatibleEnvironmentException("ForgeSPI is out of date, we cannot continue"); } @@ -122,7 +122,7 @@ static void onInitialLoad(IEnvironment environment, Set otherServices) t Class.forName("com.electronwill.nightconfig.core.Config", false, environment.getClass().getClassLoader()); Class.forName("com.electronwill.nightconfig.toml.TomlFormat", false, environment.getClass().getClassLoader()); } catch (ClassNotFoundException e) { - LOGGER.fatal(CORE, "Failed to load NightConfig"); + LOGGER.error(CORE, "Failed to load NightConfig"); throw new IncompatibleEnvironmentException("Missing NightConfig"); } } @@ -134,12 +134,12 @@ static void setupLaunchHandler(final IEnvironment environment, final Map launchHandler = environment.findLaunchHandler(launchTarget); LOGGER.debug(CORE, "Using {} as launch service", launchTarget); if (launchHandler.isEmpty()) { - LOGGER.fatal(CORE,"Missing LaunchHandler {}, cannot continue", launchTarget); + LOGGER.error(CORE, "Missing LaunchHandler {}, cannot continue", launchTarget); throw new RuntimeException("Missing launch handler: " + launchTarget); } if (!(launchHandler.get() instanceof CommonLaunchHandler)) { - LOGGER.fatal(CORE, "Incompatible Launch handler found - type {}, cannot continue", launchHandler.get().getClass().getName()); + LOGGER.error(CORE, "Incompatible Launch handler found - type {}, cannot continue", launchHandler.get().getClass().getName()); throw new RuntimeException("Incompatible launch handler found"); } commonLaunchHandler = (CommonLaunchHandler)launchHandler.get(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java index 8c5bbd2b16e..91b51288530 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java @@ -5,9 +5,9 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.IEnvironment; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.nio.file.Path; import java.nio.file.Paths; @@ -22,7 +22,7 @@ public enum FMLPaths CONFIGDIR("config"), FMLCONFIG(false, CONFIGDIR, "fml.toml"); - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final Path relativePath; private final boolean isDirectory; private Path absolutePath; @@ -61,7 +61,10 @@ public static void loadAbsolutePaths(Path rootPath) { FileUtils.getOrCreateDirectory(path.absolutePath, path.name()); } - LOGGER.debug(CORE,"Path {} is {}", ()-> path, ()-> path.absolutePath); + if (LOGGER.isDebugEnabled(CORE)) + { + LOGGER.debug(CORE, "Path {} is {}", path, path.absolutePath); + } } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java index de6134b379e..e8647f17f5c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLServiceProvider.java @@ -5,14 +5,14 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.*; import joptsimple.ArgumentAcceptingOptionSpec; import joptsimple.OptionSpecBuilder; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.forgespi.Environment; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; import java.util.ArrayList; import java.util.Arrays; @@ -26,7 +26,7 @@ public class FMLServiceProvider implements ITransformationService { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private ArgumentAcceptingOptionSpec modsOption; private ArgumentAcceptingOptionSpec modListsOption; private ArgumentAcceptingOptionSpec mavenRootsOption; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java index 554ccc87ba6..7cc66b9dd30 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java @@ -5,8 +5,8 @@ package net.minecraftforge.fml.loading; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; import java.io.IOException; import java.nio.file.FileAlreadyExistsException; @@ -17,7 +17,7 @@ public class FileUtils { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); public static Path getOrCreateDirectory(Path dirPath, String dirLabel) { if (!Files.isDirectory(dirPath.getParent())) { @@ -25,20 +25,20 @@ public static Path getOrCreateDirectory(Path dirPath, String dirLabel) { } if (!Files.isDirectory(dirPath)) { - LOGGER.debug(CORE,"Making {} directory : {}", dirLabel, dirPath); + LOGGER.debug(CORE, "Making {} directory : {}", dirLabel, dirPath); try { Files.createDirectory(dirPath); } catch (IOException e) { if (e instanceof FileAlreadyExistsException) { - LOGGER.fatal(CORE,"Failed to create {} directory - there is a file in the way", dirLabel); + LOGGER.error(CORE, "Failed to create {} directory - there is a file in the way", dirLabel); } else { - LOGGER.fatal(CORE,"Problem with creating {} directory (Permissions?)", dirLabel, e); + LOGGER.error(CORE, "Problem with creating {} directory (Permissions?)", dirLabel, e); } throw new RuntimeException("Problem creating directory", e); } - LOGGER.debug(CORE,"Created {} directory : {}", dirLabel, dirPath); + LOGGER.debug(CORE, "Created {} directory : {}", dirLabel, dirPath); } else { - LOGGER.debug(CORE,"Found existing {} directory : {}", dirLabel, dirPath); + LOGGER.debug(CORE, "Found existing {} directory : {}", dirLabel, dirPath); } return dirPath; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java index 3e1cb03cbfd..da4ef9cdd4b 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LanguageLoadingProvider.java @@ -5,6 +5,7 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.Launcher; import cpw.mods.modlauncher.api.IModuleLayerManager; import cpw.mods.modlauncher.util.ServiceLoaderUtils; @@ -12,11 +13,10 @@ import net.minecraftforge.forgespi.language.IModLanguageProvider; import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator; import net.minecraftforge.fml.loading.moddiscovery.ModFile; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.VersionRange; +import org.slf4j.Logger; import java.net.URISyntaxException; import java.nio.file.Files; @@ -38,7 +38,7 @@ public class LanguageLoadingProvider { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final List languageProviders = new ArrayList<>(); private final ServiceLoader serviceLoader; private final Map languageProviderMap = new HashMap<>(); @@ -81,7 +81,7 @@ public IModLanguageProvider getModLanguageProvider() loadLanguageProviders(); } private void loadLanguageProviders() { - LOGGER.debug(CORE, "Found {} language providers", ServiceLoaderUtils.streamServiceLoader(()->serviceLoader, sce->LOGGER.fatal("Problem with language loaders")).count()); + LOGGER.debug(CORE, "Found {} language providers", ServiceLoaderUtils.streamServiceLoader(()->serviceLoader, sce->LOGGER.error("Problem with language loaders")).count()); serviceLoader.forEach(languageProviders::add); languageProviders.forEach(lp -> { @@ -94,7 +94,7 @@ private void loadLanguageProviders() { Optional implementationVersion = JarVersionLookupHandler.getImplementationVersion(lp.getClass()); String impl = implementationVersion.orElse(Files.isDirectory(lpPath) ? FMLLoader.versionInfo().forgeVersion().split("\\.")[0] : null); if (impl == null) { - LOGGER.fatal(CORE, "Found unversioned language provider {}", lp.name()); + LOGGER.error(CORE, "Found unversioned language provider {}", lp.name()); throw new RuntimeException("Failed to find implementation version for language provider "+ lp.name()); } LOGGER.debug(CORE, "Found language provider {}, version {}", lp.name(), impl); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LauncherVersion.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LauncherVersion.java index c3edd08574d..02355687e17 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LauncherVersion.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LauncherVersion.java @@ -5,13 +5,13 @@ package net.minecraftforge.fml.loading; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; import static net.minecraftforge.fml.loading.LogMarkers.CORE; public class LauncherVersion { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final String launcherVersion; static { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LibraryFinder.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LibraryFinder.java index 31a0e44183d..c8cdcea41a7 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LibraryFinder.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LibraryFinder.java @@ -5,14 +5,14 @@ package net.minecraftforge.fml.loading; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; import java.nio.file.Files; import java.nio.file.Path; public class LibraryFinder { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static Path libsPath; static Path findLibsPath() { if (libsPath == null) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LogMarkers.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LogMarkers.java index e8f5c3aa494..63e68352a17 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/LogMarkers.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/LogMarkers.java @@ -5,12 +5,12 @@ package net.minecraftforge.fml.loading; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; public class LogMarkers { - public static final Marker CORE = MarkerManager.getMarker("CORE"); - public static final Marker LOADING = MarkerManager.getMarker("LOADING"); - public static final Marker SCAN = MarkerManager.getMarker("SCAN"); - public static final Marker SPLASH = MarkerManager.getMarker("SPLASH"); + public static final Marker CORE = MarkerFactory.getMarker("CORE"); + public static final Marker LOADING = MarkerFactory.getMarker("LOADING"); + public static final Marker SCAN = MarkerFactory.getMarker("SCAN"); + public static final Marker SPLASH = MarkerFactory.getMarker("SPLASH"); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java index 17bdb3d4d1e..767bdfa1ecc 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/MCPNamingService.java @@ -5,10 +5,10 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.INameMappingService; import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.BufferedReader; import java.io.IOException; @@ -20,7 +20,7 @@ import java.util.function.BiFunction; public class MCPNamingService implements INameMappingService { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private HashMap methods; private HashMap fields; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModDirTransformerDiscoverer.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModDirTransformerDiscoverer.java index 925c6bf2ec8..62b167146d0 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModDirTransformerDiscoverer.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModDirTransformerDiscoverer.java @@ -5,10 +5,11 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import cpw.mods.modlauncher.api.NamedPath; import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService; -import org.apache.logging.log4j.LogManager; +import org.slf4j.Logger; import java.io.File; import java.io.IOException; @@ -19,6 +20,8 @@ import java.util.zip.ZipFile; public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService { + private static final Logger LOGGER = LogUtils.getLogger(); + @Override public List candidates(final Path gameDirectory) { ModDirTransformerDiscoverer.scan(gameDirectory); @@ -40,7 +43,7 @@ private static void scan(final Path gameDirectory) { try (var walk = Files.walk(modsDir, 1)){ walk.forEach(ModDirTransformerDiscoverer::visitFile); } catch (IOException | IllegalStateException ioe) { - LogManager.getLogger().error("Error during early discovery", ioe); + LOGGER.error("Error during early discovery", ioe); } } @@ -55,7 +58,7 @@ private static void visitFile(Path path) { found.add(new NamedPath(zf.getName(), path)); } } catch (IOException ioe) { - LogManager.getLogger().error("Zip Error when loading jar file {}", path, ioe); + LOGGER.error("Zip Error when loading jar file {}", path, ioe); } } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModJarURLHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModJarURLHandler.java index 1326824b8ab..19b8220b7ec 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModJarURLHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModJarURLHandler.java @@ -5,9 +5,9 @@ package net.minecraftforge.fml.loading; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.io.InputStream; @@ -24,7 +24,7 @@ public class ModJarURLHandler extends URLStreamHandler { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); // modjar://modid/path/to/file @Override protected URLConnection openConnection(URL url) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java index b20f161182d..0332596f3fa 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/ModSorter.java @@ -7,6 +7,7 @@ import com.google.common.graph.GraphBuilder; import com.google.common.graph.MutableGraph; +import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.SecureJar; import net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator; import net.minecraftforge.forgespi.language.IModFileInfo; @@ -18,10 +19,9 @@ import net.minecraftforge.fml.loading.toposort.CyclePresentException; import net.minecraftforge.fml.loading.toposort.TopologicalSort; import net.minecraftforge.forgespi.locating.IModFile; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.slf4j.Logger; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -35,7 +35,7 @@ public class ModSorter { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private List modFiles; private List sortedList; private Map modIdNameLookup; @@ -98,11 +98,10 @@ private void sort() catch (CyclePresentException e) { Set> cycles = e.getCycles(); - LOGGER.error(LOADING, () -> new AdvancedLogMessageAdapter(buffer -> - buffer.append("Mod Sorting failed.\n") - .append("Detected Cycles: ") - .append(cycles) - .append('\n'))); + if (LOGGER.isErrorEnabled(LOADING)) + { + LOGGER.error(LOADING, "Mod Sorting failed.\nDetected Cycles: {}\n", cycles); + } var dataList = cycles.stream() .mapMulti(Iterable::forEach) .mapMulti((mf,c)->mf.getMods().forEach(c)) diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java index 3b2e9fcf4c5..40b1ced3181 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/RuntimeDistCleaner.java @@ -16,14 +16,11 @@ import java.util.stream.Collectors; import com.google.common.collect.Streams; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIns; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; import org.objectweb.asm.Handle; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -33,11 +30,14 @@ import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; import org.objectweb.asm.tree.MethodNode; +import org.slf4j.Logger; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; public class RuntimeDistCleaner implements ILaunchPluginService { - private static final Logger LOGGER = LogManager.getLogger(); - private static final Marker DISTXFORM = MarkerManager.getMarker("DISTXFORM"); + private static final Logger LOGGER = LogUtils.getLogger(); + private static final Marker DISTXFORM = MarkerFactory.getMarker("DISTXFORM"); private static String DIST; private static final String ONLYIN = Type.getDescriptor(OnlyIn.class); private static final String ONLYINS = Type.getDescriptor(OnlyIns.class); @@ -53,7 +53,7 @@ public int processClassWithFlags(final Phase phase, final ClassNode classNode, f AtomicBoolean changes = new AtomicBoolean(); if (remove(classNode.visibleAnnotations, DIST)) { - LOGGER.fatal(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST); + LOGGER.error(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST); throw new RuntimeException("Attempted to load class "+ classNode.name + " for invalid dist "+ DIST); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/TracingPrintStream.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/TracingPrintStream.java index 030b187b61b..cc84df2b94d 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/TracingPrintStream.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/TracingPrintStream.java @@ -5,8 +5,7 @@ package net.minecraftforge.fml.loading; -import org.apache.logging.log4j.Logger; - +import org.slf4j.Logger; import java.io.PrintStream; /** diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractJarFileLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractJarFileLocator.java index 0f70a6cb038..14b0c885917 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractJarFileLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractJarFileLocator.java @@ -5,32 +5,23 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.SecureJar; -import cpw.mods.jarhandling.JarMetadata; -import net.minecraftforge.fml.loading.LogMarkers; -import net.minecraftforge.forgespi.language.IConfigurable; -import net.minecraftforge.forgespi.language.IModFileInfo; -import net.minecraftforge.forgespi.language.IModInfo; -import net.minecraftforge.forgespi.locating.IModFile; -import net.minecraftforge.forgespi.locating.IModLocator; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; -import java.util.jar.Manifest; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraftforge.fml.loading.LogMarkers; +import net.minecraftforge.forgespi.locating.IModFile; +import org.slf4j.Logger; public abstract class AbstractJarFileLocator extends AbstractModLocator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); @Override public void scanFile(final IModFile file, final Consumer pathConsumer) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModLocator.java index 51c8c71cabe..97b9a3ddc25 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModLocator.java @@ -5,6 +5,7 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.JarMetadata; import cpw.mods.jarhandling.SecureJar; import net.minecraftforge.fml.loading.LogMarkers; @@ -13,8 +14,7 @@ import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.IModLocator; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.nio.file.Path; import java.util.Collections; @@ -25,7 +25,7 @@ import java.util.jar.Manifest; public abstract class AbstractModLocator implements IModLocator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); protected static final String MODS_TOML = "META-INF/mods.toml"; protected static final String MANIFEST = "META-INF/MANIFEST.MF"; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java index f2f56ceb7bf..c4550454b74 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/BackgroundScanHandler.java @@ -5,11 +5,11 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LoadingModList; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.ModFileScanData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.time.Duration; import java.time.Instant; @@ -28,7 +28,7 @@ private enum ScanStatus { ERRORED } - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ExecutorService modContentScanner; private final List pendingFiles; private final List scannedFiles; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java index cf19b284084..0283bf3b010 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ClasspathLocator.java @@ -5,9 +5,9 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LogMarkers; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.File; import java.io.IOException; @@ -25,7 +25,7 @@ import java.util.stream.Stream; public class ClasspathLocator extends AbstractJarFileLocator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final List legacyClasspath = Arrays.stream(System.getProperty("legacyClassPath", "").split(File.pathSeparator)).map(Path::of).toList(); private boolean enabled = false; @@ -48,7 +48,7 @@ public Stream scanCandidates() { return paths.build(); } catch (IOException e) { - LOGGER.fatal(LogMarkers.SCAN, "Error trying to find resources", e); + LOGGER.error(LogMarkers.SCAN, "Error trying to find resources", e); throw new RuntimeException(e); } } @@ -85,7 +85,7 @@ private Path findJarPathFor(final String resourceName, final String jarName, fin //LOGGER.debug(CORE, "Found JAR {} at path {}", jarName, path.toString()); return path; } catch (NullPointerException | URISyntaxException e) { - LOGGER.fatal(LogMarkers.SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName); + LOGGER.error(LogMarkers.SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName); throw new RuntimeException("Unable to locate "+resourceName+" - "+jarName, e); } } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java index 4666aa0b415..faef0000b00 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java @@ -5,11 +5,11 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.IModLocator; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.nio.file.Files; @@ -22,7 +22,7 @@ import java.util.stream.Stream; public class ExplodedDirectoryLocator implements IModLocator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); public record ExplodedMod(String modid, List paths) {} diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java index 939d5f8cb03..ea527c050b3 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/MinecraftLocator.java @@ -6,15 +6,14 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.electronwill.nightconfig.core.Config; +import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.SecureJar; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.locating.IModFile; -import net.minecraftforge.forgespi.locating.IModLocator; import net.minecraftforge.forgespi.locating.ModFileFactory; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.nio.file.*; @@ -24,7 +23,7 @@ import java.util.stream.Stream; public class MinecraftLocator extends AbstractModLocator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); @Override public List scanMods() { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java index 55fc8a974fa..746b78c08a7 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModDiscoverer.java @@ -5,6 +5,7 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.Launcher; import cpw.mods.modlauncher.api.IModuleLayerManager; import cpw.mods.modlauncher.util.ServiceLoaderUtils; @@ -13,8 +14,7 @@ import net.minecraftforge.forgespi.Environment; import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.IModLocator; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.util.ArrayList; import java.util.List; @@ -23,7 +23,7 @@ import java.util.stream.Collectors; public class ModDiscoverer { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ServiceLoader locators; private final List locatorList; @@ -34,7 +34,11 @@ public ModDiscoverer(Map arguments) { locators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IModLocator.class); locatorList = ServiceLoaderUtils.streamServiceLoader(()->locators, sce->LOGGER.error("Failed to load locator list", sce)).collect(Collectors.toList()); locatorList.forEach(l->l.initArguments(arguments)); - LOGGER.debug(LogMarkers.CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(","))); + if (LOGGER.isDebugEnabled(LogMarkers.CORE)) + { + LOGGER.debug(LogMarkers.CORE, "Found Mod Locators : {}", locatorList.stream() + .map(iModLocator -> "(" + iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion() + ")").collect(Collectors.joining(","))); + } } ModDiscoverer(List locatorList) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java index 760ec9dac9f..d88d99900b8 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java @@ -6,6 +6,7 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.google.common.collect.ImmutableMap; +import com.mojang.logging.LogUtils; import cpw.mods.jarhandling.SecureJar; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.LogMarkers; @@ -17,8 +18,7 @@ import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.IModLocator; import net.minecraftforge.forgespi.locating.ModFileFactory; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.nio.file.Files; import java.nio.file.Path; @@ -37,7 +37,7 @@ public class ModFile implements IModFile { // Mods either must have a mods.toml or a manifest. We can no longer just put any jar on the classpath. @Deprecated(forRemoval = true, since = "1.18") public static final Manifest DEFAULTMANIFEST; - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); static { DEFAULTMANIFEST = new Manifest(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java index 74b4644841f..449cd58db43 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileInfo.java @@ -6,6 +6,7 @@ package net.minecraftforge.fml.loading.moddiscovery; import com.google.common.base.Strings; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.fml.loading.StringUtils; @@ -13,8 +14,7 @@ import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.MavenVersionAdapter; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import javax.security.auth.x500.X500Principal; import java.net.URL; import java.security.CodeSigner; @@ -32,7 +32,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final IConfigurable config; private final ModFile modFile; private final URL issueURL; @@ -68,10 +68,13 @@ public class ModFileInfo implements IModFileInfo, IConfigurable this.mods = modConfigs.stream() .map(mi-> new ModInfo(this, mi)) .collect(Collectors.toList()); - LOGGER.debug(LogMarkers.LOADING, "Found valid mod file {} with {} mods - versions {}", - this.modFile::getFileName, - () -> this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")), - () -> this.mods.stream().map(IModInfo::getVersion).map(Objects::toString).collect(Collectors.joining(",", "{", "}"))); + if (LOGGER.isDebugEnabled(LogMarkers.LOADING)) + { + LOGGER.debug(LogMarkers.LOADING, "Found valid mod file {} with {} mods - versions {}", + this.modFile.getFileName(), + this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")), + this.mods.stream().map(IModInfo::getVersion).map(Objects::toString).collect(Collectors.joining(",", "{", "}"))); + } } public ModFileInfo(final ModFile file, final IConfigurable config, final List languageSpecs) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java index c11e9cb56a0..eb1140b9823 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFileParser.java @@ -8,12 +8,12 @@ import com.electronwill.nightconfig.core.file.FileConfig; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.locating.IModFile; import net.minecraftforge.forgespi.locating.ModFileFactory; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.lang.reflect.Type; @@ -25,7 +25,7 @@ import java.util.stream.Collectors; public class ModFileParser { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); public static IModFileInfo readModList(final ModFile modFile, final ModFileFactory.ModFileInfoParser parser) { return parser.build(modFile); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java index 6573e4fd94b..7c7f82c99e5 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java @@ -5,16 +5,18 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.StringSubstitutor; import net.minecraftforge.fml.loading.StringUtils; import net.minecraftforge.forgespi.language.IConfigurable; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.MavenVersionAdapter; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.VersionRange; +import org.slf4j.Logger; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; import java.net.URL; import java.util.Collections; @@ -26,7 +28,7 @@ public class ModInfo implements IModInfo, IConfigurable { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1"); private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$"); private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$"); @@ -52,12 +54,12 @@ public ModInfo(final ModFileInfo owningFile, final IConfigurable config) this.modId = config.getConfigElement("modId") .orElseThrow(() -> new InvalidModFileException("Missing modId", owningFile)); if (!VALID_MODID.matcher(this.modId).matches()) { - LOGGER.fatal("Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_MODID.pattern()); + LOGGER.error(LogUtils.FATAL_MARKER, "Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_MODID.pattern()); throw new InvalidModFileException("Invalid modId found : " + this.modId, owningFile); } this.namespace = config.getConfigElement("namespace").orElse(this.modId); if (!VALID_NAMESPACE.matcher(this.namespace).matches()) { - LOGGER.fatal("Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_NAMESPACE.pattern()); + LOGGER.error(LogUtils.FATAL_MARKER, "Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_NAMESPACE.pattern()); throw new InvalidModFileException("Invalid override namespace found : " + this.namespace, owningFile); } this.version = config.getConfigElement("version") diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModListHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModListHandler.java index ecf067502d7..a9b4a9233da 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModListHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModListHandler.java @@ -5,13 +5,13 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.FileUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.fml.loading.MavenCoordinateResolver; import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.IOException; import java.nio.file.Files; @@ -23,7 +23,7 @@ import java.util.stream.Collectors; public class ModListHandler { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); /** * Reads the modList paths specified, and searches each maven root for mods matching. Returns a list of mods * found. diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java index b7b4d2455b4..d9dd34cff68 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModValidator.java @@ -5,6 +5,7 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.IModuleLayerManager; import cpw.mods.modlauncher.api.ITransformationService; import net.minecraftforge.fml.loading.EarlyLoadingException; @@ -13,14 +14,13 @@ import net.minecraftforge.fml.loading.ModSorter; import net.minecraftforge.fml.loading.progress.StartupMessageManager; import net.minecraftforge.forgespi.locating.IModFile; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; import java.util.*; public class ModValidator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final Map> modFiles; private final List candidatePlugins; private final List candidateMods; @@ -41,7 +41,9 @@ private static List lst(List files) { public void stage1Validation() { brokenFiles = validateFiles(candidateMods); - LOGGER.debug(LogMarkers.SCAN,"Found {} mod files with {} mods", candidateMods::size, ()-> candidateMods.stream().mapToInt(mf -> mf.getModInfos().size()).sum()); + if (LOGGER.isDebugEnabled(LogMarkers.SCAN)) { + LOGGER.debug(LogMarkers.SCAN, "Found {} mod files with {} mods", candidateMods.size(), candidateMods.stream().mapToInt(mf -> mf.getModInfos().size()).sum()); + } StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found "+ candidateMods.size()+" modfiles to load")); } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModsFolderLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModsFolderLocator.java index f21e069835b..7d770554115 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModsFolderLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModsFolderLocator.java @@ -5,12 +5,12 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.fml.loading.ModDirTransformerDiscoverer; import net.minecraftforge.fml.loading.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.nio.file.Files; import java.nio.file.Path; @@ -25,7 +25,7 @@ */ public class ModsFolderLocator extends AbstractJarFileLocator { private static final String SUFFIX = ".jar"; - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final Path modFolder; private final String customName; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java index 19683914a3e..08a6310f151 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/Scanner.java @@ -5,12 +5,12 @@ package net.minecraftforge.fml.loading.moddiscovery; +import com.mojang.logging.LogUtils; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.forgespi.language.IModLanguageProvider; import net.minecraftforge.forgespi.language.ModFileScanData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.objectweb.asm.ClassReader; +import org.slf4j.Logger; import java.io.IOException; import java.io.InputStream; @@ -19,7 +19,7 @@ import java.util.List; public class Scanner { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ModFile fileToScan; public Scanner(final ModFile fileToScan) { diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/ClientVisualization.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/ClientVisualization.java index d9ab80d2225..7fa1082321b 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/ClientVisualization.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/ClientVisualization.java @@ -34,8 +34,6 @@ import java.util.function.LongSupplier; import java.util.function.Supplier; -import javax.annotation.Nullable; - import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.glfw.GLFW.glfwCreateWindow; import static org.lwjgl.opengl.GL11.*; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ArgumentList.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ArgumentList.java index ab3abed4da3..69ce04db9e6 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ArgumentList.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/ArgumentList.java @@ -5,8 +5,8 @@ package net.minecraftforge.fml.loading.targets; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; import java.util.ArrayList; import java.util.Arrays; @@ -20,7 +20,7 @@ * Can not use JOptSimple as that doesn't parse out the values for keys unless the spec says it has a value. */ class ArgumentList { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private List> entries = new ArrayList<>(); private Map values = new HashMap<>(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java index 3db4ff71a4e..29b02f75b9e 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java @@ -10,17 +10,12 @@ import net.minecraftforge.fml.loading.VersionInfo; import net.minecraftforge.api.distmarker.Dist; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import java.nio.file.Path; import java.util.List; import java.util.concurrent.Callable; import java.util.stream.Stream; public abstract class CommonClientLaunchHandler extends CommonLaunchHandler { - private static final Logger LOGGER = LogManager.getLogger(); - @Override public Dist getDist() { return Dist.CLIENT; } @Override public String getNaming() { return "srg"; } @Override public boolean isProduction() { return true; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java index 2e05adb6d14..411c4a2374f 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java @@ -5,12 +5,12 @@ package net.minecraftforge.fml.loading.targets; +import com.mojang.logging.LogUtils; import cpw.mods.modlauncher.api.ILaunchHandlerService; import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder; import net.minecraftforge.fml.loading.LogMarkers; import net.minecraftforge.api.distmarker.Dist; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.io.File; import java.nio.file.Path; @@ -25,7 +25,7 @@ public abstract class CommonLaunchHandler implements ILaunchHandlerService { public record LocatedPaths(List minecraftPaths, BiPredicate minecraftFilter, List> otherModPaths, List otherArtifacts) {} - protected static final Logger LOGGER = LogManager.getLogger(); + protected static final Logger LOGGER = LogUtils.getLogger(); public abstract Dist getDist(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java index 01b763a558b..afe91492bd0 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java @@ -10,8 +10,6 @@ import net.minecraftforge.fml.loading.LibraryFinder; import net.minecraftforge.fml.loading.VersionInfo; import net.minecraftforge.api.distmarker.Dist; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.nio.file.Path; import java.util.List; @@ -20,8 +18,6 @@ import java.util.stream.Stream; public abstract class CommonServerLaunchHandler extends CommonLaunchHandler { - protected static final Logger LOGGER = LogManager.getLogger(); - @Override public Dist getDist() { return Dist.DEDICATED_SERVER; } @Override public String getNaming() { return "srg"; } @Override public boolean isProduction() { return true; } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..41d9927a4d4fb3f96a785543079b8df6723c946b 100644 GIT binary patch delta 8958 zcmY+KWl$VIlZIh&f(Hri?gR<$?iyT!TL`X;1^2~W7YVSq1qtqM!JWlDxLm%}UESUM zndj}Uny%^UnjhVhFb!8V3s(a#fIy>`VW15{5nuy;_V&a5O#0S&!a4dSkUMz_VHu3S zGA@p9Q$T|Sj}tYGWdjH;Mpp8m&yu&YURcrt{K;R|kM~(*{v%QwrBJIUF+K1kX5ZmF zty3i{d`y0;DgE+de>vN@yYqFPe1Ud{!&G*Q?iUc^V=|H%4~2|N zW+DM)W!`b&V2mQ0Y4u_)uB=P@-2`v|Wm{>CxER1P^ z>c}ZPZ)xxdOCDu59{X^~2id7+6l6x)U}C4Em?H~F`uOxS1?}xMxTV|5@}PlN%Cg$( zwY6c}r60=z5ZA1L zTMe;84rLtYvcm?M(H~ZqU;6F7Evo{P7!LGcdwO|qf1w+)MsnvK5^c@Uzj<{ zUoej1>95tuSvDJ|5K6k%&UF*uE6kBn47QJw^yE&#G;u^Z9oYWrK(+oL97hBsUMc_^ z;-lmxebwlB`Er_kXp2$`&o+rPJAN<`WX3ws2K{q@qUp}XTfV{t%KrsZ5vM!Q#4{V& zq>iO$MCiLq#%wXj%`W$_%FRg_WR*quv65TdHhdpV&jlq<=K^K`&!Kl5mA6p4n~p3u zWE{20^hYpn1M}}VmSHBXl1*-)2MP=0_k)EPr#>EoZukiXFDz?Di1I>2@Z^P$pvaF+ zN+qUy63jek2m59;YG)`r^F3-O)0RDIXPhf)XOOdkmu`3SMMSW(g+`Ajt{=h1dt~ks ztrhhP|L4G%5x79N#kwAHh5N){@{fzE7n&%dnisCm65Za<8r_hKvfx4Bg*`%-*-Mvn zFvn~)VP@}1sAyD+B{{8l{EjD10Av&Mz9^Xff*t`lU=q=S#(|>ls520;n3<}X#pyh& z*{CJf7$*&~!9jMnw_D~ikUKJ2+UnXmN6qak{xx%W;BKuXt7@ky!LPI1qk?gDwG@@o zkY+BkIie>{{q==5)kXw(*t#I?__Kwi>`=+s?Gq6X+vtSsaAO&Tf+Bl$vKnzc&%BHM z=loWOQq~n}>l=EL(5&6((ESsQC3^@4jlO5Od{qN#sWV)vqXw}aA>*uvwZopNN(|-T zRTF%5Y_k1R$;(d-)n;hWex{;7b6KgdAVE@&0pd(*qDzBO#YZV%kh%pYt1`hnQ(Fa& zYiDrOTDqk5M7hzp9kI2h!PxNnuJ&xl*zF8sx6!67bA49R1bmUF5bpK&&{eI0U~cH}PM z3aW1$lRb|ItkG5~_eBNu$|I|vYIdAA9a!pVq<+UTx*M}fG`23zxXp&E=FfnY- zEzKj;Cu_s4v>leO7M2-mE(UzKHL4c$c`3dS*19OpLV^4NI*hWWnJQ9lvzP4c;c?do zqrcsKT*i~eIHl0D3r4N{)+RsB6XhrC^;sp2cf_Eq#6*CV;t8v=V!ISe>>9kPgh}NI z=1UZutslxcT$Ad;_P^;Oouoa(cs!Ctpvi>%aQ+Zp=1d|h{W9Wmf7JWxa(~<#tSZ?C%wu4_5F!fc!<@PIBeJ)Nr^$bB6!_Gic_7}c3J{QI~Gg5g5jTp9}V6KYgrgaX>pJt}7$!wOht&KO|+z{Iw@YL|@~D zMww}+lG}rm2^peNx>58ME||ZQxFQeVSX8iogHLq_vXb`>RnoEKaTWBF-$JD#Q4BMv zt2(2Qb*x-?ur1Y(NsW8AdtX0#rDB?O(Vs4_xA(u-o!-tBG03OI!pQD+2UytbL5>lG z*(F)KacHqMa4?dxa(Vcrw>IIAeB$3cx#;;5r2X;HE8|}eYdAgCw#tpXNy7C3w1q`9 zGxZ6;@1G%8shz9e+!K2MO*{_RjO}Jo6eL3{TSZ>nY7)Qs`Dhi5><@oh0r)gT7H-?3 zLDsd^@m%JvrS8sta5`QiZNs^*GT}Hiy^zjK2^Ni%`Z|ma)D2 zuyumbvw$M8$haCTI~6M%d4+P)uX%u{Sfg4Al+F7c6;O-*)DKI7E8izSOKB#FcV{M+ zEvY0FBkq!$J0EW$Cxl}3{JwV^ki-T?q6C30Y5e&p@8Rd?$ST-Ghn*-`tB{k54W<>F z5I)TFpUC!E9298=sk>m#FI4sUDy_!8?51FqqW!9LN1(zuDnB3$!pEUjL>N>RNgAG~-9Xm|1lqHseW(%v&6K(DZ3Pano(1-Qe?3%J&>0`~w^Q-p&@ zg@HjvhJk?*hpF7$9P|gkzz`zBz_5Z!C4_-%fCcAgiSilzFQef!@amHDrW!YZS@?7C zs2Y9~>yqO+rkih?kXztzvnB^6W=f52*iyuZPv$c42$WK7>PHb z6%MYIr5D32KPdwL1hJf{_#jn?`k(taW?mwmZVvrr=y~fNcV$`}v(8};o9AjOJumS4 z`889O91^pkF+|@$d9wVoZ3;^j;^sUs&Ubo_qD&MTL%O z&*SE0ujG~zm;?x)8TLC&ft))nyI zcg44@*Q{cYT+qGrA=In_X{NNCD+B0w#;@g)jvBU;_8od6U>;7HIo@F*=g8CQUo(u^ z3r4FJ7#<@)MXO&5+DgKE&^>^`r!loe7CWE*1k0*0wLFzSOV8jvlX~WOQ?$1v zk$Or}!;ix0g78^6W;+<=J>z@CBs!<<)HvF(Ls-&`matpesJ5kkjC)6nGB@b{ii6-Uoho$BT%iJgugTOeZ$5Xo4D7Pd< zC*LJh5V@2#5%aBZCgzlQi3@<_!VfiL07ywc)ZbwKPfcR|ElQoS(8x|a7#IR}7#Io= zwg4$8S{egr-NffD)Fg&X9bJSoM25pF&%hf>(T&9bI}=#dPQyNYz;ZZ7EZ=u1n701SWKkZ9n(-qU ztN`sdWL1uxQ1mKS@x11;O|@^AD9!NeoPx}?EKIr!2>1Qq4gjfGU)tr6?Z5l7JAS3j zZeq{vG{rb%DFE4%$szK}d2UzB{4>L?Tv+NAlE*&Nq6g+XauaSI+N2Y8PJLw+aNg1p zbxr|hI8wcMP&&+(Cu|%+Jq|r>+BHk@{AvfBXKiVldN)@}TBS0LdIpnANCVE26WL-} zV}HJ^?m&$Rkq;Zf*i-hoasnpJVyTH__dbGWrB_R55d*>pTyl6(?$EO@>RCmTX1Hzr zT2)rOng?D4FfZ_C49hjMV*UonG2DlG$^+k=Y%|?Dqae4}JOU=8=fgY4Uh!pa9eEqf zFX&WLPu!jArN*^(>|H>dj~g`ONZhaaD%h_HHrHkk%d~TR_RrX{&eM#P@3x=S^%_6h zh=A)A{id16$zEFq@-D7La;kTuE!oopx^9{uA3y<}9 z^bQ@U<&pJV6kq7LRF47&!UAvgkBx=)KS_X!NY28^gQr27P=gKh0+E>$aCx&^vj2uc}ycsfSEP zedhTgUwPx%?;+dESs!g1z}5q9EC+fol}tAH9#fhZQ?q1GjyIaR@}lGCSpM-014T~l zEwriqt~ftwz=@2tn$xP&-rJt?nn5sy8sJ5Roy;pavj@O+tm}d_qmAlvhG(&k>(arz z;e|SiTr+0<&6(-An0*4{7akwUk~Yf4M!!YKj^swp9WOa%al`%R>V7mi z+5+UodFAaPdi4(8_FO&O!Ymb#@yxkuVMrog(7gkj$G@FLA#ENMxG)4f<}S%Fn?Up$+C%{02AgMKa^ z4SFGWp6U>{Q6VRJV}yjxXT*e`1XaX}(dW1F&RNhpTzvCtzuu;LMhMfJ2LBEy?{^GHG!OF!! zDvs64TG)?MX&9NCE#H3(M0K>O>`ca0WT2YR>PTe&tn?~0FV!MRtdb@v?MAUG&Ef7v zW%7>H(;Mm)RJkt18GXv!&np z?RUxOrCfs;m{fBz5MVlq59idhov21di5>WXWD-594L-X5;|@kyWi@N+(jLuh=o+5l zGGTi~)nflP_G}Yg5Pi%pl88U4+^*ihDoMP&zA*^xJE_X*Ah!jODrijCqQ^{=&hD7& z^)qv3;cu?olaT3pc{)Kcy9jA2E8I)#Kn8qO>70SQ5P8YSCN=_+_&)qg)OYBg|-k^d3*@jRAeB?;yd-O1A0wJ z?K*RDm|wE<(PBz~+C%2CTtzCTUohxP2*1kE8Of~{KRAvMrO_}NN&@P7SUO{;zx0iK z@or9R8ydYOFZf(cHASCAatL%;62IL27~SmASr(7F&NMr+#gNw@z1VM z_ALFwo3)SoANEwRerBdRV`>y`t72#aF2ConmWQp(Xy|msN9$yxhZ1jAQ67lq{vbC5 zujj|MlGo`6Bfn0TfKgi(k=gq0`K~W+X(@GzYlPI4g0M;owH3yG14rhK>lG8lS{`!K z+Nc@glT-DGz?Ym?v#Hq|_mEdPAlHH5jZuh*6glq!+>Lk$S%ED2@+ea6CE@&1-9a?s znglt|fmIK}fg<9@XgHe4*q!aO<-;Xj$T?IzB-{&2`#eA6rdtCi80mpP&vw(Uytxu$#YzNI_cB>LS zmim>ys;ir;*Dzbr22ZDxO2s;671&J0U<9(n1yj)J zHFNz=ufPcQVEG+ePjB<5C;=H0{>Mi*xD>hQq8`Vi7TjJ$V04$`h3EZGL|}a07oQdR z?{cR(z+d>arn^AUug&voOzzi$ZqaS)blz-z3zr;10x;oP2)|Cyb^WtN2*wNn`YX!Y z+$Pji<7|!XyMCEw4so}xXLU)p)BA~2fl>y2Tt}o9*BPm?AXA8UE8a;>rOgyCwZBFa zyl42y`bc3}+hiZL_|L_LY29vVerM+BVE@YxK>TGm@dHi@Uw*7AIq?QA9?THL603J% zIBJ4y3n8OFzsOI;NH%DZ!MDwMl<#$)d9eVVeqVl(5ZX$PPbt*p_(_9VSXhaUPa9Qu z7)q4vqYKX7ieVSjOmVEbLj4VYtnDpe*0Y&+>0dS^bJ<8s*eHq3tjRAw^+Mu4W^-E= z4;&namG4G;3pVDyPkUw#0kWEO1;HI6M51(1<0|*pa(I!sj}F^)avrE`ShVMKBz}nE zzKgOPMSEp6M>hJzyTHHcjV%W*;Tdb}1xJjCP#=iQuBk_Eho6yCRVp&e!}4IBJ&?ksVc&u#g3+G$oNlJ?mWfADjeBS-Ph3`DKk-~Z70XugH8sq2eba@4 zIC1H_J$`9b$K`J)sGX3d!&>OmC@@rx1TL~NinQOYy72Q_+^&Mg>Ku(fTgaXdr$p_V z#gav1o{k~c>#)u3r@~6v^o)Lf=C{rAlL@!s457pq)pO;Cojx7U{urO4cvXP|E>+dV zmr2?!-5)tk-&*ap^D^2x7NG6nOop2zNFQ9v8-EZ{WCz-h36C)<^|f{V#R_WE^@(T0+d-at5hXX{U?zak*ac-XnyINo+yBD~~3O1I=a z99|CI>502&s-Qi5bv>^2#cQ%ut<4d7KgQ^kE|=%6#VlGiY8$rdJUH{sra;P~cyb_i zeX(kS%w0C?mjhJl9TZp8RS;N~y3(EXEz13oPhOSE4WaTljGkVXWd~|#)vsG6_76I)Kb z8ro?;{j^lxNsaxE-cfP;g(e;mhh3)&ba}li?woV2#7ByioiD>s%L_D;?#;C#z;a(N z-_WY<=SH42m9bFQ>Nb z@4K$@4l8pD7AKxCR>t0%`Qoy9=hA?<<^Vcj8;-E+oBe3ReW1`el8np8E$k{LgFQ}2 z2t8a`wOXFdJ9!5$&mEfD1CnJ)TB+RJih88-Zos9@HZ# zL#{qfbF0ARTXkR@G{lwlOH~nnL)1jcyu!qv2`57S&%oKz0}r{~l9U_UHaJ5!8#nrs z?2FrL`mxnzu&{bweD&62)ilz*?pYIvt`T!XFVVA78})p1YEy7 z8fK#s?b~Yo$n7&_a?EBdXH-_W)Z44?!;DFx6pZ?~RArtBI*Qm4~6nX6Z_T*i$bQPE;Qz?DAPstpGSqr-AJ zo%m9cA`oDDm?&dTaoh_>@F>a?!y4qt_;NGN9Z<%SS;fX-cSu|>+Pba22`CRb#|HZa z;{)yHE>M-pc1C0mrnT~80!u&dvVTYFV8xTQ#g;6{c<9d!FDqU%TK5T6h*w*p980D~ zUyCb`y3{-?(mJFP)0*-Nt;mI$-gc4VQumh|rs&j_^R{sgTPF`1Xja2YWstsKFuQ(d zmZMxV$p$|qQUXchu&8%J(9|)B?`~rIx&)LqDS>ob5%gTeTP#Sbny#y*rnJ&?(l=!( zoV~}LJ1DPLnF8oyM(2ScrQ0{Q4m4-BWnS4wilgCW-~~;}pw=&<+HggRD_3c@3RQIr z9+-%!%}u_{`YS=&>h%kPO3ce}>y!d-zqiniNR-b5r97u;+K6HA2tS>Z#cV{+eFI`* zd8RMGAUtX1KWfPV;q<-5JAykS+2sY$2~UX+4461a(%{P#{rwFPu0xpIuYlbgD{C7C z=U{FUarVTYX6ZUq3wE@G^QT4H2Re;n$Fz9cJ>hABl)9T8pozqbA1)H-%1=WKm^QMu zjnUZ&Pu>q+X&6Co*y#@pxc-4waKMInEPGmE_>3@Ym3S*dedSradmc5mlJn`i0vMW6 zhBnGQD^Z;&S0lnS0curqDO@({J7kTtRE+Ra?nl^HP9<)W&C>~`!258f$XDbyQOQXG zP8hhySnarOpgu8xv8@WlXnm(Uk~)_3$Sg0vTbU3 z{W!5B(L3{Yy3K5PN<@jEarAtja`}@KYva&zFRF*s+_%jIXh$T(S=an8?=Ry3H*NRqWgsM`&!#|@kf1>=4q%bFw7^Rhz!z5I zyI^zU8_R1WN9`88Z=n>pIZQ`Ixr~_9G%Q}@A7rd#*%y7G zXl^Id=^ZL?Rx}}gWXCqzj9C6;x(~mAH|$JteXa1MH<6UQig@!Hf~t}B%tP0I|H&;y zO6N0}svOa1a^PyP9N5?4W6VF%=Bj{qHUgc8@siw4bafT=UPFSoQqKgyUX>sXTBZ=x zOh^Ad!{kOM9v{%5y}`-8u*T&C7Vq6mD%GR}UeU(*epO&qgC-CkD;%=l)ZuinSzHM` z{@`j&_vC6dDe{Yb9k@1zeV_K6!l(@=6ucoI=R^cH=6{i71%4W3$J-?<8Qn#$-DMtA z6Qqi)t?4ifrt%3jSA#6ji#{f(($KBL-iQh-xrC||3U3lq`9>r)>X%oLvtimuHW-)} zy}>9~|M>w4eES`g7;iBM%Se5-OP%1U6gNWp3AZqT8C6OlFFfQ$|7LL;tBV)(qlp4K zruar^K8FnJN3@_}B;G`a~H`t|3+6d>q3#`ctTkE-D^1#d9NalQ04lH*qUW2!V zhk7#z8OwHhSl8w14;KctfO8ubZJ4$dEdpXE78wABz=n5*=q9ex3S}`e7x~~V-jmHOhtX2*n+pBslo3uosdE7xABK=V#-t{1Hd~?i z{i~%Bw6NYF+F$aK$M`r#xe=NxhA5=p%i7!$);sd>Q}#`G?Q~fygrMXmZw?0#5#17W}6Tj+&kFexG{!mYl5FoA99}3G9l;3lVQ^ z48^~gsVppE*x91WheqI(A%F0Z#$#1UJP1R12Mj9r)y(A?a+iquX+d8WD4WAQJ_!oq z9rTISr7bPd(GTP57xm$}C}&kjMivi;zi^Y9g3&X0A;ovdJ?{%_wHgt%%9P&N4H z^XzV(uNA4 zAP`hgP6BEN5`YXh|DF~6Pud?~gWfhUKoPX4>z|}0aocC&K+AoV%|SX*N!wGq3|y< zg4lP(04XIPmt6}$N!dTk+pZv>u;MTB{L4hp9uXk7>aS!6jqM2lVr%{)H3$O127TSZ z0x9hi0k-P?nWFdQ0K`pykqUIT&jD~B0tHP{ffS(}fZ(aW$oBWTSfHO!A^><6vA?qar%tzN-5NQO zL&|F{nGiQyzNJ+bM$Y`n=Lx^3wTG^o2bGB@cwr1eb+6c-1tN=U+Db;bc~eJ!hwM{SbI=#g?$!PjDB+) zPgU_2EIxocr*EOJG52-~!gml&|D|C2OQ3Y(zAhL}iae4-Ut0F*!z!VEdfw8#`LAi# zhJ_EM*~;S|FMV6y%-SduHjPOI3cFM(GpH|HES<}*=vqY+64%dJYc|k?n6Br7)D#~# zEqO(xepfaf2F{>{E2`xb=AO%A<7RtUq6kU_Iu0m?@0K(+<}u3gVw5fy=Y4CC*{IE3 zLP3YBJ7x+U(os5=&NT%gKi23bbaZ`@;%ln)wp4GpDUT$J8NtFDHJzIe_-t}{!HAsh zJ4<^WovY};)9IKAskSebdQiXv$y5}THuJZ}ouoElIZRui=6lrupV|_Jz=9^&;@HwL;J#@23k?A;k`0Bgf;ioO>W`IQ+4? z7A)eKoY4%+g%=w;=Vm8}H>@U*=*AWNtPqgWRqib#5RTGA@Q=43FrQn3J`GkTUV5yp0U`EOTqjfp+-9;0F8!dMEwwcK%(6`8sDD^aR04 zd6O5vh|Xk?&3dy4f|1QK&Ulf{h6Iq;d-&*ti#Ck>wZFG;GHwc?b;X~eBITx49>2d8 z4HcK&1&DvEGT6kXdzAm4oO8%c}8OBt~8H956_;YP-ss*uMf==a+%w~F>Qkm7r)IAuxuoX}h92$gHqbFUun#8m zWHdy`Zrm#=Pa98x8cO0vd@Tgkr*lm0{dky+Gocr0P8y%HGEI#c3qLqIRc`Oq_C%*; zG+QTr(#Q|yHKv6R@!DmLlwJQ3FAB)Yor-I4zyDyqM4yp5n2TrQH>gRt*Zw0+WI-Sj`EgmYHh=t9! zF6lz^xpqGGpo6!5`sc0a^FVhy_Uxq|@~(1@IIzV)nTpY9sY`CV!?8e&bB8=M&sYEb z2i}fvKdhp9Hs68Y-!QJ<=wE(iQ5+49tqt;Rh|jhYrI5VW-mIz|UY{h8E=rC5sh#DU z?wGgk-Tn!I?+Zer7pHlF_Z^!Kd1qkS3&lv#%s6-<5Y%jQL${cge5=G5Ab?D&|9$Y~ zf%rJC2+=2vg;y0-SJb3<@3%}BO$T$C66q$L_H33a`VUbgW~N(4B=v5(<=My|#|J7q z*Ox4wL4kbJd_~EjLTABSu4U7Jk#`y(6O*U6(k6XxM}CtGZB(H@3~kh*zaGRXM}Iwp zQ%xFk2>@wiZrVCV_G4G~v;NebCQ%T7{SDyPpSv&dT@Cn)Mx@IK*IdNrj{*4pkV4wv z)y0J538h>cpB7iPSzA~x24T`{dzNkpvGIqvt1Dvdq@o-`B=$hkczX8$yFMhsWNK-X zxr$kR$tMD0@W)Vxe1^t9qVmsg&K^F@u84)(n2dttIEAZFN6VD$&tskpG%SI7whGL3 z)DeRiwe&?8m7U{G`oW8!SCi*dM>oYL%UKQnKxV_0RXAEBQg1kStExGEUVwLJ0orGGwb7uv+kPDl7_E2*iD|J*=8A@;XCvwq0aw5oJYN*Yh&o=l} z2z8YKb-fIAH5spql4eXqp*)o2*b>#1@DSt?zZi{GPj0gH&Nm+EI<3^z0w%YTEV4xw zI6$+=Faa|Y4o5i0zm5lOg|&tmnJ806DBovU@Ll6XsA;NRrTK~t*AAJIAS=v-UZ%Pr z$oddI@NRir&erzCwq|)ciJemr-E061j{0Vc@Ys7K(mW|JYj*$+i1Q8XlIK8T?TYS(AXu$`2U zQ@fHxc=AVHl_}cRZQ)w0anMEoqRKKIvS^`<-aMf*FM`NsG&Uowneo+Ji$7DUDYc7*Hjg;-&aHM%3 zXO6cz$$G};Uqh+iY7Wpme>PHG4cu(q;xyskNLs$^uRRMfEg?8Cj~aE-ajM%CXkx0F z>C?g3tIA#9sBQOpe`J+04{q7^TqhFk^F1jFtk4JDRO*`d-fx`GYHb=&(JiaM1b?Y^ zO3Kj3sj76ieol|N$;>j@t#tKj=@*gP+mv}KwlTcPYgR$+)2(gk)2JNE=jSauPq!$< z<|?Sb%W)wS)b>b6i{8!x!^!xIdU3{CJFVnTcw0j{M%DUCF=_>eYYEUWnA-|B(+KYL z_W_`JI&&u^@t0})@DH^1LDuT0s3dMpCHIbYBgOT4Zh_4yHbSqRbtIKndeT4Q*Jg91 z@>rO!^t-G~*AIW;FQ$3J=b;oGg8?CTa~qNCb>&cgp@e;?0AqA&paz~(%PYO+QBo4( zp?}ZdSMWx0iJm7HVNk9A#^9Osa#GPJ!_pYEW}($8>&2}fbr@&ygZ?${A7_9?X$(&5 z#~-hxdPQwCNEpf=^+WH-3`2LxrrBMTa}~qJC9S;VzhG!On^JLyW6WkF{8aAE$sM+( zxr8xLW(KIjI`Rm(24r3OJBk<3GF=G!uSP0-G&AY32mLm8q=#Xom&Pqv=1C{d3>1^ zAjsmV@XZ%BKq^eUfBpa8KvO8ob|F3hAjJv*yo2Bhl0)KUus{qA9m8jf)KnOGGTa6~4>3@J_VzkL|vYPl*uL+Ot*Q7W!f5rJw5+AsjP_IfL+-S*2p| zB7!FhjvkUTxQkGWGSg{X;h~dK>gAJivW?88Nu!3o>ySDaABn$rAYt086#27fbjPQS zhq>55ASvm*60qRdVOY9=bU^+{Pi#!OaZwENN;zy5?EztOHK-Q5;rCuiFl}BSc1YaQ zC-S{=KsGDz@Ji9O5W;XxE0xI|@3o6(2~i4b8Ii9VT;^G$*dRw(V?=br)D&q^XkeBX z+gl~+R@rVD-Hwv@7RHV?Bip5KMI)aV^&snt?H<$Nt=OPx#VxF&BGi?2A2+lNOYywNUGMeGL;|(=UjGDtLG0sN&LpGx;|U;xa13s z;W_|SPk^G}!M9_^pO zA3bt3-tca%^42sHeDtfcC0S3w3H1ny!Bxpa=*k?XRPpx9Bb-gx1J9Yvx)4J(8cG+q z(iCPZ9dsf3#QVyZgD_MW#G#qgV)olu$59&3(PzQfw@%4uZ~<5J=ABvdY43(Qnp{;G zHg3>@T#>DbTuhFl3)fb3TFqdh)V2aq7!;&JOHseTWukvA7}(iGUq;v-{2J0iHSNHq z;+)h!p6Ok^+Sp8-jgL($n6Qu47xyE`cFO5SdZR6;R!FET`tm#0D37z339Suxjpv+s z*=%2-N$N?X&0?x_uut3erF@aBGj;9$k9?3FlbDO{RQa1_qtxrh4!4#fjp4x~akvdTp@ zos?^Q&XE;3N93s4rHQGPrV7+au1$$aB6$hLy*Yz_kN$~dweb9PcB!eYVQTGjFuJP> zZCEwBtb>TIgIO^qAzq@Bv-qud_ZD-2W<_at&ml-gv`tPt$@DF5`HlA zM>DmmMkpv&Zm-8)Y#0bLQf4MpD4_-7M8eu6rh(tL8dq8onHs#R9J~dGd2IaXXMC~h z91pKhnQa%Fsn29nAA1;x(%oC zhca~qQDJaMf?wFrl-Pj;e$bZMYmMF!Y3Lv&Sb?Sjn#!NVx&NDyc^$b4uYyo2OmERa zRz;yDGd@JTykzFLe|Wk-y7#3x`6$wt$zR8r48mdUvfbeL+4D|Z``~7$PrE@qc7rZe zVsIoIbCwzjLZ@_M1*bD{HaYn();Z1-q*-I{tEnTZ(}Zmk&%MXSNBX>o| z-u*RNkAyKC-Srp7c-=@5f)xMWg>o2WWl}j6j9=8+D8;T z>0*0q#;qw8%U8i;6s0fu#I*%(g*@@a2Er@@nyI}{=@W{Z-;`=wN4N~>6Xrh&z#g}l zN1g5}0-#(nHUTv_rl2{yUZ;h#t&Fd?tY!7L%ClY)>uH-Ny2ET$lW$S)IQiN79H)D^ zb&0AXYkupy0~w8)*>Sj_p9}4L?lGTq%VG|2p`nWGhnM^!g|j-|O{%9Q%swOq63|*W zw$(N_laI}`ilB+o!a-wl?er~;;3+)$_akSQ!8YO_&-e*SI7n^(QQ;X0ZE`{4f!gAl z5$d+9CKVNonM!NO_frREICIAxOv)wm>}-k?iRisM`R7;=lyo|E_YR~FpS&PS`Lg0f zl-ON<0S%Uix8J%#yZdkCz4YNhcec<|7*P(JsM#>-L>+tYg_71q9~70FAc^6KW5jql zw!crdgVLH1G_eET=|SEc977;)ezVC|{PJZfra|}@rD;0s&@61mTEBJtILllg{%{vN zfhb&lq0yChaLhnJ-Qb62MB7`>M;|_ceHKZAeeh@#8tbrK!ArP6oXIhMK;dhEJTY`@ z0Tq>MIe0`7tGv)N*F0IGYSJv0vN?Az8g+4K9S!pW2~9F4W(_U_T=jCZrzuZ3*|__T zONp_UWmyePv8C~rckc?Xji;Z5OEqg zC*Um)i;Wh4TEwqReQdVVbUKT^2>Tpi6z_^-uF*adUFug4i@JhzpWT^Sk&E>CyP2?H zWf6x}ehuTs6wvzCnTU&gYzT029Nz19(In1WC z`(1IGmi!O%2AR|BjQa4Q0~u)kM%}?xQyjWuQ16^Gp++;`vr7!k--UZWM*~7Zl|ceO@I3`OpaRhD;YoCuo5IC0uHx>9 z478hu@H|e0Zlo)Zj@01#;8BDs@991xe~^9uG2}UXLM(m7fa}AMwX*tjioBeV&Q8Gx zSq$6wZFkRBK`cMI>R(@W@+lo2t)L+4q-negWRLWZBz*|%=W4v62JrmzNuOtA*x)QE z5L%=OH#@KMdB%Jp^r?0tE}5-*6oP`-lO7Sf)0)n*e<{HA=&qhLR)oD8-+V}Z4=md) z+k9lKf64DB2hAT)UaCP~di?-V3~JBH7itYyk~L6hrnxM%?RKntqd`=!b|e7eFnAcu z3*V;g{xr7TSTm$}DY%~SMpl>m{Sj!We+WfxSEor?YeiAxYUy25pn(?T()E>ByP^c@ zipwvWrhIK((R((VU+;@LmOnDu)ZXB3YArzzin!Z^0;PyJWnlfflo|q8(QY;o1*5CO z##hnkO{uynTMdk`~DOC#1 zdiYxQoy}=@7(ke#A8$YZZVtk4wo$8x28&I;cY3Ro-|kW=*yiiHgCLZeAr)UtVx>Tu z|LvL0hq|1-jC0I4x#>&QZCfrVB=zT!nR|~Uz`9%~2 znl{uZ{VEszW`Fad^q_HB!K9*|U-stK%?~;g?&&+12A}Rq$z($Bzuk^2X(Y=hF?-dQ ztc3DsQKI;qhWIV`99Q#R3xnU0AvY!i*BECj-z9l74|%O=V@nlv|qqC^r^-~C?E zGW%c|uYgnfJ(gjsTm_cIqcv*mYM{+i+&@F@+69ZQOK&u#v4oxUSQJ=tvqQ3W=*m;| z>SkBi8LYb-qRY7Sthh*0%3XAC%$z1rhOJzuX=PkTOa=DlocZUpE#KxVNH5)_4n=T( zGi3YrH7e~sPNYVBd~Grcq#CF~rN{p9Zza-Ntnwfma@TB)=3g36*0lSZg#ixEjFe%+ zX=&LDZ5zqculZ`=RYc^ln(~;nN|Qh6gN=!6f9-N2h+3NWbIxYud&;4SX*tWf5slk4 z{q@@l71UAZgj~*6edXb57fBUxvAS7s(RI=X868JM0+^DCn2yC>;v%S;qPOjB>YVsz(Zx9a>>BK&M zIQK>7_n)4ud0X5YM}^i*keH{ehLsiy9@NvOpsFeQjdI6anLGvVbBw_*fU1TzdVS$i z*4j7z!I5RF#rSz|8ibi$;qE{4`aqWYik7QB5U&F5C*;TO_x+gtzPGpzNt!7~nsBT7)Ckc(K~%uv&{{6A`mmBJVAk-{s~52Vu|HbCH7_W1~ZCX^RflOakGg=jo2Z z<*s;5-J+2@^LRDZ-7EV&Pq+FTErw@pfFqvx^i%E7Fx#^n(E`m2(c>K-O5`M`Yek9el zzTGs5qD6*G;y#~xu3>qWuO?-amKYtvRA}I9z#UspEeM;wOERYeot_n_EUMJf$4_u?E!6X~?q)tPoZb^_;8Y_Ox2h1m<+Le-fsRd|T8db<8#$bqez zua^Z|>h%zdnuU^ww$#-dZ9NTM`FN+!IlLkz*FqWb!x^Z|C{KyGjZ+>G;;7Mb@LY|H zc+Gp`L((Dw7pnDlHNm&;SfHedhx*kad$I^uGz{`0BYelq0yEUHpNKSkvj$|dpvY3{7*YGyhXA^LP0&wOw9oNoC=QoVx1<2Dne8qqZL zm>nFh5DX(-RnQwvHCZQwn^#Z=E!SPVlaRJ78Bo@}!!9dRt^qZy?-*`Pt4WSmgucJv zV1yFkcjlEM^uz-;b#Q7ZCP@Lk)m}uPX={R4B=56k7WNh11BN~0T*vr@!!ow^B0hOR zQ)4)&(e%>bNNL%bm<&8H{*l_L7s0$2GUgX2Vd;=4d9Dm2v3TaL+;L>{K7h7 zV#k?xDPm(NDE31$ z<}|X)pEY6myjK+^gaIMk&Yj2~F0rSKemNqlsVm4c|N7mp_C*L01s;GNx#D-*&gk!qQr}^?_r@q!8fuXw!)fA7xkd} zb>vHvdx~H$5qqAWrow7}+8zBM65-JOt5z za=T6f7MK`XJuQog8kIEboPdhcaVJeHy)5z7EBLK5NRr()E|#K0L0N^JD@pUA^Czb` zbUZ_558y+vqAGeyHCbrvOvLD67Ph}06959VzQ_|>RrXQAqE+AQ(-AaKdxoWaF8hdt z{O3W@b^*o#-f1VuU>YMV03ELF7zkCN4Q&b#prz%3Nne0lSbRo@@ z^ihv%oIl~Qyl6Q;a#$*jOC%x0_;eis*)J7=f@Ct*)xF5 zo}u~@-I}2|$b%5L7>@+Z?4o+1r&v6ceIy+vroK&jCQ<4q&45HP2wCol4hVm3pZtjf zHz1D7oyaSKJ~T{Gx}7ONLA)D5k(%%`WswrDyzX*rn}i}}TB4^y#@mAwPzoC)`?rYv zHgx|trUN#mu*VzUV~8TnJM2Qh*ZM5B{x&y>5An`(M7=Z*Q>TdiH@j*2=moNuOtvpz z+G`@~-`%~+AgPKgke@XiRPgndh@bp*-HRsh;HTtz@-y_uhb%7ylVOTqG0#u?Vn5c5 zEp*XRo|8hcgG^$#{$O9CJ&NE;TrfRpSnLmes&MO{m=N%zc`}gb!eQ7odl$oy1%PI} z#AIxx%oRVy&{O~9xnK4$EY>(eQj}!HKIV$Fz*H=-=Kn)N0D6u`(;iO|VraI4fu_W` z;b5{7;Lyx4za}DU#+U7}=H0dAS#YJJ&g2!P@Htu-AL&w=-)*%P9h2{wR|@?Ff9~)b z^+e_3Hetq7W%ls{!?<6&Y$Z;NNB41pvrv)|MET6AZXFXJeFqbFW5@i5WGzl?bP+~? z*&_puH;wKv2)9T_d+P`bLvJFqX#j&xa*-;0nGBbQf0DC>o~=J_Wmtf*2SZQr?{i~X z9-IbRH8{iy?<0v9Ir1?$66+igy|yDQ5J~A9sFX@Pe<*kCY8+MwH?I z`P}zfQ6l^AO8ehZ=l^ZR;R%uu4;BK*=?W9t|0{+-at(MQZ(CtG=EJFNaFMlKCMXu30(gJUqj5+ z`GM|!keqcj;FKTa_qq;{*dHRXAq157hlB@kL#8%yAm2AgfU|*rDKX@FLlp=HL8ddv zAWLCHe@DcDeB2}fl7#=0+#<05c3=VqM*O3bkr@9X4nO|)q0hU;Gye{L8ZN*NH8Id@mP-u;Fmb8YuorjLrW&ndip8CN%_qp982r w1WEnz9^$&s1hkp_3#lPJQ~!HI7WYYjA7>z!`?f%npAh2%rB@vD|Lau$2O)#1n*aa+ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87909a..aa991fceae6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefaa5fc..1b6c787337f 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # diff --git a/javafmllanguage/build.gradle b/javafmllanguage/build.gradle index d85d95e76c7..20434dc1361 100644 --- a/javafmllanguage/build.gradle +++ b/javafmllanguage/build.gradle @@ -10,7 +10,7 @@ apply plugin: 'org.javamodularity.moduleplugin' dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencies { - compileOnly('org.jetbrains:annotations:21.0.1') + compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") implementation(project(':fmlloader')) implementation(project(':fmlcore')) } diff --git a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java index 174b3a9661a..50b8265d8e8 100644 --- a/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java +++ b/javafmllanguage/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java @@ -18,14 +18,15 @@ import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; import java.util.Optional; -import static net.minecraftforge.fml.loading.LogMarkers.LOADING; - public class FMLModContainer extends ModContainer { private static final Logger LOGGER = LogManager.getLogger(); + private static final Marker LOADING = MarkerManager.getMarker("LOADING"); private final ModFileScanData scanResults; private final IEventBus eventBus; private Object modInstance; diff --git a/l4jManifest.xml b/l4jManifest.xml deleted file mode 100644 index a57d63e795b..00000000000 --- a/l4jManifest.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModContainer.java b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModContainer.java index 8e90f05ff56..049ccdfbe15 100644 --- a/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModContainer.java +++ b/lowcodelanguage/src/main/java/net/minecraftforge/fml/lowcodemod/LowCodeModContainer.java @@ -5,14 +5,14 @@ package net.minecraftforge.fml.lowcodemod; +import com.mojang.logging.LogUtils; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.IExtensionPoint; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.event.IModBusEvent; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.ModFileScanData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.util.Objects; @@ -20,7 +20,7 @@ public class LowCodeModContainer extends ModContainer { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ModFileScanData scanResults; private Object modInstance; diff --git a/mclanguage/build.gradle b/mclanguage/build.gradle index 9f1c151393f..2e386543e57 100644 --- a/mclanguage/build.gradle +++ b/mclanguage/build.gradle @@ -10,7 +10,7 @@ apply plugin: 'org.javamodularity.moduleplugin' dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencies { - compileOnly('org.jetbrains:annotations:21.0.1') + compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") implementation(project(':fmlloader')) implementation(project(':fmlcore')) } diff --git a/mdk/build.gradle b/mdk/build.gradle index 4f1e84df32e..f2dd6cf98d1 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -1,20 +1,8 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } -} -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. plugins { id 'eclipse' id 'maven-publish' + id 'net.minecraftforge.gradle' version '5.+' } -apply plugin: 'net.minecraftforge.gradle' - version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/mdk/settings.gradle b/mdk/settings.gradle new file mode 100644 index 00000000000..3703f364a95 --- /dev/null +++ b/mdk/settings.gradle @@ -0,0 +1,6 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = 'https://maven.minecraftforge.net/' } + } +} \ No newline at end of file diff --git a/mdk/src/main/resources/pack.mcmeta b/mdk/src/main/resources/pack.mcmeta index 6f2f48b7e4c..b643e13f888 100644 --- a/mdk/src/main/resources/pack.mcmeta +++ b/mdk/src/main/resources/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "description": "examplemod resources", "pack_format": 9, - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } } diff --git a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 910e5a4df4c..255fa4efb32 100644 --- a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -26,7 +26,7 @@ } this.m_83949_(); -@@ -292,4 +_,27 @@ +@@ -291,4 +_,27 @@ public int m_83980_() { return this.f_83924_; } diff --git a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch index 2bdeee44027..e84ad62200e 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/platform/Window.java +++ b/com/mojang/blaze3d/platform/Window.java -@@ -81,7 +_,7 @@ +@@ -80,7 +_,7 @@ GLFW.glfwWindowHint(139267, 2); GLFW.glfwWindowHint(139272, 204801); GLFW.glfwWindowHint(139270, 1); @@ -9,7 +9,7 @@ if (monitor != null) { VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty()); this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2; -@@ -299,6 +_,7 @@ +@@ -298,6 +_,7 @@ GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1); this.f_85361_ = aint[0] > 0 ? aint[0] : 1; this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1; diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch index f9feac5e30e..dc7c6274f70 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch @@ -1,14 +1,6 @@ --- a/com/mojang/blaze3d/vertex/BufferBuilder.java +++ b/com/mojang/blaze3d/vertex/BufferBuilder.java -@@ -332,6 +_,7 @@ - } - - ByteBuffer bytebuffer = this.f_85648_.slice(); -+ bytebuffer.order(this.f_85648_.order()); // FORGE: Fix incorrect byte order - this.f_85648_.clear(); - return Pair.of(bufferbuilder$drawstate, bytebuffer); - } -@@ -444,4 +_,15 @@ +@@ -486,4 +_,15 @@ this.f_166822_ = p_166829_; } } diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch index 2574be5e216..2b57d3de3d5 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/VertexFormat.java +++ b/com/mojang/blaze3d/vertex/VertexFormat.java -@@ -195,4 +_,11 @@ +@@ -181,4 +_,11 @@ return i; } } diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index 11fcabc3329..bb108875901 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -1,7 +1,7 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java -@@ -67,6 +_,15 @@ - return (new TextComponent("")).m_7220_(this.f_200947_.getFirst()).m_130946_(": ").m_7220_(this.f_200947_.getSecond()); +@@ -65,6 +_,15 @@ + return Component.m_237119_().m_7220_(this.f_200947_.getFirst()).m_130946_(": ").m_7220_(this.f_200947_.getSecond()); } + @Override diff --git a/patches/minecraft/net/minecraft/SharedConstants.java.patch b/patches/minecraft/net/minecraft/SharedConstants.java.patch index 69a6ecccb04..6076fa4557a 100644 --- a/patches/minecraft/net/minecraft/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/SharedConstants.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -183,6 +_,7 @@ +@@ -203,6 +_,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/Util.java.patch b/patches/minecraft/net/minecraft/Util.java.patch index 8dac1a5ae72..e0dcf5e7931 100644 --- a/patches/minecraft/net/minecraft/Util.java.patch +++ b/patches/minecraft/net/minecraft/Util.java.patch @@ -1,16 +1,18 @@ --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -155,6 +_,9 @@ +@@ -164,6 +_,11 @@ return 255; } -+ // We add this inner class to compensate for Mojang's missing inner class and allow us to obf subsequent anon inner classes correctly. -+ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT = new LongSupplier() { public long getAsLong() { return 0; } }; ++ // We add these inner classes to compensate for Mojang's missing inner classes and shift the anonymous class index. ++ // This allows us to obfuscate subsequent anonymous inner classes correctly. ++ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT1 = new LongSupplier() { public long getAsLong() { return 0; } }; ++ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT2 = new LongSupplier() { public long getAsLong() { return 0; } }; + public static ExecutorService m_183988_() { return f_137443_; } -@@ -233,7 +_,7 @@ +@@ -242,7 +_,7 @@ try { type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_); } catch (IllegalArgumentException illegalargumentexception) { diff --git a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch index 56c9ff33a31..1889d490454 100644 --- a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch +++ b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch @@ -1,16 +1,15 @@ --- a/net/minecraft/advancements/Advancement.java +++ b/net/minecraft/advancements/Advancement.java -@@ -129,8 +_,8 @@ +@@ -127,7 +_,7 @@ return this.f_138305_; } - public static class Builder { - @Nullable + public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder { + @Nullable private ResourceLocation f_138332_; @Nullable - private Advancement f_138333_; -@@ -320,7 +_,14 @@ +@@ -308,7 +_,14 @@ return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + "}"; } diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch index 2c51150adfd..80436c26c06 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementList.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/AdvancementList.java +++ b/net/minecraft/advancements/AdvancementList.java -@@ -91,6 +_,7 @@ +@@ -90,6 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch index f828d2248c6..8e49614e082 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch @@ -4,8 +4,8 @@ public void m_9989_(ServerPlayer p_9990_) { p_9990_.m_6756_(this.f_9979_); -- LootContext lootcontext = (new LootContext.Builder(p_9990_.m_183503_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78975_(LootContextParamSets.f_81418_); -+ LootContext lootcontext = (new LootContext.Builder(p_9990_.m_183503_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78963_(p_9990_.m_36336_()).m_78975_(LootContextParamSets.f_81418_); // FORGE: luck to LootContext +- LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_230911_(p_9990_.m_217043_()).m_78975_(LootContextParamSets.f_81418_); ++ LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_230911_(p_9990_.m_217043_()).m_78963_(p_9990_.m_36336_()).m_78975_(LootContextParamSets.f_81418_); // FORGE: luck to LootContext boolean flag = false; for(ResourceLocation resourcelocation : this.f_9980_) { diff --git a/patches/minecraft/net/minecraft/client/ClientRecipeBook.java.patch b/patches/minecraft/net/minecraft/client/ClientRecipeBook.java.patch index cf29f1ae9c9..2855244ad43 100644 --- a/patches/minecraft/net/minecraft/client/ClientRecipeBook.java.patch +++ b/patches/minecraft/net/minecraft/client/ClientRecipeBook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/ClientRecipeBook.java +++ b/net/minecraft/client/ClientRecipeBook.java -@@ -104,6 +_,8 @@ +@@ -103,6 +_,8 @@ } else if (recipetype == RecipeType.f_44113_) { return RecipeBookCategories.SMITHING; } else { diff --git a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch index 3237bef33ea..60bec959dac 100644 --- a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/KeyMapping.java +++ b/net/minecraft/client/KeyMapping.java -@@ -14,9 +_,9 @@ +@@ -13,9 +_,9 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -12,7 +12,7 @@ private static final Set f_90811_ = Sets.newHashSet(); public static final String f_167805_ = "key.categories.movement"; public static final String f_167806_ = "key.categories.misc"; -@@ -42,7 +_,7 @@ +@@ -41,7 +_,7 @@ private int f_90818_; public static void m_90835_(InputConstants.Key p_90836_) { @@ -21,7 +21,7 @@ if (keymapping != null) { ++keymapping.f_90818_; } -@@ -50,7 +_,7 @@ +@@ -49,7 +_,7 @@ } public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) { @@ -30,7 +30,7 @@ if (keymapping != null) { keymapping.m_7249_(p_90839_); } -@@ -74,10 +_,10 @@ +@@ -73,10 +_,10 @@ } public static void m_90854_() { @@ -43,7 +43,7 @@ } } -@@ -92,12 +_,12 @@ +@@ -91,12 +_,12 @@ this.f_90814_ = this.f_90816_; this.f_90815_ = p_90828_; f_90809_.put(p_90825_, this); @@ -58,7 +58,7 @@ } public String m_90858_() { -@@ -131,7 +_,13 @@ +@@ -130,7 +_,13 @@ } public int compareTo(KeyMapping p_90841_) { @@ -73,7 +73,7 @@ } public static Supplier m_90842_(String p_90843_) { -@@ -142,6 +_,20 @@ +@@ -141,6 +_,20 @@ } public boolean m_90850_(KeyMapping p_90851_) { @@ -94,7 +94,7 @@ return this.f_90816_.equals(p_90851_.f_90816_); } -@@ -162,11 +_,13 @@ +@@ -161,11 +_,13 @@ } public Component m_90863_() { @@ -109,7 +109,7 @@ } public String m_90865_() { -@@ -176,4 +_,84 @@ +@@ -175,4 +_,84 @@ public void m_7249_(boolean p_90846_) { this.f_90817_ = p_90846_; } diff --git a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch index c91cbc2702c..5aa624f564e 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/KeyboardHandler.java +++ b/net/minecraft/client/KeyboardHandler.java -@@ -307,7 +_,9 @@ +@@ -300,7 +_,9 @@ } Screen screen = this.f_90867_.f_91080_; @@ -10,8 +10,8 @@ + if (p_90897_ == 1) { if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) { this.f_90867_.m_91268_().m_85438_(); - this.f_90867_.f_91066_.f_92052_ = this.f_90867_.m_91268_().m_85440_(); -@@ -326,6 +_,8 @@ + this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_()); +@@ -318,6 +_,8 @@ }); return; } @@ -20,7 +20,7 @@ } if (NarratorChatListener.f_93311_.m_93316_()) { -@@ -349,11 +_,15 @@ +@@ -340,11 +_,15 @@ Screen.m_96579_(() -> { if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) { if (p_90897_ == 0) { @@ -38,7 +38,7 @@ } }, "keyPressed event handler", screen.getClass().getCanonicalName()); -@@ -406,22 +_,26 @@ +@@ -397,22 +_,26 @@ } } } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 7172b87a9af..5b0c81c6daa 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,31 +1,32 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -252,7 +_,7 @@ +@@ -236,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) -public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler { +public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft { - private static Minecraft f_90981_; + static Minecraft f_90981_; private static final Logger f_90982_ = LogUtils.getLogger(); public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX; -@@ -394,14 +_,13 @@ +@@ -385,7 +_,7 @@ this.f_91029_ = p_91084_.f_101908_.f_101928_; this.f_90986_ = p_91084_.f_101905_.f_101944_; this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_()); - this.f_91038_ = new PackRepository(Minecraft::m_167933_, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_)); + this.f_91038_ = new PackRepository(Minecraft::createClientPackAdapter, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_)); this.f_91030_ = p_91084_.f_101905_.f_101945_; - YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_); - this.f_91048_ = yggdrasilauthenticationservice.createMinecraftSessionService(); - this.f_193584_ = this.m_193585_(yggdrasilauthenticationservice, p_91084_); + this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_); + this.f_91048_ = this.f_231338_.createMinecraftSessionService(); +@@ -393,7 +_,6 @@ + this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey()); this.f_90998_ = p_91084_.f_101905_.f_101942_; f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_()); - f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_()); this.f_91033_ = p_91084_.f_101908_.f_101926_; this.f_91034_ = !p_91084_.f_101908_.f_101929_; this.f_91035_ = !p_91084_.f_101908_.f_101930_; -@@ -433,6 +_,7 @@ +@@ -426,6 +_,7 @@ } Util.f_137440_ = RenderSystem.m_69576_(); @@ -33,15 +34,15 @@ this.f_90989_ = new VirtualScreen(this); this.f_90990_ = this.f_90989_.m_110872_(displaydata, this.f_91066_.f_92123_, this.m_91270_()); this.m_7440_(true); -@@ -448,7 +_,6 @@ +@@ -445,7 +_,6 @@ - this.f_90990_.m_85380_(this.f_91066_.f_92113_); + this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_()); this.f_91067_ = new MouseHandler(this); - this.f_91067_.m_91524_(this.f_90990_.m_85439_()); this.f_91068_ = new KeyboardHandler(this); this.f_91068_.m_90887_(this.f_90990_.m_85439_()); RenderSystem.m_69580_(this.f_91066_.f_92035_, false); -@@ -456,6 +_,7 @@ +@@ -453,6 +_,7 @@ this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F); this.f_91042_.m_83954_(f_91002_); this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES); @@ -49,7 +50,7 @@ this.f_91038_.m_10506_(); this.f_91066_.m_92145_(this.f_91038_); this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_); -@@ -504,6 +_,7 @@ +@@ -500,6 +_,7 @@ this.m_91271_(); this.f_91036_.m_7217_(this.f_90997_); this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_); @@ -57,17 +58,17 @@ this.f_91036_.m_7217_(this.f_91061_); this.f_91053_ = new PaintingTextureManager(this.f_90987_); this.f_91036_.m_7217_(this.f_91053_); -@@ -512,7 +_,8 @@ +@@ -508,7 +_,8 @@ this.f_91047_ = new GpuWarnlistManager(); this.f_91036_.m_7217_(this.f_91047_); this.f_91036_.m_7217_(this.f_205120_); -- this.f_91065_ = new Gui(this); +- this.f_91065_ = new Gui(this, this.f_90995_); + this.f_91065_ = new net.minecraftforge.client.gui.ForgeIngameGui(this); + this.f_91067_.m_91524_(this.f_90990_.m_85439_()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. this.f_91064_ = new DebugRenderer(this); RenderSystem.m_69900_(this::m_91113_); if (this.f_91042_.f_83915_ == this.f_90990_.m_85441_() && this.f_91042_.f_83916_ == this.f_90990_.m_85442_()) { -@@ -530,6 +_,11 @@ +@@ -526,6 +_,11 @@ TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false); } @@ -76,10 +77,10 @@ + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterLayerDefinitions()); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers()); + - this.f_90990_.m_85409_(this.f_91066_.f_92041_); - this.f_90990_.m_85424_(this.f_91066_.f_92034_); + this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_()); + this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_()); this.f_90990_.m_85426_(); -@@ -545,13 +_,16 @@ +@@ -543,13 +_,16 @@ } this.f_167847_.m_168556_(); @@ -101,7 +102,7 @@ } -@@ -594,6 +_,8 @@ +@@ -592,6 +_,8 @@ private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { try { @@ -110,7 +111,7 @@ return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_()); } catch (AuthenticationException authenticationexception) { f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception); -@@ -606,7 +_,7 @@ +@@ -604,7 +_,7 @@ } private void m_91239_(Throwable p_91240_) { @@ -119,7 +120,7 @@ this.m_91241_(p_91240_, (Component)null); } else { Util.m_137559_(p_91240_); -@@ -763,13 +_,13 @@ +@@ -762,13 +_,13 @@ Bootstrap.m_135875_(p_91333_.m_127526_()); if (p_91333_.m_127527_() != null) { Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_()); @@ -136,7 +137,7 @@ } } -@@ -879,10 +_,6 @@ +@@ -892,10 +_,6 @@ f_90982_.error("setScreen called from non-game thread"); } @@ -147,7 +148,7 @@ if (p_91153_ == null && this.f_91073_ == null) { p_91153_ = new TitleScreen(); } else if (p_91153_ == null && this.f_91074_.m_21224_()) { -@@ -893,6 +_,15 @@ +@@ -906,6 +_,15 @@ } } @@ -163,7 +164,7 @@ this.f_91080_ = p_91153_; BufferUploader.m_166835_(); if (p_91153_ != null) { -@@ -1022,11 +_,13 @@ +@@ -1049,11 +_,13 @@ RenderSystem.m_69481_(); this.f_91026_.m_7238_(); if (!this.f_91079_) { @@ -177,7 +178,7 @@ } if (this.f_91056_ != null) { -@@ -1132,10 +_,12 @@ +@@ -1180,10 +_,12 @@ this.f_90990_.m_85378_((double)i); if (this.f_91080_ != null) { this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_()); @@ -190,7 +191,15 @@ this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_()); this.f_91067_.m_91599_(); } -@@ -1432,11 +_,21 @@ +@@ -1461,6 +_,7 @@ + } + + public void m_91395_() { ++ if (this.m_91396_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent()); + this.f_91019_ = false; + } + +@@ -1490,10 +_,18 @@ if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) { BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; BlockPos blockpos = blockhitresult.m_82425_(); @@ -205,20 +214,18 @@ + return; + } Direction direction = blockhitresult.m_82434_(); - if (this.f_91072_.m_105283_(blockpos, direction)) { +- if (this.f_91072_.m_105283_(blockpos, direction)) { - this.f_91061_.m_107367_(blockpos, direction); -+ if (inputEvent.shouldSwingHand()) { ++ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) { + this.f_91061_.addBlockHitEffects(blockpos, blockhitresult); this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); -+ } } } - -@@ -1460,14 +_,20 @@ +@@ -1518,14 +_,20 @@ return false; } else { boolean flag = false; -- switch(this.f_91077_.m_6662_()) { +- switch (this.f_91077_.m_6662_()) { + net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND); + HitResult.Type hitType = this.f_91077_.m_6662_(); + if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work. @@ -226,21 +233,21 @@ + } + if (!inputEvent.isCanceled()) + switch(hitType) { - case ENTITY: - this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_()); - break; - case BLOCK: - BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; - BlockPos blockpos = blockhitresult.m_82425_(); -- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { + case ENTITY: + this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_()); + break; + case BLOCK: + BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; + BlockPos blockpos = blockhitresult.m_82425_(); +- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { + if (!this.f_91073_.m_46859_(blockpos)) { - this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_()); - if (this.f_91073_.m_8055_(blockpos).m_60795_()) { - flag = true; -@@ -1480,8 +_,10 @@ - } + this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_()); + if (this.f_91073_.m_8055_(blockpos).m_60795_()) { + flag = true; +@@ -1538,8 +_,10 @@ + } - this.f_91074_.m_36334_(); + this.f_91074_.m_36334_(); + net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_); } @@ -248,7 +255,7 @@ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); return flag; } -@@ -1496,6 +_,11 @@ +@@ -1554,6 +_,11 @@ } for(InteractionHand interactionhand : InteractionHand.values()) { @@ -259,32 +266,32 @@ + } ItemStack itemstack = this.f_91074_.m_21120_(interactionhand); if (this.f_91077_ != null) { - switch(this.f_91077_.m_6662_()) { -@@ -1506,6 +_,7 @@ - return; - } + switch (this.f_91077_.m_6662_()) { +@@ -1564,6 +_,7 @@ + return; + } + if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code. - InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand); - if (!interactionresult.m_19077_()) { - interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand); -@@ -1513,6 +_,7 @@ + InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand); + if (!interactionresult.m_19077_()) { + interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand); +@@ -1571,6 +_,7 @@ - if (interactionresult.m_19077_()) { - if (interactionresult.m_19080_()) { + if (interactionresult.m_19077_()) { + if (interactionresult.m_19080_()) { + if (inputEvent.shouldSwingHand()) - this.f_91074_.m_6674_(interactionhand); - } + this.f_91074_.m_6674_(interactionhand); + } -@@ -1525,6 +_,7 @@ - InteractionResult interactionresult1 = this.f_91072_.m_105262_(this.f_91074_, this.f_91073_, interactionhand, blockhitresult); - if (interactionresult1.m_19077_()) { - if (interactionresult1.m_19080_()) { +@@ -1583,6 +_,7 @@ + InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult); + if (interactionresult1.m_19077_()) { + if (interactionresult1.m_19080_()) { + if (inputEvent.shouldSwingHand()) - this.f_91074_.m_6674_(interactionhand); - if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) { - this.f_91063_.f_109055_.m_109320_(interactionhand); -@@ -1540,6 +_,9 @@ + this.f_91074_.m_6674_(interactionhand); + if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) { + this.f_91063_.f_109055_.m_109320_(interactionhand); +@@ -1598,6 +_,9 @@ } } @@ -292,9 +299,9 @@ + net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand); + if (!itemstack.m_41619_()) { - InteractionResult interactionresult2 = this.f_91072_.m_105235_(this.f_91074_, this.f_91073_, interactionhand); + InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand); if (interactionresult2.m_19077_()) { -@@ -1566,6 +_,8 @@ +@@ -1624,6 +_,8 @@ --this.f_91011_; } @@ -303,7 +310,7 @@ this.f_91026_.m_6180_("gui"); this.f_91065_.m_193832_(this.f_91012_); this.f_91026_.m_7238_(); -@@ -1694,6 +_,8 @@ +@@ -1752,6 +_,8 @@ this.f_91026_.m_6182_("keyboard"); this.f_91068_.m_90931_(); this.f_91026_.m_7238_(); @@ -312,105 +319,26 @@ } private boolean m_91278_() { -@@ -1814,11 +_,11 @@ - } - - public void m_91200_(String p_91201_) { -- this.m_205205_(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP); -+ this.doLoadLevel(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP, false); - } - - public void m_205185_(String p_205186_, LevelSettings p_205187_, RegistryAccess p_205188_, WorldGenSettings p_205189_) { -- this.m_205205_(p_205186_, (p_210684_) -> { -+ this.doLoadLevel(p_205186_, (p_210684_) -> { - return p_205187_::m_46934_; - }, (p_210718_) -> { - return (p_210712_, p_210713_) -> { -@@ -1831,10 +_,10 @@ - WorldGenSettings worldgensettings = dataresult.getOrThrow(false, Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error)); - return Pair.of(new PrimaryLevelData(p_205187_, worldgensettings, dataresult.lifecycle()), registryaccess$writable.m_203557_()); - }; -- }, false, Minecraft.ExperimentalDialogType.CREATE); -+ }, false, Minecraft.ExperimentalDialogType.CREATE, true); - } - -- private void m_205205_(String p_205206_, Function p_205207_, Function p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_) { -+ private void doLoadLevel(String p_205206_, Function p_205207_, Function p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_, boolean creating) { - LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess; - try { - levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_205206_); -@@ -1849,11 +_,12 @@ - - WorldStem worldstem; - try { -+ if (!creating) levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); - worldstem = this.m_205125_(packrepository, p_205209_, p_205207_.apply(levelstoragesource$levelstorageaccess), p_205208_.apply(levelstoragesource$levelstorageaccess)); - } catch (Exception exception) { - f_90982_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception); - this.m_91152_(new DatapackLoadFailureScreen(() -> { -- this.m_205205_(p_205206_, p_205207_, p_205208_, true, p_205210_); -+ this.doLoadLevel(p_205206_, p_205207_, p_205208_, true, p_205210_, creating); - })); - - try { -@@ -1869,13 +_,15 @@ - WorldData worlddata = worldstem.f_206895_(); - boolean flag = worlddata.m_5961_().m_64670_(); - boolean flag1 = worlddata.m_5754_() != Lifecycle.stable(); -- if (p_205210_ == Minecraft.ExperimentalDialogType.NONE || !flag && !flag1) { -+ //Skip confirmation if it has been done already for this world -+ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning(); -+ if (skipConfirmation || p_205210_ == Minecraft.ExperimentalDialogType.NONE || !flag && !flag1) { - this.m_91399_(); - this.f_90999_.set((StoringChunkProgressListener)null); - - try { - RegistryAccess.Frozen registryaccess$frozen = worldstem.f_206894_(); -- levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); -+ levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); //TODO-PATCHING: Figure out what registry access needs to be passed in here. - worldstem.m_206901_(); - YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_); - MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); -@@ -1885,7 +_,7 @@ - SkullBlockEntity.m_196700_(gameprofilecache, minecraftsessionservice, this); - GameProfileCache.m_11004_(false); - this.f_91007_ = MinecraftServer.m_129872_((p_210695_) -> { -- return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> { -+ return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> { //TODO-PATCHING: Handle the registry freeze delay again. - StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_210795_ + 0); - this.f_90999_.set(storingchunkprogresslistener); - return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add); -@@ -1929,12 +_,19 @@ - connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_210793_) -> { - })); - connection.m_129512_(new ClientIntentionPacket(socketaddress.toString(), 0, ConnectionProtocol.LOGIN)); -- connection.m_129512_(new ServerboundHelloPacket(this.m_91094_().m_92548_())); -+ com.mojang.authlib.GameProfile gameProfile = this.m_91094_().m_92548_(); -+ if (!this.m_91094_().hasCachedProperties()) { -+ gameProfile = f_91048_.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.m_91094_().setProperties(gameProfile.getProperties()); -+ } -+ connection.m_129512_(new ServerboundHelloPacket(gameProfile)); - this.f_91009_ = connection; - } else { -+ if (flag) //FORGE: For legacy world options, let vanilla handle it. - this.m_91143_(p_205210_, p_205206_, flag, () -> { -- this.m_205205_(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE); -+ this.doLoadLevel(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE, creating); - }); -+ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(f_91031_, p_205206_, creating, p_205208_, wds -> () -> this.doLoadLevel(p_205206_, p_205207_, wds, p_205209_, ExperimentalDialogType.NONE, creating)); - worldstem.close(); - - try { -@@ -2026,6 +_,7 @@ +@@ -1894,8 +_,8 @@ + SkullBlockEntity.m_222885_(services, this); + GameProfileCache.m_11004_(false); + this.f_91007_ = MinecraftServer.m_129872_((p_231361_) -> { +- return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (p_231447_) -> { +- StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_231447_ + 0); ++ return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (p_210795_) -> { //TODO-PATCHING: Handle the registry freeze delay again. ++ StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_210795_ + 0); + this.f_90999_.set(storingchunkprogresslistener); + return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add); + }); +@@ -1945,6 +_,7 @@ } public void m_91156_(ClientLevel p_91157_) { + if (f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(f_91073_)); ProgressScreen progressscreen = new ProgressScreen(true); - progressscreen.m_6309_(new TranslatableComponent("connect.joining")); + progressscreen.m_6309_(Component.m_237115_("connect.joining")); this.m_91362_(progressscreen); -@@ -2058,10 +_,12 @@ +@@ -1978,10 +_,12 @@ IntegratedServer integratedserver = this.f_91007_; this.f_91007_ = null; this.f_91063_.m_109150_(); @@ -423,7 +351,7 @@ if (integratedserver != null) { this.f_91026_.m_6180_("waitForServer"); -@@ -2076,6 +_,7 @@ +@@ -1996,6 +_,7 @@ this.f_91065_.m_93089_(); this.f_91008_ = null; this.f_91010_ = false; @@ -431,7 +359,7 @@ this.f_91004_.m_90740_(); } -@@ -2162,66 +_,9 @@ +@@ -2082,66 +_,9 @@ private void m_91280_() { if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) { @@ -501,7 +429,7 @@ } } -@@ -2713,8 +_,8 @@ +@@ -2632,8 +_,8 @@ return this.f_90993_; } @@ -512,7 +440,7 @@ Supplier supplier = p_167937_; if (i <= 3) { supplier = m_91330_(p_167937_); -@@ -2724,7 +_,7 @@ +@@ -2643,7 +_,7 @@ supplier = m_91352_(supplier); } @@ -521,7 +449,7 @@ } private static Supplier m_91330_(Supplier p_91331_) { -@@ -2741,6 +_,14 @@ +@@ -2660,6 +_,14 @@ public void m_91312_(int p_91313_) { this.f_91051_.m_119410_(p_91313_); diff --git a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch index c3534811e8f..d4266d503d7 100644 --- a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch @@ -41,13 +41,13 @@ private void m_91526_(long p_91527_, double p_91528_, double p_91529_) { if (p_91527_ == Minecraft.m_91087_().m_91268_().m_85439_()) { -- double d0 = (this.f_91503_.f_91066_.f_92045_ ? Math.signum(p_91529_) : p_91529_) * this.f_91503_.f_91066_.f_92033_; +- double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(p_91529_) : p_91529_) * this.f_91503_.f_91066_.m_232122_().m_231551_(); + // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772 + double offset = p_91529_; + if (Minecraft.f_91002_ && p_91529_ == 0) { + offset = p_91528_; + } -+ double d0 = (this.f_91503_.f_91066_.f_92045_ ? Math.signum(offset) : offset) * this.f_91503_.f_91066_.f_92033_; ++ double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(offset) : offset) * this.f_91503_.f_91066_.m_232122_().m_231551_(); if (this.f_91503_.m_91265_() == null) { if (this.f_91503_.f_91080_ != null) { double d1 = this.f_91507_ * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_(); diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index 826b04f9e03..d2e11e5892f 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java -@@ -188,6 +_,7 @@ - public boolean f_92076_; +@@ -772,6 +_,7 @@ + } public Options(Minecraft p_92138_, File p_92139_) { + setForgeKeybindProperties(); this.f_92060_ = p_92138_; this.f_92110_ = new File(p_92139_, "options.txt"); - if (p_92138_.m_91103_() && Runtime.getRuntime().maxMemory() >= 1000000000L) { -@@ -302,10 +_,14 @@ - this.f_193762_ = p_168428_.m_142682_("allowServerListing", this.f_193762_); + boolean flag = p_92138_.m_91103_(); +@@ -887,10 +_,14 @@ + p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_); for(KeyMapping keymapping : this.f_92059_) { - String s = keymapping.m_90865_(); @@ -25,7 +25,7 @@ } } -@@ -493,6 +_,7 @@ +@@ -1058,6 +_,7 @@ } public void m_92169_() { @@ -33,7 +33,7 @@ try { final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8)); -@@ -641,6 +_,23 @@ +@@ -1205,6 +_,23 @@ } p_92146_.m_10509_(set); diff --git a/patches/minecraft/net/minecraft/client/RecipeBookCategories.java.patch b/patches/minecraft/net/minecraft/client/RecipeBookCategories.java.patch index 3ee67a58a79..ba40062a6ad 100644 --- a/patches/minecraft/net/minecraft/client/RecipeBookCategories.java.patch +++ b/patches/minecraft/net/minecraft/client/RecipeBookCategories.java.patch @@ -19,12 +19,12 @@ private RecipeBookCategories(ItemStack... p_92267_) { @@ -54,11 +_,17 @@ - case SMOKER: - return f_92256_; - default: + case SMOKER: + return f_92256_; + default: + if (net.minecraftforge.client.RecipeBookRegistry.TYPE_TO_CATEGORIES_VIEW.containsKey(p_92270_)) + return net.minecraftforge.client.RecipeBookRegistry.TYPE_TO_CATEGORIES_VIEW.get(p_92270_); - return ImmutableList.of(); + return ImmutableList.of(); } } diff --git a/patches/minecraft/net/minecraft/client/Screenshot.java.patch b/patches/minecraft/net/minecraft/client/Screenshot.java.patch index e60f21fc383..f940cee4739 100644 --- a/patches/minecraft/net/minecraft/client/Screenshot.java.patch +++ b/patches/minecraft/net/minecraft/client/Screenshot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Screenshot.java +++ b/net/minecraft/client/Screenshot.java -@@ -61,13 +_,23 @@ +@@ -59,13 +_,23 @@ file2 = new File(file1, p_92307_); } @@ -15,15 +15,15 @@ try { - nativeimage.m_85056_(file2); + nativeimage.m_85056_(target); - Component component = (new TextComponent(file2.getName())).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> { + Component component = Component.m_237113_(file2.getName()).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> { - return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); + return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())); }); -- p_92311_.accept(new TranslatableComponent("screenshot.success", component)); +- p_92311_.accept(Component.m_237110_("screenshot.success", component)); + if (event.getResultMessage() != null) + p_92311_.accept(event.getResultMessage()); + else -+ p_92311_.accept(new TranslatableComponent("screenshot.success", component)); ++ p_92311_.accept(Component.m_237110_("screenshot.success", component)); } catch (Exception exception) { f_92276_.warn("Couldn't save screenshot", (Throwable)exception); - p_92311_.accept(new TranslatableComponent("screenshot.failure", exception.getMessage())); + p_92311_.accept(Component.m_237110_("screenshot.failure", exception.getMessage())); diff --git a/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch b/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch index 531cd100559..c0ca58a0b0c 100644 --- a/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/color/block/BlockColors.java.patch @@ -5,8 +5,8 @@ public class BlockColors { private static final int f_168640_ = -1; - private final IdMapper f_92571_ = new IdMapper<>(32); -+ // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant -+ private final java.util.Map, BlockColor> f_92571_ = new java.util.HashMap<>(); ++ // FORGE: Use registry delegate as non-Vanilla block ids are not constant ++ private final java.util.Map, BlockColor> f_92571_ = new java.util.HashMap<>(); private final Map>> f_92572_ = Maps.newHashMap(); public static BlockColors m_92574_() { @@ -20,7 +20,7 @@ public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) { - BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92583_.m_60734_())); -+ BlockColor blockcolor = this.f_92571_.get(p_92583_.m_60734_().delegate); ++ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_())); if (blockcolor != null) { return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0); } else { @@ -29,14 +29,14 @@ public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) { - BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92578_.m_60734_())); -+ BlockColor blockcolor = this.f_92571_.get(p_92578_.m_60734_().delegate); ++ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_())); return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_); } public void m_92589_(BlockColor p_92590_, Block... p_92591_) { for(Block block : p_92591_) { - this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.m_7447_(block)); -+ this.f_92571_.put(block.delegate, p_92590_); ++ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_); } } diff --git a/patches/minecraft/net/minecraft/client/color/item/ItemColors.java.patch b/patches/minecraft/net/minecraft/client/color/item/ItemColors.java.patch index 1ab1c1def5d..5021f30bad0 100644 --- a/patches/minecraft/net/minecraft/client/color/item/ItemColors.java.patch +++ b/patches/minecraft/net/minecraft/client/color/item/ItemColors.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/color/item/ItemColors.java +++ b/net/minecraft/client/color/item/ItemColors.java -@@ -24,7 +_,8 @@ +@@ -25,7 +_,8 @@ @OnlyIn(Dist.CLIENT) public class ItemColors { private static final int f_168642_ = -1; - private final IdMapper f_92674_ = new IdMapper<>(32); -+ // FORGE: Use RegistryDelegates as non-Vanilla item ids are not constant -+ private final java.util.Map, ItemColor> f_92674_ = new java.util.HashMap<>(); ++ // FORGE: Use registry delegate as non-Vanilla item ids are not constant ++ private final java.util.Map, ItemColor> f_92674_ = new java.util.HashMap<>(); public static ItemColors m_92683_(BlockColors p_92684_) { ItemColors itemcolors = new ItemColors(); -@@ -84,17 +_,18 @@ - itemcolors.m_92689_((p_92693_, p_92694_) -> { - return p_92694_ == 0 ? -1 : MapItem.m_42918_(p_92693_); +@@ -88,17 +_,18 @@ + itemcolors.m_92689_((p_232352_, p_232353_) -> { + return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_); }, Items.f_42573_); + net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_); return itemcolors; @@ -20,14 +20,14 @@ public int m_92676_(ItemStack p_92677_, int p_92678_) { - ItemColor itemcolor = this.f_92674_.m_7942_(Registry.f_122827_.m_7447_(p_92677_.m_41720_())); -+ ItemColor itemcolor = this.f_92674_.get(p_92677_.m_41720_().delegate); ++ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_())); return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_); } public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) { for(ItemLike itemlike : p_92691_) { - this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_())); -+ this.f_92674_.put(itemlike.m_5456_().delegate, p_92690_); ++ this.f_92674_.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.m_5456_()), p_92690_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch index 72682e4eda9..4cd9e4b0ce1 100644 --- a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java -@@ -411,6 +_,7 @@ +@@ -400,6 +_,7 @@ if (this.f_92986_.f_91076_ != null && this.f_92986_.f_91076_ instanceof LivingEntity && f >= 1.0F) { flag = this.f_92986_.f_91074_.m_36333_() > 5.0F; flag &= this.f_92986_.f_91076_.m_6084_(); @@ -8,7 +8,7 @@ } int j = this.f_92978_ / 2 - 7 + 16; -@@ -463,6 +_,10 @@ +@@ -452,6 +_,10 @@ for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { MobEffect mobeffect = mobeffectinstance.m_19544_(); @@ -19,7 +19,7 @@ if (mobeffectinstance.m_19575_()) { int i = this.f_92977_; int j = 1; -@@ -500,6 +_,7 @@ +@@ -489,6 +_,7 @@ RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, f1); m_93200_(p_93029_, l + 3, i1 + 3, this.m_93252_(), 18, 18, textureatlassprite); }); @@ -27,12 +27,12 @@ } } -@@ -620,12 +_,13 @@ +@@ -609,12 +_,13 @@ public void m_93069_(PoseStack p_93070_) { this.f_92986_.m_91307_().m_6180_("selectedItemName"); if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) { -- MutableComponent mutablecomponent = (new TextComponent("")).m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_); -+ MutableComponent mutablecomponent = (new TextComponent("")).m_7220_(this.f_92994_.m_41786_()).m_130938_(this.f_92994_.m_41791_().getStyleModifier()); +- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_); ++ MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130938_(this.f_92994_.m_41791_().getStyleModifier()); if (this.f_92994_.m_41788_()) { mutablecomponent.m_130940_(ChatFormatting.ITALIC); } @@ -43,7 +43,7 @@ int j = (this.f_92977_ - i) / 2; int k = this.f_92978_ - 59; if (!this.f_92986_.f_91072_.m_105205_()) { -@@ -641,7 +_,13 @@ +@@ -630,7 +_,13 @@ RenderSystem.m_69478_(); RenderSystem.m_69453_(); m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0)); @@ -58,7 +58,7 @@ RenderSystem.m_69461_(); } } -@@ -1153,7 +_,7 @@ +@@ -1144,7 +_,7 @@ ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_(); if (itemstack.m_41619_()) { this.f_92993_ = 0; diff --git a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch index 130f63de498..e582815e1ac 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/AbstractWidget.java +++ b/net/minecraft/client/gui/components/AbstractWidget.java -@@ -86,7 +_,7 @@ +@@ -85,7 +_,7 @@ this.m_93228_(p_93676_, this.f_93620_, this.f_93621_, 0, 46 + i * 20, this.f_93618_ / 2, this.f_93619_); this.m_93228_(p_93676_, this.f_93620_ + this.f_93618_ / 2, this.f_93621_, 200 - this.f_93618_ / 2, 46 + i * 20, this.f_93618_ / 2, this.f_93619_); this.m_7906_(p_93676_, minecraft, p_93677_, p_93678_); @@ -9,7 +9,7 @@ m_93215_(p_93676_, font, this.m_6035_(), this.f_93620_ + this.f_93618_ / 2, this.f_93621_ + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24); } -@@ -181,6 +_,10 @@ +@@ -180,6 +_,10 @@ this.f_93618_ = p_93675_; } @@ -20,7 +20,7 @@ public void m_93650_(float p_93651_) { this.f_93625_ = p_93651_; } -@@ -203,6 +_,19 @@ +@@ -202,6 +_,19 @@ protected void m_93692_(boolean p_93693_) { this.f_93616_ = p_93693_; diff --git a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch index 548584b76a0..08759aa86b0 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/DebugScreenOverlay.java +++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java -@@ -399,6 +_,7 @@ +@@ -409,6 +_,7 @@ list.add(""); list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_()))); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/DeathScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/DeathScreen.java.patch index 438b09e4d2e..5b7d111e147 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/DeathScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/DeathScreen.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/gui/screens/DeathScreen.java +++ b/net/minecraft/client/gui/screens/DeathScreen.java -@@ -37,6 +_,7 @@ +@@ -36,6 +_,7 @@ }))); - this.f_169295_.add(this.m_142416_(new Button(this.f_96543_ / 2 - 100, this.f_96544_ / 4 + 96, 200, 20, new TranslatableComponent("deathScreen.titleScreen"), (p_95925_) -> { + this.f_169295_.add(this.m_142416_(new Button(this.f_96543_ / 2 - 100, this.f_96544_ / 4 + 96, 200, 20, Component.m_237115_("deathScreen.titleScreen"), (p_95925_) -> { if (this.f_95908_) { + m_95931_(true); this.m_95934_(); } else { - ConfirmScreen confirmscreen = new ConfirmScreen(this::m_95931_, new TranslatableComponent("deathScreen.quit.confirm"), TextComponent.f_131282_, new TranslatableComponent("deathScreen.titleScreen"), new TranslatableComponent("deathScreen.respawn")); + ConfirmScreen confirmscreen = new ConfirmScreen(this::m_95931_, Component.m_237115_("deathScreen.quit.confirm"), CommonComponents.f_237098_, Component.m_237115_("deathScreen.titleScreen"), Component.m_237115_("deathScreen.respawn")); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch index bbb6bf4c536..dbfd441b0bc 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/OptionsScreen.java +++ b/net/minecraft/client/gui/screens/OptionsScreen.java -@@ -141,4 +_,12 @@ +@@ -140,4 +_,12 @@ m_93215_(p_96249_, this.f_96547_, this.f_96539_, this.f_96543_ / 2, 15, 16777215); super.m_6305_(p_96249_, p_96250_, p_96251_, p_96252_); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch index 4ee57876d2b..7ea644ffa06 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/Screen.java +++ b/net/minecraft/client/gui/screens/Screen.java -@@ -127,7 +_,7 @@ +@@ -126,7 +_,7 @@ } public void m_7379_() { @@ -9,7 +9,7 @@ } protected T m_142416_(T p_169406_) { -@@ -164,15 +_,29 @@ +@@ -163,15 +_,29 @@ this.f_169368_.clear(); } @@ -43,7 +43,7 @@ this.m_169383_(p_169389_, list, p_169392_, p_169393_); } -@@ -185,20 +_,44 @@ +@@ -184,20 +_,44 @@ } public void m_96597_(PoseStack p_96598_, List p_96599_, int p_96600_, int p_96601_) { @@ -90,7 +90,7 @@ if (k > i) { i = k; } -@@ -206,8 +_,8 @@ +@@ -205,8 +_,8 @@ j += clienttooltipcomponent.m_142103_(); } @@ -101,7 +101,7 @@ if (j2 + i > this.f_96543_) { j2 -= 28 + i; } -@@ -228,15 +_,16 @@ +@@ -231,15 +_,16 @@ RenderSystem.m_157427_(GameRenderer::m_172811_); bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_); Matrix4f matrix4f = p_169384_.m_85850_().m_85861_(); @@ -127,7 +127,7 @@ RenderSystem.m_69482_(); RenderSystem.m_69472_(); RenderSystem.m_69478_(); -@@ -251,7 +_,7 @@ +@@ -253,7 +_,7 @@ for(int i2 = 0; i2 < p_169385_.size(); ++i2) { ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2); @@ -136,7 +136,7 @@ l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0); } -@@ -261,7 +_,7 @@ +@@ -263,7 +_,7 @@ for(int l2 = 0; l2 < p_169385_.size(); ++l2) { ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2); @@ -145,20 +145,7 @@ l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0); } -@@ -355,9 +_,12 @@ - } - - public void m_96612_(String p_96613_, boolean p_96614_) { -+ p_96613_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_96613_); -+ if (p_96613_.isEmpty()) return; - if (p_96614_) { - this.f_96541_.f_91065_.m_93076_().m_93783_(p_96613_); - } -+ if (net.minecraftforge.client.ClientCommandHandler.sendMessage(p_96613_)) return; - - this.f_96541_.f_91074_.m_108739_(p_96613_); - } -@@ -368,11 +_,21 @@ +@@ -363,9 +_,19 @@ this.f_96547_ = p_96607_.f_91062_; this.f_96543_ = p_96608_; this.f_96544_ = p_96609_; @@ -170,17 +157,15 @@ + f_96540_.add(b); + }; + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Pre(this, this.f_96540_, add, this::m_169411_))) { - this.m_169413_(); - this.m_7522_((GuiEventListener)null); - this.m_7856_(); + this.m_232761_(); this.m_169407_(false); this.m_169378_(f_169370_); + } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Post(this, this.f_96540_, add, this::m_169411_)); } - public List m_6702_() { -@@ -395,6 +_,7 @@ + protected void m_232761_() { +@@ -394,6 +_,7 @@ public void m_96558_(PoseStack p_96559_, int p_96560_) { if (this.f_96541_.f_91073_ != null) { this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680); @@ -188,7 +173,7 @@ } else { this.m_96626_(p_96560_); } -@@ -414,6 +_,7 @@ +@@ -413,6 +_,7 @@ bufferbuilder.m_5483_((double)this.f_96543_, 0.0D, 0.0D).m_7421_((float)this.f_96543_ / 32.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_(); bufferbuilder.m_5483_(0.0D, 0.0D, 0.0D).m_7421_(0.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_(); tesselator.m_85914_(); @@ -196,7 +181,7 @@ } public boolean m_7043_() { -@@ -499,6 +_,10 @@ +@@ -498,6 +_,10 @@ } public void m_7400_(List p_96591_) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch index acd4dcb64a7..112fe416c4d 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java -@@ -73,6 +_,7 @@ - private TitleScreen.Warning32Bit f_210857_; - private RealmsClient f_210858_; - private boolean f_210859_ = false; +@@ -66,6 +_,7 @@ + private long f_96715_; + @Nullable + private TitleScreen.WarningLabel f_232768_; + private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; public TitleScreen() { this(false); -@@ -131,11 +_,16 @@ +@@ -110,11 +_,16 @@ int j = this.f_96543_ - i - 2; int k = 24; int l = this.f_96544_ / 4 + 48; @@ -17,7 +17,7 @@ this.m_96772_(l, 24); } else { this.m_96763_(l, 24); -+ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, l + 24 * 2, 98, 20, new TranslatableComponent("fml.menu.mods"), button -> { ++ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, l + 24 * 2, 98, 20, Component.m_237115_("fml.menu.mods"), button -> { + this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this)); + })); } @@ -25,24 +25,24 @@ this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> { this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_())); -@@ -201,7 +_,7 @@ +@@ -169,7 +_,7 @@ Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this)); this.f_96541_.m_91152_(screen); }, button$ontooltip))).f_93623_ = flag; -- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, new TranslatableComponent("menu.online"), (p_211788_) -> { -+ (this.m_142416_(new Button(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20, new TranslatableComponent("menu.online"), (p_96771_) -> { +- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, Component.m_237115_("menu.online"), (p_210872_) -> { ++ (this.m_142416_(new Button(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20, Component.m_237115_("menu.online"), (p_96771_) -> { this.m_96793_(); }, button$ontooltip))).f_93623_ = flag; } -@@ -331,6 +_,7 @@ - this.f_210857_.f_210875_.m_6514_(p_96739_, this.f_210857_.f_210876_, this.f_210857_.f_210877_, 9, 16777215 | l); +@@ -298,6 +_,7 @@ + this.f_232768_.m_232790_(p_96739_, l); } + net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, l); if (this.f_96721_ != null) { p_96739_.m_85836_(); p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D); -@@ -353,7 +_,14 @@ +@@ -320,7 +_,14 @@ s = s + I18n.m_118938_("menu.modded"); } @@ -58,7 +58,7 @@ for(GuiEventListener guieventlistener : this.m_6702_()) { if (guieventlistener instanceof AbstractWidget) { -@@ -365,6 +_,7 @@ +@@ -332,6 +_,7 @@ if (this.m_96789_() && f1 >= 1.0F) { this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch index e69bb8ba9b4..25193d29fd8 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java -@@ -43,6 +_,7 @@ +@@ -42,6 +_,7 @@ @Nullable private AdvancementTab f_97336_; private boolean f_97337_; @@ -8,7 +8,7 @@ public AdvancementsScreen(ClientAdvancements p_97340_) { super(NarratorChatListener.f_93310_); -@@ -58,7 +_,13 @@ +@@ -57,7 +_,13 @@ } else { this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true); } @@ -16,14 +16,14 @@ + if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) { + int guiLeft = (this.f_96543_ - 252) / 2; + int guiTop = (this.f_96544_ - 140) / 2; -+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft, guiTop - 50, 20, 20, new net.minecraft.network.chat.TextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); -+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, new net.minecraft.network.chat.TextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft, guiTop - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); + maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS; + } } public void m_7861_() { -@@ -76,7 +_,7 @@ +@@ -75,7 +_,7 @@ int j = (this.f_96544_ - 140) / 2; for(AdvancementTab advancementtab : this.f_97335_.values()) { @@ -32,19 +32,19 @@ this.f_97334_.m_104401_(advancementtab.m_97182_(), true); break; } -@@ -100,6 +_,11 @@ +@@ -99,6 +_,11 @@ int i = (this.f_96543_ - 252) / 2; int j = (this.f_96544_ - 140) / 2; this.m_7333_(p_97361_); + if (maxPages != 0) { -+ net.minecraft.network.chat.Component page = new net.minecraft.network.chat.TextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); ++ net.minecraft.network.chat.Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1)); + int width = this.f_96547_.m_92852_(page); + this.f_96547_.m_92744_(p_97361_, page.m_7532_(), i + (252 / 2) - (width / 2), j - 44, -1); + } this.m_97373_(p_97361_, p_97362_, p_97363_, i, j); this.m_97356_(p_97361_, i, j); this.m_97381_(p_97361_, p_97362_, p_97363_, i, j); -@@ -150,12 +_,14 @@ +@@ -149,12 +_,14 @@ RenderSystem.m_157456_(0, f_97330_); for(AdvancementTab advancementtab : this.f_97335_.values()) { @@ -59,7 +59,7 @@ advancementtab1.m_97159_(p_97358_, p_97359_, this.f_96542_); } -@@ -181,7 +_,7 @@ +@@ -180,7 +_,7 @@ if (this.f_97335_.size() > 1) { for(AdvancementTab advancementtab : this.f_97335_.values()) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch index 6343977bd6f..f18b1aadd63 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java -@@ -53,7 +_,7 @@ +@@ -51,7 +_,7 @@ } protected int m_5756_() { @@ -9,7 +9,7 @@ } public int m_5759_() { -@@ -109,7 +_,7 @@ +@@ -107,7 +_,7 @@ KeyEntry(final KeyMapping p_193916_, final Component p_193917_) { this.f_193910_ = p_193916_; this.f_193911_ = p_193917_; @@ -18,15 +18,15 @@ KeyBindsList.this.f_193858_.f_193975_ = p_193916_; }) { protected MutableComponent m_5646_() { -@@ -117,6 +_,7 @@ +@@ -115,6 +_,7 @@ } }; - this.f_193913_ = new Button(0, 0, 50, 20, new TranslatableComponent("controls.reset"), (p_193935_) -> { + this.f_193913_ = new Button(0, 0, 50, 20, Component.m_237115_("controls.reset"), (p_193935_) -> { + this.f_193910_.setToDefault(); KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_()); KeyMapping.m_90854_(); }) { -@@ -130,7 +_,7 @@ +@@ -128,7 +_,7 @@ boolean flag = KeyBindsList.this.f_193858_.f_193975_ == this.f_193910_; float f = (float)(p_193926_ + 90 - KeyBindsList.this.f_193859_); KeyBindsList.this.f_93386_.f_91062_.m_92889_(p_193923_, this.f_193911_, f, (float)(p_193925_ + p_193928_ / 2 - 9 / 2), 16777215); @@ -35,7 +35,7 @@ this.f_193913_.f_93621_ = p_193925_; this.f_193913_.f_93623_ = !this.f_193910_.m_90864_(); this.f_193913_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_); -@@ -138,11 +_,12 @@ +@@ -136,11 +_,12 @@ this.f_193912_.f_93621_ = p_193925_; this.f_193912_.m_93666_(this.f_193910_.m_90863_()); boolean flag1 = false; @@ -49,9 +49,9 @@ } } } -@@ -150,7 +_,7 @@ +@@ -148,7 +_,7 @@ if (flag) { - this.f_193912_.m_93666_((new TextComponent("> ")).m_7220_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW)); + this.f_193912_.m_93666_(Component.m_237113_("> ").m_7220_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW)); } else if (flag1) { - this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.RED)); + this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED)); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch index 7891326ea8b..5a0a9bd0cba 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java @@ -31,7 +_,7 @@ this.m_7787_(this.f_193977_); - this.f_193978_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, new TranslatableComponent("controls.resetAll"), (p_193999_) -> { + this.f_193978_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, Component.m_237115_("controls.resetAll"), (p_193999_) -> { for(KeyMapping keymapping : this.f_96282_.f_92059_) { - keymapping.m_90848_(keymapping.m_90861_()); + keymapping.setToDefault(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 8e2cd08af50..d49e023ae12 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -108,7 +108,7 @@ this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE); } } -@@ -496,7 +_,7 @@ +@@ -495,7 +_,7 @@ this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT); } else if (!this.f_97732_.m_142621_().m_41619_()) { @@ -117,7 +117,7 @@ this.m_6597_(slot, k, p_97814_, ClickType.CLONE); } else { boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344)); -@@ -538,34 +_,39 @@ +@@ -542,34 +_,39 @@ } public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) { @@ -164,13 +164,13 @@ this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP); return true; } -@@ -600,6 +_,18 @@ +@@ -604,6 +_,18 @@ public T m_6262_() { return this.f_97732_; + } + -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public Slot getSlotUnderMouse() { return this.f_97734_; } + public int getGuiLeft() { return f_97735_; } + public int getGuiTop() { return f_97736_; } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 457f30e45a5..4e18a7ff4f2 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java -@@ -73,6 +_,8 @@ +@@ -72,6 +_,8 @@ private Slot f_98512_; private CreativeInventoryListener f_98513_; private boolean f_98514_; @@ -9,20 +9,20 @@ private boolean f_98515_; private final Set> f_98516_ = new HashSet<>(); -@@ -232,6 +_,12 @@ +@@ -231,6 +_,12 @@ protected void m_7856_() { if (this.f_96541_.f_91072_.m_105290_()) { super.m_7856_(); + int tabCount = CreativeModeTab.f_40748_.length; + if (tabCount > 12) { -+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_, f_97736_ - 50, 20, 20, new TextComponent("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); -+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_ + f_97726_ - 20, f_97736_ - 50, 20, 20, new TextComponent(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_, f_97736_ - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_ + f_97726_ - 20, f_97736_ - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))); + maxPages = (int) Math.ceil((tabCount - 12) / 10D); + } this.f_96541_.f_91068_.m_90926_(true); - this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, new TranslatableComponent("itemGroup.search")); + this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search")); this.f_98510_.m_94199_(50); -@@ -273,7 +_,7 @@ +@@ -272,7 +_,7 @@ public boolean m_5534_(char p_98521_, int p_98522_) { if (this.f_98514_) { return false; @@ -31,7 +31,7 @@ return false; } else { String s = this.f_98510_.m_94155_(); -@@ -291,7 +_,7 @@ +@@ -290,7 +_,7 @@ public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) { this.f_98514_ = false; @@ -40,7 +40,7 @@ if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) { this.f_98514_ = true; this.m_98560_(CreativeModeTab.f_40754_); -@@ -328,6 +_,32 @@ +@@ -327,6 +_,32 @@ private void m_98630_() { (this.f_97732_).f_98639_.clear(); this.f_98516_.clear(); @@ -73,7 +73,7 @@ String s = this.f_98510_.m_94155_(); if (s.isEmpty()) { for(Item item : Registry.f_122827_) { -@@ -372,9 +_,9 @@ +@@ -371,9 +_,9 @@ protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) { CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_]; @@ -85,7 +85,7 @@ } } -@@ -385,7 +_,7 @@ +@@ -384,7 +_,7 @@ double d1 = p_98532_ - (double)this.f_97736_; for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) { @@ -94,7 +94,7 @@ return true; } } -@@ -406,7 +_,7 @@ +@@ -405,7 +_,7 @@ this.f_98509_ = false; for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) { @@ -103,7 +103,7 @@ this.m_98560_(creativemodetab); return true; } -@@ -417,12 +_,15 @@ +@@ -416,12 +_,15 @@ } private boolean m_98631_() { @@ -118,7 +118,7 @@ + slotColor = p_98561_.getSlotColor(); this.f_97737_.clear(); (this.f_97732_).f_98639_.clear(); - if (p_98561_ == CreativeModeTab.f_40760_) { + this.m_238391_(); @@ -499,13 +_,15 @@ } @@ -162,7 +162,7 @@ } + if (maxPages != 0) { -+ Component page = new TextComponent(String.format("%d / %d", tabPage + 1, maxPages + 1)); ++ Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1)); + this.m_93250_(300); + this.f_96542_.f_115093_ = 300.0F; + f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2) - (f_96547_.m_92852_(page) / 2), f_97736_ - 44, -1); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch index bea69fe6c3f..42964990f43 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java -@@ -44,12 +_,15 @@ +@@ -42,12 +_,15 @@ if (!collection.isEmpty() && j >= 32) { RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F); boolean flag = j >= 120; @@ -17,7 +17,7 @@ this.m_194002_(p_194015_, i, k, iterable, flag); this.m_194008_(p_194015_, i, k, iterable, flag); if (flag) { -@@ -110,6 +_,12 @@ +@@ -108,6 +_,12 @@ int i = this.f_97736_; for(MobEffectInstance mobeffectinstance : p_98726_) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch index a88da97caa7..e79bb5c6490 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java -@@ -151,7 +_,7 @@ +@@ -150,7 +_,7 @@ int i2 = 86 - this.f_96547_.m_92895_(s); FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, i2); int j2 = 6839882; @@ -9,20 +9,20 @@ this.m_93228_(p_98762_, j1, j + 14 + 19 * i1, 0, 185, 108, 19); this.m_93228_(p_98762_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); this.f_96547_.m_92857_(formattedtext, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); -@@ -190,10 +_,13 @@ +@@ -189,10 +_,13 @@ Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]); int l = (this.f_97732_).f_39448_[j]; int i1 = j + 1; - if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_98768_, (double)p_98769_) && k > 0 && l >= 0 && enchantment != null) { + if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_98768_, (double)p_98769_) && k > 0) { List list = Lists.newArrayList(); -- list.add((new TranslatableComponent("container.enchant.clue", enchantment.m_44700_(l))).m_130940_(ChatFormatting.WHITE)); +- list.add(Component.m_237110_("container.enchant.clue", enchantment.m_44700_(l)).m_130940_(ChatFormatting.WHITE)); - if (!flag) { -+ list.add((new TranslatableComponent("container.enchant.clue", enchantment == null ? "" : enchantment.m_44700_(l))).m_130940_(ChatFormatting.WHITE)); ++ list.add((Component.m_237110_("container.enchant.clue", enchantment == null ? "" : enchantment.m_44700_(l))).m_130940_(ChatFormatting.WHITE)); + if (enchantment == null) { -+ list.add(new TextComponent("")); -+ list.add(new TranslatableComponent("forge.container.enchant.limitedEnchantability").m_130940_(ChatFormatting.RED)); ++ list.add(Component.m_237113_("")); ++ list.add(Component.m_237115_("forge.container.enchant.limitedEnchantability").m_130940_(ChatFormatting.RED)); + } else if (!flag) { - list.add(TextComponent.f_131282_); + list.add(CommonComponents.f_237098_); if (this.f_96541_.f_91074_.f_36078_ < k) { - list.add((new TranslatableComponent("container.enchant.level.requirement", (this.f_97732_).f_39446_[j])).m_130940_(ChatFormatting.RED)); + list.add(Component.m_237110_("container.enchant.level.requirement", (this.f_97732_).f_39446_[j]).m_130940_(ChatFormatting.RED)); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/LoomScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/LoomScreen.java.patch deleted file mode 100644 index cc67b94ce2f..00000000000 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/LoomScreen.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/net/minecraft/client/gui/screens/inventory/LoomScreen.java -+++ b/net/minecraft/client/gui/screens/inventory/LoomScreen.java -@@ -125,20 +_,20 @@ - int l2 = j + 13; - int l = this.f_99072_ + 16; - -- for(int i1 = this.f_99072_; i1 < l && i1 < BannerPattern.f_58526_ - BannerPattern.f_58527_; ++i1) { -+ for(int i1 = this.f_99072_; i1 < l && i1 < net.minecraftforge.common.ForgeHooks.getNonPatternItemCount(); ++i1) { - int j1 = i1 - this.f_99072_; - int k1 = j2 + j1 % 4 * 14; - int l1 = l2 + j1 / 4 * 14; - RenderSystem.m_157456_(0, f_99060_); - int i2 = this.f_97727_; -- if (i1 == this.f_97732_.m_39891_()) { -+ if (net.minecraftforge.common.ForgeHooks.getActualPatternIndex(i1) == this.f_97732_.m_39891_()) { - i2 += 14; - } else if (p_99101_ >= k1 && p_99102_ >= l1 && p_99101_ < k1 + 14 && p_99102_ < l1 + 14) { - i2 += 28; - } - - this.m_93228_(p_99099_, k1, l1, 0, i2, 14, 14); -- this.m_99108_(i1, k1, l1); -+ this.m_99108_(net.minecraftforge.common.ForgeHooks.getActualPatternIndex(i1), k1, l1); - } - } else if (this.f_99068_) { - int k2 = i + 60; -@@ -209,7 +_,7 @@ - int j = i + 56; - this.f_99070_ = ((float)p_99088_ - (float)i - 7.5F) / ((float)(j - i) - 15.0F); - this.f_99070_ = Mth.m_14036_(this.f_99070_, 0.0F, 1.0F); -- int k = f_99061_ - 4; -+ int k = net.minecraftforge.common.ForgeHooks.getTotalPatternRows() - 4; - int l = (int)((double)(this.f_99070_ * (float)k) + 0.5D); - if (l < 0) { - l = 0; -@@ -224,7 +_,7 @@ - - public boolean m_6050_(double p_99079_, double p_99080_, double p_99081_) { - if (this.f_99067_) { -- int i = f_99061_ - 4; -+ int i = net.minecraftforge.common.ForgeHooks.getTotalPatternRows() - 4; - float f = (float)p_99081_ / (float)i; - this.f_99070_ = Mth.m_14036_(this.f_99070_ - f, 0.0F, 1.0F); - this.f_99072_ = 1 + (int)(this.f_99070_ * (float)i + 0.5F) * 4; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch index a4c259b70a9..22842acb97f 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java +++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java -@@ -250,6 +_,11 @@ +@@ -263,6 +_,11 @@ } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch index f6fa61b2127..c5c9b3e9ad6 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java +++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java -@@ -334,6 +_,8 @@ +@@ -321,6 +_,8 @@ this.f_99855_.m_99707_(list1); } + net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_99879_, p_99882_, p_99881_, p_99883_, i1, j1); + - if (this.f_99856_.f_91066_.f_92051_ || p_99887_) { + if (this.f_99856_.f_91066_.m_231828_().m_231551_() || p_99887_) { RenderSystem.m_157456_(0, ServerSelectionList.f_99759_); GuiComponent.m_93172_(p_99879_, p_99882_, p_99881_, p_99882_ + 32, p_99881_ + 32, -1601138544); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch index 6afde4d114c..ec662d3d9cc 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java +++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java -@@ -139,7 +_,7 @@ +@@ -137,7 +_,7 @@ private void m_100013_(TransferableSelectionList p_100014_, Stream p_100015_) { p_100014_.m_6702_().clear(); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch index 4dd1b853d63..220e6f093ab 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java -@@ -107,7 +_,7 @@ +@@ -106,7 +_,7 @@ this.m_5674_(); this.f_100279_.clear(); @@ -9,7 +9,7 @@ this.f_100279_.add(new RecipeBookTabButton(recipebookcategories)); } -@@ -319,7 +_,7 @@ +@@ -318,7 +_,7 @@ } if (itemstack != null && this.f_100272_.f_91080_ != null) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index 97391bc335b..ed356fd4c99 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java -@@ -106,7 +_,7 @@ - - public static CreateWorldScreen m_205424_(@Nullable Screen p_205425_) { - RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.f_123049_.get(); -- return new CreateWorldScreen(p_205425_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$frozen, WorldGenSettings.m_190050_(registryaccess$frozen), Optional.of(WorldPreset.f_101506_), OptionalLong.empty())); -+ return new CreateWorldScreen(p_205425_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$frozen, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset().map(type -> type.m_205485_(registryaccess$frozen, new java.util.Random().nextLong(), true, false)).orElseGet(() -> WorldGenSettings.m_190050_(registryaccess$frozen)), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset(), OptionalLong.empty())); - } - - public static CreateWorldScreen m_205426_(@Nullable Screen p_205427_, WorldStem p_205428_, @Nullable Path p_205429_) { -@@ -625,6 +_,7 @@ +@@ -653,6 +_,7 @@ File file1 = path.toFile(); if (this.f_100832_ == null) { this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_)); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch deleted file mode 100644 index b69f42adc01..00000000000 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java -+++ b/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java -@@ -107,6 +_,7 @@ - this.f_170244_.f_93624_ = false; - this.f_101391_ = p_101430_.m_142416_(new Button(j, 120, 150, 20, new TranslatableComponent("selectWorld.customizeType"), (p_170248_) -> { - WorldPreset.PresetEditor worldpreset$preseteditor = WorldPreset.f_101509_.get(this.f_101395_); -+ worldpreset$preseteditor = net.minecraftforge.client.ForgeHooksClient.getPresetEditor(this.f_101395_, worldpreset$preseteditor); - if (worldpreset$preseteditor != null) { - p_101431_.m_91152_(worldpreset$preseteditor.m_101642_(p_101430_, this.f_101394_)); - } -@@ -273,7 +_,7 @@ - } else { - this.f_101389_.f_93624_ = p_170288_; - this.f_101380_.f_93624_ = p_170288_; -- this.f_101391_.f_93624_ = p_170288_ && WorldPreset.f_101509_.containsKey(this.f_101395_); -+ this.f_101391_.f_93624_ = p_170288_ && (WorldPreset.f_101509_.containsKey(this.f_101395_) || net.minecraftforge.client.ForgeHooksClient.hasPresetEditor(this.f_101395_)); - this.f_101392_.f_93624_ = p_170288_; - } - diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch new file mode 100644 index 00000000000..3e9f703eaa0 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch @@ -0,0 +1,33 @@ +--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java ++++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +@@ -66,6 +_,7 @@ + + try { + WorldLoader.PackConfig worldloader$packconfig = new WorldLoader.PackConfig(packrepository, datapackconfig, false); ++ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it + WorldStem worldstem = this.m_233096_(worldloader$packconfig, (p_233103_, p_233104_) -> { + return Pair.of(new PrimaryLevelData(p_233159_, p_233161_, Lifecycle.stable()), p_233160_.m_203557_()); + }); +@@ -151,7 +_,9 @@ + WorldData worlddata = worldstem.f_206895_(); + boolean flag = worlddata.m_5961_().m_64670_(); + boolean flag1 = worlddata.m_5754_() != Lifecycle.stable(); +- if (!p_233149_ || !flag && !flag1) { ++ // Forge: Skip confirmation if it has been done already for this world ++ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning(); ++ if (skipConfirmation || !p_233149_ || !flag && !flag1) { + this.f_233089_.m_91100_().m_235003_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> { + return true; + }).exceptionallyComposeAsync((p_233183_) -> { +@@ -173,9 +_,11 @@ + return null; + }); + } else { ++ if (flag) // Forge: For legacy world options, let vanilla handle it. + this.m_233140_(p_233146_, p_233147_, flag, () -> { + this.m_233145_(p_233146_, p_233147_, p_233148_, false); + }); ++ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(p_233147_, levelstoragesource$levelstorageaccess, packrepository, worldstem); + worldstem.close(); + m_233116_(levelstoragesource$levelstorageaccess, p_233147_); + } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch deleted file mode 100644 index a4680d8718e..00000000000 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/gui/screens/worldselection/WorldPreset.java -+++ b/net/minecraft/client/gui/screens/worldselection/WorldPreset.java -@@ -93,6 +_,9 @@ - WorldPreset(String p_101519_) { - this.f_101516_ = new TranslatableComponent("generator." + p_101519_); - } -+ public WorldPreset(Component displayName) { -+ this.f_101516_ = displayName; -+ } - - private static WorldGenSettings m_205493_(RegistryAccess p_205494_, WorldGenSettings p_205495_, Holder p_205496_) { - BiomeSource biomesource = new FixedBiomeSource(p_205496_); -@@ -134,4 +_,8 @@ - public interface PresetEditor { - Screen m_101642_(CreateWorldScreen p_101643_, WorldGenSettings p_101644_); - } -+ -+ // Forge start -+ // For internal use only, automatically called for all ForgeWorldTypes. Register your ForgeWorldType in the forge registry! -+ public static void registerGenerator(WorldPreset gen) { f_101508_.add(gen); } - } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch index 5d369310812..62959cc46d7 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java -@@ -64,6 +_,7 @@ +@@ -68,6 +_,7 @@ static final DateFormat f_101646_ = new SimpleDateFormat(); static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png"); static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.png"); + private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png"); - static final Component f_101649_ = (new TranslatableComponent("selectWorld.tooltip.fromNewerVersion1")).m_130940_(ChatFormatting.RED); - static final Component f_101650_ = (new TranslatableComponent("selectWorld.tooltip.fromNewerVersion2")).m_130940_(ChatFormatting.RED); - static final Component f_101651_ = (new TranslatableComponent("selectWorld.tooltip.snapshot1")).m_130940_(ChatFormatting.GOLD); -@@ -207,6 +_,7 @@ + static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED); + static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED); + static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD); +@@ -326,6 +_,7 @@ RenderSystem.m_69478_(); GuiComponent.m_93133_(p_101721_, p_101724_, p_101723_, 0.0F, 0.0F, 32, 32, 32, 32); RenderSystem.m_69461_(); + renderExperimentalWarning(p_101721_, p_101727_, p_101728_, p_101723_, p_101724_); - if (this.f_101693_.f_91066_.f_92051_ || p_101729_) { + if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) { RenderSystem.m_157456_(0, WorldSelectionList.f_101648_); GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544); -@@ -524,6 +_,19 @@ +@@ -647,6 +_,19 @@ - public String m_170324_() { - return this.f_101695_.m_78361_(); + public boolean m_214209_() { + return !this.f_101695_.m_164916_(); + } + private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) { + if (this.f_101695_.isExperimental()) { @@ -29,7 +29,7 @@ + //Reset texture to what it was before + RenderSystem.m_157456_(0, this.f_101698_ != null ? this.f_101696_ : WorldSelectionList.f_101647_); + if (WorldSelectionList.this.m_93412_(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) { -+ List tooltip = Minecraft.m_91087_().f_91062_.m_92923_(new TranslatableComponent("forge.experimentalsettings.tooltip"), 200); ++ List tooltip = Minecraft.m_91087_().f_91062_.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200); + WorldSelectionList.this.f_101654_.m_96617_(stack, tooltip, mouseX, mouseY); + } + } diff --git a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch index acf31ddefe4..20086835712 100644 --- a/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch +++ b/patches/minecraft/net/minecraft/client/model/geom/LayerDefinitions.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java -@@ -284,6 +_,7 @@ +@@ -293,6 +_,7 @@ WoodType.m_61843_().forEach((p_171114_) -> { - builder.put(ModelLayers.m_171291_(p_171114_), layerdefinition19); + builder.put(ModelLayers.m_171291_(p_171114_), layerdefinition20); }); + net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder); ImmutableMap immutablemap = builder.build(); diff --git a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch b/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch index 0ee6a42e259..0e7241950e3 100644 --- a/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch +++ b/patches/minecraft/net/minecraft/client/model/geom/ModelLayers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/model/geom/ModelLayers.java +++ b/net/minecraft/client/model/geom/ModelLayers.java -@@ -199,7 +_,8 @@ +@@ -207,7 +_,8 @@ } public static ModelLayerLocation m_171291_(WoodType p_171292_) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch index 18e172351ac..6c1d569bae8 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java -@@ -115,6 +_,7 @@ - this.f_104521_.accept(new TranslatableComponent("connect.joining")); +@@ -126,6 +_,7 @@ + this.f_104521_.accept(Component.m_237115_("connect.joining")); this.f_104523_ = p_104547_.m_134774_(); this.f_104522_.m_129498_(ConnectionProtocol.PLAY); + net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_); this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_())); } -@@ -122,7 +_,7 @@ +@@ -133,7 +_,7 @@ if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) { this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_)); } else { @@ -17,11 +17,11 @@ } } -@@ -143,6 +_,7 @@ +@@ -154,6 +_,7 @@ } public void m_7254_(ClientboundCustomQueryPacket p_104545_) { + if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_104545_, this.f_104522_)) return; - this.f_104521_.accept(new TranslatableComponent("connect.negotiating")); + this.f_104521_.accept(Component.m_237115_("connect.negotiating")); this.f_104522_.m_129512_(new ServerboundCustomQueryPacket(p_104545_.m_134755_(), (FriendlyByteBuf)null)); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch index abd9dadcdac..f35dbee5b22 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java -@@ -117,6 +_,7 @@ - private final Deque f_194122_ = Queues.newArrayDeque(); +@@ -121,6 +_,7 @@ private int f_194123_; + private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler(); private static final Set f_194124_ = Set.of(Items.f_42127_, Items.f_151033_); + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); - public ClientLevel(ClientPacketListener p_205505_, ClientLevel.ClientLevelData p_205506_, ResourceKey p_205507_, Holder p_205508_, int p_205509_, int p_205510_, Supplier p_205511_, LevelRenderer p_205512_, boolean p_205513_, long p_205514_) { - super(p_205506_, p_205507_, p_205508_, p_205511_, true, p_205513_, p_205514_); -@@ -129,6 +_,8 @@ + public void m_233651_(int p_233652_) { + this.f_233599_.m_233856_(p_233652_, this); +@@ -174,6 +_,8 @@ this.f_194123_ = p_205510_; this.m_46465_(); this.m_46466_(); @@ -17,7 +17,7 @@ } public void m_194171_(Runnable p_194172_) { -@@ -215,6 +_,7 @@ +@@ -260,6 +_,7 @@ this.m_46473_().m_6521_(() -> { return Registry.f_122826_.m_7981_(p_104640_.m_6095_()).toString(); }); @@ -25,7 +25,7 @@ p_104640_.m_8119_(); this.m_46473_().m_7238_(); -@@ -277,8 +_,10 @@ +@@ -322,8 +_,10 @@ } private void m_104739_(int p_104740_, Entity p_104741_) { @@ -36,31 +36,33 @@ } public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) { -@@ -409,6 +_,11 @@ +@@ -450,6 +_,12 @@ } - public void m_6263_(@Nullable Player p_104645_, double p_104646_, double p_104647_, double p_104648_, SoundEvent p_104649_, SoundSource p_104650_, float p_104651_, float p_104652_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_104645_, p_104649_, p_104650_, p_104651_, p_104652_); + public void m_214150_(@Nullable Player p_233621_, double p_233622_, double p_233623_, double p_233624_, SoundEvent p_233625_, SoundSource p_233626_, float p_233627_, float p_233628_, long p_233629_) { ++ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_); + if (event.isCanceled() || event.getSound() == null) return; -+ p_104649_ = event.getSound(); -+ p_104650_ = event.getCategory(); -+ p_104651_ = event.getVolume(); - if (p_104645_ == this.f_104565_.f_91074_) { - this.m_7785_(p_104646_, p_104647_, p_104648_, p_104649_, p_104650_, p_104651_, p_104652_, false); ++ p_233625_ = event.getSound(); ++ p_233626_ = event.getSource(); ++ p_233627_ = event.getNewVolume(); ++ p_233628_ = event.getNewPitch(); + if (p_233621_ == this.f_104565_.f_91074_) { + this.m_233602_(p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_, false, p_233629_); } -@@ -416,6 +_,11 @@ +@@ -457,6 +_,12 @@ } - public void m_6269_(@Nullable Player p_104659_, Entity p_104660_, SoundEvent p_104661_, SoundSource p_104662_, float p_104663_, float p_104664_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_104659_, p_104661_, p_104662_, p_104663_, p_104664_); + public void m_213890_(@Nullable Player p_233631_, Entity p_233632_, SoundEvent p_233633_, SoundSource p_233634_, float p_233635_, float p_233636_, long p_233637_) { ++ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_233631_, p_233633_, p_233634_, p_233635_, p_233636_); + if (event.isCanceled() || event.getSound() == null) return; -+ p_104661_ = event.getSound(); -+ p_104662_ = event.getCategory(); -+ p_104663_ = event.getVolume(); - if (p_104659_ == this.f_104565_.f_91074_) { - this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_104661_, p_104662_, p_104663_, p_104664_, p_104660_)); ++ p_233633_ = event.getSound(); ++ p_233634_ = event.getSource(); ++ p_233635_ = event.getNewVolume(); ++ p_233636_ = event.getNewPitch(); + if (p_233631_ == this.f_104565_.f_91074_) { + this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_233633_, p_233634_, p_233635_, p_233636_, p_233632_, p_233637_)); } -@@ -870,6 +_,7 @@ +@@ -902,6 +_,7 @@ } public void m_104851_(Difficulty p_104852_) { @@ -68,13 +70,13 @@ this.f_104840_ = p_104852_; } -@@ -907,11 +_,30 @@ +@@ -939,14 +_,33 @@ ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_); } + if (p_171712_.isMultipartEntity()) { + for (net.minecraftforge.entity.PartEntity part : p_171712_.getParts()) { -+ ClientLevel.this.partEntities.put(part.m_142049_(), part); ++ ClientLevel.this.partEntities.put(part.m_19879_(), part); + } + } } @@ -88,10 +90,13 @@ + + if (p_171716_.isMultipartEntity()) { + for (net.minecraftforge.entity.PartEntity part : p_171716_.getParts()) { -+ ClientLevel.this.partEntities.remove(part.m_142049_()); ++ ClientLevel.this.partEntities.remove(part.m_19879_()); + } + } } + + public void m_214006_(Entity p_233660_) { + } + } + + @Override diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index c69570d52f7..cbc03e9e020 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java -@@ -360,6 +_,7 @@ +@@ -361,6 +_,7 @@ this.f_104888_.f_91064_.m_113434_(); this.f_104888_.f_91074_.m_172530_(); @@ -8,26 +8,24 @@ int i = p_105030_.f_132360_(); this.f_104888_.f_91074_.m_20234_(i); this.f_104889_.m_104630_(i, this.f_104888_.f_91074_); -@@ -371,6 +_,7 @@ - this.f_104888_.f_91074_.m_108711_(p_105030_.f_132372_()); +@@ -373,6 +_,7 @@ + this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_()); this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_()); this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_()); + net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER"); this.f_104888_.f_91066_.m_92172_(); this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_()))); this.f_104888_.m_91309_().m_90739_(); -@@ -712,7 +_,9 @@ +@@ -768,6 +_,8 @@ + } - public void m_5784_(ClientboundChatPacket p_104986_) { - PacketUtils.m_131363_(p_104986_, this, this.f_104888_); -- this.f_104888_.f_91065_.m_93051_(p_104986_.m_131840_(), p_104986_.m_131836_(), p_104986_.m_131841_()); -+ net.minecraft.network.chat.Component message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_104986_.m_131840_(), p_104986_.m_131836_(), p_104986_.m_131841_()); -+ if (message == null) return; -+ this.f_104888_.f_91065_.m_93051_(p_104986_.m_131840_(), message, p_104986_.m_131841_()); + Component component = flag ? p_233693_.f_237213_() : p_233693_.m_237220_(); ++ component = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_233692_, component, p_233694_); ++ if (component == null) return; + this.f_104888_.f_91065_.m_232360_(p_233692_, component, p_233694_); } - public void m_7791_(ClientboundAnimatePacket p_104968_) { -@@ -894,8 +_,10 @@ +@@ -931,8 +_,10 @@ localplayer1.m_21204_().m_22159_(localplayer.m_21204_()); } @@ -38,7 +36,7 @@ this.f_104889_.m_104630_(i, localplayer1); localplayer1.m_146922_(-180.0F); localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_); -@@ -998,10 +_,7 @@ +@@ -1036,10 +_,7 @@ PacketUtils.m_131363_(p_104976_, this, this.f_104888_); BlockPos blockpos = p_104976_.m_131704_(); this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> { @@ -50,33 +48,33 @@ if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) { ((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_(); -@@ -1147,6 +_,7 @@ +@@ -1185,6 +_,7 @@ public void m_7443_(ClientboundCommandsPacket p_104990_) { PacketUtils.m_131363_(p_104990_, this, this.f_104888_); - this.f_104899_ = new CommandDispatcher<>(p_104990_.m_131884_()); + this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(new CommandBuildContext(this.f_104903_))); + this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_); } public void m_7183_(ClientboundStopSoundPacket p_105116_) { -@@ -1168,6 +_,7 @@ +@@ -1203,6 +_,7 @@ + ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_(); clientrecipebook.m_90625_(this.f_104900_.m_44051_()); - clientrecipebook.m_90639_().forEach(mutablesearchtree::m_8080_); - mutablesearchtree.m_7729_(); + this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_()); + net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.f_104900_); } public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) { -@@ -1262,6 +_,7 @@ - } +@@ -1304,6 +_,7 @@ - this.f_104888_.m_91171_(SearchRegistry.f_119942_).m_7729_(); + this.f_104888_.m_231374_(SearchRegistry.f_119941_, nonnulllist); + this.f_104888_.m_231374_(SearchRegistry.f_119942_, nonnulllist); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_, true, f_104885_.m_129531_())); } private void m_205560_(ResourceKey> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) { -@@ -1815,7 +_,8 @@ - int i5 = friendlybytebuf.m_130242_(); - this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, i5); +@@ -1843,7 +_,8 @@ + int j5 = friendlybytebuf.m_130242_(); + this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5); } else { - f_104883_.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); + if (!net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_)) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index e63e45d894f..577d96798d5 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java +++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java -@@ -102,6 +_,7 @@ +@@ -104,6 +_,7 @@ } public boolean m_105267_(BlockPos p_105268_) { @@ -8,7 +8,7 @@ if (this.f_105189_.f_91074_.m_36187_(this.f_105189_.f_91073_, p_105268_, this.f_105197_)) { return false; } else { -@@ -116,9 +_,8 @@ +@@ -118,9 +_,8 @@ } else if (blockstate.m_60795_()) { return false; } else { @@ -19,47 +19,58 @@ if (flag) { block.m_6786_(level, p_105268_, blockstate); } -@@ -139,21 +_,25 @@ +@@ -141,6 +_,7 @@ BlockState blockstate = this.f_105189_.f_91073_.m_8055_(p_105270_); this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate, 1.0F); - this.m_105272_(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_).isCanceled()) - this.m_105267_(p_105270_); - this.f_105195_ = 5; - } else if (!this.f_105196_ || !this.m_105281_(p_105270_)) { + this.m_233729_(this.f_105189_.f_91073_, (p_233757_) -> { ++ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_).isCanceled()) + this.m_105267_(p_105270_); + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_); + }); +@@ -149,15 +_,19 @@ if (this.f_105196_) { - this.m_105272_(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.f_105191_, p_105271_); + this.f_105190_.m_104955_(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.f_105191_, p_105271_)); } + net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_); BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105270_); this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate1, 0.0F); - this.m_105272_(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_); - boolean flag = !blockstate1.m_60795_(); - if (flag && this.f_105193_ == 0.0F) { -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - blockstate1.m_60686_(this.f_105189_.f_91073_, p_105270_, this.f_105189_.f_91074_); - } + this.m_233729_(this.f_105189_.f_91073_, (p_233728_) -> { + boolean flag = !blockstate1.m_60795_(); + if (flag && this.f_105193_ == 0.0F) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) + blockstate1.m_60686_(this.f_105189_.f_91073_, p_105270_, this.f_105189_.f_91074_); + } -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - if (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.f_19853_, p_105270_) >= 1.0F) { - this.m_105267_(p_105270_); - } else { -@@ -193,6 +_,7 @@ ++ ServerboundPlayerActionPacket packet = new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_); ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return packet; + if (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.f_19853_, p_105270_) >= 1.0F) { + this.m_105267_(p_105270_); + } else { +@@ -169,7 +_,7 @@ + this.f_105189_.f_91073_.m_6801_(this.f_105189_.f_91074_.m_19879_(), this.f_105191_, (int)(this.f_105193_ * 10.0F) - 1); + } + +- return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_); ++ return packet; + }); + } + +@@ -200,6 +_,7 @@ BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105284_); this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105284_, blockstate1, 1.0F); - this.m_105272_(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105284_, p_105285_).isCanceled()) - this.m_105267_(p_105284_); - return true; - } else if (this.m_105281_(p_105284_)) { -@@ -203,12 +_,13 @@ + this.m_233729_(this.f_105189_.f_91073_, (p_233753_) -> { ++ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105284_, p_105285_).isCanceled()) + this.m_105267_(p_105284_); + return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_); + }); +@@ -212,12 +_,13 @@ } else { this.f_105193_ += blockstate.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.f_19853_, p_105284_); if (this.f_105194_ % 4.0F == 0.0F) { - SoundType soundtype = blockstate.m_60827_(); + SoundType soundtype = blockstate.getSoundType(this.f_105189_.f_91073_, p_105284_, this.f_105189_.f_91074_); - this.f_105189_.m_91106_().m_120367_(new SimpleSoundInstance(soundtype.m_56778_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 8.0F, soundtype.m_56774_() * 0.5F, p_105284_)); + this.f_105189_.m_91106_().m_120367_(new SimpleSoundInstance(soundtype.m_56778_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 8.0F, soundtype.m_56774_() * 0.5F, SoundInstance.m_235150_(), p_105284_)); } ++this.f_105194_; @@ -67,8 +78,8 @@ + if (net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105284_, p_105285_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; if (this.f_105193_ >= 1.0F) { this.f_105196_ = false; - this.m_105272_(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, p_105284_, p_105285_); -@@ -227,7 +_,7 @@ + this.m_233729_(this.f_105189_.f_91073_, (p_233739_) -> { +@@ -263,7 +_,7 @@ } public float m_105286_() { @@ -77,7 +88,7 @@ } public void m_105287_() { -@@ -244,7 +_,7 @@ +@@ -280,7 +_,7 @@ ItemStack itemstack = this.f_105189_.f_91074_.m_21205_(); boolean flag = this.f_105192_.m_41619_() && itemstack.m_41619_(); if (!this.f_105192_.m_41619_() && !itemstack.m_41619_()) { @@ -86,62 +97,63 @@ } return p_105282_.equals(this.f_105191_) && flag; -@@ -266,13 +_,27 @@ - return InteractionResult.FAIL; +@@ -312,20 +_,33 @@ + private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) { + BlockPos blockpos = p_233749_.m_82425_(); + ItemStack itemstack = p_233747_.m_21120_(p_233748_); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_233747_, p_233748_, blockpos, p_233749_); ++ if (event.isCanceled()) { ++ return event.getCancellationResult(); ++ } + if (this.f_105197_ == GameType.SPECTATOR) { + return InteractionResult.SUCCESS; } else { - ItemStack itemstack = p_105263_.m_21120_(p_105265_); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks -+ .onRightClickBlock(p_105263_, p_105265_, blockpos, p_105266_); -+ if (event.isCanceled()) { -+ this.f_105190_.m_104955_(new ServerboundUseItemOnPacket(p_105265_, p_105266_)); -+ return event.getCancellationResult(); -+ } - if (this.f_105197_ == GameType.SPECTATOR) { - this.f_105190_.m_104955_(new ServerboundUseItemOnPacket(p_105265_, p_105266_)); - return InteractionResult.SUCCESS; - } else { -- boolean flag = !p_105263_.m_21205_().m_41619_() || !p_105263_.m_21206_().m_41619_(); -+ UseOnContext useoncontext = new UseOnContext(p_105263_, p_105265_, p_105266_); -+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ InteractionResult result = itemstack.onItemUseFirst(useoncontext); -+ if (result != InteractionResult.PASS) { -+ this.f_105190_.m_104955_(new ServerboundUseItemOnPacket(p_105265_, p_105266_)); -+ return result; -+ } +- boolean flag = !p_233747_.m_21205_().m_41619_() || !p_233747_.m_21206_().m_41619_(); ++ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); ++ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ InteractionResult result = itemstack.onItemUseFirst(useoncontext); ++ if (result != InteractionResult.PASS) { ++ return result; + } -+ boolean flag = !p_105263_.m_21205_().doesSneakBypassUse(p_105264_,blockpos,p_105263_) || !p_105263_.m_21206_().doesSneakBypassUse(p_105264_,blockpos,p_105263_); - boolean flag1 = p_105263_.m_36341_() && flag; -- if (!flag1) { -+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { - InteractionResult interactionresult = p_105264_.m_8055_(blockpos).m_60664_(p_105264_, p_105263_, p_105265_, p_105266_); - if (interactionresult.m_19077_()) { - this.f_105190_.m_104955_(new ServerboundUseItemOnPacket(p_105265_, p_105266_)); -@@ -281,8 +_,8 @@ ++ } ++ boolean flag = !p_233747_.m_21205_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_) || !p_233747_.m_21206_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_); + boolean flag1 = p_233747_.m_36341_() && flag; +- if (!flag1) { ++ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { + InteractionResult interactionresult = this.f_105189_.f_91073_.m_8055_(blockpos).m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_); + if (interactionresult.m_19077_()) { + return interactionresult; } + } - this.f_105190_.m_104955_(new ServerboundUseItemOnPacket(p_105265_, p_105266_)); -- if (!itemstack.m_41619_() && !p_105263_.m_36335_().m_41519_(itemstack.m_41720_())) { -- UseOnContext useoncontext = new UseOnContext(p_105263_, p_105265_, p_105266_); -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return InteractionResult.PASS; -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.m_41619_() && !p_105263_.m_36335_().m_41519_(itemstack.m_41720_()))) { - InteractionResult interactionresult1; - if (this.f_105197_.m_46408_()) { - int i = itemstack.m_41613_(); -@@ -311,10 +_,13 @@ - if (p_105236_.m_36335_().m_41519_(itemstack.m_41720_())) { - return InteractionResult.PASS; - } else { -+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_105236_, p_105238_); -+ if (cancelResult != null) return cancelResult; - InteractionResultHolder interactionresultholder = itemstack.m_41682_(p_105237_, p_105236_, p_105238_); - ItemStack itemstack1 = interactionresultholder.m_19095_(); - if (itemstack1 != itemstack) { - p_105236_.m_21008_(p_105238_, itemstack1); -+ if (itemstack1.m_41619_()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_105236_, itemstack, p_105238_); - } +- if (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_())) { +- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ return InteractionResult.PASS; ++ } ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_()))) { + InteractionResult interactionresult1; + if (this.f_105197_.m_46408_()) { + int i = itemstack.m_41613_(); +@@ -356,10 +_,17 @@ + mutableobject.setValue(InteractionResult.PASS); + return serverbounduseitempacket; + } else { ++ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_233722_, p_233723_); ++ if (cancelResult != null) { ++ mutableobject.setValue(cancelResult); ++ return serverbounduseitempacket; ++ } + InteractionResultHolder interactionresultholder = itemstack.m_41682_(this.f_105189_.f_91073_, p_233722_, p_233723_); + ItemStack itemstack1 = interactionresultholder.m_19095_(); + if (itemstack1 != itemstack) { + p_233722_.m_21008_(p_233723_, itemstack1); ++ if (itemstack1.m_41619_()) ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_); + } - return interactionresultholder.m_19089_(); -@@ -350,6 +_,9 @@ + mutableobject.setValue(interactionresultholder.m_19089_()); +@@ -398,6 +_,9 @@ this.m_105297_(); Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_()); this.f_105190_.m_104955_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3)); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch index c61b6feaa32..a125f091101 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerInfo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/PlayerInfo.java +++ b/net/minecraft/client/multiplayer/PlayerInfo.java -@@ -50,6 +_,7 @@ +@@ -77,6 +_,7 @@ } protected void m_105317_(GameType p_105318_) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ProfileKeyPairManager.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ProfileKeyPairManager.java.patch new file mode 100644 index 00000000000..cd3c2d838d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/ProfileKeyPairManager.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/multiplayer/ProfileKeyPairManager.java ++++ b/net/minecraft/client/multiplayer/ProfileKeyPairManager.java +@@ -64,6 +_,8 @@ + this.m_233776_(profilekeypair); + return Optional.of(profilekeypair); + } catch (CryptException | MinecraftClientException | IOException ioexception) { ++ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev ++ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || p_233781_ != UserApiService.OFFLINE) + f_233765_.error("Failed to retrieve profile key pair", (Throwable)ioexception); + this.m_233776_((ProfileKeyPair)null); + return optional; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch index a4803b21bd9..cbd5759ac08 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java -@@ -26,6 +_,7 @@ +@@ -35,6 +_,7 @@ @Nullable - private String f_105372_; - private boolean f_105373_; + private ServerData.ChatPreview f_233800_; + private boolean f_233801_ = true; + public net.minecraftforge.client.ExtendedServerListData forgeData = null; public ServerData(String p_105375_, String p_105376_, boolean p_105377_) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch index 0678850644b..892f7f7fa58 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerStatusPinger.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ServerStatusPinger.java +++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java -@@ -125,6 +_,7 @@ +@@ -124,6 +_,7 @@ p_105461_.run(); } diff --git a/patches/minecraft/net/minecraft/client/particle/BreakingItemParticle.java.patch b/patches/minecraft/net/minecraft/client/particle/BreakingItemParticle.java.patch index 0357c21112b..8cd54f85dbd 100644 --- a/patches/minecraft/net/minecraft/client/particle/BreakingItemParticle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/BreakingItemParticle.java.patch @@ -9,4 +9,4 @@ + this.m_108337_(model.m_7343_().m_173464_(model, p_105669_, p_105665_, null, 0).getParticleIcon(net.minecraftforge.client.model.data.EmptyModelData.INSTANCE)); this.f_107226_ = 1.0F; this.f_107663_ /= 2.0F; - this.f_105643_ = this.f_107223_.nextFloat() * 3.0F; + this.f_105643_ = this.f_107223_.m_188501_() * 3.0F; diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch index f4fb172ba4a..d7da5ca52be 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/ParticleEngine.java +++ b/net/minecraft/client/particle/ParticleEngine.java -@@ -66,11 +_,11 @@ +@@ -63,11 +_,11 @@ private static final int f_172264_ = 16384; private static final List f_107288_ = ImmutableList.of(ParticleRenderType.f_107429_, ParticleRenderType.f_107430_, ParticleRenderType.f_107432_, ParticleRenderType.f_107431_, ParticleRenderType.f_107433_); protected ClientLevel f_107287_; @@ -8,13 +8,13 @@ + private final Map> f_107289_ = Maps.newTreeMap(net.minecraftforge.client.ForgeHooksClient.makeParticleRenderTypeComparator(f_107288_)); private final Queue f_107290_ = Queues.newArrayDeque(); private final TextureManager f_107291_; - private final Random f_107292_ = new Random(); + private final RandomSource f_107292_ = RandomSource.m_216327_(); - private final Int2ObjectMap> f_107293_ = new Int2ObjectOpenHashMap<>(); + private final Map> f_107293_ = new java.util.HashMap<>(); private final Queue f_107294_ = Queues.newArrayDeque(); private final Map f_107295_ = Maps.newHashMap(); private final TextureAtlas f_107296_; -@@ -176,13 +_,13 @@ +@@ -178,13 +_,13 @@ } public void m_107381_(ParticleType p_107382_, ParticleProvider p_107383_) { @@ -30,7 +30,7 @@ } public CompletableFuture m_5540_(PreparableReloadListener.PreparationBarrier p_107305_, ResourceManager p_107306_, ProfilerFiller p_107307_, ProfilerFiller p_107308_, Executor p_107309_, Executor p_107310_) { -@@ -300,7 +_,7 @@ +@@ -288,7 +_,7 @@ @Nullable private Particle m_107395_(T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_) { @@ -39,7 +39,7 @@ return particleprovider == null ? null : particleprovider.m_6966_(p_107396_, this.f_107287_, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_); } -@@ -381,15 +_,25 @@ +@@ -369,15 +_,25 @@ } } @@ -66,7 +66,7 @@ Iterable iterable = this.f_107289_.get(particlerendertype); if (iterable != null) { RenderSystem.m_157427_(GameRenderer::m_172829_); -@@ -399,6 +_,7 @@ +@@ -387,6 +_,7 @@ particlerendertype.m_6505_(bufferbuilder, this.f_107291_); for(Particle particle : iterable) { @@ -74,7 +74,7 @@ try { particle.m_5744_(bufferbuilder, p_107340_, p_107341_); } catch (Throwable throwable) { -@@ -429,7 +_,7 @@ +@@ -417,7 +_,7 @@ } public void m_107355_(BlockPos p_107356_, BlockState p_107357_) { @@ -83,7 +83,7 @@ VoxelShape voxelshape = p_107357_.m_60808_(this.f_107287_, p_107356_); double d0 = 0.25D; voxelshape.m_83286_((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> { -@@ -449,7 +_,7 @@ +@@ -437,7 +_,7 @@ double d7 = d4 * d1 + p_172273_; double d8 = d5 * d2 + p_172274_; double d9 = d6 * d3 + p_172275_; @@ -92,7 +92,7 @@ } } } -@@ -493,12 +_,18 @@ +@@ -481,12 +_,18 @@ d0 = (double)i + aabb.f_82291_ + (double)0.1F; } diff --git a/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch index 7d52bf21444..786d0ad6640 100644 --- a/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/AbstractClientPlayer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/player/AbstractClientPlayer.java +++ b/net/minecraft/client/player/AbstractClientPlayer.java -@@ -144,6 +_,6 @@ +@@ -146,6 +_,6 @@ } } -- return Mth.m_14179_(Minecraft.m_91087_().f_91066_.f_92070_, 1.0F, f); +- return Mth.m_14179_(Minecraft.m_91087_().f_91066_.m_231925_().m_231551_().floatValue(), 1.0F, f); + return net.minecraftforge.client.ForgeHooksClient.getFieldOfView(this, f); } } diff --git a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch index 6910353f99e..3da16b96168 100644 --- a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/player/LocalPlayer.java +++ b/net/minecraft/client/player/LocalPlayer.java -@@ -145,6 +_,7 @@ +@@ -159,6 +_,7 @@ } public boolean m_6469_(DamageSource p_108662_, float p_108663_) { @@ -8,27 +8,48 @@ return false; } -@@ -461,6 +_,11 @@ +@@ -290,6 +_,9 @@ + } + + public void m_234125_(String p_234126_, @Nullable Component p_234127_) { ++ // TODO-PATCHING: If the chat preview component is not null and the message is changed by this event, it looks like the signatures will de-sync and the server will skip the message. Fix? -SS ++ p_234126_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_234126_); ++ if (p_234126_.isEmpty()) return; + MessageSigner messagesigner = MessageSigner.m_237183_(this.m_20148_()); + this.m_234141_(messagesigner, p_234126_, p_234127_); + } +@@ -328,6 +_,7 @@ + } + + private void m_234151_(MessageSigner p_234152_, String p_234153_, @Nullable Component p_234154_) { ++ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_234153_)) return; + ParseResults parseresults = this.f_108617_.m_105146_().parse(p_234153_, this.f_108617_.m_105137_()); + ArgumentSignatures argumentsignatures = this.m_234137_(p_234152_, parseresults, p_234154_); + this.f_108617_.m_104955_(new ServerboundChatCommandPacket(p_234153_, p_234152_.f_237170_(), argumentsignatures, p_234154_ != null)); +@@ -544,7 +_,13 @@ } public void m_5496_(SoundEvent p_108651_, float p_108652_, float p_108653_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_108651_, this.m_5720_(), p_108652_, p_108653_); +- this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false); ++ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_108651_, this.m_5720_(), p_108652_, p_108653_); + if (event.isCanceled() || event.getSound() == null) return; + p_108651_ = event.getSound(); -+ p_108652_ = event.getVolume(); -+ p_108653_ = event.getPitch(); - this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false); ++ SoundSource source = event.getSource(); ++ p_108652_ = event.getNewVolume(); ++ p_108653_ = event.getNewPitch(); ++ this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, source, p_108652_, p_108653_, false); } -@@ -616,6 +_,7 @@ - boolean flag2 = this.m_108733_(); + public void m_6330_(SoundEvent p_108655_, SoundSource p_108656_, float p_108657_, float p_108658_) { +@@ -700,6 +_,7 @@ this.f_108601_ = !this.m_150110_().f_35935_ && !this.m_6069_() && this.m_20175_(Pose.CROUCHING) && (this.m_6144_() || !this.m_5803_() && !this.m_20175_(Pose.STANDING)); - this.f_108618_.m_7606_(this.m_108635_()); + float f = Mth.m_14036_(0.3F + EnchantmentHelper.m_220302_(this), 0.0F, 1.0F); + this.f_108618_.m_214106_(this.m_108635_(), f); + net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.f_108618_); this.f_108619_.m_91301_().m_120586_(this.f_108618_); if (this.m_6117_() && !this.m_20159_()) { this.f_108618_.f_108566_ *= 0.2F; -@@ -688,7 +_,7 @@ +@@ -772,7 +_,7 @@ if (this.f_108618_.f_108572_ && !flag7 && !flag && !this.m_150110_().f_35935_ && !this.m_20159_() && !this.m_6147_()) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -37,7 +58,7 @@ this.f_108617_.m_104955_(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.START_FALL_FLYING)); } } -@@ -806,6 +_,7 @@ +@@ -890,6 +_,7 @@ public void m_6083_() { super.m_6083_(); @@ -45,7 +66,7 @@ this.f_108611_ = false; if (this.m_20202_() instanceof Boat) { Boat boat = (Boat)this.m_20202_(); -@@ -1019,6 +_,18 @@ +@@ -1103,6 +_,18 @@ } else { return super.m_7398_(p_108758_); } diff --git a/patches/minecraft/net/minecraft/client/player/RemotePlayer.java.patch b/patches/minecraft/net/minecraft/client/player/RemotePlayer.java.patch index e838305c875..0cab3677288 100644 --- a/patches/minecraft/net/minecraft/client/player/RemotePlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/RemotePlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/player/RemotePlayer.java +++ b/net/minecraft/client/player/RemotePlayer.java -@@ -29,6 +_,7 @@ +@@ -30,6 +_,7 @@ } public boolean m_6469_(DamageSource p_108772_, float p_108773_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/DimensionSpecialEffects.java.patch b/patches/minecraft/net/minecraft/client/renderer/DimensionSpecialEffects.java.patch index bd0131443f2..add11e0cef8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/DimensionSpecialEffects.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/DimensionSpecialEffects.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/DimensionSpecialEffects.java +++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java -@@ -26,6 +_,10 @@ +@@ -27,6 +_,10 @@ private final DimensionSpecialEffects.SkyType f_108861_; private final boolean f_108862_; private final boolean f_108863_; @@ -11,7 +11,7 @@ public DimensionSpecialEffects(float p_108866_, boolean p_108867_, DimensionSpecialEffects.SkyType p_108868_, boolean p_108869_, boolean p_108870_) { this.f_108859_ = p_108866_; -@@ -80,6 +_,35 @@ +@@ -81,6 +_,35 @@ public boolean m_108885_() { return this.f_108863_; diff --git a/patches/minecraft/net/minecraft/client/renderer/EffectInstance.java.patch b/patches/minecraft/net/minecraft/client/renderer/EffectInstance.java.patch index 9b6d4d00b11..d0136cdb019 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EffectInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EffectInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/EffectInstance.java +++ b/net/minecraft/client/renderer/EffectInstance.java -@@ -60,7 +_,8 @@ +@@ -58,7 +_,8 @@ private final EffectProgram f_108938_; public EffectInstance(ResourceManager p_108941_, String p_108942_) throws IOException { @@ -8,15 +8,15 @@ + ResourceLocation rl = ResourceLocation.m_135820_(p_108942_); + ResourceLocation resourcelocation = new ResourceLocation(rl.m_135827_(), "shaders/program/" + rl.m_135815_() + ".json"); this.f_108932_ = p_108942_; - Resource resource = null; + Resource resource = p_108941_.m_215593_(resourcelocation); -@@ -162,7 +_,8 @@ +@@ -168,7 +_,8 @@ } else { EffectProgram effectprogram; if (program == null) { - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.m_85569_()); + ResourceLocation rl = ResourceLocation.m_135820_(p_172569_); + ResourceLocation resourcelocation = new ResourceLocation(rl.m_135827_(), "shaders/program/" + rl.m_135815_() + p_172568_.m_85569_()); - Resource resource = p_172567_.m_142591_(resourcelocation); + Resource resource = p_172567_.m_215593_(resourcelocation); + InputStream inputstream = resource.m_215507_(); - try { diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index b01e056bc3b..2b1b096bba9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/FogRenderer.java +++ b/net/minecraft/client/renderer/FogRenderer.java -@@ -178,19 +_,36 @@ - f_109012_ = f_109012_ * (1.0F - f6) + f_109012_ * f8 * f6; +@@ -182,6 +_,13 @@ + f_109012_ = f_109012_ * (1.0F - f7) + f_109012_ * f9 * f7; } + net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(p_109019_, p_109020_, f_109010_, f_109011_, f_109012_); @@ -14,35 +14,11 @@ RenderSystem.m_69424_(f_109010_, f_109011_, f_109012_, 0.0F); } - public static void m_109017_() { - RenderSystem.m_157445_(Float.MAX_VALUE); - } -- -+ @Deprecated // FORGE: Pass in partialTicks - public static void m_109024_(Camera p_109025_, FogRenderer.FogMode p_109026_, float p_109027_, boolean p_109028_) { -+ setupFog(p_109025_, p_109026_, p_109027_, p_109028_, 0); -+ } -+ -+ public static void setupFog(Camera p_109025_, FogRenderer.FogMode p_109026_, float p_109027_, boolean p_109028_, float partialTicks) { - FogType fogtype = p_109025_.m_167685_(); - Entity entity = p_109025_.m_90592_(); - FogShape fogshape = FogShape.SPHERE; - float f; - float f1; -+ // TODO: remove this hook in 1.19 -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(p_109026_, p_109025_, partialTicks, 0.1F); -+ if (hook >= 0) { -+ f = -8.0f; -+ f1 = hook * 0.5F; -+ } else - if (fogtype == FogType.LAVA) { - if (entity.m_5833_()) { - f = -8.0F; -@@ -253,6 +_,7 @@ - RenderSystem.m_157445_(f); - RenderSystem.m_157443_(f1); - RenderSystem.m_202160_(fogshape); -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_109026_, p_109025_, partialTicks, f, f1, fogshape); +@@ -263,6 +_,7 @@ + RenderSystem.m_157445_(fogrenderer$fogdata.f_234200_); + RenderSystem.m_157443_(fogrenderer$fogdata.f_234201_); + RenderSystem.m_202160_(fogrenderer$fogdata.f_234202_); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(fogtype, p_234173_, p_234177_, fogrenderer$fogdata.f_234200_, fogrenderer$fogdata.f_234201_, fogrenderer$fogdata.f_234202_); } public static void m_109036_() { diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 3f6a32b7b8d..75fbdca0b5c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -288,6 +_,8 @@ +@@ -290,6 +_,8 @@ this.m_109128_(new ResourceLocation("shaders/post/spider.json")); } else if (p_109107_ instanceof EnderMan) { this.m_109128_(new ResourceLocation("shaders/post/invert.json")); @@ -9,15 +9,15 @@ } } -@@ -544,6 +_,7 @@ - list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_172733_) -> { - f_172607_ = p_172733_; +@@ -549,6 +_,7 @@ + list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> { + f_172607_ = p_234230_; })); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_172768_, list1)); } catch (IOException ioexception) { - list1.forEach((p_172772_) -> { - p_172772_.getFirst().close(); -@@ -625,19 +_,21 @@ + list1.forEach((p_172729_) -> { + p_172729_.getFirst().close(); +@@ -630,19 +_,21 @@ boolean flag = false; int i = 3; double d1 = d0; @@ -42,7 +42,7 @@ d1 = this.f_109059_.f_91077_.m_82450_().m_82557_(vec3); } -@@ -652,7 +_,7 @@ +@@ -657,7 +_,7 @@ Entity entity1 = entityhitresult.m_82443_(); Vec3 vec33 = entityhitresult.m_82450_(); double d2 = vec3.m_82557_(vec33); @@ -51,8 +51,8 @@ this.f_109059_.f_91077_ = BlockHitResult.m_82426_(vec33, Direction.m_122366_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_), new BlockPos(vec33)); } else if (d2 < d1 || this.f_109059_.f_91077_ == null) { this.f_109059_.f_91077_ = entityhitresult; -@@ -706,7 +_,7 @@ - d0 *= (double)Mth.m_14179_(this.f_109059_.f_91066_.f_92070_, 1.0F, 0.85714287F); +@@ -711,7 +_,7 @@ + d0 *= Mth.m_14139_(this.f_109059_.f_91066_.m_231925_().m_231551_(), 1.0D, (double)0.85714287F); } - return d0; @@ -60,7 +60,7 @@ } } -@@ -843,11 +_,11 @@ +@@ -848,11 +_,11 @@ Window window = this.f_109059_.m_91268_(); RenderSystem.m_69421_(256, Minecraft.f_91002_); @@ -74,7 +74,7 @@ RenderSystem.m_157182_(); Lighting.m_84931_(); PoseStack posestack1 = new PoseStack(); -@@ -882,7 +_,7 @@ +@@ -888,7 +_,7 @@ } } else if (this.f_109059_.f_91080_ != null) { try { @@ -83,7 +83,7 @@ } catch (Throwable throwable1) { CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details"); -@@ -1040,6 +_,11 @@ +@@ -1047,6 +_,11 @@ Matrix4f matrix4f = posestack.m_85850_().m_85861_(); this.m_109111_(matrix4f); camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_); @@ -95,9 +95,9 @@ p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_())); p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F)); Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_(); -@@ -1049,6 +_,8 @@ +@@ -1056,6 +_,8 @@ - this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, this.f_109059_.f_91066_.f_92068_))); + this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue()))); this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f); + this.f_109059_.m_91307_().m_6182_("forge_render_last"); + net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.f_109059_.f_91060_, p_109092_, p_109090_, matrix4f, p_109091_); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch index e68d1475ce4..335416fa3bc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch @@ -8,15 +8,15 @@ private static final Map f_109275_ = Util.m_137469_(Maps.newHashMap(), (p_109296_) -> { RenderType rendertype = RenderType.m_110503_(); p_109296_.put(Blocks.f_50267_, rendertype); -@@ -286,6 +_,7 @@ - p_109296_.put(Blocks.f_50628_, rendertype3); +@@ -296,6 +_,7 @@ p_109296_.put(Blocks.f_152498_, rendertype3); + p_109296_.put(Blocks.f_220862_, rendertype3); }); + @Deprecated private static final Map f_109276_ = Util.m_137469_(Maps.newHashMap(), (p_109290_) -> { RenderType rendertype = RenderType.m_110466_(); p_109290_.put(Fluids.f_76192_, rendertype); -@@ -293,6 +_,7 @@ +@@ -303,6 +_,7 @@ }); private static boolean f_109277_; @@ -24,7 +24,7 @@ public static RenderType m_109282_(BlockState p_109283_) { Block block = p_109283_.m_60734_(); if (block instanceof LeavesBlock) { -@@ -303,6 +_,7 @@ +@@ -313,6 +_,7 @@ } } @@ -32,7 +32,7 @@ public static RenderType m_109293_(BlockState p_109294_) { Block block = p_109294_.m_60734_(); if (block instanceof LeavesBlock) { -@@ -318,8 +_,7 @@ +@@ -328,8 +_,7 @@ } public static RenderType m_109284_(BlockState p_109285_, boolean p_109286_) { @@ -42,7 +42,7 @@ if (!Minecraft.m_91085_()) { return Sheets.m_110792_(); } else { -@@ -340,9 +_,70 @@ +@@ -350,9 +_,68 @@ } } @@ -55,16 +55,14 @@ + // FORGE START + + private static final java.util.function.Predicate SOLID_PREDICATE = type -> type == RenderType.m_110451_(); -+ private static final Map, java.util.function.Predicate> blockRenderChecks = createRenderCheckMap(f_109275_); -+ private static final Map, java.util.function.Predicate> fluidRenderChecks = createRenderCheckMap(f_109276_); ++ private static final Map, java.util.function.Predicate> blockRenderChecks = createRenderCheckMap(net.minecraftforge.registries.ForgeRegistries.BLOCKS, f_109275_); ++ private static final Map, java.util.function.Predicate> fluidRenderChecks = createRenderCheckMap(net.minecraftforge.registries.ForgeRegistries.FLUIDS, f_109276_); + -+ private static > Map, java.util.function.Predicate> createRenderCheckMap( -+ Map vanillaMap -+ ) { ++ private static Map, java.util.function.Predicate> createRenderCheckMap(net.minecraftforge.registries.IForgeRegistry registry, Map vanillaMap) { + return Util.m_137469_(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(vanillaMap.size(), 0.5F), map -> { + map.defaultReturnValue(SOLID_PREDICATE); -+ for (Map.Entry entry : vanillaMap.entrySet()) { -+ map.put(entry.getKey().delegate, createMatchingLayerPredicate(entry.getValue())); ++ for(Map.Entry entry : vanillaMap.entrySet()) { ++ map.put(registry.getDelegateOrThrow(entry.getKey()), createMatchingLayerPredicate(entry.getValue())); + } + }); + } @@ -74,12 +72,12 @@ + if (block instanceof LeavesBlock) { + return f_109277_ ? type == RenderType.m_110457_() : type == RenderType.m_110451_(); + } else { -+ return blockRenderChecks.get(block.delegate).test(type); ++ return blockRenderChecks.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block)).test(type); + } + } + + public static boolean canRenderInLayer(FluidState fluid, RenderType type) { -+ return fluidRenderChecks.get(fluid.m_76152_().delegate).test(type); ++ return fluidRenderChecks.get(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid.m_76152_())).test(type); + } + + public static void setRenderLayer(Block block, RenderType type) { @@ -88,7 +86,7 @@ + + public static synchronized void setRenderLayer(Block block, java.util.function.Predicate predicate) { + checkClientLoading(); -+ blockRenderChecks.put(block.delegate, predicate); ++ blockRenderChecks.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), predicate); + } + + public static void setRenderLayer(Fluid fluid, RenderType type) { @@ -97,7 +95,7 @@ + + public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate predicate) { + checkClientLoading(); -+ fluidRenderChecks.put(fluid.delegate, predicate); ++ fluidRenderChecks.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), predicate); + } + + private static void checkClientLoading() { diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch index 6ca654e8140..fc1d5f7c6a5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LevelRenderer.java +++ b/net/minecraft/client/renderer/LevelRenderer.java -@@ -259,6 +_,11 @@ +@@ -263,6 +_,11 @@ } private void m_109703_(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) { @@ -12,7 +12,7 @@ float f = this.f_109461_.f_91073_.m_46722_(p_109705_); if (!(f <= 0.0F)) { p_109704_.m_109896_(); -@@ -379,6 +_,11 @@ +@@ -383,6 +_,11 @@ } public void m_109693_(Camera p_109694_) { @@ -23,43 +23,35 @@ + } float f = this.f_109461_.f_91073_.m_46722_(1.0F) / (Minecraft.m_91405_() ? 1.0F : 2.0F); if (!(f <= 0.0F)) { - Random random = new Random((long)this.f_109477_ * 312987231L); -@@ -1134,20 +_,23 @@ + RandomSource randomsource = RandomSource.m_216335_((long)this.f_109477_ * 312987231L); +@@ -1140,6 +_,7 @@ RenderSystem.m_69421_(16640, Minecraft.f_91002_); float f = p_109605_.m_109152_(); boolean flag2 = this.f_109461_.f_91073_.m_104583_().m_5781_(Mth.m_14107_(d0), Mth.m_14107_(d1)) || this.f_109461_.f_91065_.m_93090_().m_93715_(); -+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_); ++ FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_); profilerfiller.m_6182_("sky"); RenderSystem.m_157427_(GameRenderer::m_172808_); this.m_202423_(p_109600_, p_109607_, p_109601_, p_109604_, flag2, () -> { -- FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2); -+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_); - }); - profilerfiller.m_6182_("fog"); -- FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2); -+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2, p_109601_); - profilerfiller.m_6182_("terrain_setup"); - this.m_194338_(p_109604_, frustum, flag1, this.f_109461_.f_91074_.m_5833_()); - profilerfiller.m_6182_("compilechunks"); +@@ -1153,7 +_,9 @@ this.m_194370_(p_109604_); profilerfiller.m_6182_("terrain"); this.m_172993_(RenderType.m_110451_(), p_109600_, d0, d1, d2, p_109607_); -+ this.f_109461_.m_91304_().m_119428_(TextureAtlas.f_118259_).setBlurMipmap(false, this.f_109461_.f_91066_.f_92027_ > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings ++ this.f_109461_.m_91304_().m_119428_(TextureAtlas.f_118259_).setBlurMipmap(false, this.f_109461_.f_91066_.m_232119_().m_231551_() > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings this.m_172993_(RenderType.m_110457_(), p_109600_, d0, d1, d2, p_109607_); + this.f_109461_.m_91304_().m_119428_(TextureAtlas.f_118259_).restoreLastBlurMipmap(); this.m_172993_(RenderType.m_110463_(), p_109600_, d0, d1, d2, p_109607_); if (this.f_109465_.m_104583_().m_108885_()) { Lighting.m_84925_(p_109600_.m_85850_().m_85861_()); -@@ -1179,7 +_,7 @@ +@@ -1185,7 +_,7 @@ for(Entity entity : this.f_109465_.m_104735_()) { if (this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) { - BlockPos blockpos = entity.m_142538_(); + BlockPos blockpos = entity.m_20183_(); - if ((this.f_109465_.m_151562_(blockpos.m_123342_()) || this.m_202430_(blockpos)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity)) { + if ((this.f_109465_.m_151562_(blockpos.m_123342_()) || this.m_202430_(blockpos)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity || (entity == f_109461_.f_91074_ && !f_109461_.f_91074_.m_5833_()))) { //FORGE: render local player entity when it is not the renderViewEntity ++this.f_109439_; if (entity.f_19797_ == 0) { entity.f_19790_ = entity.m_20185_(); -@@ -1219,6 +_,7 @@ +@@ -1225,6 +_,7 @@ List list = levelrenderer$renderchunkinfo.f_109839_.m_112835_().m_112773_(); if (!list.isEmpty()) { for(BlockEntity blockentity1 : list) { @@ -67,7 +59,7 @@ BlockPos blockpos4 = blockentity1.m_58899_(); MultiBufferSource multibuffersource1 = multibuffersource$buffersource; p_109600_.m_85836_(); -@@ -1244,6 +_,7 @@ +@@ -1250,6 +_,7 @@ synchronized(this.f_109468_) { for(BlockEntity blockentity : this.f_109468_) { @@ -75,7 +67,7 @@ BlockPos blockpos3 = blockentity.m_58899_(); p_109600_.m_85836_(); p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2); -@@ -1295,10 +_,13 @@ +@@ -1301,10 +_,13 @@ profilerfiller.m_6182_("outline"); BlockPos blockpos1 = ((BlockHitResult)hitresult).m_82425_(); BlockState blockstate = this.f_109465_.m_8055_(blockpos1); @@ -89,7 +81,7 @@ } PoseStack posestack = RenderSystem.m_157191_(); -@@ -1333,7 +_,7 @@ +@@ -1339,7 +_,7 @@ this.f_109415_.m_83945_(this.f_109461_.m_91385_()); RenderStateShard.f_110126_.m_110185_(); profilerfiller.m_6182_("particles"); @@ -98,7 +90,7 @@ RenderStateShard.f_110126_.m_110188_(); } else { profilerfiller.m_6182_("translucent"); -@@ -1347,7 +_,7 @@ +@@ -1353,7 +_,7 @@ profilerfiller.m_6182_("string"); this.m_172993_(RenderType.m_110503_(), p_109600_, d0, d1, d2, p_109607_); profilerfiller.m_6182_("particles"); @@ -107,7 +99,7 @@ } posestack.m_85836_(); -@@ -1783,6 +_,11 @@ +@@ -1781,6 +_,11 @@ public void m_202423_(PoseStack p_202424_, Matrix4f p_202425_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { p_202429_.run(); @@ -118,8 +110,8 @@ + } if (!p_202428_) { FogType fogtype = p_202427_.m_167685_(); - if (fogtype != FogType.POWDER_SNOW && fogtype != FogType.LAVA) { -@@ -1910,6 +_,11 @@ + if (fogtype != FogType.POWDER_SNOW && fogtype != FogType.LAVA && !this.m_234310_(p_202427_)) { +@@ -1912,6 +_,11 @@ } public void m_172954_(PoseStack p_172955_, Matrix4f p_172956_, float p_172957_, double p_172958_, double p_172959_, double p_172960_) { @@ -131,16 +123,16 @@ float f = this.f_109465_.m_104583_().m_108871_(); if (!Float.isNaN(f)) { RenderSystem.m_69464_(); -@@ -2095,7 +_,7 @@ +@@ -2102,7 +_,7 @@ } } else { - BlockPos blockpos1 = chunkrenderdispatcher$renderchunk.m_112839_().m_142082_(8, 8, 8); + BlockPos blockpos1 = chunkrenderdispatcher$renderchunk.m_112839_().m_7918_(8, 8, 8); - flag = blockpos1.m_123331_(blockpos) < 768.0D || chunkrenderdispatcher$renderchunk.m_112842_(); + flag = !net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && (blockpos1.m_123331_(blockpos) < 768.0D || chunkrenderdispatcher$renderchunk.m_112842_()); // the target is the else block below, so invert the forge addition to get there early } if (flag) { -@@ -2393,7 +_,12 @@ +@@ -2399,7 +_,12 @@ this.f_109469_.m_110859_(p_109502_, p_109503_, p_109504_, p_109505_); } @@ -153,7 +145,7 @@ SoundInstance soundinstance = this.f_109410_.get(p_109516_); if (soundinstance != null) { this.f_109461_.m_91106_().m_120399_(soundinstance); -@@ -2401,7 +_,7 @@ +@@ -2407,7 +_,7 @@ } if (p_109515_ != null) { @@ -162,25 +154,25 @@ if (recorditem != null) { this.f_109461_.f_91065_.m_93055_(recorditem.m_43050_()); } -@@ -2553,7 +_,7 @@ - break; - case 1010: - if (Item.m_41445_(p_109536_) instanceof RecordItem) { -- this.m_109514_(((RecordItem)Item.m_41445_(p_109536_)).m_43051_(), p_109535_); -+ this.playStreamingMusic(((RecordItem)Item.m_41445_(p_109536_)).m_43051_(), p_109535_, (RecordItem) Item.m_41445_(p_109536_)); - } else { - this.m_109514_((SoundEvent)null, p_109535_); - } -@@ -2723,7 +_,7 @@ - case 2001: - BlockState blockstate = Block.m_49803_(p_109536_); - if (!blockstate.m_60795_()) { -- SoundType soundtype = blockstate.m_60827_(); -+ SoundType soundtype = blockstate.getSoundType(this.f_109465_, p_109535_, null); - this.f_109465_.m_104677_(p_109535_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false); - } +@@ -2559,7 +_,7 @@ + break; + case 1010: + if (Item.m_41445_(p_234307_) instanceof RecordItem) { +- this.m_109514_(((RecordItem)Item.m_41445_(p_234307_)).m_43051_(), p_234306_); ++ this.playStreamingMusic(((RecordItem)Item.m_41445_(p_234307_)).m_43051_(), p_234306_, (RecordItem) Item.m_41445_(p_234307_)); + } else { + this.m_109514_((SoundEvent)null, p_234306_); + } +@@ -2729,7 +_,7 @@ + case 2001: + BlockState blockstate = Block.m_49803_(p_234307_); + if (!blockstate.m_60795_()) { +- SoundType soundtype = blockstate.m_60827_(); ++ SoundType soundtype = blockstate.getSoundType(this.f_109465_, p_234306_, null); + this.f_109465_.m_104677_(p_234306_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false); + } -@@ -2888,7 +_,7 @@ +@@ -2944,7 +_,7 @@ } else { int i = p_109538_.m_45517_(LightLayer.SKY, p_109540_); int j = p_109538_.m_45517_(LightLayer.BLOCK, p_109540_); diff --git a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch index 5905d2bf9c6..bc73f10fdbe 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java -@@ -160,7 +_,7 @@ +@@ -193,7 +_,7 @@ } public static int m_109883_(int p_109884_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/PostChain.java.patch b/patches/minecraft/net/minecraft/client/renderer/PostChain.java.patch index 4117e205ca1..f4a714495df 100644 --- a/patches/minecraft/net/minecraft/client/renderer/PostChain.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/PostChain.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/client/renderer/PostChain.java +++ b/net/minecraft/client/renderer/PostChain.java -@@ -169,7 +_,8 @@ +@@ -173,7 +_,8 @@ throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer"); } - ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png"); + ResourceLocation rl = ResourceLocation.m_135820_(s4); + ResourceLocation resourcelocation = new ResourceLocation(rl.m_135827_(), "textures/effect/" + rl.m_135815_() + ".png"); - Resource resource = null; - - try { -@@ -279,6 +_,7 @@ + this.f_110007_.m_213713_(resourcelocation).orElseThrow(() -> { + return new ChainedJsonException("Render target or texture '" + s4 + "' does not exist"); + }); +@@ -276,6 +_,7 @@ public void m_110038_(String p_110039_, int p_110040_, int p_110041_) { RenderTarget rendertarget = new TextureTarget(p_110040_, p_110041_, true, Minecraft.f_91002_); rendertarget.m_83931_(0.0F, 0.0F, 0.0F, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch index 3a5f3cebb04..464f302330c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/RenderType.java +++ b/net/minecraft/client/renderer/RenderType.java -@@ -288,27 +_,27 @@ +@@ -301,27 +_,27 @@ } public static RenderType m_110497_(ResourceLocation p_110498_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index f9e15bac953..cab7a34e672 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -9,19 +9,19 @@ - m_173296_(p_110719_.m_91289_().m_110907_().m_110882_(blockstate), p_110720_); + org.apache.commons.lang3.tuple.Pair overlay = getOverlayBlock(player); + if (overlay != null) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(player, p_110720_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) -+ m_173296_(p_110719_.m_91289_().m_110907_().getTexture(overlay.getLeft(), p_110719_.f_91073_, overlay.getRight()), p_110720_); ++ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, p_110720_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) ++ m_173296_(p_110719_.m_91289_().m_110907_().getTexture(overlay.getLeft(), p_110719_.f_91073_, overlay.getRight()), p_110720_); } } if (!p_110719_.f_91074_.m_5833_()) { if (p_110719_.f_91074_.m_204029_(FluidTags.f_13131_)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(player, p_110720_)) ++ if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, p_110720_)) m_110725_(p_110719_, p_110720_); } if (p_110719_.f_91074_.m_6060_()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(player, p_110720_)) ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, p_110720_)) m_110728_(p_110719_, p_110720_); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch b/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch index cb8c9d08392..59e48e95296 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ShaderInstance.java +++ b/net/minecraft/client/renderer/ShaderInstance.java -@@ -96,10 +_,14 @@ +@@ -95,10 +_,14 @@ @Nullable public final Uniform f_173320_; @@ -14,18 +14,19 @@ this.f_173307_ = p_173338_; - ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json"); + ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.m_135827_(), "shaders/core/" + shaderLocation.m_135815_() + ".json"); - Resource resource = null; try { -@@ -209,8 +_,9 @@ + Reader reader = p_173336_.m_215597_(resourcelocation); +@@ -222,8 +_,10 @@ Program program1 = p_173342_.m_85570_().get(p_173343_); Program program; if (program1 == null) { - String s = "shaders/core/" + p_173343_ + p_173342_.m_85569_(); -- ResourceLocation resourcelocation = new ResourceLocation(s); +- Resource resource = p_173341_.m_215593_(new ResourceLocation(s)); + ResourceLocation loc = new ResourceLocation(p_173343_); + String s = "shaders/core/" + loc.m_135815_() + p_173342_.m_85569_(); + ResourceLocation resourcelocation = new ResourceLocation(loc.m_135827_(), s); - Resource resource = p_173341_.m_142591_(resourcelocation); - final String s1 = FileUtil.m_179922_(s); ++ Resource resource = p_173341_.m_215593_(resourcelocation); + InputStream inputstream = resource.m_215507_(); + try { diff --git a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch index 9ae217780b2..e286658a170 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/Sheets.java +++ b/net/minecraft/client/renderer/Sheets.java -@@ -127,7 +_,8 @@ +@@ -129,7 +_,8 @@ } private static Material m_173385_(WoodType p_173386_) { @@ -10,9 +10,9 @@ } public static Material m_173381_(WoodType p_173382_) { -@@ -174,5 +_,12 @@ - default: - return p_110773_; +@@ -176,5 +_,12 @@ + default: + return p_110773_; } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch index 02c3137aeb9..1e1b84cc0f4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/BlockModelShaper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/BlockModelShaper.java +++ b/net/minecraft/client/renderer/block/BlockModelShaper.java -@@ -24,8 +_,15 @@ +@@ -23,8 +_,15 @@ this.f_110878_ = p_110880_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch index 3582193ea63..ac76163e5a6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch @@ -9,36 +9,37 @@ this.f_110901_ = new LiquidBlockRenderer(); } -@@ -45,18 +_,26 @@ +@@ -45,19 +_,27 @@ return this.f_110899_; } + @Deprecated //Forge: Model parameter public void m_110918_(BlockState p_110919_, BlockPos p_110920_, BlockAndTintGetter p_110921_, PoseStack p_110922_, VertexConsumer p_110923_) { -+ renderBreakingTexture(p_110919_,p_110920_, p_110921_, p_110922_, p_110923_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ renderBreakingTexture(p_110919_, p_110920_, p_110921_, p_110922_, p_110923_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public void renderBreakingTexture(BlockState p_110919_, BlockPos p_110920_, BlockAndTintGetter p_110921_, PoseStack p_110922_, VertexConsumer p_110923_, net.minecraftforge.client.model.data.IModelData modelData) { if (p_110919_.m_60799_() == RenderShape.MODEL) { BakedModel bakedmodel = this.f_110899_.m_110893_(p_110919_); long i = p_110919_.m_60726_(p_110920_); -- this.f_110900_.m_111047_(p_110921_, bakedmodel, p_110919_, p_110920_, p_110922_, p_110923_, true, this.f_110902_, i, OverlayTexture.f_118083_); +- this.f_110900_.m_234379_(p_110921_, bakedmodel, p_110919_, p_110920_, p_110922_, p_110923_, true, this.f_110902_, i, OverlayTexture.f_118083_); + this.f_110900_.tesselateBlock(p_110921_, bakedmodel, p_110919_, p_110920_, p_110922_, p_110923_, true, this.f_110902_, i, OverlayTexture.f_118083_, modelData); } } + @Deprecated //Forge: Model parameter - public boolean m_110924_(BlockState p_110925_, BlockPos p_110926_, BlockAndTintGetter p_110927_, PoseStack p_110928_, VertexConsumer p_110929_, boolean p_110930_, Random p_110931_) { -+ return renderBatched(p_110925_, p_110926_, p_110927_, p_110928_, p_110929_, p_110930_, p_110931_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public void m_234355_(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_) { ++ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean renderBatched(BlockState p_110925_, BlockPos p_110926_, BlockAndTintGetter p_110927_, PoseStack p_110928_, VertexConsumer p_110929_, boolean p_110930_, Random p_110931_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.IModelData modelData) { try { - RenderShape rendershape = p_110925_.m_60799_(); -- return rendershape != RenderShape.MODEL ? false : this.f_110900_.m_111047_(p_110927_, this.m_110910_(p_110925_), p_110925_, p_110926_, p_110928_, p_110929_, p_110930_, p_110931_, p_110925_.m_60726_(p_110926_), OverlayTexture.f_118083_); -+ return rendershape != RenderShape.MODEL ? false : this.f_110900_.tesselateBlock(p_110927_, this.m_110910_(p_110925_), p_110925_, p_110926_, p_110928_, p_110929_, p_110930_, p_110931_, p_110925_.m_60726_(p_110926_), OverlayTexture.f_118083_, modelData); + RenderShape rendershape = p_234356_.m_60799_(); + if (rendershape == RenderShape.MODEL) { +- this.f_110900_.m_234379_(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_); ++ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData); + } + } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.m_127521_(throwable, "Tesselating block in world"); - CrashReportCategory crashreportcategory = crashreport.m_127514_("Block being tesselated"); -@@ -84,7 +_,11 @@ +@@ -87,7 +_,11 @@ return this.f_110899_.m_110893_(p_110911_); } @@ -49,16 +50,16 @@ + public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.minecraftforge.client.model.data.IModelData modelData) { RenderShape rendershape = p_110913_.m_60799_(); if (rendershape != RenderShape.INVISIBLE) { - switch(rendershape) { -@@ -94,10 +_,11 @@ - float f = (float)(i >> 16 & 255) / 255.0F; - float f1 = (float)(i >> 8 & 255) / 255.0F; - float f2 = (float)(i & 255) / 255.0F; -- this.f_110900_.m_111067_(p_110914_.m_85850_(), p_110915_.m_6299_(ItemBlockRenderTypes.m_109284_(p_110913_, false)), p_110913_, bakedmodel, f, f1, f2, p_110916_, p_110917_); + switch (rendershape) { +@@ -97,10 +_,11 @@ + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; +- this.f_110900_.m_111067_(p_110914_.m_85850_(), p_110915_.m_6299_(ItemBlockRenderTypes.m_109284_(p_110913_, false)), p_110913_, bakedmodel, f, f1, f2, p_110916_, p_110917_); + this.f_110900_.renderModel(p_110914_.m_85850_(), p_110915_.m_6299_(ItemBlockRenderTypes.m_109284_(p_110913_, false)), p_110913_, bakedmodel, f, f1, f2, p_110916_, p_110917_, modelData); - break; - case ENTITYBLOCK_ANIMATED: -- this.f_173397_.m_108829_(new ItemStack(p_110913_.m_60734_()), ItemTransforms.TransformType.NONE, p_110914_, p_110915_, p_110916_, p_110917_); + break; + case ENTITYBLOCK_ANIMATED: +- this.f_173397_.m_108829_(new ItemStack(p_110913_.m_60734_()), ItemTransforms.TransformType.NONE, p_110914_, p_110915_, p_110916_, p_110917_); + ItemStack stack = new ItemStack(p_110913_.m_60734_()); + net.minecraftforge.client.RenderProperties.get(stack).getItemStackRenderer().m_108829_(stack, ItemTransforms.TransformType.NONE, p_110914_, p_110915_, p_110916_, p_110917_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch index c12129af8ab..d935e04639e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch @@ -2,97 +2,97 @@ +++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java @@ -68,8 +_,9 @@ - public boolean m_203173_(BlockAndTintGetter p_203174_, BlockPos p_203175_, VertexConsumer p_203176_, BlockState p_203177_, FluidState p_203178_) { - boolean flag = p_203178_.m_205070_(FluidTags.f_13132_); + public void m_234369_(BlockAndTintGetter p_234370_, BlockPos p_234371_, VertexConsumer p_234372_, BlockState p_234373_, FluidState p_234374_) { + boolean flag = p_234374_.m_205070_(FluidTags.f_13132_); - TextureAtlasSprite[] atextureatlassprite = flag ? this.f_110940_ : this.f_110941_; -- int i = flag ? 16777215 : BiomeColors.m_108811_(p_203174_, p_203175_); -+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_203174_, p_203175_, p_203178_); -+ int i = p_203178_.m_76152_().getAttributes().getColor(p_203174_, p_203175_); +- int i = flag ? 16777215 : BiomeColors.m_108811_(p_234370_, p_234371_); ++ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_234370_, p_234371_, p_234374_); ++ int i = p_234374_.m_76152_().getAttributes().getColor(p_234370_, p_234371_); + 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; -@@ -184,15 +_,16 @@ +@@ -180,15 +_,16 @@ float f30 = f4 * f; float f31 = f4 * f1; float f32 = f4 * f2; -- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); -- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); +- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); +- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); + -+ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); -+ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); - if (p_203178_.m_76171_(p_203174_, p_203175_.m_7494_())) { -- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); -- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); -+ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); -+ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); ++ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); ++ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); + if (p_234374_.m_76171_(p_234370_, p_234371_.m_7494_())) { +- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); +- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); ++ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); ++ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); } } -@@ -205,10 +_,11 @@ +@@ -201,10 +_,11 @@ float f46 = f3 * f; float f47 = f3 * f1; float f48 = f3 * f2; -- this.m_110984_(p_203176_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f40, f43, l); -- this.m_110984_(p_203176_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, l); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, f41, f42, l); -- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f41, f43, l); +- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f40, f43, l); +- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, l); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, f41, f42, l); +- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f41, f43, l); + -+ this.vertex(p_203176_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f40, f43, l); -+ this.vertex(p_203176_, d1, d2 + (double)f17, d0, f46, f47, f48, alpha, f40, f42, l); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, alpha, f41, f42, l); -+ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f41, f43, l); - flag7 = true; ++ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f40, f43, l); ++ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, alpha, f40, f42, l); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, alpha, f41, f42, l); ++ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f41, f43, l); } -@@ -264,10 +_,9 @@ - flag7 = true; - BlockPos blockpos = p_203175_.m_142300_(direction); + int k = this.m_110945_(p_234370_, p_234371_); +@@ -258,10 +_,9 @@ + if (flag7 && !m_203179_(p_234370_, p_234371_, direction, Math.max(f44, f45), p_234370_.m_8055_(p_234371_.m_121945_(direction)))) { + BlockPos blockpos = p_234371_.m_121945_(direction); TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { -- Block block = p_203174_.m_8055_(blockpos).m_60734_(); +- Block block = p_234370_.m_8055_(blockpos).m_60734_(); - if (block instanceof HalfTransparentBlock || block instanceof LeavesBlock) { - textureatlassprite2 = this.f_110942_; + if (atextureatlassprite[2] != null) { -+ if (p_203174_.m_8055_(blockpos).shouldDisplayFluidOverlay(p_203174_, blockpos, p_203178_)) { ++ if (p_234370_.m_8055_(blockpos).shouldDisplayFluidOverlay(p_234370_, blockpos, p_234374_)) { + textureatlassprite2 = atextureatlassprite[2]; } } -@@ -280,15 +_,16 @@ +@@ -274,15 +_,16 @@ float f37 = f4 * f36 * f; float f38 = f4 * f36 * f1; float f39 = f4 * f36 * f2; -- this.m_110984_(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); -- this.m_110984_(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); -- this.m_110984_(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); -- this.m_110984_(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); +- this.m_110984_(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); +- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); +- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); +- this.m_110984_(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); + -+ this.vertex(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); -+ this.vertex(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); -+ this.vertex(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); -+ this.vertex(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); ++ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); ++ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); ++ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); ++ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); if (textureatlassprite2 != this.f_110942_) { -- this.m_110984_(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); -- this.m_110984_(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); -- this.m_110984_(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); -- this.m_110984_(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); -+ this.vertex(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); -+ this.vertex(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); -+ this.vertex(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); -+ this.vertex(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); +- this.m_110984_(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); +- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); +- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); +- this.m_110984_(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); ++ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); ++ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); ++ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); ++ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); } } } -@@ -343,8 +_,8 @@ +@@ -336,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch index fe8f20416cc..d81ca1cb16b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -1,86 +1,117 @@ --- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java +++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java -@@ -40,13 +_,18 @@ +@@ -40,72 +_,85 @@ this.f_110995_ = p_110999_; } + @Deprecated //Forge: Model data argument - public boolean m_111047_(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, Random p_111055_, long p_111056_, int p_111057_) { -- boolean flag = Minecraft.m_91086_() && p_111050_.m_60791_() == 0 && p_111049_.m_7541_(); -+ return tesselateBlock(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public void m_234379_(BlockAndTintGetter p_234380_, BakedModel p_234381_, BlockState p_234382_, BlockPos p_234383_, PoseStack p_234384_, VertexConsumer p_234385_, boolean p_234386_, RandomSource p_234387_, long p_234388_, int p_234389_) { +- boolean flag = Minecraft.m_91086_() && p_234382_.m_60791_() == 0 && p_234381_.m_7541_(); +- Vec3 vec3 = p_234382_.m_60824_(p_234380_, p_234383_); +- p_234384_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_); ++ tesselateBlock(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, Random p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.IModelData modelData) { + boolean flag = Minecraft.m_91086_() && p_111050_.getLightEmission(p_111048_, p_111051_) == 0 && p_111049_.m_7541_(); - Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_); - p_111052_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_); ++ Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_); ++ p_111052_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_); + modelData = p_111049_.getModelData(p_111048_, p_111051_, p_111050_, modelData); try { -- return flag ? this.m_111078_(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_) : this.m_111090_(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_); -+ return flag ? this.tesselateWithAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData) : this.tesselateWithoutAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData); + if (flag) { +- this.m_234390_(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_); ++ this.tesselateWithAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData); + } else { +- this.m_234401_(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_); ++ this.tesselateWithoutAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData); + } + } catch (Throwable throwable) { CrashReport crashreport = CrashReport.m_127521_(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Block model being tesselated"); -@@ -56,7 +_,11 @@ +- CrashReportCategory.m_178950_(crashreportcategory, p_234380_, p_234383_, p_234382_); ++ CrashReportCategory.m_178950_(crashreportcategory, p_111048_, p_111051_, p_111050_); + crashreportcategory.m_128159_("Using AO", flag); + throw new ReportedException(crashreport); } } + @Deprecated //Forge: Model data argument - public boolean m_111078_(BlockAndTintGetter p_111079_, BakedModel p_111080_, BlockState p_111081_, BlockPos p_111082_, PoseStack p_111083_, VertexConsumer p_111084_, boolean p_111085_, Random p_111086_, long p_111087_, int p_111088_) { -+ return tesselateWithAO(p_111079_, p_111080_, p_111081_, p_111082_, p_111083_, p_111084_, p_111085_, p_111086_, p_111087_, p_111088_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public void m_234390_(BlockAndTintGetter p_234391_, BakedModel p_234392_, BlockState p_234393_, BlockPos p_234394_, PoseStack p_234395_, VertexConsumer p_234396_, boolean p_234397_, RandomSource p_234398_, long p_234399_, int p_234400_) { ++ tesselateWithAO(p_234391_, p_234392_, p_234393_, p_234394_, p_234395_, p_234396_, p_234397_, p_234398_, p_234399_, p_234400_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean tesselateWithAO(BlockAndTintGetter p_111079_, BakedModel p_111080_, BlockState p_111081_, BlockPos p_111082_, PoseStack p_111083_, VertexConsumer p_111084_, boolean p_111085_, Random p_111086_, long p_111087_, int p_111088_, net.minecraftforge.client.model.data.IModelData modelData) { - boolean flag = false; ++ public void tesselateWithAO(BlockAndTintGetter p_111079_, BakedModel p_111080_, BlockState p_111081_, BlockPos p_111082_, PoseStack p_111083_, VertexConsumer p_111084_, boolean p_111085_, RandomSource p_111086_, long p_111087_, int p_111088_, net.minecraftforge.client.model.data.IModelData modelData) { float[] afloat = new float[f_173405_.length * 2]; BitSet bitset = new BitSet(3); -@@ -65,7 +_,7 @@ + ModelBlockRenderer.AmbientOcclusionFace modelblockrenderer$ambientocclusionface = new ModelBlockRenderer.AmbientOcclusionFace(); +- BlockPos.MutableBlockPos blockpos$mutableblockpos = p_234394_.m_122032_(); ++ BlockPos.MutableBlockPos blockpos$mutableblockpos = p_111082_.m_122032_(); for(Direction direction : f_173405_) { - p_111086_.setSeed(p_111087_); -- List list = p_111080_.m_6840_(p_111081_, direction, p_111086_); +- p_234398_.m_188584_(p_234399_); +- List list = p_234392_.m_213637_(p_234393_, direction, p_234398_); ++ p_111086_.m_188584_(p_111087_); + List list = p_111080_.getQuads(p_111081_, direction, p_111086_, modelData); if (!list.isEmpty()) { - blockpos$mutableblockpos.m_122159_(p_111082_, direction); - if (!p_111085_ || Block.m_152444_(p_111081_, p_111079_, p_111082_, direction, blockpos$mutableblockpos)) { -@@ -76,7 +_,7 @@ +- blockpos$mutableblockpos.m_122159_(p_234394_, direction); +- if (!p_234397_ || Block.m_152444_(p_234393_, p_234391_, p_234394_, direction, blockpos$mutableblockpos)) { +- this.m_111012_(p_234391_, p_234393_, p_234394_, p_234395_, p_234396_, list, afloat, bitset, modelblockrenderer$ambientocclusionface, p_234400_); ++ blockpos$mutableblockpos.m_122159_(p_111082_, direction); ++ if (!p_111085_ || Block.m_152444_(p_111081_, p_111079_, p_111082_, direction, blockpos$mutableblockpos)) { ++ this.m_111012_(p_111079_, p_111081_, p_111082_, p_111083_, p_111084_, list, afloat, bitset, modelblockrenderer$ambientocclusionface, p_111088_); + } + } } - p_111086_.setSeed(p_111087_); -- List list1 = p_111080_.m_6840_(p_111081_, (Direction)null, p_111086_); +- p_234398_.m_188584_(p_234399_); +- List list1 = p_234392_.m_213637_(p_234393_, (Direction)null, p_234398_); ++ p_111086_.m_188584_(p_111087_); + List list1 = p_111080_.getQuads(p_111081_, (Direction)null, p_111086_, modelData); if (!list1.isEmpty()) { - this.m_111012_(p_111079_, p_111081_, p_111082_, p_111083_, p_111084_, list1, afloat, bitset, modelblockrenderer$ambientocclusionface, p_111088_); - flag = true; -@@ -85,14 +_,18 @@ - return flag; +- this.m_111012_(p_234391_, p_234393_, p_234394_, p_234395_, p_234396_, list1, afloat, bitset, modelblockrenderer$ambientocclusionface, p_234400_); ++ this.m_111012_(p_111079_, p_111081_, p_111082_, p_111083_, p_111084_, list1, afloat, bitset, modelblockrenderer$ambientocclusionface, p_111088_); + } + } + @Deprecated //Forge: Model data argument - public boolean m_111090_(BlockAndTintGetter p_111091_, BakedModel p_111092_, BlockState p_111093_, BlockPos p_111094_, PoseStack p_111095_, VertexConsumer p_111096_, boolean p_111097_, Random p_111098_, long p_111099_, int p_111100_) { -+ return tesselateWithoutAO(p_111091_, p_111092_, p_111093_, p_111094_, p_111095_, p_111096_, p_111097_, p_111098_, p_111099_, p_111100_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + public void m_234401_(BlockAndTintGetter p_234402_, BakedModel p_234403_, BlockState p_234404_, BlockPos p_234405_, PoseStack p_234406_, VertexConsumer p_234407_, boolean p_234408_, RandomSource p_234409_, long p_234410_, int p_234411_) { ++ tesselateWithoutAO(p_234402_, p_234403_, p_234404_, p_234405_, p_234406_, p_234407_, p_234408_, p_234409_, p_234410_, p_234411_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean tesselateWithoutAO(BlockAndTintGetter p_111091_, BakedModel p_111092_, BlockState p_111093_, BlockPos p_111094_, PoseStack p_111095_, VertexConsumer p_111096_, boolean p_111097_, Random p_111098_, long p_111099_, int p_111100_, net.minecraftforge.client.model.data.IModelData modelData) { - boolean flag = false; ++ public void tesselateWithoutAO(BlockAndTintGetter p_111091_, BakedModel p_111092_, BlockState p_111093_, BlockPos p_111094_, PoseStack p_111095_, VertexConsumer p_111096_, boolean p_111097_, RandomSource p_111098_, long p_111099_, int p_111100_, net.minecraftforge.client.model.data.IModelData modelData) { BitSet bitset = new BitSet(3); - BlockPos.MutableBlockPos blockpos$mutableblockpos = p_111094_.m_122032_(); +- BlockPos.MutableBlockPos blockpos$mutableblockpos = p_234405_.m_122032_(); ++ BlockPos.MutableBlockPos blockpos$mutableblockpos = p_111094_.m_122032_(); for(Direction direction : f_173405_) { - p_111098_.setSeed(p_111099_); -- List list = p_111092_.m_6840_(p_111093_, direction, p_111098_); +- p_234409_.m_188584_(p_234410_); +- List list = p_234403_.m_213637_(p_234404_, direction, p_234409_); ++ p_111098_.m_188584_(p_111099_); + List list = p_111092_.getQuads(p_111093_, direction, p_111098_, modelData); if (!list.isEmpty()) { - blockpos$mutableblockpos.m_122159_(p_111094_, direction); - if (!p_111097_ || Block.m_152444_(p_111093_, p_111091_, p_111094_, direction, blockpos$mutableblockpos)) { -@@ -104,7 +_,7 @@ +- blockpos$mutableblockpos.m_122159_(p_234405_, direction); +- if (!p_234408_ || Block.m_152444_(p_234404_, p_234402_, p_234405_, direction, blockpos$mutableblockpos)) { +- int i = LevelRenderer.m_109537_(p_234402_, p_234404_, blockpos$mutableblockpos); +- this.m_111001_(p_234402_, p_234404_, p_234405_, i, p_234411_, false, p_234406_, p_234407_, list, bitset); ++ blockpos$mutableblockpos.m_122159_(p_111094_, direction); ++ if (!p_111097_ || Block.m_152444_(p_111093_, p_111091_, p_111094_, direction, blockpos$mutableblockpos)) { ++ int i = LevelRenderer.m_109537_(p_111091_, p_111093_, blockpos$mutableblockpos); ++ this.m_111001_(p_111091_, p_111093_, p_111094_, i, p_111100_, false, p_111095_, p_111096_, list, bitset); + } + } } - p_111098_.setSeed(p_111099_); -- List list1 = p_111092_.m_6840_(p_111093_, (Direction)null, p_111098_); +- p_234409_.m_188584_(p_234410_); +- List list1 = p_234403_.m_213637_(p_234404_, (Direction)null, p_234409_); ++ p_111098_.m_188584_(p_111099_); + List list1 = p_111092_.getQuads(p_111093_, (Direction)null, p_111098_, modelData); if (!list1.isEmpty()) { - this.m_111001_(p_111091_, p_111093_, p_111094_, -1, p_111100_, true, p_111095_, p_111096_, list1, bitset); - flag = true; -@@ -220,17 +_,21 @@ +- this.m_111001_(p_234402_, p_234404_, p_234405_, -1, p_234411_, true, p_234406_, p_234407_, list1, bitset); ++ this.m_111001_(p_111091_, p_111093_, p_111094_, -1, p_111100_, true, p_111095_, p_111096_, list1, bitset); + } + + } +@@ -217,17 +_,21 @@ } @@ -89,18 +120,18 @@ + renderModel(p_111068_, p_111069_, p_111070_, p_111071_, p_111072_, p_111073_, p_111074_, p_111075_, p_111076_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + public void renderModel(PoseStack.Pose p_111068_, VertexConsumer p_111069_, @Nullable BlockState p_111070_, BakedModel p_111071_, float p_111072_, float p_111073_, float p_111074_, int p_111075_, int p_111076_, net.minecraftforge.client.model.data.IModelData modelData) { - Random random = new Random(); + RandomSource randomsource = RandomSource.m_216327_(); long i = 42L; for(Direction direction : f_173405_) { - random.setSeed(42L); -- m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.m_6840_(p_111070_, direction, random), p_111075_, p_111076_); -+ m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, random, modelData), p_111075_, p_111076_); + randomsource.m_188584_(42L); +- m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.m_213637_(p_111070_, direction, randomsource), p_111075_, p_111076_); ++ m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource, modelData), p_111075_, p_111076_); } - random.setSeed(42L); -- m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.m_6840_(p_111070_, (Direction)null, random), p_111075_, p_111076_); -+ m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, (Direction)null, random, modelData), p_111075_, p_111076_); + randomsource.m_188584_(42L); +- m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.m_213637_(p_111070_, (Direction)null, randomsource), p_111075_, p_111076_); ++ m_111058_(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, (Direction)null, randomsource, modelData), p_111075_, p_111076_); } private static void m_111058_(PoseStack.Pose p_111059_, VertexConsumer p_111060_, float p_111061_, float p_111062_, float p_111063_, List p_111064_, int p_111065_, int p_111066_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch index 6d2de87ca7f..3d6b06f8e53 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/model/BlockModel.java +++ b/net/minecraft/client/renderer/block/model/BlockModel.java -@@ -66,9 +_,10 @@ +@@ -65,9 +_,10 @@ public BlockModel f_111418_; @Nullable protected ResourceLocation f_111419_; @@ -12,7 +12,7 @@ } public static BlockModel m_111463_(String p_111464_) { -@@ -85,10 +_,15 @@ +@@ -84,10 +_,15 @@ this.f_111426_ = p_111435_; } @@ -28,7 +28,7 @@ public boolean m_111476_() { return this.f_111418_ != null ? this.f_111418_.m_111476_() : this.f_111424_; } -@@ -113,6 +_,10 @@ +@@ -112,6 +_,10 @@ return this.f_111426_.isEmpty() ? ItemOverrides.f_111734_ : new ItemOverrides(p_111447_, p_111448_, p_111447_::m_119341_, this.f_111426_); } @@ -39,7 +39,7 @@ public Collection m_7970_() { Set set = Sets.newHashSet(); -@@ -156,6 +_,9 @@ +@@ -155,6 +_,9 @@ Set set1 = Sets.newHashSet(this.m_111480_("particle")); @@ -49,7 +49,7 @@ for(BlockElement blockelement : this.m_111436_()) { for(BlockElementFace blockelementface : blockelement.f_111310_.values()) { Material material = this.m_111480_(blockelementface.f_111356_); -@@ -182,11 +_,17 @@ +@@ -181,11 +_,17 @@ return set1; } @@ -67,7 +67,7 @@ TextureAtlasSprite textureatlassprite = p_111452_.apply(this.m_111480_("particle")); if (this.m_111490_() == ModelBakery.f_119233_) { return new BuiltInModel(this.m_111491_(), this.m_111446_(p_111450_, p_111451_), textureatlassprite, this.m_111479_().m_111526_()); -@@ -213,6 +_,10 @@ +@@ -212,6 +_,10 @@ return f_111421_.m_111600_(p_111438_.f_111308_, p_111438_.f_111309_, p_111439_, p_111440_, p_111441_, p_111442_, p_111438_.f_111311_, p_111438_.f_111312_, p_111443_); } @@ -78,7 +78,7 @@ public boolean m_111477_(String p_111478_) { return !MissingTextureAtlasSprite.m_118071_().equals(this.m_111480_(p_111478_).m_119203_()); } -@@ -269,7 +_,18 @@ +@@ -268,7 +_,18 @@ ItemTransform itemtransform5 = this.m_111444_(ItemTransforms.TransformType.GUI); ItemTransform itemtransform6 = this.m_111444_(ItemTransforms.TransformType.GROUND); ItemTransform itemtransform7 = this.m_111444_(ItemTransforms.TransformType.FIXED); @@ -98,7 +98,7 @@ } private ItemTransform m_111444_(ItemTransforms.TransformType p_111445_) { -@@ -388,6 +_,8 @@ +@@ -387,6 +_,8 @@ public boolean m_111526_() { return this == SIDE; } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch index 294e1aefdf7..8a6ab9112a2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransforms.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/model/ItemTransforms.java +++ b/net/minecraft/client/renderer/block/model/ItemTransforms.java -@@ -20,6 +_,7 @@ +@@ -20,11 +_,13 @@ public final ItemTransform f_111792_; public final ItemTransform f_111793_; public final ItemTransform f_111794_; @@ -8,6 +8,12 @@ private ItemTransforms() { this(ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_, ItemTransform.f_111754_); + } + ++ @Deprecated + public ItemTransforms(ItemTransforms p_111807_) { + this.f_111787_ = p_111807_.f_111787_; + this.f_111788_ = p_111807_.f_111788_; @@ -34,9 +_,16 @@ this.f_111792_ = p_111807_.f_111792_; this.f_111793_ = p_111807_.f_111793_; @@ -25,20 +31,23 @@ this.f_111787_ = p_111798_; this.f_111788_ = p_111799_; this.f_111789_ = p_111800_; -@@ -45,6 +_,7 @@ +@@ -45,8 +_,10 @@ this.f_111792_ = p_111803_; this.f_111793_ = p_111804_; this.f_111794_ = p_111805_; + this.moddedTransforms = moddedTransforms; } ++ @Deprecated public ItemTransform m_111808_(ItemTransforms.TransformType p_111809_) { + switch (p_111809_) { + case THIRD_PERSON_LEFT_HAND: @@ -66,7 +_,7 @@ - case FIXED: - return this.f_111794_; - default: -- return ItemTransform.f_111754_; -+ return moddedTransforms.getOrDefault(p_111809_, ItemTransform.f_111754_); + case FIXED: + return this.f_111794_; + default: +- return ItemTransform.f_111754_; ++ return moddedTransforms.getOrDefault(p_111809_, ItemTransform.f_111754_); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch index da62612fc6e..f4370faf3d4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java +++ b/net/minecraft/client/renderer/blockentity/BlockEntityRenderers.java -@@ -12,7 +_,7 @@ +@@ -11,7 +_,7 @@ @OnlyIn(Dist.CLIENT) public class BlockEntityRenderers { diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch index f7cced50ce5..64c3a580c1d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/ChestRenderer.java +++ b/net/minecraft/client/renderer/blockentity/ChestRenderer.java -@@ -120,7 +_,7 @@ +@@ -119,7 +_,7 @@ f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; int i = neighborcombineresult.m_5649_(new BrightnessCombiner<>()).applyAsInt(p_112367_); @@ -9,7 +9,7 @@ VertexConsumer vertexconsumer = material.m_119194_(p_112366_, RenderType::m_110452_); if (flag1) { if (chesttype == ChestType.LEFT) { -@@ -142,5 +_,9 @@ +@@ -141,5 +_,9 @@ p_112372_.m_104301_(p_112370_, p_112371_, p_112376_, p_112377_); p_112373_.m_104301_(p_112370_, p_112371_, p_112376_, p_112377_); p_112374_.m_104301_(p_112370_, p_112371_, p_112376_, p_112377_); diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java.patch index 4ce31025dab..6fa8f4585d3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java.patch @@ -8,7 +8,7 @@ + if(false) { RenderType rendertype = ItemBlockRenderTypes.m_109293_(p_112460_); VertexConsumer vertexconsumer = p_112462_.m_6299_(rendertype); - this.f_112441_.m_110937_().m_111047_(p_112463_, this.f_112441_.m_110910_(p_112460_), p_112460_, p_112459_, p_112461_, vertexconsumer, p_112464_, new Random(), p_112460_.m_60726_(p_112459_), p_112465_); + this.f_112441_.m_110937_().m_234379_(p_112463_, this.f_112441_.m_110910_(p_112460_), p_112460_, p_112459_, p_112461_, vertexconsumer, p_112464_, RandomSource.m_216327_(), p_112460_.m_60726_(p_112459_), p_112465_); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch index 902d8fe755c..b1a5d4d5098 100644 --- a/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java +++ b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java -@@ -52,6 +_,7 @@ +@@ -51,6 +_,7 @@ builder.put(SkullBlock.Types.ZOMBIE, new SkullModel(p_173662_.m_171103_(ModelLayers.f_171224_))); builder.put(SkullBlock.Types.CREEPER, new SkullModel(p_173662_.m_171103_(ModelLayers.f_171130_))); builder.put(SkullBlock.Types.DRAGON, new DragonHeadModel(p_173662_.m_171103_(ModelLayers.f_171135_))); 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 1a00e0a5a9e..6e91ef0c887 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java -@@ -73,12 +_,15 @@ +@@ -77,12 +_,15 @@ private Vec3 f_112683_ = Vec3.f_82478_; public ChunkRenderDispatcher(ClientLevel p_194405_, LevelRenderer p_194406_, Executor p_194407_, boolean p_194408_, ChunkBufferBuilderPack p_194409_) { @@ -17,8 +17,8 @@ this.f_112678_ = p_194409_; List list = Lists.newArrayListWithExpectedSize(l); -@@ -420,7 +_,7 @@ - if (!chunkrenderdispatcher$compiledchunk.f_112750_.contains(p_112810_)) { +@@ -418,7 +_,7 @@ + if (!chunkrenderdispatcher$compiledchunk.f_112749_.contains(p_112810_)) { return false; } else { - this.f_112788_ = new ChunkRenderDispatcher.RenderChunk.ResortTransparencyTask(this.m_112832_(), chunkrenderdispatcher$compiledchunk); @@ -26,7 +26,7 @@ p_112811_.m_112709_(this.f_112788_); return true; } -@@ -452,7 +_,7 @@ +@@ -450,7 +_,7 @@ this.f_202433_.incrementAndGet(); } @@ -35,7 +35,7 @@ return this.f_112787_; } -@@ -485,10 +_,20 @@ +@@ -483,10 +_,20 @@ protected final double f_112847_; protected final AtomicBoolean f_112848_ = new AtomicBoolean(false); protected final boolean f_194420_; @@ -56,7 +56,7 @@ } public abstract CompletableFuture m_5869_(ChunkBufferBuilderPack p_112853_); -@@ -500,6 +_,10 @@ +@@ -498,6 +_,10 @@ public int compareTo(ChunkRenderDispatcher.RenderChunk.ChunkCompileTask p_112855_) { return Doubles.compare(this.f_112847_, p_112855_.f_112847_); } @@ -67,7 +67,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -507,8 +_,13 @@ +@@ -505,8 +_,13 @@ @Nullable protected RenderChunkRegion f_112858_; @@ -82,61 +82,75 @@ this.f_112858_ = p_194428_; } -@@ -591,8 +_,10 @@ +@@ -592,29 +_,34 @@ BlockState blockstate1 = renderchunkregion.m_8055_(blockpos2); FluidState fluidstate = blockstate1.m_60819_(); - if (!fluidstate.m_76178_()) { - RenderType rendertype = ItemBlockRenderTypes.m_109287_(fluidstate); +- BufferBuilder bufferbuilder = p_234471_.m_108839_(rendertype); +- if (set.add(rendertype)) { +- RenderChunk.this.m_112805_(bufferbuilder); +- } +- +- blockrenderdispatcher.m_234363_(blockpos2, renderchunkregion, bufferbuilder, blockstate1, fluidstate); +- } +- +- if (blockstate.m_60799_() != RenderShape.INVISIBLE) { +- RenderType rendertype2 = ItemBlockRenderTypes.m_109282_(blockstate); +- BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype2); +- if (set.add(rendertype2)) { +- RenderChunk.this.m_112805_(bufferbuilder2); +- } +- +- posestack.m_85836_(); +- posestack.m_85837_((double)(blockpos2.m_123341_() & 15), (double)(blockpos2.m_123342_() & 15), (double)(blockpos2.m_123343_() & 15)); +- blockrenderdispatcher.m_234355_(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource); +- posestack.m_85849_(); + net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2); + for (RenderType rendertype : RenderType.m_110506_()) { + net.minecraftforge.client.ForgeHooksClient.setRenderType(rendertype); -+ if (!fluidstate.m_76178_() && ItemBlockRenderTypes.canRenderInLayer(fluidstate, rendertype)) { - BufferBuilder bufferbuilder = p_112870_.m_108839_(rendertype); - if (p_112869_.f_112750_.add(rendertype)) { - RenderChunk.this.m_112805_(bufferbuilder); -@@ -604,8 +_,8 @@ - } - } - -- if (blockstate.m_60799_() != RenderShape.INVISIBLE) { -- RenderType rendertype1 = ItemBlockRenderTypes.m_109282_(blockstate); -+ if (blockstate.m_60799_() != RenderShape.INVISIBLE && ItemBlockRenderTypes.canRenderInLayer(blockstate, rendertype)) { -+ RenderType rendertype1 = rendertype; - BufferBuilder bufferbuilder2 = p_112870_.m_108839_(rendertype1); - if (p_112869_.f_112750_.add(rendertype1)) { - RenderChunk.this.m_112805_(bufferbuilder2); -@@ -613,14 +_,16 @@ - - posestack.m_85836_(); - posestack.m_85837_((double)(blockpos2.m_123341_() & 15), (double)(blockpos2.m_123342_() & 15), (double)(blockpos2.m_123343_() & 15)); -- if (blockrenderdispatcher.m_110924_(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, random)) { -+ if (blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, random, modelData)) { - p_112869_.f_112751_ = false; - p_112869_.f_112749_.add(rendertype1); - } - - posestack.m_85849_(); ++ ++ if (!fluidstate.m_76178_() && ItemBlockRenderTypes.canRenderInLayer(fluidstate, rendertype)) { ++ BufferBuilder bufferbuilder = p_234471_.m_108839_(rendertype); ++ if (set.add(rendertype)) { ++ RenderChunk.this.m_112805_(bufferbuilder); ++ } ++ ++ blockrenderdispatcher.m_234363_(blockpos2, renderchunkregion, bufferbuilder, blockstate1, fluidstate); ++ } ++ ++ if (blockstate.m_60799_() != RenderShape.INVISIBLE && ItemBlockRenderTypes.canRenderInLayer(blockstate, rendertype)) { ++ RenderType rendertype1 = rendertype; ++ BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype1); ++ if (set.add(rendertype1)) { ++ RenderChunk.this.m_112805_(bufferbuilder2); ++ } ++ ++ posestack.m_85836_(); ++ posestack.m_85837_((double) (blockpos2.m_123341_() & 15), (double) (blockpos2.m_123342_() & 15), (double) (blockpos2.m_123343_() & 15)); ++ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData); ++ posestack.m_85849_(); ++ } } -+ } } + net.minecraftforge.client.ForgeHooksClient.setRenderType(null); - if (p_112869_.f_112749_.contains(RenderType.m_110466_())) { - BufferBuilder bufferbuilder1 = p_112870_.m_108839_(RenderType.m_110466_()); -@@ -639,10 +_,10 @@ - private void m_112877_(ChunkRenderDispatcher.CompiledChunk p_112878_, Set p_112879_, E p_112880_) { - BlockEntityRenderer blockentityrenderer = Minecraft.m_91087_().m_167982_().m_112265_(p_112880_); + if (set.contains(RenderType.m_110466_())) { + BufferBuilder bufferbuilder1 = p_234471_.m_108839_(RenderType.m_110466_()); +@@ -641,10 +_,10 @@ + private void m_234476_(ChunkRenderDispatcher.RenderChunk.RebuildTask.CompileResults p_234477_, E p_234478_) { + BlockEntityRenderer blockentityrenderer = Minecraft.m_91087_().m_167982_().m_112265_(p_234478_); if (blockentityrenderer != null) { -- p_112878_.f_112752_.add(p_112880_); - if (blockentityrenderer.m_5932_(p_112880_)) { - p_112879_.add(p_112880_); +- p_234477_.f_234485_.add(p_234478_); + if (blockentityrenderer.m_5932_(p_234478_)) { + p_234477_.f_234484_.add(p_234478_); } -+ else p_112878_.f_112752_.add(p_112880_); //FORGE: Fix MC-112730 ++ else p_234477_.f_234485_.add(p_234478_); //FORGE: Fix MC-112730 } } -@@ -660,8 +_,13 @@ +@@ -672,8 +_,13 @@ class ResortTransparencyTask extends ChunkRenderDispatcher.RenderChunk.ChunkCompileTask { private final ChunkRenderDispatcher.CompiledChunk f_112886_; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/BoatRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/BoatRenderer.java.patch index 40d7e505595..527f677576b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/BoatRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/BoatRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/BoatRenderer.java +++ b/net/minecraft/client/renderer/entity/BoatRenderer.java -@@ -52,7 +_,7 @@ +@@ -62,7 +_,7 @@ p_113932_.m_85845_(new Quaternion(new Vector3f(1.0F, 0.0F, 1.0F), p_113929_.m_38352_(p_113931_), true)); } @@ -9,7 +9,7 @@ ResourceLocation resourcelocation = pair.getFirst(); BoatModel boatmodel = pair.getSecond(); p_113932_.m_85841_(-1.0F, -1.0F, 1.0F); -@@ -69,7 +_,10 @@ +@@ -79,7 +_,10 @@ super.m_7392_(p_113929_, p_113930_, p_113931_, p_113932_, p_113933_, p_113934_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch index 797d26d337f..5dd7f3e9e6d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java +++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java -@@ -161,12 +_,12 @@ +@@ -168,12 +_,12 @@ private static void m_114441_(PoseStack p_114442_, VertexConsumer p_114443_, Entity p_114444_, float p_114445_) { - AABB aabb = p_114444_.m_142469_().m_82386_(-p_114444_.m_20185_(), -p_114444_.m_20186_(), -p_114444_.m_20189_()); + AABB aabb = p_114444_.m_20191_().m_82386_(-p_114444_.m_20185_(), -p_114444_.m_20186_(), -p_114444_.m_20189_()); LevelRenderer.m_109646_(p_114442_, p_114443_, aabb, 1.0F, 1.0F, 1.0F, 1.0F); - if (p_114444_ instanceof EnderDragon) { + if (p_114444_.isMultipartEntity()) { @@ -15,8 +15,8 @@ p_114442_.m_85836_(); double d3 = d0 + Mth.m_14139_((double)p_114445_, enderdragonpart.f_19790_, enderdragonpart.m_20185_()); double d4 = d1 + Mth.m_14139_((double)p_114445_, enderdragonpart.f_19791_, enderdragonpart.m_20186_()); -@@ -324,9 +_,14 @@ - return this.f_114367_; +@@ -335,9 +_,14 @@ + return this.f_234577_; } + public Map> getSkinMap() { @@ -24,7 +24,7 @@ + } + public void m_6213_(ResourceManager p_174004_) { - EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context(this, this.f_173995_, p_174004_, this.f_173996_, this.f_114365_); + EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context(this, this.f_173995_, this.f_234576_, this.f_234577_, p_174004_, this.f_173996_, this.f_114365_); this.f_114362_ = EntityRenderers.m_174049_(entityrendererprovider$context); this.f_114363_ = EntityRenderers.m_174051_(entityrendererprovider$context); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.AddLayers(f_114362_, f_114363_)); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch index 9e90b95e85c..d2a7dabc237 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FallingBlockRenderer.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/renderer/entity/FallingBlockRenderer.java +++ b/net/minecraft/client/renderer/entity/FallingBlockRenderer.java -@@ -33,7 +_,13 @@ - BlockPos blockpos = new BlockPos(p_114634_.m_20185_(), p_114634_.m_142469_().f_82292_, p_114634_.m_20189_()); +@@ -34,7 +_,13 @@ + p_114637_.m_85836_(); + BlockPos blockpos = new BlockPos(p_114634_.m_20185_(), p_114634_.m_20191_().f_82292_, p_114634_.m_20189_()); p_114637_.m_85837_(-0.5D, 0.0D, -0.5D); - BlockRenderDispatcher blockrenderdispatcher = Minecraft.m_91087_().m_91289_(); -- blockrenderdispatcher.m_110937_().m_111047_(level, blockrenderdispatcher.m_110910_(blockstate), blockstate, blockpos, p_114637_, p_114638_.m_6299_(ItemBlockRenderTypes.m_109293_(blockstate)), false, new Random(), blockstate.m_60726_(p_114634_.m_31978_()), OverlayTexture.f_118083_); +- this.f_234617_.m_110937_().m_234379_(level, this.f_234617_.m_110910_(blockstate), blockstate, blockpos, p_114637_, p_114638_.m_6299_(ItemBlockRenderTypes.m_109293_(blockstate)), false, RandomSource.m_216327_(), blockstate.m_60726_(p_114634_.m_31978_()), OverlayTexture.f_118083_); + for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType.m_110506_()) { + if (ItemBlockRenderTypes.canRenderInLayer(blockstate, type)) { + net.minecraftforge.client.ForgeHooksClient.setRenderType(type); -+ blockrenderdispatcher.m_110937_().m_111047_(level, blockrenderdispatcher.m_110910_(blockstate), blockstate, blockpos, p_114637_, p_114638_.m_6299_(type), false, new Random(), blockstate.m_60726_(p_114634_.m_31978_()), OverlayTexture.f_118083_); ++ this.f_234617_.m_110937_().m_234379_(level, this.f_234617_.m_110910_(blockstate), blockstate, blockpos, p_114637_, p_114638_.m_6299_(type), false, RandomSource.m_216327_(), blockstate.m_60726_(p_114634_.m_31978_()), OverlayTexture.f_118083_); + } + } + net.minecraftforge.client.ForgeHooksClient.setRenderType(null); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch index b498636b1fa..f98fde0bb44 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch @@ -23,14 +23,14 @@ } @@ -83,18 +_,18 @@ - float f11 = (this.f_115020_.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f13 = (this.f_115020_.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f10 = (this.f_115020_.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f11 = (this.f_115020_.m_188501_() * 2.0F - 1.0F) * 0.15F; + float f13 = (this.f_115020_.m_188501_() * 2.0F - 1.0F) * 0.15F; + float f10 = (this.f_115020_.m_188501_() * 2.0F - 1.0F) * 0.15F; - p_115039_.m_85837_((double)f11, (double)f13, (double)f10); + p_115039_.m_85837_(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); } else { - float f12 = (this.f_115020_.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - float f14 = (this.f_115020_.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; + float f12 = (this.f_115020_.m_188501_() * 2.0F - 1.0F) * 0.15F * 0.5F; + float f14 = (this.f_115020_.m_188501_() * 2.0F - 1.0F) * 0.15F * 0.5F; - p_115039_.m_85837_((double)f12, (double)f14, 0.0D); + p_115039_.m_85837_(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); } 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 03ab6b9989c..76794cc9097 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -61,7 +_,7 @@ +@@ -62,7 +_,7 @@ + ItemStack itemstack = p_115076_.m_31822_(); if (!flag) { - BlockRenderDispatcher blockrenderdispatcher = this.f_115046_.m_91289_(); - ModelManager modelmanager = blockrenderdispatcher.m_110907_().m_110881_(); + ModelManager modelmanager = this.f_234645_.m_110907_().m_110881_(); - ModelResourceLocation modelresourcelocation = this.m_174212_(p_115076_, itemstack); + ModelResourceLocation modelresourcelocation = p_115076_.m_31822_().m_41720_() instanceof MapItem ? f_115045_ : f_115044_; p_115079_.m_85836_(); p_115079_.m_85837_(-0.5D, -0.5D, -0.5D); - blockrenderdispatcher.m_110937_().m_111067_(p_115079_.m_85850_(), p_115080_.m_6299_(Sheets.m_110789_()), (BlockState)null, modelmanager.m_119422_(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_115081_, OverlayTexture.f_118083_); -@@ -69,22 +_,22 @@ + this.f_234645_.m_110937_().m_111067_(p_115079_.m_85850_(), p_115080_.m_6299_(Sheets.m_110789_()), (BlockState)null, modelmanager.m_119422_(modelresourcelocation), 1.0F, 1.0F, 1.0F, p_115081_, OverlayTexture.f_118083_); +@@ -70,30 +_,31 @@ } if (!itemstack.m_41619_()) { -- boolean flag1 = itemstack.m_150930_(Items.f_42573_); +- OptionalInt optionalint = p_115076_.m_218868_(); + MapItemSavedData mapitemsaveddata = MapItem.m_42853_(itemstack, p_115076_.f_19853_); if (flag) { p_115079_.m_85837_(0.0D, 0.0D, 0.5D); @@ -21,25 +21,27 @@ p_115079_.m_85837_(0.0D, 0.0D, 0.4375D); } -- int j = flag1 ? p_115076_.m_31823_() % 4 * 2 : p_115076_.m_31823_(); +- int j = optionalint.isPresent() ? p_115076_.m_31823_() % 4 * 2 : p_115076_.m_31823_(); + int j = mapitemsaveddata != null ? p_115076_.m_31823_() % 4 * 2 : p_115076_.m_31823_(); p_115079_.m_85845_(Vector3f.f_122227_.m_122240_((float)j * 360.0F / 8.0F)); -- if (flag1) { +- if (optionalint.isPresent()) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_115076_, this, p_115079_, p_115080_, p_115081_))) { + if (mapitemsaveddata != null) { p_115079_.m_85845_(Vector3f.f_122227_.m_122240_(180.0F)); float f = 0.0078125F; p_115079_.m_85841_(0.0078125F, 0.0078125F, 0.0078125F); p_115079_.m_85837_(-64.0D, -64.0D, 0.0D); - Integer integer = MapItem.m_151131_(itemstack); -- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(integer, p_115076_.f_19853_); +- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(optionalint.getAsInt(), p_115076_.f_19853_); p_115079_.m_85837_(0.0D, 0.0D, -1.0D); if (mapitemsaveddata != null) { int i = this.m_174208_(p_115076_, 15728850, p_115081_); -@@ -94,6 +_,7 @@ +- Minecraft.m_91087_().f_91063_.m_109151_().m_168771_(p_115079_, p_115080_, optionalint.getAsInt(), mapitemsaveddata, true, i); ++ Minecraft.m_91087_().f_91063_.m_109151_().m_168771_(p_115079_, p_115080_, p_115076_.m_218868_().getAsInt(), mapitemsaveddata, true, i); + } + } else { int k = this.m_174208_(p_115076_, 15728880, p_115081_); p_115079_.m_85841_(0.5F, 0.5F, 0.5F); - this.f_115047_.m_174269_(itemstack, ItemTransforms.TransformType.FIXED, k, OverlayTexture.f_118083_, p_115079_, p_115080_, p_115076_.m_142049_()); + this.f_115047_.m_174269_(itemstack, ItemTransforms.TransformType.FIXED, k, OverlayTexture.f_118083_, p_115079_, p_115080_, p_115076_.m_19879_()); + } } } 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 d4728f2f811..419758f5a3b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java -@@ -76,8 +_,8 @@ +@@ -77,8 +_,8 @@ public ItemRenderer(TextureManager p_174225_, ModelManager p_174226_, ItemColors p_174227_, BlockEntityWithoutLevelRenderer p_174228_) { this.f_115096_ = p_174225_; @@ -10,7 +10,7 @@ for(Item item : Registry.f_122827_) { if (!f_115094_.contains(item)) { -@@ -117,7 +_,7 @@ +@@ -118,7 +_,7 @@ } } @@ -19,7 +19,7 @@ p_115147_.m_85837_(-0.5D, -0.5D, -0.5D); if (!p_115151_.m_7521_() && (!p_115144_.m_150930_(Items.f_42713_) || flag)) { boolean flag1; -@@ -127,7 +_,8 @@ +@@ -128,7 +_,8 @@ } else { flag1 = true; } @@ -28,8 +28,8 @@ + else { RenderType rendertype = ItemBlockRenderTypes.m_109279_(p_115144_, flag1); VertexConsumer vertexconsumer; - if (p_115144_.m_150930_(Items.f_42522_) && p_115144_.m_41790_()) { -@@ -153,8 +_,9 @@ + if (p_115144_.m_204117_(ItemTags.f_215866_) && p_115144_.m_41790_()) { +@@ -154,8 +_,9 @@ } this.m_115189_(p_115151_, p_115144_, p_115149_, p_115150_, p_115147_, vertexconsumer); @@ -40,7 +40,7 @@ } p_115147_.m_85849_(); -@@ -198,7 +_,7 @@ +@@ -199,7 +_,7 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; @@ -49,11 +49,11 @@ } } -@@ -301,6 +_,7 @@ +@@ -302,6 +_,7 @@ crashreportcategory.m_128165_("Item Type", () -> { return String.valueOf((Object)p_174237_.m_41720_()); }); -+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(p_174237_.m_41720_().getRegistryName())); ++ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_174237_.m_41720_()))); crashreportcategory.m_128165_("Item Damage", () -> { return String.valueOf(p_174237_.m_41773_()); }); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch index 18cb857800f..4644202de7c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/player/PlayerRenderer.java +++ b/net/minecraft/client/renderer/entity/player/PlayerRenderer.java -@@ -58,7 +_,9 @@ +@@ -57,7 +_,9 @@ public void m_7392_(AbstractClientPlayer p_117788_, float p_117789_, float p_117790_, PoseStack p_117791_, MultiBufferSource p_117792_, int p_117793_) { this.m_117818_(p_117788_); @@ -10,16 +10,16 @@ } public Vec3 m_7860_(AbstractClientPlayer p_117785_, float p_117786_) { -@@ -123,7 +_,7 @@ - if (useanim == UseAnim.SPYGLASS) { - return HumanoidModel.ArmPose.SPYGLASS; +@@ -126,7 +_,7 @@ + if (useanim == UseAnim.TOOT_HORN) { + return HumanoidModel.ArmPose.TOOT_HORN; } - } else if (!p_117795_.f_20911_ && itemstack.m_150930_(Items.f_42717_) && CrossbowItem.m_40932_(itemstack)) { + } else if (!p_117795_.f_20911_ && itemstack.m_41720_() instanceof CrossbowItem && CrossbowItem.m_40932_(itemstack)) { return HumanoidModel.ArmPose.CROSSBOW_HOLD; } -@@ -158,10 +_,12 @@ +@@ -161,10 +_,12 @@ } public void m_117770_(PoseStack p_117771_, MultiBufferSource p_117772_, int p_117773_, AbstractClientPlayer p_117774_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch b/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch index d84c628aa65..62c1244f2a0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/item/ItemProperties.java +++ b/net/minecraft/client/renderer/item/ItemProperties.java -@@ -47,7 +_,7 @@ +@@ -40,7 +_,7 @@ }; private static final Map> f_117825_ = Maps.newHashMap(); @@ -9,7 +9,7 @@ f_117820_.put(p_174582_, p_174583_); return p_174583_; } -@@ -56,7 +_,7 @@ +@@ -49,7 +_,7 @@ f_117820_.put(new ResourceLocation("custom_model_data"), p_174580_); } @@ -18,7 +18,7 @@ f_117825_.computeIfAbsent(p_174571_, (p_117828_) -> { return Maps.newHashMap(); }).put(p_174572_, p_174573_); -@@ -84,29 +_,29 @@ +@@ -77,29 +_,29 @@ } static { @@ -54,62 +54,100 @@ private double f_117899_; private double f_117900_; private long f_117901_; -@@ -149,7 +_,7 @@ +@@ -142,56 +_,56 @@ return this.f_117899_; } }); -- m_174570_(Items.f_42522_, new ResourceLocation("angle"), new ClampedItemPropertyFunction() { -+ register(Items.f_42522_, new ResourceLocation("angle"), new ClampedItemPropertyFunction() { - private final ItemProperties.CompassWobble f_117910_ = new ItemProperties.CompassWobble(); - private final ItemProperties.CompassWobble f_117911_ = new ItemProperties.CompassWobble(); - -@@ -235,26 +_,26 @@ - return Math.atan2(p_117919_.m_7094_() - p_117920_.m_20189_(), p_117919_.m_7096_() - p_117920_.m_20185_()); +- m_174570_(Items.f_42522_, new ResourceLocation("angle"), new CompassItemPropertyFunction((p_234992_, p_234993_, p_234994_) -> { ++ register(Items.f_42522_, new ResourceLocation("angle"), new CompassItemPropertyFunction((p_234992_, p_234993_, p_234994_) -> { + return CompassItem.m_40736_(p_234993_) ? CompassItem.m_220021_(p_234993_.m_41784_()) : CompassItem.m_220019_(p_234992_); + })); +- m_174570_(Items.f_220211_, new ResourceLocation("angle"), new CompassItemPropertyFunction((p_234983_, p_234984_, p_234985_) -> { ++ register(Items.f_220211_, new ResourceLocation("angle"), new CompassItemPropertyFunction((p_234983_, p_234984_, p_234985_) -> { + if (p_234985_ instanceof Player player) { + return player.m_219759_().orElse((GlobalPos)null); + } else { + return null; } - }); -- m_174570_(Items.f_42717_, new ResourceLocation("pull"), (p_174620_, p_174621_, p_174622_, p_174623_) -> { + })); +- m_174570_(Items.f_42717_, new ResourceLocation("pull"), (p_174610_, p_174611_, p_174612_, p_174613_) -> { +- if (p_174612_ == null) { + register(Items.f_42717_, new ResourceLocation("pull"), (p_174620_, p_174621_, p_174622_, p_174623_) -> { - if (p_174622_ == null) { ++ if (p_174622_ == null) { return 0.0F; } else { - return CrossbowItem.m_40932_(p_174620_) ? 0.0F : (float)(p_174620_.m_41779_() - p_174622_.m_21212_()) / (float)CrossbowItem.m_40939_(p_174620_); +- return CrossbowItem.m_40932_(p_174610_) ? 0.0F : (float)(p_174610_.m_41779_() - p_174612_.m_21212_()) / (float)CrossbowItem.m_40939_(p_174610_); ++ return CrossbowItem.m_40932_(p_174620_) ? 0.0F : (float)(p_174620_.m_41779_() - p_174622_.m_21212_()) / (float)CrossbowItem.m_40939_(p_174620_); } }); -- m_174570_(Items.f_42717_, new ResourceLocation("pulling"), (p_174615_, p_174616_, p_174617_, p_174618_) -> { +- m_174570_(Items.f_42717_, new ResourceLocation("pulling"), (p_174605_, p_174606_, p_174607_, p_174608_) -> { +- return p_174607_ != null && p_174607_.m_6117_() && p_174607_.m_21211_() == p_174605_ && !CrossbowItem.m_40932_(p_174605_) ? 1.0F : 0.0F; +- }); +- m_174570_(Items.f_42717_, new ResourceLocation("charged"), (p_174600_, p_174601_, p_174602_, p_174603_) -> { +- return p_174602_ != null && CrossbowItem.m_40932_(p_174600_) ? 1.0F : 0.0F; +- }); +- m_174570_(Items.f_42717_, new ResourceLocation("firework"), (p_174595_, p_174596_, p_174597_, p_174598_) -> { +- return p_174597_ != null && CrossbowItem.m_40932_(p_174595_) && CrossbowItem.m_40871_(p_174595_, Items.f_42688_) ? 1.0F : 0.0F; +- }); +- m_174570_(Items.f_42741_, new ResourceLocation("broken"), (p_174590_, p_174591_, p_174592_, p_174593_) -> { +- return ElytraItem.m_41140_(p_174590_) ? 0.0F : 1.0F; +- }); +- m_174570_(Items.f_42523_, new ResourceLocation("cast"), (p_174585_, p_174586_, p_174587_, p_174588_) -> { +- if (p_174587_ == null) { + register(Items.f_42717_, new ResourceLocation("pulling"), (p_174615_, p_174616_, p_174617_, p_174618_) -> { - return p_174617_ != null && p_174617_.m_6117_() && p_174617_.m_21211_() == p_174615_ && !CrossbowItem.m_40932_(p_174615_) ? 1.0F : 0.0F; - }); -- m_174570_(Items.f_42717_, new ResourceLocation("charged"), (p_174610_, p_174611_, p_174612_, p_174613_) -> { ++ return p_174617_ != null && p_174617_.m_6117_() && p_174617_.m_21211_() == p_174615_ && !CrossbowItem.m_40932_(p_174615_) ? 1.0F : 0.0F; ++ }); + register(Items.f_42717_, new ResourceLocation("charged"), (p_174610_, p_174611_, p_174612_, p_174613_) -> { - return p_174612_ != null && CrossbowItem.m_40932_(p_174610_) ? 1.0F : 0.0F; - }); -- m_174570_(Items.f_42717_, new ResourceLocation("firework"), (p_174605_, p_174606_, p_174607_, p_174608_) -> { ++ return p_174612_ != null && CrossbowItem.m_40932_(p_174610_) ? 1.0F : 0.0F; ++ }); + register(Items.f_42717_, new ResourceLocation("firework"), (p_174605_, p_174606_, p_174607_, p_174608_) -> { - return p_174607_ != null && CrossbowItem.m_40932_(p_174605_) && CrossbowItem.m_40871_(p_174605_, Items.f_42688_) ? 1.0F : 0.0F; - }); -- m_174570_(Items.f_42741_, new ResourceLocation("broken"), (p_174600_, p_174601_, p_174602_, p_174603_) -> { ++ return p_174607_ != null && CrossbowItem.m_40932_(p_174605_) && CrossbowItem.m_40871_(p_174605_, Items.f_42688_) ? 1.0F : 0.0F; ++ }); + register(Items.f_42741_, new ResourceLocation("broken"), (p_174600_, p_174601_, p_174602_, p_174603_) -> { - return ElytraItem.m_41140_(p_174600_) ? 0.0F : 1.0F; - }); -- m_174570_(Items.f_42523_, new ResourceLocation("cast"), (p_174595_, p_174596_, p_174597_, p_174598_) -> { ++ return ElytraItem.m_41140_(p_174600_) ? 0.0F : 1.0F; ++ }); + register(Items.f_42523_, new ResourceLocation("cast"), (p_174595_, p_174596_, p_174597_, p_174598_) -> { - if (p_174597_ == null) { ++ if (p_174597_ == null) { return 0.0F; } else { -@@ -267,13 +_,13 @@ - return (flag || flag1) && p_174597_ instanceof Player && ((Player)p_174597_).f_36083_ != null ? 1.0F : 0.0F; +- boolean flag = p_174587_.m_21205_() == p_174585_; +- boolean flag1 = p_174587_.m_21206_() == p_174585_; +- if (p_174587_.m_21205_().m_41720_() instanceof FishingRodItem) { ++ boolean flag = p_174597_.m_21205_() == p_174595_; ++ boolean flag1 = p_174597_.m_21206_() == p_174595_; ++ if (p_174597_.m_21205_().m_41720_() instanceof FishingRodItem) { + flag1 = false; + } + +- return (flag || flag1) && p_174587_ instanceof Player && ((Player)p_174587_).f_36083_ != null ? 1.0F : 0.0F; ++ return (flag || flag1) && p_174597_ instanceof Player && ((Player)p_174597_).f_36083_ != null ? 1.0F : 0.0F; } }); -- m_174570_(Items.f_42740_, new ResourceLocation("blocking"), (p_174590_, p_174591_, p_174592_, p_174593_) -> { +- m_174570_(Items.f_42740_, new ResourceLocation("blocking"), (p_174575_, p_174576_, p_174577_, p_174578_) -> { +- return p_174577_ != null && p_174577_.m_6117_() && p_174577_.m_21211_() == p_174575_ ? 1.0F : 0.0F; +- }); +- m_174570_(Items.f_42713_, new ResourceLocation("throwing"), (p_234996_, p_234997_, p_234998_, p_234999_) -> { +- return p_234998_ != null && p_234998_.m_6117_() && p_234998_.m_21211_() == p_234996_ ? 1.0F : 0.0F; +- }); +- m_174570_(Items.f_151033_, new ResourceLocation("level"), (p_234987_, p_234988_, p_234989_, p_234990_) -> { +- CompoundTag compoundtag = p_234987_.m_41737_("BlockStateTag"); + register(Items.f_42740_, new ResourceLocation("blocking"), (p_174590_, p_174591_, p_174592_, p_174593_) -> { - return p_174592_ != null && p_174592_.m_6117_() && p_174592_.m_21211_() == p_174590_ ? 1.0F : 0.0F; - }); -- m_174570_(Items.f_42713_, new ResourceLocation("throwing"), (p_174585_, p_174586_, p_174587_, p_174588_) -> { ++ return p_174592_ != null && p_174592_.m_6117_() && p_174592_.m_21211_() == p_174590_ ? 1.0F : 0.0F; ++ }); + register(Items.f_42713_, new ResourceLocation("throwing"), (p_174585_, p_174586_, p_174587_, p_174588_) -> { - return p_174587_ != null && p_174587_.m_6117_() && p_174587_.m_21211_() == p_174585_ ? 1.0F : 0.0F; - }); -- m_174570_(Items.f_151033_, new ResourceLocation("level"), (p_174575_, p_174576_, p_174577_, p_174578_) -> { ++ return p_174587_ != null && p_174587_.m_6117_() && p_174587_.m_21211_() == p_174585_ ? 1.0F : 0.0F; ++ }); + register(Items.f_151033_, new ResourceLocation("level"), (p_174575_, p_174576_, p_174577_, p_174578_) -> { - CompoundTag compoundtag = p_174575_.m_41737_("BlockStateTag"); ++ CompoundTag compoundtag = p_174575_.m_41737_("BlockStateTag"); try { + if (compoundtag != null) { +@@ -205,7 +_,7 @@ + + return 1.0F; + }); +- m_174570_(Items.f_220219_, new ResourceLocation("tooting"), (p_234978_, p_234979_, p_234980_, p_234981_) -> { ++ register(Items.f_220219_, new ResourceLocation("tooting"), (p_234978_, p_234979_, p_234980_, p_234981_) -> { + return p_234980_ != null && p_234980_.m_6117_() && p_234980_.m_21211_() == p_234978_ ? 1.0F : 0.0F; + }); + } 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 39a9c4098a8..6dd93225bb0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -9,16 +9,18 @@ private static final Comparator f_118161_ = Comparator.comparing((p_118201_) -> { return -p_118201_.f_118204_; }).thenComparing((p_118199_) -> { -@@ -53,6 +_,12 @@ +@@ -53,6 +_,14 @@ for(Stitcher.Holder stitcher$holder : list) { if (!this.m_118178_(stitcher$holder)) { -+ LOGGER.info(new net.minecraftforge.fml.loading.AdvancedLogMessageAdapter(sb->{ ++ if (LOGGER.isInfoEnabled()) { ++ StringBuilder sb = new StringBuilder(); + sb.append("Unable to fit: ").append(stitcher$holder.f_118202_.m_118431_()); + sb.append(" - size: ").append(stitcher$holder.f_118202_.m_118434_()).append("x").append(stitcher$holder.f_118202_.m_118437_()); + sb.append(" - Maybe try a lower resolution resourcepack?\n"); -+ list.forEach(h-> sb.append("\t").append(h).append("\n")); -+ })); ++ list.forEach(h -> sb.append("\t").append(h).append("\n")); ++ LOGGER.info(sb.toString()); ++ } throw new StitcherException(stitcher$holder.f_118202_, list.stream().map((p_118195_) -> { return p_118195_.f_118202_; }).collect(ImmutableList.toImmutableList())); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch index 1ccc48f31c8..f474c718e8d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlas.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlas.java +++ b/net/minecraft/client/renderer/texture/TextureAtlas.java -@@ -85,6 +_,7 @@ +@@ -87,6 +_,7 @@ } } @@ -8,7 +8,7 @@ } public TextureAtlas.Preparations m_118307_(ResourceManager p_118308_, Stream p_118309_, ProfilerFiller p_118310_, int p_118311_) { -@@ -99,6 +_,7 @@ +@@ -101,6 +_,7 @@ int j = Integer.MAX_VALUE; int k = 1 << p_118311_; p_118310_.m_6182_("extracting_frames"); @@ -16,7 +16,7 @@ for(TextureAtlasSprite.Info textureatlassprite$info : this.m_118304_(p_118308_, set)) { j = Math.min(j, Math.min(textureatlassprite$info.m_118434_(), textureatlassprite$info.m_118437_())); -@@ -113,7 +_,8 @@ +@@ -115,7 +_,8 @@ int i1 = Math.min(j, k); int j1 = Mth.m_14173_(i1); @@ -26,12 +26,19 @@ if (j1 < p_118311_) { f_118261_.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.f_118265_, p_118311_, j1, i1); k1 = j1; -@@ -229,6 +_,8 @@ +@@ -232,11 +_,14 @@ + ResourceLocation resourcelocation = this.m_118324_(p_118289_.m_118431_()); + + try { +- InputStream inputstream = p_118288_.m_215595_(resourcelocation); ++ Resource resource = p_118288_.m_215593_(resourcelocation); ++ InputStream inputstream = resource.m_215507_(); + TextureAtlasSprite textureatlassprite; try { - NativeImage nativeimage = NativeImage.m_85058_(resource.m_6679_()); + NativeImage nativeimage = NativeImage.m_85058_(inputstream); + textureatlassprite = net.minecraftforge.client.ForgeHooksClient.loadTextureAtlasSprite(this, p_118288_, p_118289_, resource, p_118290_, p_118291_, p_118293_, p_118294_, p_118292_, nativeimage); + if (textureatlassprite == null) textureatlassprite = new TextureAtlasSprite(this, p_118289_, p_118292_, p_118290_, p_118291_, p_118293_, p_118294_, nativeimage); } catch (Throwable throwable1) { - if (resource != null) { + if (inputstream != null) { 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 a46ecc889f5..4492bc4a352 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java -@@ -167,6 +_,7 @@ +@@ -166,6 +_,7 @@ public void m_118513_(ResourceLocation p_118514_) { AbstractTexture abstracttexture = this.m_174786_(p_118514_, MissingTextureAtlasSprite.m_118080_()); if (abstracttexture != MissingTextureAtlasSprite.m_118080_()) { diff --git a/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch b/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch index 09faaacf22c..265077f05ce 100644 --- a/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/language/ClientLanguage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/language/ClientLanguage.java +++ b/net/minecraft/client/resources/language/ClientLanguage.java -@@ -95,4 +_,9 @@ +@@ -94,4 +_,9 @@ public FormattedCharSequence m_5536_(FormattedText p_118925_) { return FormattedBidiReorder.m_118931_(p_118925_, this.f_118911_); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/BakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/BakedModel.java.patch index f70f6d8eba4..b00cbf36243 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/BakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/BakedModel.java.patch @@ -8,7 +8,7 @@ +public interface BakedModel extends net.minecraftforge.client.extensions.IForgeBakedModel { + /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#getQuads(BlockState, Direction, Random, net.minecraftforge.client.model.data.IModelData)}*/ + @Deprecated - List m_6840_(@Nullable BlockState p_119123_, @Nullable Direction p_119124_, Random p_119125_); + List m_213637_(@Nullable BlockState p_235039_, @Nullable Direction p_235040_, RandomSource p_235041_); boolean m_7541_(); @@ -24,9 +_,13 @@ diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch index a934ddc7b25..3af88fac7b9 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/model/ModelBakery.java +++ b/net/minecraft/client/resources/model/ModelBakery.java -@@ -155,8 +_,17 @@ +@@ -149,8 +_,17 @@ }); public ModelBakery(ResourceManager p_119247_, BlockColors p_119248_, ProfilerFiller p_119249_, int p_119250_) { @@ -18,7 +18,7 @@ p_119249_.m_6180_("missing_model"); try { -@@ -190,12 +_,16 @@ +@@ -184,12 +_,16 @@ p_119249_.m_6182_("special"); this.m_119306_(new ModelResourceLocation("minecraft:trident_in_hand#inventory")); this.m_119306_(new ModelResourceLocation("minecraft:spyglass_in_hand#inventory")); @@ -35,7 +35,7 @@ set.stream().filter((p_119357_) -> { return !p_119357_.getSecond().equals(f_119236_); }).forEach((p_119292_) -> { -@@ -234,6 +_,7 @@ +@@ -228,6 +_,7 @@ try { bakedmodel = this.m_119349_(p_119369_, BlockModelRotation.X0_Y0); } catch (Exception exception) { @@ -43,7 +43,7 @@ f_119235_.warn("Unable to bake model: '{}': {}", p_119369_, exception); } -@@ -473,6 +_,13 @@ +@@ -458,6 +_,13 @@ this.f_119210_.addAll(p_119354_.m_7970_()); } @@ -57,7 +57,7 @@ private void m_119306_(ModelResourceLocation p_119307_) { UnbakedModel unbakedmodel = this.m_119341_(p_119307_); this.f_119212_.put(p_119307_, unbakedmodel); -@@ -487,7 +_,13 @@ +@@ -472,7 +_,13 @@ } @Nullable @@ -71,7 +71,7 @@ Triple triple = Triple.of(p_119350_, p_119351_.m_6189_(), p_119351_.m_7538_()); if (this.f_119213_.containsKey(triple)) { return this.f_119213_.get(triple); -@@ -498,11 +_,11 @@ +@@ -483,11 +_,11 @@ if (unbakedmodel instanceof BlockModel) { BlockModel blockmodel = (BlockModel)unbakedmodel; if (blockmodel.m_111490_() == f_119232_) { @@ -85,7 +85,7 @@ this.f_119213_.put(triple, bakedmodel); return bakedmodel; } -@@ -555,11 +_,19 @@ +@@ -537,11 +_,19 @@ return this.f_119218_; } diff --git a/patches/minecraft/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch index b15a2595105..2dd3f8847ee 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch @@ -26,18 +26,18 @@ this.f_119458_ = bakedmodel.m_7343_(); } -- public List m_6840_(@Nullable BlockState p_119465_, @Nullable Direction p_119466_, Random p_119467_) { -+ // FORGE: Implement our overloads (here and below) so child models can have custom logic -+ public List getQuads(@Nullable BlockState p_119465_, @Nullable Direction p_119466_, Random p_119467_, net.minecraftforge.client.model.data.IModelData modelData) { - if (p_119465_ == null) { +- public List m_213637_(@Nullable BlockState p_235050_, @Nullable Direction p_235051_, RandomSource p_235052_) { ++ // FORGE: Implement our overloads (here and below) so child models can have custom logic ++ public List getQuads(@Nullable BlockState p_235050_, @Nullable Direction p_235051_, RandomSource p_235052_, net.minecraftforge.client.model.data.IModelData modelData) { + if (p_235050_ == null) { return Collections.emptyList(); } else { @@ -65,7 +_,7 @@ for(int j = 0; j < bitset.length(); ++j) { if (bitset.get(j)) { -- list.addAll(this.f_119459_.get(j).getRight().m_6840_(p_119465_, p_119466_, new Random(k))); -+ list.addAll(this.f_119459_.get(j).getRight().getQuads(p_119465_, p_119466_, new Random(k), net.minecraftforge.client.model.data.MultipartModelData.resolve(this.f_119459_.get(j).getRight(), modelData))); +- list.addAll(this.f_119459_.get(j).getRight().m_213637_(p_235050_, p_235051_, RandomSource.m_216335_(k))); ++ list.addAll(this.f_119459_.get(j).getRight().getQuads(p_235050_, p_235051_, RandomSource.m_216335_(k), net.minecraftforge.client.model.data.MultipartModelData.resolve(this.f_119459_.get(j).getRight(), modelData))); } } diff --git a/patches/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java.patch index f17f0e678c2..32d6a51f826 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java.patch @@ -9,22 +9,20 @@ private final int f_119540_; private final List> f_119541_; private final BakedModel f_119542_; -@@ -28,16 +_,22 @@ +@@ -28,9 +_,10 @@ this.f_119542_ = p_119544_.get(0).m_146310_(); } -- public List m_6840_(@Nullable BlockState p_119547_, @Nullable Direction p_119548_, Random p_119549_) { -- return WeightedRandom.m_146314_(this.f_119541_, Math.abs((int)p_119549_.nextLong()) % this.f_119540_).map((p_174916_) -> { -- return p_174916_.m_146310_().m_6840_(p_119547_, p_119548_, p_119549_); -- }).orElse(Collections.emptyList()); -+ // FORGE: Implement our overloads (here and below) so child models can have custom logic -+ public List getQuads(@Nullable BlockState p_119547_, @Nullable Direction p_119548_, Random p_119549_, net.minecraftforge.client.model.data.IModelData modelData) { -+ return WeightedRandom.m_146314_(this.f_119541_, Math.abs((int)p_119549_.nextLong()) % this.f_119540_).map((p_174916_) -> { -+ return p_174916_.m_146310_().getQuads(p_119547_, p_119548_, p_119549_, modelData); -+ }).orElse(Collections.emptyList()); +- public List m_213637_(@Nullable BlockState p_235058_, @Nullable Direction p_235059_, RandomSource p_235060_) { ++ // FORGE: Implement our overloads (here and below) so child models can have custom logic ++ public List getQuads(@Nullable BlockState p_235058_, @Nullable Direction p_235059_, RandomSource p_235060_, net.minecraftforge.client.model.data.IModelData modelData) { + return WeightedRandom.m_146314_(this.f_119541_, Math.abs((int)p_235060_.m_188505_()) % this.f_119540_).map((p_235065_) -> { +- return p_235065_.m_146310_().m_213637_(p_235058_, p_235059_, p_235060_); ++ return p_235065_.m_146310_().getQuads(p_235058_, p_235059_, p_235060_, modelData); + }).orElse(Collections.emptyList()); } - public boolean m_7541_() { +@@ -38,6 +_,11 @@ return this.f_119542_.m_7541_(); } diff --git a/patches/minecraft/net/minecraft/client/resources/sounds/SoundInstance.java.patch b/patches/minecraft/net/minecraft/client/resources/sounds/SoundInstance.java.patch index f726f7d9536..052db1aa18f 100644 --- a/patches/minecraft/net/minecraft/client/resources/sounds/SoundInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/sounds/SoundInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/resources/sounds/SoundInstance.java +++ b/net/minecraft/client/resources/sounds/SoundInstance.java -@@ -50,4 +_,10 @@ +@@ -55,4 +_,10 @@ NONE, LINEAR; } diff --git a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch index 8b3c0980564..7efbdfa11ad 100644 --- a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch @@ -1,22 +1,24 @@ --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java -@@ -60,9 +_,10 @@ +@@ -58,11 +_,12 @@ this.m_129997_(true); this.m_129999_(true); this.m_129793_(); + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; this.m_130006_(); - this.m_129989_(this.m_129791_() + " - " + this.m_129910_().m_5462_()); + GameProfile gameprofile = this.m_236731_(); + String s = this.m_129910_().m_5462_(); + this.m_129989_(gameprofile != null ? gameprofile.getName() + " - " + s : s); - return true; + return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); } public void m_5705_(BooleanSupplier p_120049_) { -@@ -179,6 +_,7 @@ +@@ -178,6 +_,7 @@ } public void m_7570_(boolean p_120053_) { + if (m_130010_()) this.m_18709_(() -> { for(ServerPlayer serverplayer : Lists.newArrayList(this.m_6846_().m_11314_())) { - if (!serverplayer.m_142081_().equals(this.f_120019_)) { + if (!serverplayer.m_20148_().equals(this.f_120019_)) { diff --git a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch index 47d136abba8..80c709b5d2e 100644 --- a/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/sounds/SoundEngine.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/sounds/SoundEngine.java +++ b/net/minecraft/client/sounds/SoundEngine.java -@@ -76,6 +_,7 @@ +@@ -75,6 +_,7 @@ this.f_120217_ = p_120236_; this.f_120218_ = p_120237_; this.f_120222_ = new SoundBufferLibrary(p_120238_); -+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); ++ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.sound.SoundEngineLoadEvent(this)); } public void m_120239_() { -@@ -91,6 +_,7 @@ +@@ -90,6 +_,7 @@ this.m_120304_(); this.m_120323_(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); ++ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.sound.SoundEngineLoadEvent(this)); } private synchronized void m_120323_() { diff --git a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch index ee0b3d7979c..d1b5c2f072e 100644 --- a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch +++ b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/commands/CommandSourceStack.java +++ b/net/minecraft/commands/CommandSourceStack.java -@@ -35,7 +_,7 @@ +@@ -33,7 +_,7 @@ import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; -public class CommandSourceStack implements SharedSuggestionProvider { +public class CommandSourceStack implements SharedSuggestionProvider, net.minecraftforge.common.extensions.IForgeCommandSourceStack { - public static final SimpleCommandExceptionType f_81286_ = new SimpleCommandExceptionType(new TranslatableComponent("permissions.requires.player")); - public static final SimpleCommandExceptionType f_81287_ = new SimpleCommandExceptionType(new TranslatableComponent("permissions.requires.entity")); + public static final SimpleCommandExceptionType f_81286_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.player")); + public static final SimpleCommandExceptionType f_81287_ = new SimpleCommandExceptionType(Component.m_237115_("permissions.requires.entity")); private final CommandSource f_81288_; diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index 34e491ee72d..24919b933c7 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -177,7 +_,7 @@ +@@ -175,7 +_,7 @@ JfrCommand.m_183645_(this.f_82090_); } @@ -9,15 +9,15 @@ TestCommand.m_127946_(this.f_82090_); } -@@ -201,6 +_,7 @@ - if (p_82093_.f_82144_) { +@@ -199,6 +_,7 @@ + if (p_230943_.f_82144_) { PublishCommand.m_138184_(this.f_82090_); } -+ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.f_82090_, p_82093_); ++ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.f_82090_, p_230943_); - this.f_82090_.findAmbiguities((p_82108_, p_82109_, p_82110_, p_82111_) -> { - f_82089_.warn("Ambiguity between arguments {} and {} with inputs: {}", this.f_82090_.getPath(p_82109_), this.f_82090_.getPath(p_82110_), p_82111_); -@@ -220,7 +_,17 @@ + this.f_82090_.setConsumer((p_230954_, p_230955_, p_230956_) -> { + p_230954_.getSource().m_81342_(p_230954_, p_230955_, p_230956_); +@@ -217,7 +_,17 @@ try { try { @@ -36,13 +36,13 @@ } catch (CommandRuntimeException commandruntimeexception) { p_82118_.m_81352_(commandruntimeexception.m_79226_()); return 0; -@@ -276,7 +_,8 @@ +@@ -273,7 +_,8 @@ Map, CommandNode> map = Maps.newHashMap(); RootCommandNode rootcommandnode = new RootCommandNode<>(); map.put(this.f_82090_.getRoot(), rootcommandnode); - this.m_82112_(this.f_82090_.getRoot(), rootcommandnode, p_82096_.m_20203_(), map); + // FORGE: Use our own command node merging method to handle redirect nodes properly, see issue #7551 + net.minecraftforge.server.command.CommandHelper.mergeCommandNode(this.f_82090_.getRoot(), rootcommandnode, map, p_82096_.m_20203_(), ctx -> 0, suggest -> SuggestionProviders.m_121664_((com.mojang.brigadier.suggestion.SuggestionProvider) (com.mojang.brigadier.suggestion.SuggestionProvider) suggest)); - p_82096_.f_8906_.m_141995_(new ClientboundCommandsPacket(rootcommandnode)); + p_82096_.f_8906_.m_9829_(new ClientboundCommandsPacket(rootcommandnode)); } diff --git a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch index 2d60f5d5895..8b9619eefb3 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch @@ -9,12 +9,12 @@ Objective objective = scoreboard.m_83477_(s); if (objective == null) { throw f_101953_.create(s); -@@ -57,7 +_,7 @@ +@@ -56,7 +_,7 @@ + public CompletableFuture listSuggestions(CommandContext p_101974_, SuggestionsBuilder p_101975_) { S s = p_101974_.getSource(); - if (s instanceof CommandSourceStack) { - CommandSourceStack commandsourcestack = (CommandSourceStack)s; + if (s instanceof CommandSourceStack commandsourcestack) { - return SharedSuggestionProvider.m_82970_(commandsourcestack.m_81377_().m_129896_().m_83474_(), p_101975_); + return SharedSuggestionProvider.m_82970_(commandsourcestack.getScoreboard().m_83474_(), p_101975_); - } else if (s instanceof SharedSuggestionProvider) { - SharedSuggestionProvider sharedsuggestionprovider = (SharedSuggestionProvider)s; + } else if (s instanceof SharedSuggestionProvider sharedsuggestionprovider) { return sharedsuggestionprovider.m_212155_(p_101974_); + } else { diff --git a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch index 48f0f7e8027..4f5c4fbd4a9 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch @@ -11,9 +11,9 @@ } else { this.m_121304_(); @@ -476,6 +_,7 @@ - p_121248_.suggest("@r", new TranslatableComponent("argument.entity.selector.randomPlayer")); - p_121248_.suggest("@s", new TranslatableComponent("argument.entity.selector.self")); - p_121248_.suggest("@e", new TranslatableComponent("argument.entity.selector.allEntities")); + p_121248_.suggest("@r", Component.m_237115_("argument.entity.selector.randomPlayer")); + p_121248_.suggest("@s", Component.m_237115_("argument.entity.selector.self")); + p_121248_.suggest("@e", Component.m_237115_("argument.entity.selector.allEntities")); + net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(p_121248_); } diff --git a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch new file mode 100644 index 00000000000..10924ed7153 --- /dev/null +++ b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/commands/synchronization/ArgumentTypeInfos.java ++++ b/net/minecraft/commands/synchronization/ArgumentTypeInfos.java +@@ -63,6 +_,20 @@ + public class ArgumentTypeInfos { + private static final Map, ArgumentTypeInfo> f_235379_ = Maps.newHashMap(); + ++ /** ++ * Forge: Use this in conjunction with a ++ * {@link net.minecraftforge.registries.DeferredRegister#register(String, java.util.function.Supplier) DeferredRegister#register(String, Supplier)} ++ * call to both populate the {@code BY_CLASS} map and register the argument type info so it can be used in commands. ++ * ++ * @param infoClass the class type of the argument type info ++ * @param argumentTypeInfo the argument type info instance ++ * @return the provided argument type info instance for chaining ++ */ ++ public static synchronized , T extends ArgumentTypeInfo.Template, I extends ArgumentTypeInfo> I registerByClass(Class infoClass, I argumentTypeInfo) { ++ f_235379_.put(infoClass, argumentTypeInfo); ++ return argumentTypeInfo; ++ } ++ + private static , T extends ArgumentTypeInfo.Template> ArgumentTypeInfo m_235386_(Registry> p_235387_, String p_235388_, Class p_235389_, ArgumentTypeInfo p_235390_) { + f_235379_.put(p_235389_, p_235390_); + return Registry.m_122961_(p_235387_, p_235388_, p_235390_); +@@ -116,7 +_,7 @@ + m_235386_(p_235385_, "resource", m_235395_(ResourceKeyArgument.class), new ResourceKeyArgument.Info()); + m_235386_(p_235385_, "template_mirror", TemplateMirrorArgument.class, SingletonArgumentInfo.m_235451_(TemplateMirrorArgument::m_234343_)); + m_235386_(p_235385_, "template_rotation", TemplateRotationArgument.class, SingletonArgumentInfo.m_235451_(TemplateRotationArgument::m_234414_)); +- if (SharedConstants.f_136183_) { ++ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) { + m_235386_(p_235385_, "test_argument", TestFunctionArgument.class, SingletonArgumentInfo.m_235451_(TestFunctionArgument::m_128088_)); + m_235386_(p_235385_, "test_class", TestClassNameArgument.class, SingletonArgumentInfo.m_235451_(TestClassNameArgument::m_127917_)); + } diff --git a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch deleted file mode 100644 index 619bc052483..00000000000 --- a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/commands/synchronization/ArgumentTypes.java -+++ b/net/minecraft/commands/synchronization/ArgumentTypes.java -@@ -122,7 +_,7 @@ - m_121601_("uuid", UuidArgument.class, new EmptyArgumentSerializer<>(UuidArgument::m_113850_)); - m_121601_("resource", m_211031_(ResourceKeyArgument.class), new ResourceKeyArgument.Serializer()); - m_121601_("resource_or_tag", m_211031_(ResourceOrTagLocationArgument.class), new ResourceOrTagLocationArgument.Serializer()); -- if (SharedConstants.f_136183_) { -+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) { - m_121601_("test_argument", TestFunctionArgument.class, new EmptyArgumentSerializer<>(TestFunctionArgument::m_128088_)); - m_121601_("test_class", TestClassNameArgument.class, new EmptyArgumentSerializer<>(TestClassNameArgument::m_127917_)); - } -@@ -262,5 +_,9 @@ - this.f_121619_ = p_211034_; - this.f_121620_ = p_211035_; - } -+ } -+ @javax.annotation.Nullable public static ResourceLocation getId(ArgumentType type) { -+ Entry entry = m_121616_(type); -+ return entry == null ? null : entry.f_121620_; - } - } diff --git a/patches/minecraft/net/minecraft/core/Holder.java.patch b/patches/minecraft/net/minecraft/core/Holder.java.patch index 2aeac31d4a7..2c9c9f8f067 100644 --- a/patches/minecraft/net/minecraft/core/Holder.java.patch +++ b/patches/minecraft/net/minecraft/core/Holder.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/Holder.java +++ b/net/minecraft/core/Holder.java -@@ -11,7 +_,17 @@ +@@ -11,7 +_,22 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; -public interface Holder { -+public interface Holder extends net.minecraftforge.registries.tags.IReverseTag { ++public interface Holder extends java.util.function.Supplier, net.minecraftforge.registries.tags.IReverseTag { + @Override + default boolean containsTag(TagKey key) { + return this.m_203656_(key); @@ -15,6 +15,11 @@ + default Stream> getTagKeys() { + return this.m_203616_(); + } ++ ++ @Override ++ default T get() { ++ return this.m_203334_(); ++ } + T m_203334_(); diff --git a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch index 851cccdbe19..bac6f43e9bf 100644 --- a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch @@ -10,7 +10,7 @@ Util.m_143785_("Adding duplicate key '" + p_205859_ + "' to registry"); } -@@ -277,6 +_,14 @@ +@@ -299,6 +_,14 @@ public boolean m_142003_(ResourceKey p_175392_) { return this.f_205842_.containsKey(p_175392_); diff --git a/patches/minecraft/net/minecraft/core/Registry.java.patch b/patches/minecraft/net/minecraft/core/Registry.java.patch index 7d1e99bab6a..78ba4c2f07a 100644 --- a/patches/minecraft/net/minecraft/core/Registry.java.patch +++ b/patches/minecraft/net/minecraft/core/Registry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/Registry.java +++ b/net/minecraft/core/Registry.java -@@ -116,6 +_,10 @@ +@@ -131,6 +_,10 @@ import org.apache.commons.lang3.Validate; import org.slf4j.Logger; @@ -11,7 +11,7 @@ public abstract class Registry implements Keyable, IdMap { private static final Logger f_122894_ = LogUtils.getLogger(); private static final Map> f_122834_ = Maps.newLinkedHashMap(); -@@ -163,43 +_,43 @@ +@@ -179,41 +_,41 @@ public static final DefaultedRegistry f_175412_ = m_206031_(f_175423_, "step", GameEvent::m_204530_, (p_206044_) -> { return GameEvent.f_157785_; }); @@ -55,116 +55,126 @@ + @Deprecated public static final Registry> f_122830_ = forge(f_122907_, (registry) -> { return BlockEntityType.f_58917_; }); -- public static final DefaultedRegistry f_122831_ = m_206027_(f_122908_, "kebab", (p_205966_) -> { -+ @Deprecated public static final DefaultedRegistry f_122831_ = forge(f_122908_, "kebab", (registry) -> { - return Motive.f_31866_; - }); - public static final Registry f_122832_ = m_206008_(f_122909_, (p_205964_) -> { +- public static final DefaultedRegistry f_235728_ = m_206027_(f_235743_, "kebab", PaintingVariants::m_218942_); ++ @Deprecated public static final DefaultedRegistry f_235728_ = forge(f_235743_, "kebab", PaintingVariants::m_218942_); + public static final Registry f_122832_ = m_206008_(f_122909_, (p_235777_) -> { return Stats.f_12926_; }); -- public static final DefaultedRegistry f_122833_ = m_206027_(f_122910_, "empty", (p_205962_) -> { +- public static final DefaultedRegistry f_122833_ = m_206027_(f_122910_, "empty", (p_235775_) -> { + @Deprecated public static final DefaultedRegistry f_122833_ = forge(f_122910_, "empty", (registry) -> { return ChunkStatus.f_62314_; }); - public static final Registry> f_122861_ = m_206008_(f_122911_, (p_205960_) -> { -@@ -208,43 +_,43 @@ - public static final Registry> f_122862_ = m_206008_(f_122912_, (p_205958_) -> { + public static final Registry> f_122861_ = m_206008_(f_122911_, (p_235773_) -> { +@@ -222,42 +_,42 @@ + public static final Registry> f_122862_ = m_206008_(f_122912_, (p_235771_) -> { return PosRuleTestType.f_74205_; }); -- public static final Registry> f_122863_ = m_206008_(f_122913_, (p_205956_) -> { +- public static final Registry> f_122863_ = m_206008_(f_122913_, (p_235769_) -> { + @Deprecated public static final Registry> f_122863_ = forge(f_122913_, (registry) -> { return MenuType.f_39964_; }); - public static final Registry> f_122864_ = m_206008_(f_122914_, (p_205954_) -> { +- public static final Registry> f_122864_ = m_206008_(f_122914_, (p_235767_) -> { ++ @Deprecated public static final Registry> f_122864_ = forge(f_122914_, (p_235767_) -> { return RecipeType.f_44107_; }); -- public static final Registry> f_122865_ = m_206008_(f_122915_, (p_205952_) -> { +- public static final Registry> f_122865_ = m_206008_(f_122915_, (p_235765_) -> { + @Deprecated public static final Registry> f_122865_ = forge(f_122915_, (registry) -> { return RecipeSerializer.f_44077_; }); -- public static final Registry f_122866_ = m_206008_(f_122916_, (p_205950_) -> { +- public static final Registry f_122866_ = m_206008_(f_122916_, (p_235763_) -> { + @Deprecated public static final Registry f_122866_ = forge(f_122916_, (registry) -> { return Attributes.f_22286_; }); - public static final Registry> f_175420_ = m_206008_(f_175408_, (p_205948_) -> { + public static final Registry> f_175420_ = m_206008_(f_175408_, (p_235761_) -> { return PositionSourceType.f_157871_; }); -- public static final Registry> f_122867_ = m_206008_(f_122917_, (p_205946_) -> { + public static final Registry> f_235729_ = m_206008_(f_235724_, (RegistryBootstrap)ArgumentTypeInfos::m_235384_); +- public static final Registry> f_122867_ = m_206008_(f_122917_, (p_235759_) -> { + @Deprecated public static final Registry> f_122867_ = forge(f_122917_, (registry) -> { return Stats.f_12982_; }); - public static final DefaultedRegistry f_122868_ = m_206027_(f_122808_, "plains", (p_205944_) -> { + public static final DefaultedRegistry f_122868_ = m_206027_(f_122808_, "plains", (p_235757_) -> { return VillagerType.f_35821_; }); -- public static final DefaultedRegistry f_122869_ = m_206027_(f_122809_, "none", (p_205942_) -> { +- public static final DefaultedRegistry f_122869_ = m_206027_(f_122809_, "none", (p_235755_) -> { + @Deprecated public static final DefaultedRegistry f_122869_ = forge(f_122809_, "none", (registry) -> { return VillagerProfession.f_35585_; }); -- public static final DefaultedRegistry f_122870_ = m_206027_(f_122810_, "unemployed", (p_205940_) -> { -+ @Deprecated public static final DefaultedRegistry f_122870_ = forge(f_122810_, "unemployed", (registry) -> { - return PoiType.f_27331_; - }); -- public static final DefaultedRegistry> f_122871_ = m_206027_(f_122811_, "dummy", (p_205938_) -> { +- public static final Registry f_122870_ = m_206008_(f_122810_, PoiTypes::m_218082_); +- public static final DefaultedRegistry> f_122871_ = m_206027_(f_122811_, "dummy", (p_235753_) -> { ++ @Deprecated public static final Registry f_122870_ = forge(f_122810_, PoiTypes::m_218082_); + @Deprecated public static final DefaultedRegistry> f_122871_ = forge(f_122811_, "dummy", (registry) -> { return MemoryModuleType.f_26349_; }); -- public static final DefaultedRegistry> f_122872_ = m_206027_(f_122812_, "dummy", (p_205936_) -> { +- public static final DefaultedRegistry> f_122872_ = m_206027_(f_122812_, "dummy", (p_235751_) -> { + @Deprecated public static final DefaultedRegistry> f_122872_ = forge(f_122812_, "dummy", (registry) -> { return SensorType.f_26809_; }); -- public static final Registry f_122873_ = m_206008_(f_122813_, (p_205934_) -> { +- public static final Registry f_122873_ = m_206008_(f_122813_, (p_235749_) -> { + @Deprecated public static final Registry f_122873_ = forge(f_122813_, (registry) -> { return Schedule.f_38012_; }); -- public static final Registry f_122874_ = m_206008_(f_122814_, (p_205932_) -> { +- public static final Registry f_122874_ = m_206008_(f_122814_, (p_235747_) -> { + @Deprecated public static final Registry f_122874_ = forge(f_122814_, (registry) -> { return Activity.f_37979_; }); - public static final Registry f_122875_ = m_206008_(f_122815_, (p_206133_) -> { -@@ -293,15 +_,15 @@ - public static final ResourceKey> f_194568_ = m_122978_("worldgen/noise"); - public static final ResourceKey> f_211074_ = m_122978_("worldgen/density_function"); + public static final Registry f_122875_ = m_206008_(f_122815_, (p_235745_) -> { +@@ -308,16 +_,16 @@ + public static final ResourceKey> f_235726_ = m_122978_("worldgen/world_preset"); + public static final ResourceKey> f_235727_ = m_122978_("worldgen/flat_level_generator_preset"); public static final ResourceKey>> f_122836_ = m_122978_("worldgen/carver"); -- public static final Registry> f_122837_ = m_206008_(f_122836_, (p_206112_) -> { +- public static final Registry> f_122837_ = m_206008_(f_122836_, (p_235842_) -> { + @Deprecated public static final Registry> f_122837_ = forge(f_122836_, (registry) -> { return WorldCarver.f_64974_; }); public static final ResourceKey>> f_122838_ = m_122978_("worldgen/feature"); -- public static final Registry> f_122839_ = m_206008_(f_122838_, (p_206109_) -> { +- public static final Registry> f_122839_ = m_206008_(f_122838_, (p_235840_) -> { + @Deprecated public static final Registry> f_122839_ = forge(f_122838_, (registry) -> { return Feature.f_65731_; }); - public static final ResourceKey>> f_122840_ = m_122978_("worldgen/structure_feature"); -- public static final Registry> f_122841_ = m_206008_(f_122840_, (p_206107_) -> { -+ @Deprecated public static final Registry> f_122841_ = forge(f_122840_, (registry) -> { - return StructureFeature.f_67014_; - }); public static final ResourceKey>> f_205929_ = m_122978_("worldgen/structure_placement"); -@@ -328,16 +_,16 @@ + public static final Registry> f_205930_ = m_206008_(f_205929_, (p_235838_) -> { +- return StructurePlacementType.f_205041_; ++ return StructurePlacementType.f_205041_; + }); + public static final ResourceKey> f_122842_ = m_122978_("worldgen/structure_piece"); + public static final Registry f_122843_ = m_206008_(f_122842_, (p_235836_) -> { +@@ -344,10 +_,10 @@ public static final ResourceKey>> f_211075_ = m_122978_("worldgen/density_function_type"); public static final ResourceKey>> f_122854_ = m_122978_("worldgen/structure_processor"); public static final ResourceKey>> f_122855_ = m_122978_("worldgen/structure_pool_element"); -- public static final Registry> f_122856_ = m_206008_(f_122846_, (p_206098_) -> { +- public static final Registry> f_122856_ = m_206008_(f_122846_, (p_235830_) -> { + @Deprecated public static final Registry> f_122856_ = forge(f_122846_, (registry) -> { return BlockStateProviderType.f_68752_; }); -- public static final Registry> f_122858_ = m_206008_(f_122848_, (p_206092_) -> { +- public static final Registry> f_122858_ = m_206008_(f_122848_, (p_235828_) -> { + @Deprecated public static final Registry> f_122858_ = forge(f_122848_, (registry) -> { return FoliagePlacerType.f_68591_; }); - public static final Registry> f_122859_ = m_206008_(f_122849_, (p_206086_) -> { - return TrunkPlacerType.f_70315_; + public static final Registry> f_122859_ = m_206008_(f_122849_, (p_235822_) -> { +@@ -356,7 +_,7 @@ + public static final Registry> f_235742_ = m_206008_(f_235741_, (p_235818_) -> { + return RootPlacerType.f_225898_; }); -- public static final Registry> f_122860_ = m_206008_(f_122850_, (p_206078_) -> { +- public static final Registry> f_122860_ = m_206008_(f_122850_, (p_235814_) -> { + @Deprecated public static final Registry> f_122860_ = forge(f_122850_, (registry) -> { return TreeDecoratorType.f_70043_; }); - public static final Registry> f_122888_ = m_206008_(f_122851_, (p_206072_) -> { -@@ -383,16 +_,32 @@ + public static final Registry> f_122888_ = m_206008_(f_122851_, (p_235808_) -> { +@@ -401,7 +_,7 @@ + + if (p_235790_ instanceof DefaultedRegistry) { + ResourceLocation resourcelocation = ((DefaultedRegistry)p_235790_).m_122315_(); +- Validate.notNull(p_235790_.m_7745_(resourcelocation), "Missing default of DefaultedMappedRegistry: " + resourcelocation); ++ Validate.notNull(p_235790_.m_7745_(resourcelocation), "Missing default of DefaultedMappedRegistry: " + p_205993_.f_122887_ + ", Entry: " + resourcelocation); + } + + }); +@@ -411,16 +_,32 @@ return m_205999_(p_206009_, Lifecycle.experimental(), p_206010_); } -+ private static > Registry forge(ResourceKey> key, Registry.RegistryBootstrap def) { ++ private static Registry forge(ResourceKey> key, Registry.RegistryBootstrap def) { + return forge(key, Lifecycle.experimental(), def); + } + @@ -172,7 +182,7 @@ return m_206016_(p_206028_, p_206029_, Lifecycle.experimental(), p_206030_); } -+ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Registry.RegistryBootstrap def) { ++ private static DefaultedRegistry forge(ResourceKey> key, String defKey, Registry.RegistryBootstrap def) { + return forge(key, defKey, Lifecycle.experimental(), def); + } + @@ -180,7 +190,7 @@ return m_206021_(p_206032_, p_206033_, Lifecycle.experimental(), p_206034_, p_206035_); } -+ private static > Registry forge(ResourceKey> key, Lifecycle cycle, Registry.RegistryBootstrap def) { ++ private static Registry forge(ResourceKey> key, Lifecycle cycle, Registry.RegistryBootstrap def) { + return m_206011_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle); + } + @@ -188,7 +198,7 @@ return m_206011_(p_206000_, new MappedRegistry<>(p_206000_, p_206001_, (Function>)null), p_206002_, p_206001_); + } + -+ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Lifecycle cycle, Registry.RegistryBootstrap def) { ++ private static DefaultedRegistry forge(ResourceKey> key, String defKey, Lifecycle cycle, Registry.RegistryBootstrap def) { + return m_206011_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle); } diff --git a/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch b/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch index 304303480ae..8d694ab1f2b 100644 --- a/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/core/RegistryAccess.java +++ b/net/minecraft/core/RegistryAccess.java -@@ -58,7 +_,7 @@ - m_123053_(builder, Registry.f_122878_, NoiseGeneratorSettings.f_64430_); - m_123053_(builder, Registry.f_194568_, NormalNoise.NoiseParameters.f_192851_); - m_123053_(builder, Registry.f_211074_, DensityFunction.f_208216_); +@@ -62,7 +_,7 @@ + m_123057_(builder, Registry.f_235730_, ChatType.f_237005_, ChatType.f_237005_); + m_123053_(builder, Registry.f_235726_, WorldPreset.f_226414_); + m_123053_(builder, Registry.f_235727_, FlatLevelGeneratorPreset.f_226243_); - return builder.build(); + return net.minecraftforge.registries.DataPackRegistriesHooks.grabBuiltinRegistries(builder); // FORGE: Keep the map so custom registries can be added later }); diff --git a/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch b/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch index aa101f2f2d3..44f391caa3a 100644 --- a/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/core/RegistryCodecs.java +++ b/net/minecraft/core/RegistryCodecs.java -@@ -95,7 +_,8 @@ +@@ -92,7 +_,8 @@ } private static Codec, T>> m_206315_(ResourceKey> p_206316_, Codec p_206317_) { -- return Codec.unboundedMap(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_206316_), ResourceKey::m_135782_), p_206317_); +- return Codec.unboundedMap(ResourceKey.m_195966_(p_206316_), p_206317_); + // FORGE: Fix MC-197860 -+ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_206316_), ResourceKey::m_135782_), p_206317_); ++ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceKey.m_195966_(p_206316_), p_206317_); } public static Codec> m_206279_(ResourceKey> p_206280_, Codec p_206281_) { diff --git a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch index bcb37902709..063a9f9c3d7 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -393,9 +_,10 @@ +@@ -402,9 +_,10 @@ level.m_46597_(blockpos, BaseFireBlock.m_49245_(level, blockpos)); level.m_142346_((Entity)null, GameEvent.f_157797_, blockpos); } else if (!CampfireBlock.m_51321_(blockstate) && !CandleBlock.m_152845_(blockstate) && !CandleCakeBlock.m_152910_(blockstate)) { diff --git a/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch b/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch index 18398e3f786..d8fe2e1c206 100644 --- a/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch +++ b/patches/minecraft/net/minecraft/core/particles/ItemParticleOption.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/particles/ItemParticleOption.java +++ b/net/minecraft/core/particles/ItemParticleOption.java -@@ -35,7 +_,7 @@ +@@ -36,7 +_,7 @@ public ItemParticleOption(ParticleType p_123705_, ItemStack p_123706_) { this.f_123701_ = p_123705_; diff --git a/patches/minecraft/net/minecraft/core/particles/ParticleType.java.patch b/patches/minecraft/net/minecraft/core/particles/ParticleType.java.patch deleted file mode 100644 index f024cbd6ffc..00000000000 --- a/patches/minecraft/net/minecraft/core/particles/ParticleType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/core/particles/ParticleType.java -+++ b/net/minecraft/core/particles/ParticleType.java -@@ -2,7 +_,7 @@ - - import com.mojang.serialization.Codec; - --public abstract class ParticleType { -+public abstract class ParticleType extends net.minecraftforge.registries.ForgeRegistryEntry> { - private final boolean f_123737_; - private final ParticleOptions.Deserializer f_123738_; - diff --git a/patches/minecraft/net/minecraft/core/particles/ParticleTypes.java.patch b/patches/minecraft/net/minecraft/core/particles/ParticleTypes.java.patch deleted file mode 100644 index 870126e6f1c..00000000000 --- a/patches/minecraft/net/minecraft/core/particles/ParticleTypes.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/core/particles/ParticleTypes.java -+++ b/net/minecraft/core/particles/ParticleTypes.java -@@ -4,6 +_,7 @@ - import java.util.function.Function; - import net.minecraft.core.Registry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class ParticleTypes { - public static final SimpleParticleType f_123770_ = m_123824_("ambient_entity_effect", false); - public static final SimpleParticleType f_123792_ = m_123824_("angry_villager", false); diff --git a/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch b/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch index 355a636232e..01124ccb88c 100644 --- a/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch +++ b/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/data/BuiltinRegistries.java +++ b/net/minecraft/data/BuiltinRegistries.java -@@ -52,7 +_,7 @@ +@@ -60,7 +_,7 @@ return ProcessorLists.f_127199_; }); - public static final Registry f_123864_ = m_123893_(Registry.f_122884_, Pools::m_206434_); -- public static final Registry f_123865_ = m_123893_(Registry.f_122885_, Biomes::m_206462_); -+ @Deprecated public static final Registry f_123865_ = forge(Registry.f_122885_, Biomes::m_206462_); - public static final Registry f_194654_ = m_123893_(Registry.f_194568_, NoiseData::m_206433_); - public static final Registry f_211085_ = m_123893_(Registry.f_211074_, NoiseRouterData::m_209468_); - public static final Registry f_123866_ = m_123893_(Registry.f_122878_, NoiseGeneratorSettings::m_204599_); -@@ -60,6 +_,10 @@ + public static final Registry f_123864_ = m_236001_(Registry.f_122884_, Pools::m_236491_); +- public static final Registry f_123865_ = m_236001_(Registry.f_122885_, Biomes::m_236652_); ++ @Deprecated public static final Registry f_123865_ = forge(Registry.f_122885_, Biomes::m_236652_); + public static final Registry f_194654_ = m_236001_(Registry.f_194568_, NoiseData::m_236475_); + public static final Registry f_211085_ = m_236001_(Registry.f_211074_, NoiseRouterData::m_224458_); + public static final Registry f_123866_ = m_236001_(Registry.f_122878_, NoiseGeneratorSettings::m_224383_); +@@ -71,6 +_,10 @@ - private static Registry m_123893_(ResourceKey> p_123894_, Supplier> p_123895_) { - return m_123884_(p_123894_, Lifecycle.stable(), p_123895_); + private static Registry m_236001_(ResourceKey> p_236002_, BuiltinRegistries.RegistryBootstrap p_236003_) { + return m_235992_(p_236002_, Lifecycle.stable(), p_236003_); + } + -+ private static > Registry forge(ResourceKey> key, Supplier> holderSupplier) { -+ return m_123888_(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), holderSupplier, Lifecycle.stable()); ++ private static Registry forge(ResourceKey> key, BuiltinRegistries.RegistryBootstrap bootstrap) { ++ return m_235996_(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), bootstrap, Lifecycle.stable()); } - private static Registry m_123884_(ResourceKey> p_123885_, Lifecycle p_123886_, Supplier> p_123887_) { + private static Registry m_235992_(ResourceKey> p_235993_, Lifecycle p_235994_, BuiltinRegistries.RegistryBootstrap p_235995_) { diff --git a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch index 3c3f36951e2..c1987e8697f 100644 --- a/patches/minecraft/net/minecraft/data/DataGenerator.java.patch +++ b/patches/minecraft/net/minecraft/data/DataGenerator.java.patch @@ -1,30 +1,32 @@ --- a/net/minecraft/data/DataGenerator.java +++ b/net/minecraft/data/DataGenerator.java -@@ -16,10 +_,11 @@ - private final Collection f_123906_; - private final Path f_123907_; - private final List f_123908_ = Lists.newArrayList(); -+ private final List providerView = java.util.Collections.unmodifiableList(f_123908_); +@@ -21,12 +_,13 @@ + private final List f_236026_ = Lists.newArrayList(); + private final WorldVersion f_236027_; + private final boolean f_236028_; ++ private final List providerView = java.util.Collections.unmodifiableList(f_236025_); - public DataGenerator(Path p_123911_, Collection p_123912_) { - this.f_123907_ = p_123911_; -- this.f_123906_ = p_123912_; -+ this.f_123906_ = Lists.newArrayList(p_123912_); + public DataGenerator(Path p_236030_, Collection p_236031_, WorldVersion p_236032_, boolean p_236033_) { + this.f_123907_ = p_236030_; +- this.f_123906_ = p_236031_; + this.f_236027_ = p_236032_; + this.f_236028_ = p_236033_; ++ this.f_123906_ = Lists.newArrayList(p_236031_); } public Collection m_123913_() { -@@ -38,6 +_,7 @@ +@@ -51,6 +_,7 @@ + f_123905_.debug("Generator {} already run for version {}", dataprovider.m_6055_(), this.f_236027_.getName()); + } else { + f_123905_.info("Starting provider: {}", (Object)dataprovider.m_6055_()); ++ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + dataprovider.m_6055_()); + stopwatch1.start(); + dataprovider.m_213708_(hashcache.m_236107_(dataprovider)); + stopwatch1.stop(); +@@ -73,6 +_,14 @@ - for(DataProvider dataprovider : this.f_123908_) { - f_123905_.info("Starting provider: {}", (Object)dataprovider.m_6055_()); -+ net.minecraftforge.fml.StartupMessageManager.addModMessage("Generating: " + dataprovider.m_6055_()); - stopwatch1.start(); - dataprovider.m_6865_(hashcache); - stopwatch1.stop(); -@@ -51,6 +_,14 @@ - - public void m_123914_(DataProvider p_123915_) { - this.f_123908_.add(p_123915_); + public DataGenerator.PathProvider m_236036_(DataGenerator.Target p_236037_, String p_236038_) { + return new DataGenerator.PathProvider(this, p_236037_, p_236038_); + } + + public List getProviders() { diff --git a/patches/minecraft/net/minecraft/data/HashCache.java.patch b/patches/minecraft/net/minecraft/data/HashCache.java.patch index b17977f01b1..2d1f9ceb0de 100644 --- a/patches/minecraft/net/minecraft/data/HashCache.java.patch +++ b/patches/minecraft/net/minecraft/data/HashCache.java.patch @@ -1,13 +1,15 @@ --- a/net/minecraft/data/HashCache.java +++ b/net/minecraft/data/HashCache.java -@@ -55,8 +_,8 @@ - } +@@ -231,10 +_,10 @@ + bufferedwriter.write(p_236145_); + bufferedwriter.newLine(); - IOUtils.writeLines(this.f_123931_.entrySet().stream().map((p_123944_) -> { -- return (String)p_123944_.getValue() + " " + this.f_123927_.relativize(p_123944_.getKey()); -- }).collect(Collectors.toList()), System.lineSeparator(), writer); -+ return (String)p_123944_.getValue() + ' ' + this.f_123927_.relativize(p_123944_.getKey()).toString().replace('\\', '/'); //Forge: Standardize file paths. -+ }).sorted(java.util.Comparator.comparing(a -> a.split(" ")[1])).collect(Collectors.toList()), System.lineSeparator(), writer); - writer.close(); - f_123926_.debug("Caching: cache hits: {}, created: {} removed: {}", this.f_123929_, this.f_123931_.size() - this.f_123929_, this.f_123930_.size()); - } +- for(Map.Entry entry : this.f_236127_.entrySet()) { ++ for(Map.Entry entry : this.f_236127_.entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) { + bufferedwriter.write(entry.getValue().toString()); + bufferedwriter.write(32); +- bufferedwriter.write(p_236143_.relativize(entry.getKey()).toString()); ++ bufferedwriter.write(p_236143_.relativize(entry.getKey()).toString().replace("\\", "/")); // Forge: Standardize file paths. + bufferedwriter.newLine(); + } + } catch (Throwable throwable1) { diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index 75cbbeb35a7..cc56fc53b54 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -43,8 +_,15 @@ +@@ -52,8 +_,15 @@ 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(); @@ -17,13 +17,13 @@ Path path = Paths.get(optionspec7.value(optionset)); boolean flag = optionset.has(optionspec6); boolean flag1 = flag || optionset.has(optionspec2); -@@ -52,10 +_,14 @@ +@@ -61,10 +_,14 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); -- DataGenerator datagenerator = m_129660_(path, optionset.valuesOf(optionspec8).stream().map((p_129659_) -> { +- DataGenerator datagenerator = m_236679_(path, optionset.valuesOf(optionspec8).stream().map((p_129659_) -> { - return Paths.get(p_129659_); -- }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5); +- }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5, SharedConstants.m_183709_(), true); - datagenerator.m_123917_(); + Collection inputs = optionset.valuesOf(optionspec8).stream().map(Paths::get).collect(Collectors.toList()); + Collection existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList()); @@ -32,7 +32,7 @@ + boolean isFlat = mods.isEmpty() || optionset.has(flat); + net.minecraftforge.data.loading.DatagenModLoader.begin(mods, path, inputs, existingPacks, existingMods, flag2, flag1, flag3, flag4, flag5, isFlat, optionset.valueOf(assetIndex), optionset.valueOf(assetsDir)); + if (mods.contains("minecraft") || mods.isEmpty()) -+ m_129660_(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).m_123917_(); ++ m_236679_(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5, SharedConstants.m_183709_(), true).m_123917_(); } else { optionparser.printHelpOn(System.out); } diff --git a/patches/minecraft/net/minecraft/data/advancements/AdvancementProvider.java.patch b/patches/minecraft/net/minecraft/data/advancements/AdvancementProvider.java.patch index d4f276513b5..a4432a8b8e6 100644 --- a/patches/minecraft/net/minecraft/data/advancements/AdvancementProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/advancements/AdvancementProvider.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/data/advancements/AdvancementProvider.java +++ b/net/minecraft/data/advancements/AdvancementProvider.java -@@ -22,11 +_,18 @@ - private static final Gson f_123961_ = (new GsonBuilder()).setPrettyPrinting().create(); - private final DataGenerator f_123962_; +@@ -19,11 +_,18 @@ + private static final Logger f_123960_ = LogUtils.getLogger(); + private final DataGenerator.PathProvider f_236156_; private final List>> f_123963_ = ImmutableList.of(new TheEndAdvancements(), new HusbandryAdvancements(), new AdventureAdvancements(), new NetherAdvancements(), new StoryAdvancements()); + protected net.minecraftforge.common.data.ExistingFileHelper fileHelper; + @Deprecated public AdvancementProvider(DataGenerator p_123966_) { - this.f_123962_ = p_123966_; + this.f_236156_ = p_123966_.m_236036_(DataGenerator.Target.DATA_PACK, "advancements"); } + public AdvancementProvider(DataGenerator generatorIn, net.minecraftforge.common.data.ExistingFileHelper fileHelperIn) { -+ this.f_123962_ = generatorIn; ++ this.f_236156_ = generatorIn.m_236036_(DataGenerator.Target.DATA_PACK, "advancements"); + this.fileHelper = fileHelperIn; + } + - public void m_6865_(HashCache p_123969_) { - Path path = this.f_123962_.m_123916_(); + public void m_213708_(CachedOutput p_236158_) { Set set = Sets.newHashSet(); -@@ -45,6 +_,16 @@ + Consumer consumer = (p_236162_) -> { +@@ -41,6 +_,18 @@ } }; @@ -27,10 +27,12 @@ + } + + /** -+ * Override this method for registering and generating custom {@link Advancement}s.
-+ * Just use {@link Advancement.Builder} to build your Advancements, you don't need an extra consumer like the vanilla classes. -+ * @param consumer used for the register function from {@link Advancement.Builder} -+ * @param fileHelper used for the register function from {@link Advancement.Builder} ++ * This method registers all {@link Advancement advancements}. ++ * Mods can override this method to register their own custom advancements. ++ * ++ * @param consumer a {@link Consumer} which saves any advancements provided ++ * @param fileHelper the existing file helper to check for the existence of files like parent advancements ++ * @see Advancement.Builder#save(Consumer, ResourceLocation, net.minecraftforge.common.data.ExistingFileHelper) + */ + protected void registerAdvancements(Consumer consumer, net.minecraftforge.common.data.ExistingFileHelper fileHelper) { for(Consumer> consumer1 : this.f_123963_) { diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLoot.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLoot.java.patch index 10ce79129e7..9d0aac049ab 100644 --- a/patches/minecraft/net/minecraft/data/loot/BlockLoot.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/BlockLoot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/BlockLoot.java +++ b/net/minecraft/data/loot/BlockLoot.java -@@ -250,7 +_,7 @@ +@@ -264,7 +_,7 @@ return LootTable.m_79147_(); } @@ -9,10 +9,10 @@ this.m_124288_(Blocks.f_50122_); this.m_124288_(Blocks.f_50175_); this.m_124288_(Blocks.f_50228_); -@@ -1252,9 +_,13 @@ - this.m_124165_(Blocks.f_50142_, m_124125_()); - this.m_124165_(Blocks.f_152491_, m_124125_()); +@@ -1311,9 +_,13 @@ this.m_124165_(Blocks.f_152499_, m_124125_()); + this.m_124165_(Blocks.f_220862_, m_124125_()); + this.m_124165_(Blocks.f_220863_, m_124125_()); + } + + public void accept(BiConsumer p_124179_) { @@ -24,7 +24,7 @@ ResourceLocation resourcelocation = block.m_60589_(); if (resourcelocation != BuiltInLootTables.f_78712_ && set.add(resourcelocation)) { LootTable.Builder loottable$builder = this.f_124070_.remove(resourcelocation); -@@ -1279,6 +_,10 @@ +@@ -1338,6 +_,10 @@ public static LootTable.Builder m_124137_(Block p_124138_) { return m_124161_(p_124138_, DoorBlock.f_52730_, DoubleBlockHalf.LOWER); diff --git a/patches/minecraft/net/minecraft/data/loot/EntityLoot.java.patch b/patches/minecraft/net/minecraft/data/loot/EntityLoot.java.patch index 3d318b41ed5..273823f5a0d 100644 --- a/patches/minecraft/net/minecraft/data/loot/EntityLoot.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/EntityLoot.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/data/loot/EntityLoot.java +++ b/net/minecraft/data/loot/EntityLoot.java -@@ -49,7 +_,7 @@ +@@ -54,7 +_,7 @@ return LootTable.m_79147_().m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootItem.m_79579_(p_124375_))).m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootTableReference.m_79776_(EntityType.f_20520_.m_20677_()))); } - public void accept(BiConsumer p_124377_) { + protected void addTables() { + this.m_124371_(EntityType.f_217014_, LootTable.m_79147_()); this.m_124371_(EntityType.f_20529_, LootTable.m_79147_()); this.m_124371_(EntityType.f_147039_, LootTable.m_79147_()); - this.m_124371_(EntityType.f_20549_, LootTable.m_79147_()); -@@ -141,11 +_,15 @@ +@@ -150,11 +_,15 @@ this.m_124371_(EntityType.f_20511_, LootTable.m_79147_()); this.m_124371_(EntityType.f_20512_, LootTable.m_79147_()); - this.m_124371_(EntityType.f_20530_, LootTable.m_79147_().m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootItem.m_79579_(Items.f_42583_).m_5577_(SetItemCountFunction.m_165412_(UniformGenerator.m_165780_(0.0F, 2.0F))).m_5577_(LootingEnchantFunction.m_165229_(UniformGenerator.m_165780_(0.0F, 1.0F))))).m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootItem.m_79579_(Items.f_42416_)).m_79076_(LootItem.m_79579_(Items.f_42619_)).m_79076_(LootItem.m_79579_(Items.f_42620_).m_5577_(SmeltItemFunction.m_81271_().m_6509_(LootItemEntityPropertyCondition.m_81864_(LootContext.EntityTarget.THIS, f_124366_)))).m_6509_(LootItemKilledByPlayerCondition.m_81901_()).m_6509_(LootItemRandomChanceWithLootingCondition.m_81963_(0.025F, 0.01F)))); + this.m_124371_(EntityType.f_20530_, LootTable.m_79147_().m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootItem.m_79579_(Items.f_42583_).m_79078_(SetItemCountFunction.m_165412_(UniformGenerator.m_165780_(0.0F, 2.0F))).m_79078_(LootingEnchantFunction.m_165229_(UniformGenerator.m_165780_(0.0F, 1.0F))))).m_79161_(LootPool.m_79043_().m_165133_(ConstantValue.m_165692_(1.0F)).m_79076_(LootItem.m_79579_(Items.f_42416_)).m_79076_(LootItem.m_79579_(Items.f_42619_)).m_79076_(LootItem.m_79579_(Items.f_42620_).m_79078_(SmeltItemFunction.m_81271_().m_79080_(LootItemEntityPropertyCondition.m_81864_(LootContext.EntityTarget.THIS, f_124366_)))).m_79080_(LootItemKilledByPlayerCondition.m_81901_()).m_79080_(LootItemRandomChanceWithLootingCondition.m_81963_(0.025F, 0.01F)))); + } + + public void accept(BiConsumer p_124377_) { @@ -27,7 +27,7 @@ if (resourcelocation != BuiltInLootTables.f_78712_ && this.f_124368_.remove(resourcelocation) != null) { throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.f_122826_.m_7981_(entitytype))); } -@@ -160,6 +_,14 @@ +@@ -169,6 +_,14 @@ } this.f_124368_.forEach(p_124377_); @@ -41,4 +41,4 @@ + return !f_124367_.contains(entitytype) && entitytype.m_20674_() == MobCategory.MISC; } - protected void m_124371_(EntityType p_124372_, LootTable.Builder p_124373_) { + private LootItemCondition.Builder m_236264_() { diff --git a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch index a65a7b5f6ba..1cba531e6a9 100644 --- a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java -@@ -40,7 +_,7 @@ - public void m_6865_(HashCache p_124444_) { - Path path = this.f_124433_.m_123916_(); +@@ -36,7 +_,7 @@ + + public void m_213708_(CachedOutput p_236269_) { Map map = Maps.newHashMap(); - this.f_124434_.forEach((p_124458_) -> { + this.getTables().forEach((p_124458_) -> { p_124458_.getFirst().get().accept((p_176077_, p_176078_) -> { if (map.put(p_176077_, p_176078_.m_79165_(p_124458_.getSecond()).m_79167_()) != null) { throw new IllegalStateException("Duplicate loot table " + p_176077_); -@@ -51,13 +_,8 @@ +@@ -47,13 +_,8 @@ return null; }, map::get); @@ -24,7 +24,7 @@ Multimap multimap = validationcontext.m_79352_(); if (!multimap.isEmpty()) { multimap.forEach((p_124446_, p_124447_) -> { -@@ -76,6 +_,20 @@ +@@ -72,6 +_,20 @@ }); } @@ -44,4 +44,4 @@ + }); } - private static Path m_124453_(Path p_124454_, ResourceLocation p_124455_) { + public String m_6055_() { diff --git a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch index e2b07c3ea8e..fba2cfabdda 100644 --- a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -106,6 +_,7 @@ +@@ -100,6 +_,7 @@ } }); + if (this.getClass() == RecipeProvider.class) //Forge: Subclasses don't need this. - m_126013_(p_125982_, Advancement.Builder.m_138353_().m_138386_("impossible", new ImpossibleTrigger.TriggerInstance()).m_138400_(), path.resolve("data/minecraft/advancements/recipes/root.json")); + m_236367_(p_236358_, Advancement.Builder.m_138353_().m_138386_("impossible", new ImpossibleTrigger.TriggerInstance()).m_138400_(), this.f_236356_.m_236048_(RecipeBuilder.f_236353_)); } -@@ -143,7 +_,7 @@ +@@ -112,7 +_,7 @@ } -- protected static void m_126013_(HashCache p_126014_, JsonObject p_126015_, Path p_126016_) { -+ protected void m_126013_(HashCache p_126014_, JsonObject p_126015_, Path p_126016_) { +- protected static void m_236367_(CachedOutput p_236368_, JsonObject p_236369_, Path p_236370_) { ++ protected void m_236367_(CachedOutput p_236368_, JsonObject p_236369_, Path p_236370_) { try { - String s = f_125969_.toJson((JsonElement)p_126015_); - String s1 = f_123918_.hashUnencodedChars(s).toString(); -@@ -177,7 +_,7 @@ + DataProvider.m_236072_(p_236368_, p_236369_, p_236370_); + } catch (IOException ioexception) { +@@ -121,7 +_,7 @@ } diff --git a/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch new file mode 100644 index 00000000000..b7ed23b1efe --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/BannerPatternTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/BannerPatternTagsProvider.java ++++ b/net/minecraft/data/tags/BannerPatternTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.level.block.entity.BannerPatterns; + + public class BannerPatternTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #BannerPatternTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public BannerPatternTagsProvider(DataGenerator p_236411_) { + super(p_236411_, Registry.f_235736_); ++ } ++ public BannerPatternTagsProvider(DataGenerator p_236411_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236411_, Registry.f_235736_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch index b0266f6dba9..88e2e8d9de9 100644 --- a/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/BiomeTagsProvider.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/data/tags/BiomeTagsProvider.java +++ b/net/minecraft/data/tags/BiomeTagsProvider.java -@@ -7,8 +_,13 @@ - import net.minecraft.world.level.biome.Biomes; +@@ -8,8 +_,13 @@ + import net.minecraft.world.level.biome.MultiNoiseBiomeSource; public class BiomeTagsProvider extends TagsProvider { + /** @deprecated Forge: Use the {@link #BiomeTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ diff --git a/patches/minecraft/net/minecraft/data/tags/CatVariantTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/CatVariantTagsProvider.java.patch new file mode 100644 index 00000000000..ba31c956d4a --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/CatVariantTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/CatVariantTagsProvider.java ++++ b/net/minecraft/data/tags/CatVariantTagsProvider.java +@@ -6,8 +_,13 @@ + import net.minecraft.world.entity.animal.CatVariant; + + public class CatVariantTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #CatVariantTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public CatVariantTagsProvider(DataGenerator p_236420_) { + super(p_236420_, Registry.f_235732_); ++ } ++ public CatVariantTagsProvider(DataGenerator p_236420_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236420_, Registry.f_235732_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java.patch deleted file mode 100644 index 99f22735e03..00000000000 --- a/patches/minecraft/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java -+++ b/net/minecraft/data/tags/ConfiguredStructureTagsProvider.java -@@ -7,8 +_,13 @@ - import net.minecraft.world.level.levelgen.structure.BuiltinStructures; - - public class ConfiguredStructureTagsProvider extends TagsProvider> { -+ /** @deprecated Forge: Use the {@link #ConfiguredStructureTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ -+ @Deprecated - public ConfiguredStructureTagsProvider(DataGenerator p_211098_) { - super(p_211098_, BuiltinRegistries.f_123862_); -+ } -+ public ConfiguredStructureTagsProvider(DataGenerator p_211098_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_211098_, BuiltinRegistries.f_123862_, modId, existingFileHelper); - } - - protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch new file mode 100644 index 00000000000..87da98d5fb6 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java ++++ b/net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets; + + public class FlatLevelGeneratorPresetTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #FlatLevelGeneratorPresetTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public FlatLevelGeneratorPresetTagsProvider(DataGenerator p_236423_) { + super(p_236423_, BuiltinRegistries.f_235990_); ++ } ++ public FlatLevelGeneratorPresetTagsProvider(DataGenerator p_236423_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236423_, BuiltinRegistries.f_235990_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch index eaa4932931c..3e0fdedea62 100644 --- a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -6,8 +_,13 @@ - import net.minecraft.world.level.gameevent.GameEvent; - +@@ -8,8 +_,13 @@ public class GameEventTagsProvider extends TagsProvider { + private static final GameEvent[] f_236425_ = new GameEvent[]{GameEvent.f_157791_, GameEvent.f_157792_, GameEvent.f_157793_, GameEvent.f_157794_, GameEvent.f_157795_, GameEvent.f_157796_, GameEvent.f_157797_, GameEvent.f_223702_, GameEvent.f_223703_, GameEvent.f_157802_, GameEvent.f_157803_, GameEvent.f_157804_, GameEvent.f_223704_, GameEvent.f_157806_, GameEvent.f_223705_, GameEvent.f_223706_, GameEvent.f_223707_, GameEvent.f_223708_, GameEvent.f_157810_, GameEvent.f_223709_, GameEvent.f_223710_, GameEvent.f_157811_, GameEvent.f_157812_, GameEvent.f_157816_, GameEvent.f_157769_, GameEvent.f_157770_, GameEvent.f_223696_, GameEvent.f_223697_, GameEvent.f_157772_, GameEvent.f_223699_, GameEvent.f_157774_, GameEvent.f_157775_, GameEvent.f_157776_, GameEvent.f_157777_, GameEvent.f_157778_, GameEvent.f_157781_, GameEvent.f_157784_, GameEvent.f_157785_, GameEvent.f_157786_, GameEvent.f_238175_}; + + /** @deprecated Forge: Use the {@link #GameEventTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated public GameEventTagsProvider(DataGenerator p_176826_) { diff --git a/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch new file mode 100644 index 00000000000..605db634368 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/InstrumentTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/InstrumentTagsProvider.java ++++ b/net/minecraft/data/tags/InstrumentTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.item.Instruments; + + public class InstrumentTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #InstrumentTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public InstrumentTagsProvider(DataGenerator p_236428_) { + super(p_236428_, Registry.f_235738_); ++ } ++ public InstrumentTagsProvider(DataGenerator p_236428_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236428_, Registry.f_235738_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch index 69b66313812..adb78f083a3 100644 --- a/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch @@ -2,16 +2,16 @@ +++ b/net/minecraft/data/tags/ItemTagsProvider.java @@ -14,8 +_,14 @@ public class ItemTagsProvider extends TagsProvider { - private final Function, Tag.Builder> f_126528_; + private final Function, TagBuilder> f_126528_; + /** @deprecated Forge: Use the {@link #ItemTagsProvider(DataGenerator, BlockTagsProvider, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated public ItemTagsProvider(DataGenerator p_126530_, BlockTagsProvider p_126531_) { super(p_126530_, Registry.f_122827_); -+ this.f_126528_ = p_126531_::m_206426_; ++ this.f_126528_ = p_126531_::m_236451_; + } + public ItemTagsProvider(DataGenerator p_126530_, BlockTagsProvider p_126531_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { + super(p_126530_, Registry.f_122827_, modId, existingFileHelper); - this.f_126528_ = p_126531_::m_206426_; + this.f_126528_ = p_126531_::m_236451_; } diff --git a/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch new file mode 100644 index 00000000000..8aede943870 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/PaintingVariantTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/PaintingVariantTagsProvider.java ++++ b/net/minecraft/data/tags/PaintingVariantTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.entity.decoration.PaintingVariants; + + public class PaintingVariantTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #PaintingVariantTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public PaintingVariantTagsProvider(DataGenerator p_236431_) { + super(p_236431_, Registry.f_235728_); ++ } ++ public PaintingVariantTagsProvider(DataGenerator p_236431_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236431_, Registry.f_235728_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch new file mode 100644 index 00000000000..6a8ab103107 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/PoiTypeTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/PoiTypeTagsProvider.java ++++ b/net/minecraft/data/tags/PoiTypeTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.entity.ai.village.poi.PoiTypes; + + public class PoiTypeTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #PoiTypeTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public PoiTypeTagsProvider(DataGenerator p_236434_) { + super(p_236434_, Registry.f_122870_); ++ } ++ public PoiTypeTagsProvider(DataGenerator p_236434_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236434_, Registry.f_122870_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch new file mode 100644 index 00000000000..dff50b28d45 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/StructureTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/StructureTagsProvider.java ++++ b/net/minecraft/data/tags/StructureTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.level.levelgen.structure.Structure; + + public class StructureTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #StructureTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public StructureTagsProvider(DataGenerator p_236437_) { + super(p_236437_, BuiltinRegistries.f_235988_); ++ } ++ public StructureTagsProvider(DataGenerator p_236437_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236437_, BuiltinRegistries.f_235988_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch index 19257f80201..1c98cc8f4f4 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/data/tags/TagsProvider.java +++ b/net/minecraft/data/tags/TagsProvider.java -@@ -32,10 +_,24 @@ - protected final DataGenerator f_126539_; +@@ -29,10 +_,30 @@ + protected final DataGenerator.PathProvider f_236439_; protected final Registry f_126540_; - protected final Map f_126543_ = Maps.newLinkedHashMap(); + protected final Map f_126543_ = Maps.newLinkedHashMap(); + protected final String modId; + protected final net.minecraftforge.common.data.ExistingFileHelper existingFileHelper; + private final net.minecraftforge.common.data.ExistingFileHelper.IResourceType resourceType; @@ -17,84 +17,94 @@ + this(p_126546_, p_126547_, "vanilla", null); + } + protected TagsProvider(DataGenerator p_126546_, Registry p_126547_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { - this.f_126539_ = p_126546_; + this.f_236439_ = p_126546_.m_236036_(DataGenerator.Target.DATA_PACK, TagManager.m_203918_(p_126547_.m_123023_())); this.f_126540_ = p_126547_; + this.modId = modId; + this.existingFileHelper = existingFileHelper; + this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", TagManager.m_203918_(p_126547_.m_123023_())); ++ } ++ ++ // Forge: Allow customizing the path for a given tag or returning null ++ @org.jetbrains.annotations.Nullable ++ protected Path getPath(ResourceLocation id) { ++ return this.f_236439_.m_236048_(id); } - protected abstract void m_6577_(); -@@ -46,12 +_,13 @@ - this.f_126543_.forEach((p_176835_, p_176836_) -> { - List list = p_176836_.m_13330_().filter((p_176832_) -> { - return !p_176832_.f_13338_().m_142746_(this.f_126540_::m_7804_, this.f_126543_::containsKey); + public String m_6055_() { +@@ -48,12 +_,13 @@ + List list = p_236450_.m_215904_(); + List list1 = list.stream().filter((p_236444_) -> { + return !p_236444_.m_215940_(this.f_126540_::m_7804_, this.f_126543_::containsKey); - }).toList(); + }).filter(this::missing).collect(Collectors.toList()); // Forge: Add validation via existing resources - if (!list.isEmpty()) { - throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_176835_, list.stream().map(Objects::toString).collect(Collectors.joining(",")))); + if (!list1.isEmpty()) { + throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_236449_, list1.stream().map(Objects::toString).collect(Collectors.joining(",")))); } else { - JsonObject jsonobject = p_176836_.m_13334_(); - Path path = this.m_6648_(p_176835_); + JsonElement jsonelement = TagFile.f_215958_.encodeStart(JsonOps.INSTANCE, new TagFile(list, false)).getOrThrow(false, f_126541_::error); +- Path path = this.f_236439_.m_236048_(p_236449_); ++ Path path = this.getPath(p_236449_); + if (path == null) return; // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. try { - String s = f_126542_.toJson((JsonElement)jsonobject); -@@ -88,6 +_,17 @@ + DataProvider.m_236072_(p_236446_, jsonelement, path); +@@ -65,24 +_,37 @@ }); } -+ private boolean missing(Tag.BuilderEntry reference) { -+ Tag.Entry entry = reference.f_13338_(); ++ private boolean missing(TagEntry reference) { + // We only care about non-optional tag entries, this is the only type that can reference a resource and needs validation + // Optional tags should not be validated + -+ if (entry instanceof Tag.TagEntry nonOptionalEntry) { -+ return existingFileHelper == null || !existingFileHelper.exists(nonOptionalEntry.getId(), resourceType); ++ if (reference.isRequired()) { ++ return existingFileHelper == null || !existingFileHelper.exists(reference.getId(), resourceType); + } + return false; + } + - protected Path m_6648_(ResourceLocation p_126561_) { - ResourceKey> resourcekey = this.f_126540_.m_123023_(); - return this.f_126539_.m_123916_().resolve("data/" + p_126561_.m_135827_() + "/" + TagManager.m_203918_(resourcekey) + "/" + p_126561_.m_135815_() + ".json"); -@@ -95,16 +_,17 @@ - protected TagsProvider.TagAppender m_206424_(TagKey p_206425_) { - Tag.Builder tag$builder = this.m_206426_(p_206425_); -- return new TagsProvider.TagAppender<>(tag$builder, this.f_126540_, "vanilla"); -+ return new TagsProvider.TagAppender<>(tag$builder, this.f_126540_, modId); + TagBuilder tagbuilder = this.m_236451_(p_206425_); +- return new TagsProvider.TagAppender<>(tagbuilder, this.f_126540_); ++ return new TagsProvider.TagAppender<>(tagbuilder, this.f_126540_, modId); } - protected Tag.Builder m_206426_(TagKey p_206427_) { - return this.f_126543_.computeIfAbsent(p_206427_.f_203868_(), (p_176838_) -> { -+ existingFileHelper.trackGenerated(p_176838_, resourceType); - return new Tag.Builder(); + protected TagBuilder m_236451_(TagKey p_236452_) { + return this.f_126543_.computeIfAbsent(p_236452_.f_203868_(), (p_236442_) -> { ++ existingFileHelper.trackGenerated(p_236442_, resourceType); + return TagBuilder.m_215899_(); }); } - protected static class TagAppender { + public static class TagAppender implements net.minecraftforge.common.extensions.IForgeTagAppender { - private final Tag.Builder f_126568_; + private final TagBuilder f_126568_; public final Registry f_126569_; - private final String f_126570_; -@@ -150,6 +_,19 @@ - this.f_126568_.m_13327_(p_126587_, this.f_126570_); ++ private final String modId; + +- TagAppender(TagBuilder p_236454_, Registry p_236455_) { ++ TagAppender(TagBuilder p_236454_, Registry p_236455_, String modId) { + this.f_126568_ = p_236454_; + this.f_126569_ = p_236455_; ++ this.modId = modId; + } + + public TagsProvider.TagAppender m_126582_(T p_126583_) { +@@ -120,6 +_,19 @@ + this.f_126568_.m_215900_(p_126587_); }); return this; + } + -+ public TagsProvider.TagAppender add(Tag.Entry tag) { -+ f_126568_.m_13307_(tag, f_126570_); ++ public TagsProvider.TagAppender add(TagEntry tag) { ++ f_126568_.m_215902_(tag); + return this; + } + -+ public Tag.Builder getInternalBuilder() { ++ public TagBuilder getInternalBuilder() { + return f_126568_; + } + + public String getModID() { -+ return f_126570_; ++ return modId; } } } diff --git a/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch new file mode 100644 index 00000000000..370e54ebad5 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/tags/WorldPresetTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/tags/WorldPresetTagsProvider.java ++++ b/net/minecraft/data/tags/WorldPresetTagsProvider.java +@@ -7,8 +_,13 @@ + import net.minecraft.world.level.levelgen.presets.WorldPresets; + + public class WorldPresetTagsProvider extends TagsProvider { ++ /** @deprecated Forge: Use the {@link #WorldPresetTagsProvider(DataGenerator, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ ++ @Deprecated + public WorldPresetTagsProvider(DataGenerator p_236457_) { + super(p_236457_, BuiltinRegistries.f_235989_); ++ } ++ public WorldPresetTagsProvider(DataGenerator p_236457_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_236457_, BuiltinRegistries.f_235989_, modId, existingFileHelper); + } + + protected void m_6577_() { diff --git a/patches/minecraft/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch b/patches/minecraft/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch index 74829db9d30..64af395f462 100644 --- a/patches/minecraft/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch +++ b/patches/minecraft/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/worldgen/biome/OverworldBiomes.java +++ b/net/minecraft/data/worldgen/biome/OverworldBiomes.java -@@ -19,6 +_,8 @@ +@@ -20,6 +_,8 @@ import net.minecraft.world.level.levelgen.GenerationStep; public class OverworldBiomes { diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch index 30374a1f6cf..55663bf967c 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java -@@ -93,12 +_,13 @@ +@@ -98,13 +_,14 @@ public boolean m_7038_() { this.m_129823_(new PlayerList(this, this.m_206579_(), this.f_129745_, 1) { }); @@ -10,6 +10,7 @@ serverlevel.m_8733_(this.f_177588_, 0.0F); int i = 20000000; serverlevel.m_8606_(20000000, 20000000, false, false); + f_177585_.info("Started game test server"); - return true; + return net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(this); } diff --git a/patches/minecraft/net/minecraft/locale/Language.java.patch b/patches/minecraft/net/minecraft/locale/Language.java.patch index f82a97b8a73..c9bfbcf458d 100644 --- a/patches/minecraft/net/minecraft/locale/Language.java.patch +++ b/patches/minecraft/net/minecraft/locale/Language.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java -@@ -61,7 +_,8 @@ +@@ -59,7 +_,8 @@ f_128101_.error("Couldn't read strings from {}", "/assets/minecraft/lang/en_us.json", ioexception); } @@ -10,11 +10,11 @@ return new Language() { public String m_6834_(String p_128127_) { return map.getOrDefault(p_128127_, p_128127_); -@@ -82,6 +_,11 @@ +@@ -80,6 +_,11 @@ }, Style.f_131099_).isPresent(); }; } -+ ++ + @Override + public Map getLanguageData() { + return map; @@ -22,11 +22,11 @@ }; } -@@ -102,6 +_,9 @@ +@@ -100,6 +_,9 @@ public static void m_128114_(Language p_128115_) { f_128104_ = p_128115_; } -+ ++ + // FORGE START + public Map getLanguageData() { return ImmutableMap.of(); } diff --git a/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch index 018f1812765..ce960ab5bb8 100644 --- a/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompoundTag.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/CompoundTag.java +++ b/net/minecraft/nbt/CompoundTag.java -@@ -40,6 +_,7 @@ +@@ -39,6 +_,7 @@ while((b0 = CompoundTag.m_128420_(p_128485_, p_128487_)) != 0) { String s = CompoundTag.m_128432_(p_128485_, p_128487_); p_128487_.m_6800_((long)(224 + 16 * s.length())); @@ -8,7 +8,7 @@ Tag tag = CompoundTag.m_128413_(TagTypes.m_129397_(b0), s, p_128485_, p_128486_ + 1, p_128487_); if (map.put(s, tag) != null) { p_128487_.m_6800_(288L); -@@ -154,6 +_,7 @@ +@@ -153,6 +_,7 @@ @Nullable public Tag m_128365_(String p_128366_, Tag p_128367_) { @@ -16,7 +16,7 @@ return this.f_128329_.put(p_128366_, p_128367_); } -@@ -446,11 +_,12 @@ +@@ -445,11 +_,12 @@ } static byte m_128420_(DataInput p_128421_, NbtAccounter p_128422_) throws IOException { diff --git a/patches/minecraft/net/minecraft/nbt/StringTag.java.patch b/patches/minecraft/net/minecraft/nbt/StringTag.java.patch index 4c3599dffcb..c09cde67527 100644 --- a/patches/minecraft/net/minecraft/nbt/StringTag.java.patch +++ b/patches/minecraft/net/minecraft/nbt/StringTag.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/StringTag.java +++ b/net/minecraft/nbt/StringTag.java -@@ -11,7 +_,7 @@ +@@ -13,7 +_,7 @@ public StringTag m_7300_(DataInput p_129315_, int p_129316_, NbtAccounter p_129317_) throws IOException { p_129317_.m_6800_(288L); String s = p_129315_.readUTF(); diff --git a/patches/minecraft/net/minecraft/network/Connection.java.patch b/patches/minecraft/net/minecraft/network/Connection.java.patch index af42de5f434..ddd48339dc2 100644 --- a/patches/minecraft/net/minecraft/network/Connection.java.patch +++ b/patches/minecraft/net/minecraft/network/Connection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -87,6 +_,7 @@ +@@ -86,6 +_,7 @@ private float f_129477_; private int f_129478_; private boolean f_129479_; @@ -8,7 +8,7 @@ public Connection(PacketFlow p_129482_) { this.f_129466_ = p_129482_; -@@ -96,6 +_,7 @@ +@@ -95,6 +_,7 @@ super.channelActive(p_129525_); this.f_129468_ = p_129525_.channel(); this.f_129469_ = this.f_129468_.remoteAddress(); @@ -16,7 +16,7 @@ try { this.m_129498_(ConnectionProtocol.HANDSHAKING); -@@ -191,7 +_,7 @@ +@@ -190,7 +_,7 @@ ++this.f_129475_; if (connectionprotocol1 != connectionprotocol) { f_129465_.debug("Disabled auto read"); @@ -25,7 +25,7 @@ } if (this.f_129468_.eventLoop().inEventLoop()) { -@@ -289,7 +_,9 @@ +@@ -288,7 +_,9 @@ } public static Connection m_178300_(InetSocketAddress p_178301_, boolean p_178302_) { @@ -35,7 +35,7 @@ Class oclass; LazyLoadedValue lazyloadedvalue; if (Epoll.isAvailable() && p_178302_) { -@@ -315,6 +_,7 @@ +@@ -314,6 +_,7 @@ public static Connection m_129493_(SocketAddress p_129494_) { final Connection connection = new Connection(PacketFlow.CLIENTBOUND); @@ -43,7 +43,7 @@ (new Bootstrap()).group(f_129464_.m_13971_()).handler(new ChannelInitializer() { protected void initChannel(Channel p_129557_) { p_129557_.pipeline().addLast("packet_handler", connection); -@@ -401,6 +_,14 @@ +@@ -400,6 +_,14 @@ public float m_129543_() { return this.f_129477_; diff --git a/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch b/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch index 0e5a446e26e..bad0df39ad1 100644 --- a/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch +++ b/patches/minecraft/net/minecraft/network/FriendlyByteBuf.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java -@@ -52,7 +_,7 @@ +@@ -65,7 +_,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -9,7 +9,7 @@ private static final int f_178335_ = 5; private static final int f_178336_ = 10; private static final int f_178337_ = 2097152; -@@ -439,6 +_,15 @@ +@@ -517,6 +_,15 @@ } public FriendlyByteBuf m_130055_(ItemStack p_130056_) { @@ -25,8 +25,8 @@ if (p_130056_.m_41619_()) { this.writeBoolean(false); } else { -@@ -447,8 +_,8 @@ - this.m_130130_(Item.m_41393_(item)); +@@ -525,8 +_,8 @@ + this.m_236818_(Registry.f_122827_, item); this.writeByte(p_130056_.m_41613_()); CompoundTag compoundtag = null; - if (item.m_41465_() || item.m_41468_()) { @@ -36,10 +36,10 @@ } this.m_130079_(compoundtag); -@@ -464,7 +_,7 @@ - int i = this.m_130242_(); - int j = this.readByte(); - ItemStack itemstack = new ItemStack(Item.m_41445_(i), j); +@@ -542,7 +_,7 @@ + Item item = this.m_236816_(Registry.f_122827_); + int i = this.readByte(); + ItemStack itemstack = new ItemStack(item, i); - itemstack.m_41751_(this.m_130260_()); + itemstack.readShareTag(this.m_130260_()); return itemstack; diff --git a/patches/minecraft/net/minecraft/network/chat/PlayerChatMessage.java.patch b/patches/minecraft/net/minecraft/network/chat/PlayerChatMessage.java.patch new file mode 100644 index 00000000000..f073c137281 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/chat/PlayerChatMessage.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/network/chat/PlayerChatMessage.java ++++ b/net/minecraft/network/chat/PlayerChatMessage.java +@@ -27,7 +_,9 @@ + public static FilteredText m_237223_(FilteredText p_237224_, FilteredText p_237225_, MessageSignature p_237226_, boolean p_237227_) { + Component component = p_237224_.f_215168_(); + Component component1 = p_237225_.f_215168_(); +- PlayerChatMessage playerchatmessage = m_237237_(component, component1, p_237226_, p_237227_); ++ Component forgeComponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(p_237226_, p_237224_.f_215168_().getString(), component); ++ // TODO: this overrides the signed ("normal") component from the player, but ignores the unsigned component. What do we do here? This is a mess. -C ++ PlayerChatMessage playerchatmessage = m_237237_(forgeComponent, component1, p_237226_, p_237227_); + if (p_237225_.m_215174_()) { + PlayerChatMessage playerchatmessage1 = Util.m_214614_(p_237225_.f_215169_(), PlayerChatMessage::m_237235_); + return new FilteredText<>(playerchatmessage, playerchatmessage1); diff --git a/patches/minecraft/net/minecraft/network/chat/Style.java.patch b/patches/minecraft/net/minecraft/network/chat/Style.java.patch deleted file mode 100644 index 68398e5934e..00000000000 --- a/patches/minecraft/net/minecraft/network/chat/Style.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/net/minecraft/network/chat/Style.java -+++ b/net/minecraft/network/chat/Style.java -@@ -133,6 +_,30 @@ - return new Style(this.f_131101_, this.f_131102_, this.f_131103_, this.f_131104_, this.f_131105_, p_178525_, this.f_131107_, this.f_131108_, this.f_131109_, this.f_131110_); - } - -+ /** -+ * @deprecated Use {@link #withUnderlined(Boolean)} instead. -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public Style setUnderlined(@Nullable Boolean underlined) { -+ return new Style(this.f_131101_, this.f_131102_, this.f_131103_, underlined, this.f_131105_, this.f_131106_, this.f_131107_, this.f_131108_, this.f_131109_, this.f_131110_); -+ } -+ -+ /** -+ * @deprecated Use {@link #withStrikethrough(Boolean)} instead. -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public Style setStrikethrough(@Nullable Boolean strikethrough) { -+ return new Style(this.f_131101_, this.f_131102_, this.f_131103_, this.f_131104_, strikethrough, this.f_131106_, this.f_131107_, this.f_131108_, this.f_131109_, this.f_131110_); -+ } -+ -+ /** -+ * @deprecated Use {@link #withObfuscated(Boolean)} instead. -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public Style setObfuscated(@Nullable Boolean obfuscated) { -+ return new Style(this.f_131101_, this.f_131102_, this.f_131103_, this.f_131104_, this.f_131105_, obfuscated, this.f_131107_, this.f_131108_, this.f_131109_, this.f_131110_); -+ } -+ - public Style m_131142_(@Nullable ClickEvent p_131143_) { - return new Style(this.f_131101_, this.f_131102_, this.f_131103_, this.f_131104_, this.f_131105_, this.f_131106_, p_131143_, this.f_131108_, this.f_131109_, this.f_131110_); - } diff --git a/patches/minecraft/net/minecraft/network/chat/TranslatableComponent.java.patch b/patches/minecraft/net/minecraft/network/chat/TranslatableComponent.java.patch deleted file mode 100644 index d3f3f21515a..00000000000 --- a/patches/minecraft/net/minecraft/network/chat/TranslatableComponent.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/network/chat/TranslatableComponent.java -+++ b/net/minecraft/network/chat/TranslatableComponent.java -@@ -89,6 +_,10 @@ - } - } - -+ if (j == 0) { -+ // if we failed to match above, lets try the messageformat handler instead. -+ j = net.minecraftforge.internal.TextComponentMessageFormatHandler.handle(this, p_200007_, this.f_131299_, p_200006_); -+ } - if (j < p_200006_.length()) { - String s3 = p_200006_.substring(j); - if (s3.indexOf(37) != -1) { diff --git a/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch b/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch new file mode 100644 index 00000000000..a68df172e4c --- /dev/null +++ b/patches/minecraft/net/minecraft/network/chat/contents/TranslatableContents.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/network/chat/contents/TranslatableContents.java ++++ b/net/minecraft/network/chat/contents/TranslatableContents.java +@@ -94,6 +_,11 @@ + } + } + ++ if (j == 0) { ++ // Forge has some special formatting handlers defined in ForgeI18n, use those if no %s replacements present. ++ j = net.minecraftforge.internal.TextComponentMessageFormatHandler.handle(this, p_237517_, this.f_237498_, p_237516_); ++ } ++ + if (j < p_237516_.length()) { + String s3 = p_237516_.substring(j); + if (s3.indexOf(37) != -1) { diff --git a/patches/minecraft/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java.patch b/patches/minecraft/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java.patch index 68d3944f66d..048cadd8238 100644 --- a/patches/minecraft/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java.patch @@ -3,7 +3,7 @@ @@ -49,7 +_,7 @@ p_133961_.writeByte(this.f_133941_); p_133961_.m_130068_(this.f_133944_); - p_133961_.m_178355_(this.f_179569_, FriendlyByteBuf::writeShort, FriendlyByteBuf::m_130055_); + p_133961_.m_236831_(this.f_179569_, FriendlyByteBuf::writeShort, FriendlyByteBuf::m_130055_); - p_133961_.m_130055_(this.f_179568_); + p_133961_.writeItemStack(this.f_179568_, false); //Forge: Include full tag for C->S } diff --git a/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch b/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch index 5d0b8bf078e..4ab29d268e5 100644 --- a/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch +++ b/patches/minecraft/net/minecraft/network/protocol/status/ServerStatus.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/network/protocol/status/ServerStatus.java +++ b/net/minecraft/network/protocol/status/ServerStatus.java -@@ -26,6 +_,16 @@ - private ServerStatus.Version f_134902_; +@@ -27,6 +_,16 @@ @Nullable private String f_134903_; + private boolean f_238077_; + private transient net.minecraftforge.network.ServerStatusPing forgeData; + + public net.minecraftforge.network.ServerStatusPing getForgeData() { @@ -17,7 +17,7 @@ @Nullable public Component m_134905_() { -@@ -34,6 +_,7 @@ +@@ -35,6 +_,7 @@ public void m_134908_(Component p_134909_) { this.f_134900_ = p_134909_; @@ -25,7 +25,7 @@ } @Nullable -@@ -43,6 +_,7 @@ +@@ -44,6 +_,7 @@ public void m_134910_(ServerStatus.Players p_134911_) { this.f_134901_ = p_134911_; @@ -33,7 +33,7 @@ } @Nullable -@@ -52,10 +_,12 @@ +@@ -53,10 +_,12 @@ public void m_134912_(ServerStatus.Version p_134913_) { this.f_134902_ = p_134913_; @@ -46,8 +46,8 @@ } @Nullable -@@ -63,6 +_,39 @@ - return this.f_134903_; +@@ -72,6 +_,39 @@ + return this.f_238077_; } + private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); @@ -86,8 +86,8 @@ public static class Players { private final int f_134917_; private final int f_134918_; -@@ -157,6 +_,10 @@ - serverstatus.m_134906_(GsonHelper.m_13906_(jsonobject, "favicon")); +@@ -170,6 +_,10 @@ + serverstatus.m_238078_(GsonHelper.m_13912_(jsonobject, "previewsChat")); } + if (jsonobject.has("forgeData")) { @@ -97,7 +97,7 @@ return serverstatus; } -@@ -176,6 +_,10 @@ +@@ -190,6 +_,10 @@ if (p_134951_.m_134916_() != null) { jsonobject.addProperty("favicon", p_134951_.m_134916_()); diff --git a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch index eb1340bd79c..39315237d95 100644 --- a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch +++ b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -301,16 +_,16 @@ - }; +@@ -134,16 +_,16 @@ + public static final EntityDataSerializer> f_238116_ = EntityDataSerializer.m_238081_(Registry.f_235728_.m_206115_()); public static void m_135050_(EntityDataSerializer p_135051_) { - f_135046_.m_13569_(p_135051_); diff --git a/patches/minecraft/net/minecraft/recipebook/PlaceRecipe.java.patch b/patches/minecraft/net/minecraft/recipebook/PlaceRecipe.java.patch index 193e21f3c86..6e60254b87b 100644 --- a/patches/minecraft/net/minecraft/recipebook/PlaceRecipe.java.patch +++ b/patches/minecraft/net/minecraft/recipebook/PlaceRecipe.java.patch @@ -1,11 +1,10 @@ --- a/net/minecraft/recipebook/PlaceRecipe.java +++ b/net/minecraft/recipebook/PlaceRecipe.java -@@ -9,10 +_,10 @@ +@@ -9,9 +_,10 @@ default void m_135408_(int p_135409_, int p_135410_, int p_135411_, Recipe p_135412_, Iterator p_135413_, int p_135414_) { int i = p_135409_; int j = p_135410_; -- if (p_135412_ instanceof ShapedRecipe) { -- ShapedRecipe shapedrecipe = (ShapedRecipe)p_135412_; +- if (p_135412_ instanceof ShapedRecipe shapedrecipe) { - i = shapedrecipe.m_44220_(); - j = shapedrecipe.m_44221_(); + if (p_135412_ instanceof net.minecraftforge.common.crafting.IShapedRecipe) { diff --git a/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch b/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch index 86df6b3e816..a6131673468 100644 --- a/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch +++ b/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch @@ -1,28 +1,37 @@ --- a/net/minecraft/resources/RegistryResourceAccess.java +++ b/net/minecraft/resources/RegistryResourceAccess.java -@@ -66,6 +_,7 @@ +@@ -47,7 +_,7 @@ + DataResult dataresult; try { - JsonElement jsonelement = JsonParser.parseReader(reader); -+ if (jsonelement != null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_195895_.m_135782_().toString()); - optional = Optional.of(p_195896_.parse(p_195893_, jsonelement).map(RegistryResourceAccess.ParsedEntry::m_195956_)); - } catch (Throwable throwable2) { - try { -@@ -102,6 +_,8 @@ +- dataresult = this.m_214249_(p_214266_, p_214267_, reader); ++ dataresult = this.decodeElement(p_214266_, p_214267_, reader, p_214238_); + } catch (Throwable throwable1) { + if (reader != null) { + try { +@@ -82,7 +_,7 @@ + + DataResult dataresult; + try { +- dataresult = this.m_214249_(p_214247_, p_214248_, reader); ++ dataresult = this.decodeElement(p_214247_, p_214248_, reader, p_214260_); + } catch (Throwable throwable1) { + if (reader != null) { + try { +@@ -107,12 +_,15 @@ + }); } - private static String m_195909_(ResourceKey> p_195910_) { -+ if (net.minecraftforge.registries.RegistryManager.FROZEN.getRegistry(p_195910_.m_135782_()) != null && !(p_195910_.m_135782_().m_135827_().equals("minecraft"))) -+ return p_195910_.m_135782_().m_135827_() + "/" + p_195910_.m_135782_().m_135815_(); // FORGE: add non-vanilla registry namespace to loader directory, same format as tag directory (see net.minecraft.tags.TagManager#getTagDir(ResourceKey)) - return p_195910_.m_135782_().m_135815_(); +- private DataResult> m_214249_(DynamicOps p_214250_, Decoder p_214251_, Reader p_214252_) throws IOException { ++ private DataResult> decodeElement(DynamicOps p_214250_, Decoder p_214251_, Reader p_214252_, ResourceKey key) throws IOException { + JsonElement jsonelement = JsonParser.parseReader(p_214252_); ++ if (jsonelement != null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", key.m_135782_().toString()); + return p_214251_.parse(p_214250_, jsonelement).map(RegistryResourceAccess.ParsedEntry::m_195956_); } -@@ -138,6 +_,8 @@ + private static String m_214239_(ResourceLocation p_214240_) { ++ if (net.minecraftforge.registries.RegistryManager.FROZEN.getRegistry(p_214240_) != null && !(p_214240_.m_135827_().equals("minecraft"))) ++ return p_214240_.m_135827_() + "/" + p_214240_.m_135815_(); // FORGE: add non-vanilla registry namespace to loader directory, same format as tag directory (see net.minecraft.tags.TagManager#getTagDir(ResourceKey)) + return p_214240_.m_135815_(); + } - public Optional>> m_183313_(DynamicOps p_195917_, ResourceKey> p_195918_, ResourceKey p_195919_, Decoder p_195920_) { - RegistryResourceAccess.InMemoryStorage.Entry registryresourceaccess$inmemorystorage$entry = this.f_195913_.get(p_195919_); -+ if (registryresourceaccess$inmemorystorage$entry != null && registryresourceaccess$inmemorystorage$entry.f_195936_ != null && registryresourceaccess$inmemorystorage$entry.f_195936_.isJsonObject()) -+ registryresourceaccess$inmemorystorage$entry.f_195936_.getAsJsonObject().addProperty("forge:registry_name", p_195919_.m_135782_().toString()); - return registryresourceaccess$inmemorystorage$entry == null ? Optional.of(DataResult.error("Unknown element: " + p_195919_)) : Optional.of(p_195920_.parse(p_195917_, registryresourceaccess$inmemorystorage$entry.f_195936_).setLifecycle(registryresourceaccess$inmemorystorage$entry.f_195938_).map((p_195930_) -> { - return RegistryResourceAccess.ParsedEntry.m_195958_(p_195930_, registryresourceaccess$inmemorystorage$entry.f_195937_); - })); diff --git a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch index 10d491de1eb..c3f0e5684c0 100644 --- a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/resources/ResourceKey.java +++ b/net/minecraft/resources/ResourceKey.java -@@ -8,7 +_,7 @@ - import java.util.function.Function; +@@ -7,7 +_,7 @@ + import java.util.Optional; import net.minecraft.core.Registry; -public class ResourceKey { @@ -9,26 +9,21 @@ private static final Map> f_135775_ = Collections.synchronizedMap(Maps.newIdentityHashMap()); private final ResourceLocation f_135776_; private final ResourceLocation f_135777_; -@@ -63,5 +_,23 @@ - return (p_195974_) -> { - return m_135785_(p_135798_, p_195974_); - }; -+ } -+ -+ public ResourceLocation getRegistryName() { -+ return this.f_135776_; +@@ -56,5 +_,18 @@ + + public ResourceLocation m_211136_() { + return this.f_135776_; + } + -+ @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; -+ return f_135776_.equals(((ResourceKey) o).f_135776_) && f_135777_.equals(((ResourceKey) o).f_135777_); ++ return f_135777_.equals(((ResourceKey) o).f_135777_) && f_135776_.equals(((ResourceKey) o).f_135776_); + } + + @Override + public int compareTo(ResourceKey o) { -+ int ret = this.getRegistryName().compareTo(o.getRegistryName()); ++ int ret = this.m_211136_().compareTo(o.m_211136_()); + if (ret == 0) ret = this.m_135782_().compareTo(o.m_135782_()); + return ret; } diff --git a/patches/minecraft/net/minecraft/resources/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/resources/ResourceLocation.java.patch index feb2eceae30..6bf1bfd330e 100644 --- a/patches/minecraft/net/minecraft/resources/ResourceLocation.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourceLocation.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourceLocation.java +++ b/net/minecraft/resources/ResourceLocation.java -@@ -116,6 +_,12 @@ +@@ -125,6 +_,12 @@ return i; } diff --git a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch index 78168a045f5..d68e4c4f5d0 100644 --- a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -55,6 +_,8 @@ +@@ -53,6 +_,8 @@ + DispenseItemBehavior.m_123402_(); CauldronInteraction.m_175649_(); - ArgumentTypes.m_121586_(); Registry.m_206101_(); + net.minecraftforge.registries.GameData.vanillaSnapshot(); + if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context m_135890_(); } } -@@ -128,7 +_,6 @@ +@@ -126,7 +_,6 @@ m_197757_(); } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index 99efea21cd5..d80e07ae517 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -77,6 +_,15 @@ +@@ -78,6 +_,15 @@ OptionSpec optionspec12 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec optionspec13 = optionparser.accepts("jfrProfile"); OptionSpec optionspec14 = optionparser.nonOptions(); @@ -16,7 +16,7 @@ try { OptionSet optionset = optionparser.parse(p_129699_); -@@ -84,6 +_,13 @@ +@@ -85,6 +_,13 @@ optionparser.printHelpOn(System.err); return; } @@ -30,7 +30,7 @@ CrashReport.m_127529_(); if (optionset.has(optionspec13)) { -@@ -93,29 +_,28 @@ +@@ -94,26 +_,25 @@ Bootstrap.m_135870_(); Bootstrap.m_135889_(); Util.m_137584_(); @@ -51,10 +51,7 @@ - } - File file1 = new File(optionset.valueOf(optionspec9)); - YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY); - MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); - GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); - GameProfileCache gameprofilecache = new GameProfileCache(gameprofilerepository, new File(file1, MinecraftServer.f_129742_.getName())); + Services services = Services.m_214344_(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file1); String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.m_139777_().f_139741_); + if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { + f_129670_.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); @@ -66,21 +63,21 @@ LevelSummary levelsummary = levelstoragesource$levelstorageaccess.m_78308_(); if (levelsummary != null) { if (levelsummary.m_193020_()) { -@@ -160,6 +_,8 @@ - worldgensettings = optionset.has(optionspec3) ? dedicatedserverproperties.m_180927_(registryaccess$writable).m_64671_() : dedicatedserverproperties.m_180927_(registryaccess$writable); - } +@@ -158,6 +_,8 @@ + worldgensettings = optionset.has(optionspec3) ? dedicatedserverproperties.m_180927_(registryaccess$writable).m_64671_() : dedicatedserverproperties.m_180927_(registryaccess$writable); + } + // Forge: Deserialize the WorldGenSettings to ensure modded dims are loaded on first server load. Vanilla behavior only loads from the server.properties and deserializes only after the 2nd server load. + worldgensettings = WorldGenSettings.f_64600_.encodeStart(dynamicops, worldgensettings).flatMap(nbt -> WorldGenSettings.f_64600_.parse(dynamicops, nbt)).getOrThrow(false, errorMsg -> {}); - PrimaryLevelData primaryleveldata = new PrimaryLevelData(levelsettings, worldgensettings, Lifecycle.stable()); - return Pair.of(primaryleveldata, registryaccess$writable.m_203557_()); - } -@@ -181,22 +_,33 @@ + PrimaryLevelData primaryleveldata = new PrimaryLevelData(levelsettings, worldgensettings, Lifecycle.stable()); + return Pair.of(primaryleveldata, registryaccess$writable.m_203557_()); + } +@@ -178,22 +_,33 @@ } levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); -- final DedicatedServer dedicatedserver = MinecraftServer.m_129872_((p_206536_) -> { -- DedicatedServer dedicatedserver1 = new DedicatedServer(p_206536_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); +- final DedicatedServer dedicatedserver = MinecraftServer.m_129872_((p_236710_) -> { +- DedicatedServer dedicatedserver1 = new DedicatedServer(p_236710_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), services, LoggerChunkProgressListener::new); + final MinecraftServer dedicatedserver = MinecraftServer.m_129872_((p_129697_) -> { + MinecraftServer dedicatedserver1; + if (gametestEnabled) { @@ -89,9 +86,9 @@ + net.minecraft.core.BlockPos spawnPos = optionset.valueOf(spawnPosOpt); + dedicatedserver1 = new net.minecraft.gametest.framework.GameTestServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, worldstem, testBatches, spawnPos); + } else { -+ dedicatedserver1 = new DedicatedServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); ++ dedicatedserver1 = new DedicatedServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), services, LoggerChunkProgressListener::new); + } - dedicatedserver1.m_129981_(optionset.valueOf(optionspec8)); + dedicatedserver1.m_236740_(optionset.has(optionspec8) ? new GameProfile((UUID)null, optionset.valueOf(optionspec8)) : null); dedicatedserver1.m_129801_(optionset.valueOf(optionspec11)); dedicatedserver1.m_129975_(optionset.has(optionspec2)); dedicatedserver1.m_129948_(optionset.valueOf(optionspec12)); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 43fee0adee4..fedd77a81ac 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 -@@ -257,7 +_,7 @@ +@@ -241,7 +_,7 @@ public static S m_129872_(Function p_129873_) { AtomicReference atomicreference = new AtomicReference<>(); @@ -9,7 +9,7 @@ atomicreference.get().m_130011_(); }, "Server thread"); thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> { -@@ -358,6 +_,7 @@ +@@ -333,6 +_,7 @@ this.m_129841_(dimensiondatastorage); this.f_129732_ = new CommandStorage(dimensiondatastorage); WorldBorder worldborder = serverlevel.m_6857_(); @@ -17,23 +17,23 @@ if (!serverleveldata.m_6535_()) { try { m_177896_(serverlevel, serverleveldata, worldgensettings.m_64660_(), flag); -@@ -394,6 +_,7 @@ - ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, holder1, p_129816_, chunkgenerator1, flag, j, ImmutableList.of(), false); +@@ -367,6 +_,7 @@ + ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, entry.getValue(), p_129816_, flag, j, ImmutableList.of(), false); worldborder.m_61929_(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.m_6857_())); this.f_129762_.put(resourcekey1, serverlevel1); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(f_129762_.get(resourcekey))); } } -@@ -405,6 +_,7 @@ +@@ -378,6 +_,7 @@ p_177898_.m_7250_(BlockPos.f_121853_.m_6630_(80), 0.0F); } else { - ChunkGenerator chunkgenerator = p_177897_.m_7726_().m_8481_(); + ServerChunkCache serverchunkcache = p_177897_.m_7726_(); + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_177897_, p_177898_)) return; - ChunkPos chunkpos = new ChunkPos(chunkgenerator.m_183403_().m_183230_()); - int i = chunkgenerator.m_142051_(p_177897_); + ChunkPos chunkpos = new ChunkPos(serverchunkcache.m_214994_().m_224579_().m_183230_()); + int i = serverchunkcache.m_8481_().m_142051_(p_177897_); if (i < p_177897_.m_141937_()) { -@@ -485,6 +_,7 @@ +@@ -458,6 +_,7 @@ ChunkPos chunkpos = new ChunkPos(i); serverlevel1.m_7726_().m_6692_(chunkpos, true); } @@ -41,7 +41,16 @@ } } -@@ -609,6 +_,7 @@ +@@ -528,6 +_,8 @@ + } + + public void m_7041_() { ++ if (m_130010_() && m_6982_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent()); ++ + if (this.f_177872_.m_142763_()) { + this.m_236737_(); + } +@@ -572,6 +_,7 @@ for(ServerLevel serverlevel2 : this.m_129785_()) { if (serverlevel2 != null) { try { @@ -49,42 +58,40 @@ serverlevel2.close(); } catch (IOException ioexception1) { f_129750_.error("Exception closing the level", (Throwable)ioexception1); -@@ -654,6 +_,7 @@ - protected void m_130011_() { - try { - if (this.m_7038_()) { -+ net.minecraftforge.server.ServerLifecycleHooks.handleServerStarted(this); - this.f_129726_ = Util.m_137550_(); - this.f_129757_.m_134908_(new TextComponent(this.f_129709_)); - this.f_129757_.m_134912_(new ServerStatus.Version(SharedConstants.m_183709_().getName(), SharedConstants.m_183709_().getProtocolVersion())); -@@ -686,7 +_,10 @@ - this.f_129717_ = true; - JvmProfiler.f_185340_.m_183597_(this.f_129737_); - } -+ net.minecraftforge.server.ServerLifecycleHooks.handleServerStopping(this); -+ net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions - } else { -+ net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions - this.m_7268_((CrashReport)null); +@@ -620,6 +_,7 @@ + throw new IllegalStateException("Failed to initialize server"); } + ++ net.minecraftforge.server.ServerLifecycleHooks.handleServerStarted(this); + this.f_129726_ = Util.m_137550_(); + this.f_129757_.m_134908_(Component.m_237113_(this.f_129709_)); + this.f_129757_.m_134912_(new ServerStatus.Version(SharedConstants.m_183709_().getName(), SharedConstants.m_183709_().getProtocolVersion())); +@@ -653,6 +_,8 @@ + this.f_129717_ = true; + JvmProfiler.f_185340_.m_183597_(this.f_129737_); + } ++ net.minecraftforge.server.ServerLifecycleHooks.handleServerStopping(this); ++ net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // Forge: Has to come before MinecraftServer#onServerCrash to avoid race conditions } catch (Throwable throwable1) { -@@ -700,6 +_,7 @@ + f_129750_.error("Encountered an unexpected exception", throwable1); + CrashReport crashreport = m_206568_(throwable1); +@@ -664,6 +_,7 @@ f_129750_.error("We were unable to save this crash report to disk."); } -+ net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions ++ net.minecraftforge.server.ServerLifecycleHooks.expectServerStopped(); // Forge: Has to come before MinecraftServer#onServerCrash to avoid race conditions this.m_7268_(crashreport); } finally { try { -@@ -712,6 +_,7 @@ - this.f_129723_.m_196559_(); +@@ -676,6 +_,7 @@ + this.f_236721_.f_214336_().m_196559_(); } + net.minecraftforge.server.ServerLifecycleHooks.handleServerStopped(this); this.m_6988_(); } -@@ -826,6 +_,7 @@ +@@ -789,6 +_,7 @@ public void m_5705_(BooleanSupplier p_129871_) { long i = Util.m_137569_(); @@ -92,7 +99,7 @@ ++this.f_129766_; this.m_5703_(p_129871_); if (i - this.f_129724_ >= 5000000000L) { -@@ -847,6 +_,7 @@ +@@ -810,6 +_,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.f_129757_.m_134914_().m_134924_(agameprofile); } @@ -100,7 +107,7 @@ } if (this.f_129766_ % 6000 == 0) { -@@ -863,6 +_,7 @@ +@@ -826,6 +_,7 @@ long i1 = Util.m_137569_(); this.f_129735_.m_13755_(i1 - i); this.f_129754_.m_7238_(); @@ -108,7 +115,7 @@ } public void m_5703_(BooleanSupplier p_129954_) { -@@ -870,7 +_,8 @@ +@@ -833,7 +_,8 @@ this.m_129890_().m_136128_(); this.f_129754_.m_6182_("levels"); @@ -118,7 +125,7 @@ this.f_129754_.m_6521_(() -> { return serverlevel + " " + serverlevel.m_46472_().m_135782_(); }); -@@ -881,6 +_,7 @@ +@@ -844,6 +_,7 @@ } this.f_129754_.m_6180_("tick"); @@ -126,7 +133,7 @@ try { serverlevel.m_8793_(p_129954_); -@@ -889,16 +_,18 @@ +@@ -852,16 +_,18 @@ serverlevel.m_6026_(crashreport); throw new ReportedException(crashreport); } @@ -146,7 +153,7 @@ GameTestTicker.f_177648_.m_127790_(); } -@@ -966,7 +_,7 @@ +@@ -929,7 +_,7 @@ @DontObfuscate public String m_130001_() { @@ -155,15 +162,15 @@ } public SystemReport m_177935_(SystemReport p_177936_) { -@@ -1316,6 +_,7 @@ +@@ -1287,6 +_,7 @@ this.m_6846_().m_11315_(); this.f_129734_.m_136120_(this.f_129740_.f_206585_.m_206860_()); - this.f_129741_.m_74335_(this.f_129740_.f_206584_); + this.f_236720_.m_230370_(this.f_129740_.f_206584_); + this.m_6846_().m_11314_().forEach(this.m_6846_()::m_11289_); //Forge: Fix newly added/modified commands not being sent to the client when commands reload. }, this); if (this.m_18695_()) { this.m_18701_(completablefuture::isDone); -@@ -1325,10 +_,13 @@ +@@ -1296,10 +_,13 @@ } public static DataPackConfig m_129819_(PackRepository p_129820_, DataPackConfig p_129821_, boolean p_129822_) { @@ -173,13 +180,13 @@ + p_129821_.addModPacks(net.minecraftforge.common.ForgeHooks.getModPacks()); if (p_129822_) { - p_129820_.m_10509_(Collections.singleton("vanilla")); -- return new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()); +- return DataPackConfig.f_45842_; + p_129820_.m_10509_(net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla()); + return new DataPackConfig(net.minecraftforge.common.ForgeHooks.getModPacksWithVanilla(), ImmutableList.of()); } else { Set set = Sets.newLinkedHashSet(); -@@ -1479,6 +_,31 @@ +@@ -1450,6 +_,31 @@ public abstract boolean m_7779_(GameProfile p_129840_); @@ -211,7 +218,7 @@ public void m_142116_(Path p_177911_) throws IOException { } -@@ -1732,6 +_,10 @@ +@@ -1708,6 +_,10 @@ public WorldData m_129910_() { return this.f_129749_; diff --git a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch index e3cd7ac0ecf..c2a10aefed7 100644 --- a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java -@@ -181,6 +_,10 @@ +@@ -179,6 +_,10 @@ } this.m_136002_(p_136007_); @@ -11,7 +11,7 @@ this.m_136001_(); this.m_135994_(p_136007_); } -@@ -239,6 +_,8 @@ +@@ -237,6 +_,8 @@ } public boolean m_135988_(Advancement p_135989_, String p_135990_) { @@ -20,9 +20,9 @@ boolean flag = false; AdvancementProgress advancementprogress = this.m_135996_(p_135989_); boolean flag1 = advancementprogress.m_8193_(); -@@ -251,6 +_,7 @@ +@@ -249,6 +_,7 @@ if (p_135989_.m_138320_() != null && p_135989_.m_138320_().m_14996_() && this.f_135968_.f_19853_.m_46469_().m_46207_(GameRules.f_46153_)) { - this.f_135962_.m_11264_(new TranslatableComponent("chat.type.advancement." + p_135989_.m_138320_().m_14992_().m_15548_(), this.f_135968_.m_5446_(), p_135989_.m_138330_()), ChatType.SYSTEM, Util.f_137441_); + this.f_135962_.m_215627_(Component.m_237110_("chat.type.advancement." + p_135989_.m_138320_().m_14992_().m_15548_(), this.f_135968_.m_5446_(), p_135989_.m_138330_()), ChatType.f_130599_); } + net.minecraftforge.common.ForgeHooks.onAdvancement(this.f_135968_, p_135989_); } diff --git a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch index 3f8bde672b5..c0ffcb049cc 100644 --- a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch +++ b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java -@@ -28,18 +_,22 @@ - private static final Logger f_206845_ = LogUtils.getLogger(); +@@ -30,12 +_,12 @@ private static final CompletableFuture f_206846_ = CompletableFuture.completedFuture(Unit.INSTANCE); + private final CommandBuildContext f_214300_; private final Commands f_206847_; - private final RecipeManager f_206848_ = new RecipeManager(); + private final RecipeManager f_206848_; @@ -15,8 +15,9 @@ private final ServerFunctionLibrary f_206854_; public ReloadableServerResources(RegistryAccess.Frozen p_206857_, Commands.CommandSelection p_206858_, int p_206859_) { - this.f_206849_ = new TagManager(p_206857_); - this.f_206847_ = new Commands(p_206858_); +@@ -44,6 +_,10 @@ + this.f_206847_ = new Commands(p_206858_, this.f_214300_); + this.f_214300_.m_227135_(CommandBuildContext.MissingTagAccessPolicy.CREATE_NEW); this.f_206854_ = new ServerFunctionLibrary(p_206859_, this.f_206847_.m_82094_()); + // Forge: Create context object and pass it to the recipe manager. + this.context = new net.minecraftforge.common.crafting.conditions.ConditionContext(this.f_206849_); @@ -25,27 +26,27 @@ } public ServerFunctionLibrary m_206860_() { -@@ -76,7 +_,9 @@ +@@ -80,7 +_,9 @@ public static CompletableFuture m_206861_(ResourceManager p_206862_, RegistryAccess.Frozen p_206863_, Commands.CommandSelection p_206864_, int p_206865_, Executor p_206866_, Executor p_206867_) { ReloadableServerResources reloadableserverresources = new ReloadableServerResources(p_206863_, p_206864_, p_206865_); -- return SimpleReloadInstance.m_203834_(p_206862_, reloadableserverresources.m_206890_(), p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().thenApply((p_206880_) -> { +- return SimpleReloadInstance.m_203834_(p_206862_, reloadableserverresources.m_206890_(), p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().whenComplete((p_214309_, p_214310_) -> { + List listeners = new java.util.ArrayList<>(reloadableserverresources.m_206890_()); + listeners.addAll(net.minecraftforge.event.ForgeEventFactory.onResourceReload(reloadableserverresources)); -+ return SimpleReloadInstance.m_203834_(p_206862_, listeners, p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().thenApply((p_206880_) -> { ++ return SimpleReloadInstance.m_203834_(p_206862_, listeners, p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().whenComplete((p_214309_, p_214310_) -> { + reloadableserverresources.f_214300_.m_227135_(CommandBuildContext.MissingTagAccessPolicy.FAIL); + }).thenApply((p_214306_) -> { return reloadableserverresources; - }); - } -@@ -86,6 +_,7 @@ - m_206870_(p_206869_, p_206884_); +@@ -92,6 +_,7 @@ + m_206870_(p_206869_, p_214315_); }); Blocks.m_50758_(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(p_206869_, false, false)); } private static void m_206870_(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { -@@ -96,5 +_,16 @@ - return p_206874_.getValue().m_6497_(); +@@ -102,5 +_,16 @@ + return List.copyOf(p_214312_.getValue()); })); p_206871_.m_175515_(resourcekey).m_203652_(map); + } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 71f5b32e71f..dc71a8cf3ed 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -89,6 +_,7 @@ +@@ -82,6 +_,7 @@ public boolean m_7038_() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { @@ -8,9 +8,9 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); String s1; -@@ -167,11 +_,13 @@ +@@ -159,11 +_,13 @@ long i = Util.m_137569_(); - SkullBlockEntity.m_196700_(this.m_129927_(), this.m_129925_(), this); + SkullBlockEntity.m_222885_(this.f_236721_, this); GameProfileCache.m_11004_(this.m_129797_()); + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; f_139598_.info("Preparing level \"{}\"", (Object)this.m_7123_()); @@ -22,7 +22,7 @@ if (dedicatedserverproperties.f_139744_ != null) { this.m_129900_().m_46170_(GameRules.f_46153_).m_46246_(dedicatedserverproperties.f_139744_, this); } -@@ -195,12 +_,13 @@ +@@ -187,12 +_,13 @@ } Items.f_41852_.m_6787_(CreativeModeTab.f_40754_, NonNullList.m_122779_()); @@ -37,15 +37,3 @@ } } -@@ -543,6 +_,11 @@ - - public boolean m_7779_(GameProfile p_139642_) { - return false; -+ } -+ -+ @Override //Forge: Enable formated text for colors in console. -+ public void m_6352_(net.minecraft.network.chat.Component message, java.util.UUID p_108776_) { -+ f_139598_.info(message.getString()); - } - - public int m_7186_(int p_139659_) { diff --git a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch index 1f03caf5c56..57f031ac915 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -476,6 +_,7 @@ +@@ -489,6 +_,7 @@ if (this.f_140131_.remove(p_140182_, p_140183_) && p_203002_ != null) { if (p_203002_ instanceof LevelChunk) { ((LevelChunk)p_203002_).m_62913_(false); @@ -8,7 +8,7 @@ } this.m_140258_(p_203002_); -@@ -658,8 +_,14 @@ +@@ -688,8 +_,14 @@ levelchunk.m_62952_(); if (this.f_140132_.add(chunkpos.m_45588_())) { levelchunk.m_62913_(true); @@ -23,7 +23,7 @@ } return levelchunk; -@@ -762,6 +_,7 @@ +@@ -792,6 +_,7 @@ this.f_140133_.m_46473_().m_6174_("chunkSave"); CompoundTag compoundtag = ChunkSerializer.m_63454_(this.f_140133_, p_140259_); @@ -31,7 +31,7 @@ this.m_63502_(chunkpos, compoundtag); this.m_140229_(chunkpos, chunkstatus.m_62494_()); return true; -@@ -818,6 +_,7 @@ +@@ -848,6 +_,7 @@ protected void m_183754_(ServerPlayer p_183755_, ChunkPos p_183756_, MutableObject p_183757_, boolean p_183758_, boolean p_183759_) { if (p_183755_.f_19853_ == this.f_140133_) { @@ -39,7 +39,7 @@ if (p_183759_ && !p_183758_) { ChunkHolder chunkholder = this.m_140327_(p_183756_.m_45588_()); if (chunkholder != null) { -@@ -1070,7 +_,7 @@ +@@ -1104,7 +_,7 @@ } protected void m_140199_(Entity p_140200_) { diff --git a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch index f46c0f1d6d0..16d0279b366 100644 --- a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -59,6 +_,8 @@ +@@ -58,6 +_,8 @@ private long f_140771_; private int f_183902_ = 10; @@ -9,7 +9,7 @@ protected DistanceManager(Executor p_140774_, Executor p_140775_) { ProcessorHandle processorhandle = ProcessorHandle.m_18714_("player ticket throttler", p_140775_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorhandle), p_140774_, 4); -@@ -164,6 +_,10 @@ +@@ -163,6 +_,10 @@ this.f_140762_.m_140715_(p_140785_, p_140786_.m_9433_(), true); } @@ -20,7 +20,7 @@ } void m_140818_(long p_140819_, Ticket p_140820_) { -@@ -176,6 +_,13 @@ +@@ -175,6 +_,13 @@ } this.f_140762_.m_140715_(p_140819_, m_140797_(sortedarrayset), false); @@ -34,7 +34,7 @@ } public void m_140792_(TicketType p_140793_, ChunkPos p_140794_, int p_140795_, T p_140796_) { -@@ -201,6 +_,14 @@ +@@ -200,6 +_,14 @@ this.f_183901_.m_184165_(i, ticket); } @@ -49,7 +49,7 @@ private SortedArraySet> m_140857_(long p_140858_) { return this.f_140761_.computeIfAbsent(p_140858_, (p_183923_) -> { return SortedArraySet.m_14246_(4); -@@ -286,6 +_,11 @@ +@@ -285,6 +_,11 @@ public String m_140837_() { return this.f_140766_.m_140558_(); diff --git a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch index 0132ede9112..6764352e720 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -160,6 +_,7 @@ +@@ -161,6 +_,7 @@ if (chunkholder == null) { return null; } else { @@ -8,7 +8,7 @@ Either either = chunkholder.m_140080_(ChunkStatus.f_62326_).getNow((Either)null); if (either == null) { return null; -@@ -348,7 +_,7 @@ +@@ -349,7 +_,7 @@ for(ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { LevelChunk levelchunk1 = serverchunkcache$chunkandholder.f_184028_; ChunkPos chunkpos = levelchunk1.m_7697_(); @@ -17,7 +17,7 @@ levelchunk1.m_187632_(j); if (flag2 && (this.f_8335_ || this.f_8336_) && this.f_8329_.m_6857_().m_61927_(chunkpos)) { NaturalSpawner.m_47029_(this.f_8329_, levelchunk1, naturalspawner$spawnstate, this.f_8336_, this.f_8335_, flag1); -@@ -426,6 +_,14 @@ +@@ -431,6 +_,14 @@ public void m_8438_(TicketType p_8439_, ChunkPos p_8440_, int p_8441_, T p_8442_) { this.f_8327_.m_140849_(p_8439_, p_8440_, p_8441_, p_8442_); diff --git a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch index 7dd03de1a63..a2ef6f4b6b7 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch @@ -1,43 +1,42 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -81,10 +_,9 @@ - if (this.f_8510_ instanceof ItemFrame && this.f_8521_ % 10 == 0) { - ItemFrame itemframe = (ItemFrame)this.f_8510_; - ItemStack itemstack = itemframe.m_31822_(); -- if (itemstack.m_41720_() instanceof MapItem) { -- Integer integer = MapItem.m_151131_(itemstack); -- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(integer, this.f_8509_); -- if (mapitemsaveddata != null) { +@@ -80,10 +_,9 @@ + if ($$11 instanceof ItemFrame itemframe) { + if (this.f_8521_ % 10 == 0) { + ItemStack itemstack = itemframe.m_31822_(); +- if (itemstack.m_41720_() instanceof MapItem) { +- Integer integer = MapItem.m_151131_(itemstack); +- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(integer, this.f_8509_); +- if (mapitemsaveddata != null) { + Integer integer = MapItem.m_151131_(itemstack); + MapItemSavedData mapitemsaveddata = MapItem.m_42853_(itemstack, this.f_8509_); + if (mapitemsaveddata != null) { - for(ServerPlayer serverplayer : this.f_8509_.m_6907_()) { - mapitemsaveddata.m_77918_(serverplayer, itemstack); - Packet packet = mapitemsaveddata.m_164796_(integer, serverplayer); -@@ -92,12 +_,13 @@ - serverplayer.f_8906_.m_141995_(packet); + for(ServerPlayer serverplayer : this.f_8509_.m_6907_()) { + mapitemsaveddata.m_77918_(serverplayer, itemstack); + Packet packet = mapitemsaveddata.m_164796_(integer, serverplayer); +@@ -92,11 +_,12 @@ + } } } - } - } - this.m_8543_(); + this.m_8543_(); + } } - + + + if (this.f_8521_ % this.f_8511_ == 0 || this.f_8510_.f_19812_ || this.f_8510_.m_20088_().m_135352_()) { if (this.f_8510_.m_20159_()) { - int i1 = Mth.m_14143_(this.f_8510_.m_146908_() * 256.0F / 360.0F); @@ -189,11 +_,13 @@ public void m_8534_(ServerPlayer p_8535_) { this.f_8510_.m_6452_(p_8535_); - p_8535_.f_8906_.m_141995_(new ClientboundRemoveEntitiesPacket(this.f_8510_.m_142049_())); + p_8535_.f_8906_.m_9829_(new ClientboundRemoveEntitiesPacket(this.f_8510_.m_19879_())); + net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.f_8510_, p_8535_); } public void m_8541_(ServerPlayer p_8542_) { - this.m_8536_(p_8542_.f_8906_::m_141995_); + this.m_8536_(p_8542_.f_8906_::m_9829_); this.f_8510_.m_6457_(p_8542_); + net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.f_8510_, p_8542_); } diff --git a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch index e6721bccee5..6e42b951739 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -181,10 +_,11 @@ +@@ -183,10 +_,11 @@ private final List f_8558_; @Nullable private final EndDragonFight f_8559_; - final Int2ObjectMap f_143247_ = new Int2ObjectOpenHashMap<>(); + final Int2ObjectMap> f_143247_ = new Int2ObjectOpenHashMap<>(); - private final StructureFeatureManager f_8560_; + private final StructureManager f_214997_; private final StructureCheck f_196556_; private final boolean f_8561_; + private net.minecraftforge.common.util.WorldCapabilityData capabilityData; - public ServerLevel(MinecraftServer p_203762_, Executor p_203763_, LevelStorageSource.LevelStorageAccess p_203764_, ServerLevelData p_203765_, ResourceKey p_203766_, Holder p_203767_, ChunkProgressListener p_203768_, ChunkGenerator p_203769_, boolean p_203770_, long p_203771_, List p_203772_, boolean p_203773_) { - super(p_203765_, p_203766_, p_203767_, p_203762_::m_129905_, false, p_203770_, p_203771_); -@@ -223,6 +_,7 @@ + public ServerLevel(MinecraftServer p_214999_, Executor p_215000_, LevelStorageSource.LevelStorageAccess p_215001_, ServerLevelData p_215002_, ResourceKey p_215003_, LevelStem p_215004_, ChunkProgressListener p_215005_, boolean p_215006_, long p_215007_, List p_215008_, boolean p_215009_) { + super(p_215002_, p_215003_, p_215004_.m_204521_(), p_214999_::m_129905_, false, p_215006_, p_215007_, p_214999_.m_213994_()); +@@ -226,6 +_,7 @@ } this.f_143245_ = new SleepStatus(); @@ -21,7 +21,7 @@ } public void m_8606_(int p_8607_, int p_8608_, boolean p_8609_, boolean p_8610_) { -@@ -251,8 +_,8 @@ +@@ -254,8 +_,8 @@ int i = this.m_46469_().m_46215_(GameRules.f_151486_); if (this.f_143245_.m_144002_(i) && this.f_143245_.m_144004_(i, this.f_8546_)) { if (this.m_46469_().m_46207_(GameRules.f_46140_)) { @@ -32,7 +32,7 @@ } this.m_8804_(); -@@ -281,7 +_,7 @@ +@@ -284,7 +_,7 @@ this.m_8807_(); this.f_8557_ = false; profilerfiller.m_7238_(); @@ -41,18 +41,18 @@ if (flag) { this.m_8886_(); } -@@ -313,7 +_,9 @@ +@@ -316,7 +_,9 @@ } profilerfiller.m_6180_("tick"); - this.m_46653_(this::m_8647_, p_184065_); -+ if (!p_184065_.m_146910_() && !(p_184065_ instanceof net.minecraftforge.entity.PartEntity)) { ++ if (!p_184065_.m_213877_() && !(p_184065_ instanceof net.minecraftforge.entity.PartEntity)) { + this.m_46653_(this::m_8647_, p_184065_); + } profilerfiller.m_7238_(); } } -@@ -402,6 +_,7 @@ +@@ -407,6 +_,7 @@ BlockPos blockpos2 = this.m_5452_(Heightmap.Types.MOTION_BLOCKING, this.m_46496_(i, 0, j, 15)); BlockPos blockpos3 = blockpos2.m_7495_(); Biome biome = this.m_204166_(blockpos2).m_203334_(); @@ -60,7 +60,7 @@ if (biome.m_47477_(this, blockpos3)) { this.m_46597_(blockpos3, Blocks.f_50126_.m_49966_()); } -@@ -592,15 +_,19 @@ +@@ -597,15 +_,19 @@ this.f_8548_.m_6846_().m_11270_(new ClientboundGameEventPacket(ClientboundGameEventPacket.f_132161_, this.f_46440_), this.m_46472_()); } @@ -84,19 +84,15 @@ } } -@@ -656,9 +_,10 @@ - ++p_8664_.f_19797_; - ProfilerFiller profilerfiller = this.m_46473_(); - profilerfiller.m_6521_(() -> { -- return Registry.f_122826_.m_7981_(p_8664_.m_6095_()).toString(); -+ return p_8664_.m_6095_().getRegistryName() == null ? p_8664_.m_6095_().toString() : p_8664_.m_6095_().getRegistryName().toString(); +@@ -664,6 +_,7 @@ + return Registry.f_122826_.m_7981_(p_8664_.m_6095_()).toString(); }); profilerfiller.m_6174_("tickPassenger"); + if (p_8664_.canUpdate()) p_8664_.m_6083_(); profilerfiller.m_7238_(); -@@ -695,6 +_,7 @@ +@@ -700,6 +_,7 @@ this.f_143244_.m_157554_(); } @@ -104,63 +100,15 @@ } } -@@ -767,7 +_,55 @@ - this.m_8853_(p_8846_); +@@ -773,6 +_,7 @@ } -+ /** @deprecated To be removed in 1.19. See {@link #removePlayerImmediately(ServerPlayer, Entity.RemovalReason)} as a possible replacement. */ -+ @Deprecated(forRemoval = true, since = "1.18.1") -+ public void removePlayer(ServerPlayer p_8850_, boolean keepData) { -+ p_8850_.m_146870_(); -+ this.removeEntity(p_8850_, keepData); -+ } -+ -+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */ -+ @Deprecated(forRemoval = true, since = "1.18.1") -+ public void removeEntityComplete(Entity p_8865_, boolean keepData) { -+ if(p_8865_.isMultipartEntity()) { -+ for(net.minecraftforge.entity.PartEntity parts : p_8865_.getParts()) { -+ parts.m_146870_(); -+ } -+ } -+ -+ this.m_7726_().m_8443_(p_8865_); -+ if (p_8865_ instanceof ServerPlayer) { -+ ServerPlayer serverplayerentity = (ServerPlayer)p_8865_; -+ this.f_8546_.remove(serverplayerentity); -+ } -+ -+ this.m_6188_().m_83420_(p_8865_); -+ if (p_8865_ instanceof Mob) { -+ this.f_143246_.remove(((Mob)p_8865_).m_21573_()); -+ } -+ -+ p_8865_.m_146870_(); -+ // onRemovedFromWorld and EntityLeaveWorldEvent are called by discard, so no need to do it ourselves here lest we double-call -+ } -+ -+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */ -+ @Deprecated(forRemoval = true, since = "1.18.1") -+ public void removeEntity(Entity entity) { -+ removeEntity(entity, false); -+ } -+ -+ /** @deprecated To be removed in 1.19. See {@link Entity#setRemoved(Entity.RemovalReason)} as a possible replacement. */ -+ @Deprecated(forRemoval = true, since = "1.18.1") -+ public void removeEntity(Entity p_8868_, boolean keepData) { -+ if (this.f_8557_) { -+ throw (IllegalStateException) net.minecraft.Util.m_137570_(new IllegalStateException("Removing entity while ticking!")); -+ } else { -+ removeEntityComplete(p_8868_, keepData); -+ } -+ } -+ private void m_8853_(ServerPlayer p_8854_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_8854_, this))) return; - Entity entity = this.m_142646_().m_142694_(p_8854_.m_142081_()); + Entity entity = this.m_142646_().m_142694_(p_8854_.m_20148_()); if (entity != null) { - f_8566_.warn("Force-added player with duplicate UUID {}", (Object)p_8854_.m_142081_().toString()); -@@ -775,7 +_,8 @@ + f_8566_.warn("Force-added player with duplicate UUID {}", (Object)p_8854_.m_20148_().toString()); +@@ -780,7 +_,8 @@ this.m_143261_((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); } @@ -170,7 +118,7 @@ } private boolean m_8872_(Entity p_8873_) { -@@ -783,7 +_,12 @@ +@@ -788,7 +_,12 @@ f_8566_.warn("Tried to add entity {} but it was marked as removed already", (Object)EntityType.m_20613_(p_8873_.m_6095_())); return false; } else { @@ -184,36 +132,54 @@ } } -@@ -820,10 +_,20 @@ +@@ -825,10 +_,22 @@ } - public void m_6263_(@Nullable Player p_8675_, double p_8676_, double p_8677_, double p_8678_, SoundEvent p_8679_, SoundSource p_8680_, float p_8681_, float p_8682_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_8675_, p_8679_, p_8680_, p_8681_, p_8682_); + public void m_214150_(@Nullable Player p_215017_, double p_215018_, double p_215019_, double p_215020_, SoundEvent p_215021_, SoundSource p_215022_, float p_215023_, float p_215024_, long p_215025_) { ++ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_215018_, p_215019_, p_215020_, p_215021_, p_215022_, p_215023_, p_215024_); + if (event.isCanceled() || event.getSound() == null) return; -+ p_8679_ = event.getSound(); -+ p_8680_ = event.getCategory(); -+ p_8681_ = event.getVolume(); - this.f_8548_.m_6846_().m_11241_(p_8675_, p_8676_, p_8677_, p_8678_, p_8681_ > 1.0F ? (double)(16.0F * p_8681_) : 16.0D, this.m_46472_(), new ClientboundSoundPacket(p_8679_, p_8680_, p_8676_, p_8677_, p_8678_, p_8681_, p_8682_)); ++ p_215021_ = event.getSound(); ++ p_215022_ = event.getSource(); ++ p_215023_ = event.getNewVolume(); ++ p_215024_ = event.getNewPitch(); + this.f_8548_.m_6846_().m_11241_(p_215017_, p_215018_, p_215019_, p_215020_, (double)p_215021_.m_215668_(p_215023_), this.m_46472_(), new ClientboundSoundPacket(p_215021_, p_215022_, p_215018_, p_215019_, p_215020_, p_215023_, p_215024_, p_215025_)); } - public void m_6269_(@Nullable Player p_8689_, Entity p_8690_, SoundEvent p_8691_, SoundSource p_8692_, float p_8693_, float p_8694_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_8689_, p_8691_, p_8692_, p_8693_, p_8694_); + public void m_213890_(@Nullable Player p_215027_, Entity p_215028_, SoundEvent p_215029_, SoundSource p_215030_, float p_215031_, float p_215032_, long p_215033_) { ++ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_215028_, p_215029_, p_215030_, p_215031_, p_215032_); + if (event.isCanceled() || event.getSound() == null) return; -+ p_8691_ = event.getSound(); -+ p_8692_ = event.getCategory(); -+ p_8693_ = event.getVolume(); - this.f_8548_.m_6846_().m_11241_(p_8689_, p_8690_.m_20185_(), p_8690_.m_20186_(), p_8690_.m_20189_(), p_8693_ > 1.0F ? (double)(16.0F * p_8693_) : 16.0D, this.m_46472_(), new ClientboundSoundEntityPacket(p_8691_, p_8692_, p_8690_, p_8693_, p_8694_)); ++ p_215029_ = event.getSound(); ++ p_215030_ = event.getSource(); ++ p_215031_ = event.getNewVolume(); ++ p_215032_ = event.getNewPitch(); + this.f_8548_.m_6846_().m_11241_(p_215027_, p_215028_.m_20185_(), p_215028_.m_20186_(), p_215028_.m_20189_(), (double)p_215029_.m_215668_(p_215031_), this.m_46472_(), new ClientboundSoundEntityPacket(p_215029_, p_215030_, p_215028_, p_215031_, p_215032_, p_215033_)); } -@@ -840,6 +_,7 @@ +@@ -845,6 +_,7 @@ } - public void m_142346_(@Nullable Entity p_143268_, GameEvent p_143269_, BlockPos p_143270_) { -+ if (net.minecraftforge.common.ForgeHooks.onVanillaGameEvent(this, p_143268_, p_143269_, p_143270_)) - this.m_151513_(p_143268_, p_143269_, p_143270_, p_143269_.m_157827_()); + public void m_214171_(GameEvent p_215041_, Vec3 p_215042_, GameEvent.Context p_215043_) { ++ if (!net.minecraftforge.common.ForgeHooks.onVanillaGameEvent(this, p_215041_, p_215042_, p_215043_)) return; + int i = p_215041_.m_157827_(); + BlockPos blockpos = new BlockPos(p_215042_); + int j = SectionPos.m_123171_(blockpos.m_123341_() - i); +@@ -930,10 +_,15 @@ } -@@ -885,6 +_,7 @@ + public void m_46672_(BlockPos p_215045_, Block p_215046_) { ++ net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_215045_, this.m_8055_(p_215045_), java.util.EnumSet.allOf(Direction.class), false).isCanceled(); + this.f_220350_.m_214152_(p_215045_, p_215046_, (Direction)null); + } + + public void m_46590_(BlockPos p_215052_, Block p_215053_, Direction p_215054_) { ++ java.util.EnumSet directions = java.util.EnumSet.allOf(Direction.class); ++ directions.remove(p_215054_); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_215052_, this.m_8055_(p_215052_), directions, false).isCanceled()) ++ return; + this.f_220350_.m_214152_(p_215052_, p_215053_, p_215054_); + } + +@@ -955,6 +_,7 @@ public Explosion m_7703_(@Nullable Entity p_8653_, @Nullable DamageSource p_8654_, @Nullable ExplosionDamageCalculator p_8655_, double p_8656_, double p_8657_, double p_8658_, float p_8659_, boolean p_8660_, Explosion.BlockInteraction p_8661_) { Explosion explosion = new Explosion(this, p_8653_, p_8654_, p_8655_, p_8656_, p_8657_, p_8658_, p_8659_, p_8660_, p_8661_); @@ -221,7 +187,7 @@ explosion.m_46061_(); explosion.m_46075_(false); if (p_8661_ == Explosion.BlockInteraction.NONE) { -@@ -1412,6 +_,12 @@ +@@ -1461,6 +_,12 @@ }); } @@ -234,38 +200,36 @@ public LevelEntityGetter m_142646_() { return this.f_143244_.m_157567_(); } -@@ -1497,10 +_,8 @@ +@@ -1544,8 +_,8 @@ ServerLevel.this.f_143246_.add(mob); } -- if (p_143371_ instanceof EnderDragon) { -- EnderDragon enderdragon = (EnderDragon)p_143371_; -- +- if (p_143371_ instanceof EnderDragon enderdragon) { - for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) { + if (p_143371_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity enderdragonpart : p_143371_.getParts()) { - ServerLevel.this.f_143247_.put(enderdragonpart.m_142049_(), enderdragonpart); + ServerLevel.this.f_143247_.put(enderdragonpart.m_19879_(), enderdragonpart); } } -@@ -1525,10 +_,8 @@ +@@ -1569,17 +_,23 @@ ServerLevel.this.f_143246_.remove(mob); } -- if (p_143375_ instanceof EnderDragon) { -- EnderDragon enderdragon = (EnderDragon)p_143375_; -- +- if (p_143375_ instanceof EnderDragon enderdragon) { - for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) { + if (p_143375_.isMultipartEntity()) { + for(net.minecraftforge.entity.PartEntity enderdragonpart : p_143375_.getParts()) { - ServerLevel.this.f_143247_.remove(enderdragonpart.m_142049_()); + ServerLevel.this.f_143247_.remove(enderdragonpart.m_19879_()); } } -@@ -1538,6 +_,13 @@ - gameeventlistenerregistrar.m_157854_(p_143375_.f_19853_); - } -+ p_143375_.onRemovedFromWorld(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_143375_, ServerLevel.this)); +- p_143375_.m_213651_(DynamicGameEventListener::m_223634_); ++ p_143375_.m_213651_(DynamicGameEventListener::m_223641_); + } + ++ @Override + public void m_214006_(Entity p_215086_) { + p_215086_.m_213651_(DynamicGameEventListener::m_223641_); } + } + diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch index 2172f947a7d..f3c320bbd75 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -541,6 +_,7 @@ - } +@@ -549,6 +_,7 @@ public void m_6667_(DamageSource p_9035_) { + this.m_146850_(GameEvent.f_223707_); + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_9035_)) return; boolean flag = this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_); if (flag) { Component component = this.m_21231_().m_19293_(); -@@ -685,11 +_,12 @@ +@@ -694,11 +_,12 @@ } @Nullable @@ -16,14 +16,14 @@ + public Entity changeDimension(ServerLevel p_9180_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_9180_.m_46472_())) return null; this.f_8927_ = true; - ServerLevel serverlevel = this.m_183503_(); + ServerLevel serverlevel = this.m_9236_(); ResourceKey resourcekey = serverlevel.m_46472_(); - if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_) { + if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_ && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits this.m_19877_(); - this.m_183503_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); + this.m_9236_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.f_8944_) { -@@ -706,13 +_,14 @@ +@@ -715,13 +_,14 @@ PlayerList playerlist = this.f_8924_.m_6846_(); playerlist.m_11289_(this); serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); @@ -41,22 +41,22 @@ this.m_9006_(p_9180_, new BlockPos(portalinfo.f_77676_)); } -@@ -724,6 +_,9 @@ +@@ -733,6 +_,9 @@ this.m_6027_(portalinfo.f_77676_.f_82479_, portalinfo.f_77676_.f_82480_, portalinfo.f_77676_.f_82481_); serverlevel.m_46473_().m_7238_(); this.m_9209_(serverlevel); + return this;//forge: this is part of the ITeleporter patch + });//Forge: End vanilla logic + if (e != this) throw new java.lang.IllegalArgumentException(String.format(java.util.Locale.ENGLISH, "Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this)); - this.f_8906_.m_141995_(new ClientboundPlayerAbilitiesPacket(this.m_150110_())); + this.f_8906_.m_9829_(new ClientboundPlayerAbilitiesPacket(this.m_150110_())); playerlist.m_11229_(this, p_9180_); playerlist.m_11292_(this); -@@ -732,10 +_,12 @@ - this.f_8906_.m_141995_(new ClientboundUpdateMobEffectPacket(this.m_142049_(), mobeffectinstance)); +@@ -741,10 +_,12 @@ + this.f_8906_.m_9829_(new ClientboundUpdateMobEffectPacket(this.m_19879_(), mobeffectinstance)); } + if (teleporter.playTeleportSound(this, serverlevel, p_9180_)) - this.f_8906_.m_141995_(new ClientboundLevelEventPacket(1032, BlockPos.f_121853_, 0, false)); + this.f_8906_.m_9829_(new ClientboundLevelEventPacket(1032, BlockPos.f_121853_, 0, false)); this.f_8920_ = -1; this.f_8917_ = -1.0F; this.f_8918_ = -1; @@ -64,7 +64,7 @@ } return this; -@@ -799,6 +_,9 @@ +@@ -808,6 +_,9 @@ } public Either m_7720_(BlockPos p_9115_) { @@ -73,8 +73,8 @@ + if (ret != null) return Either.left(ret); Direction direction = this.f_19853_.m_8055_(p_9115_).m_61143_(HorizontalDirectionalBlock.f_54117_); if (!this.m_5803_() && this.m_6084_()) { - if (!this.f_19853_.m_6042_().m_63956_()) { -@@ -809,7 +_,7 @@ + if (!this.f_19853_.m_6042_().f_63858_()) { +@@ -818,7 +_,7 @@ return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { this.m_9158_(this.f_19853_.m_46472_(), p_9115_, this.m_146908_(), false, true); @@ -83,31 +83,31 @@ return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { if (!this.m_7500_()) { -@@ -847,6 +_,7 @@ +@@ -856,6 +_,7 @@ } private boolean m_9116_(BlockPos p_9117_, Direction p_9118_) { + if (p_9118_ == null) return false; - return this.m_9222_(p_9117_) || this.m_9222_(p_9117_.m_142300_(p_9118_.m_122424_())); + return this.m_9222_(p_9117_) || this.m_9222_(p_9117_.m_121945_(p_9118_.m_122424_())); } -@@ -955,6 +_,7 @@ - this.f_8906_.m_141995_(new ClientboundOpenScreenPacket(abstractcontainermenu.f_38840_, abstractcontainermenu.m_6772_(), p_9033_.m_5446_())); +@@ -964,6 +_,7 @@ + this.f_8906_.m_9829_(new ClientboundOpenScreenPacket(abstractcontainermenu.f_38840_, abstractcontainermenu.m_6772_(), p_9033_.m_5446_())); this.m_143399_(abstractcontainermenu); this.f_36096_ = abstractcontainermenu; + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.f_36096_)); return OptionalInt.of(this.f_8940_); } } -@@ -973,6 +_,7 @@ - this.f_8906_.m_141995_(new ClientboundHorseScreenOpenPacket(this.f_8940_, p_9060_.m_6643_(), p_9059_.m_142049_())); +@@ -982,6 +_,7 @@ + this.f_8906_.m_9829_(new ClientboundHorseScreenOpenPacket(this.f_8940_, p_9060_.m_6643_(), p_9059_.m_19879_())); this.f_36096_ = new HorseInventoryMenu(this.f_8940_, this.m_150109_(), p_9060_, p_9059_); this.m_143399_(this.f_36096_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.f_36096_)); } public void m_6986_(ItemStack p_9082_, InteractionHand p_9083_) { -@@ -998,6 +_,7 @@ +@@ -1007,6 +_,7 @@ public void m_9230_() { this.f_36096_.m_6877_(this); this.f_36095_.m_150414_(this.f_36096_); @@ -115,10 +115,10 @@ this.f_36096_ = this.f_36095_; } -@@ -1123,6 +_,13 @@ - this.f_8933_ = p_9016_.f_8933_; +@@ -1133,6 +_,13 @@ this.m_36362_(p_9016_.m_36331_()); this.m_36364_(p_9016_.m_36332_()); + this.m_219749_(p_9016_.m_219759_()); + + //Copy over a section of the Entity Data from the old player. + //Allows mods to specify data that persists after players respawn. @@ -129,7 +129,7 @@ } protected void m_142540_(MobEffectInstance p_143393_, @Nullable Entity p_143394_) { -@@ -1181,6 +_,8 @@ +@@ -1191,6 +_,8 @@ } public boolean m_143403_(GameType p_143404_) { @@ -138,7 +138,7 @@ if (!this.f_8941_.m_143473_(p_143404_)) { return false; } else { -@@ -1237,6 +_,7 @@ +@@ -1266,6 +_,7 @@ this.f_184127_ = p_9157_.f_195812_(); this.m_20088_().m_135381_(f_36089_, (byte)p_9157_.f_133867_()); this.m_20088_().m_135381_(f_36090_, (byte)(p_9157_.f_133868_() == HumanoidArm.LEFT ? 0 : 1)); @@ -146,15 +146,15 @@ } public boolean m_143432_() { -@@ -1296,6 +_,7 @@ +@@ -1329,6 +_,7 @@ public void m_9213_(@Nullable Entity p_9214_) { Entity entity = this.m_8954_(); this.f_8926_ = (Entity)(p_9214_ == null ? this : p_9214_); + while (this.f_8926_ instanceof net.minecraftforge.entity.PartEntity partEntity) this.f_8926_ = partEntity.getParent(); // FORGE: fix MC-46486 if (entity != this.f_8926_) { - this.f_8906_.m_141995_(new ClientboundSetCameraPacket(this.f_8926_)); + this.f_8906_.m_9829_(new ClientboundSetCameraPacket(this.f_8926_)); this.m_6021_(this.f_8926_.m_20185_(), this.f_8926_.m_20186_(), this.f_8926_.m_20189_()); -@@ -1325,7 +_,11 @@ +@@ -1358,7 +_,11 @@ @Nullable public Component m_8957_() { @@ -167,16 +167,16 @@ } public void m_6674_(InteractionHand p_9031_) { -@@ -1350,21 +_,23 @@ +@@ -1383,21 +_,23 @@ this.m_8127_(); if (p_9000_ == this.f_19853_) { this.f_8906_.m_9774_(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); - } else { + } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_9000_.m_46472_())) { - ServerLevel serverlevel = this.m_183503_(); + ServerLevel serverlevel = this.m_9236_(); LevelData leveldata = p_9000_.m_6106_(); - this.f_8906_.m_141995_(new ClientboundRespawnPacket(p_9000_.m_204156_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), true)); - this.f_8906_.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); + this.f_8906_.m_9829_(new ClientboundRespawnPacket(p_9000_.m_220362_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), true, this.m_219759_())); + this.f_8906_.m_9829_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); this.f_8924_.m_6846_().m_11289_(this); serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); - this.m_146912_(); @@ -193,7 +193,7 @@ } } -@@ -1387,6 +_,7 @@ +@@ -1420,6 +_,7 @@ } public void m_9158_(ResourceKey p_9159_, @Nullable BlockPos p_9160_, float p_9161_, boolean p_9162_, boolean p_9163_) { @@ -201,7 +201,7 @@ if (p_9160_ != null) { boolean flag = p_9160_.equals(this.f_8936_) && p_9159_.equals(this.f_8935_); if (p_9163_ && !flag) { -@@ -1438,6 +_,8 @@ +@@ -1471,6 +_,8 @@ if (itementity == null) { return null; } else { @@ -210,7 +210,7 @@ this.f_19853_.m_7967_(itementity); ItemStack itemstack = itementity.m_32055_(); if (p_9087_) { -@@ -1452,6 +_,29 @@ +@@ -1485,6 +_,29 @@ } } @@ -240,7 +240,7 @@ public TextFilter m_8967_() { return this.f_8939_; } -@@ -1511,11 +_,13 @@ +@@ -1544,11 +_,13 @@ public boolean m_182294_(boolean p_182295_) { Inventory inventory = this.m_150109_(); diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch index ca1e22f7850..365ed45cdf1 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -1,29 +1,25 @@ --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -125,7 +_,13 @@ - double d1 = this.f_9245_.m_20186_() - ((double)p_9282_.m_123342_() + 0.5D) + 1.5D; - double d2 = this.f_9245_.m_20189_() - ((double)p_9282_.m_123343_() + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; -- if (d3 > 36.0D) { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(f_9245_, p_9282_, p_9284_); -+ if (event.isCanceled() || (!this.m_9295_() && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data -+ f_9245_.f_8906_.m_141995_(new ClientboundBlockBreakAckPacket(p_9282_, f_9244_.m_8055_(p_9282_), p_9283_, false, "mod canceled")); -+ f_9244_.m_7260_(p_9282_, f_9244_.m_8055_(p_9282_), f_9244_.m_8055_(p_9282_), 3); +@@ -124,6 +_,10 @@ + } + + public void m_214168_(BlockPos p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(f_9245_, p_215120_, p_215122_); ++ if (event.isCanceled() || (!this.m_9295_() && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { + return; + } -+ if (!this.f_9245_.canInteractWith(p_9282_, 1)) { - BlockState blockstate1; - if (this.f_9245_.f_19853_.m_142572_() != null && this.f_9245_.m_146902_().m_45594_(new ChunkPos(p_9282_)) < this.f_9245_.f_19853_.m_142572_().m_6846_().m_11312_()) { - blockstate1 = this.f_9244_.m_8055_(p_9282_); -@@ -157,6 +_,7 @@ + if (this.f_9245_.m_146892_().m_82557_(Vec3.m_82512_(p_215120_)) > ServerGamePacketListenerImpl.f_215198_) { + this.m_215125_(p_215120_, false, p_215124_, "too far"); + } else if (p_215120_.m_123342_() >= p_215123_) { +@@ -152,6 +_,7 @@ float f = 1.0F; - BlockState blockstate = this.f_9244_.m_8055_(p_9282_); + BlockState blockstate = this.f_9244_.m_8055_(p_215120_); if (!blockstate.m_60795_()) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - blockstate.m_60686_(this.f_9244_, p_9282_, this.f_9245_); - f = blockstate.m_60625_(this.f_9245_, this.f_9245_.f_19853_, p_9282_); + blockstate.m_60686_(this.f_9244_, p_215120_, this.f_9245_); + f = blockstate.m_60625_(this.f_9245_, this.f_9245_.f_19853_, p_215120_); } -@@ -224,7 +_,8 @@ +@@ -221,7 +_,8 @@ public boolean m_9280_(BlockPos p_9281_) { BlockState blockstate = this.f_9244_.m_8055_(p_9281_); @@ -33,7 +29,7 @@ return false; } else { BlockEntity blockentity = this.f_9244_.m_7702_(p_9281_); -@@ -232,30 +_,42 @@ +@@ -229,30 +_,42 @@ if (block instanceof GameMasterBlock && !this.f_9245_.m_36337_()) { this.f_9244_.m_7260_(p_9281_, blockstate, blockstate, 3); return false; @@ -83,7 +79,7 @@ } public InteractionResult m_6261_(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) { -@@ -264,6 +_,8 @@ +@@ -261,6 +_,8 @@ } else if (p_9262_.m_36335_().m_41519_(p_9264_.m_41720_())) { return InteractionResult.PASS; } else { @@ -118,7 +114,7 @@ + if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { InteractionResult interactionresult = blockstate.m_60664_(p_9267_, p_9266_, p_9269_, p_9270_); if (interactionresult.m_19077_()) { - CriteriaTriggers.f_10562_.m_45482_(p_9266_, blockpos, itemstack); + CriteriaTriggers.f_10562_.m_220040_(p_9266_, blockpos, itemstack); @@ -317,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch index 354010850eb..8ae77d96504 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerConnectionListener.java +++ b/net/minecraft/server/network/ServerConnectionListener.java -@@ -50,11 +_,12 @@ +@@ -49,11 +_,12 @@ public class ServerConnectionListener { private static final Logger f_9701_ = LogUtils.getLogger(); @@ -15,7 +15,7 @@ }); final MinecraftServer f_9702_; public volatile boolean f_9700_; -@@ -67,6 +_,7 @@ +@@ -66,6 +_,7 @@ } public void m_9711_(@Nullable InetAddress p_9712_, int p_9713_) throws IOException { @@ -23,7 +23,7 @@ synchronized(this.f_9703_) { Class oclass; LazyLoadedValue lazyloadedvalue; -@@ -87,7 +_,7 @@ +@@ -86,7 +_,7 @@ } catch (ChannelException channelexception) { } diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index a5b92b1e031..f5ec8bdcc75 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -386,9 +_,11 @@ +@@ -413,9 +_,11 @@ } entity.m_19890_(d3, d4, d5, f, f1); + this.f_9743_.m_19890_(d3, d4, d5, this.f_9743_.m_146908_(), this.f_9743_.m_146909_()); // Forge - Resync player position on vehicle moving - boolean flag3 = serverlevel.m_45756_(entity, entity.m_142469_().m_82406_(0.0625D)); + boolean flag3 = serverlevel.m_45756_(entity, entity.m_20191_().m_82406_(0.0625D)); if (flag && (flag2 || !flag3)) { entity.m_19890_(d0, d1, d2, f, f1); + this.f_9743_.m_19890_(d3, d4, d5, this.f_9743_.m_146908_(), this.f_9743_.m_146909_()); // Forge - Resync player position on vehicle moving this.f_9742_.m_129512_(new ClientboundMoveVehiclePacket(entity)); return; } -@@ -405,7 +_,7 @@ +@@ -432,7 +_,7 @@ } private boolean m_9793_(Entity p_9794_) { -- return p_9794_.f_19853_.m_45556_(p_9794_.m_142469_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(BlockBehaviour.BlockStateBase::m_60795_); -+ return BlockPos.m_121921_(p_9794_.m_142469_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(b -> p_9794_.f_19853_.m_8055_(b).m_60795_()); +- return p_9794_.f_19853_.m_45556_(p_9794_.m_20191_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(BlockBehaviour.BlockStateBase::m_60795_); ++ return BlockPos.m_121921_(p_9794_.m_20191_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(b -> p_9794_.f_19853_.m_8055_(b).m_60795_()); } public void m_7376_(ServerboundAcceptTeleportationPacket p_9835_) { -@@ -979,7 +_,7 @@ +@@ -1012,7 +_,7 @@ this.f_9743_.m_9243_(); int i = this.f_9743_.f_19853_.m_151558_(); if (blockpos.m_123342_() < i) { @@ -29,35 +29,12 @@ + if (this.f_9766_ == null && this.f_9743_.canInteractWith(blockpos, 3) && serverlevel.m_7966_(this.f_9743_, blockpos)) { InteractionResult interactionresult = this.f_9743_.f_8941_.m_7179_(this.f_9743_, serverlevel, itemstack, interactionhand, blockhitresult); if (direction == Direction.UP && !interactionresult.m_19077_() && blockpos.m_123342_() >= i - 1 && m_9790_(this.f_9743_, itemstack)) { - Component component = (new TranslatableComponent("build.tooHigh", i - 1)).m_130940_(ChatFormatting.RED); -@@ -1099,7 +_,7 @@ - } - - public void m_7388_(ServerboundChatPacket p_9841_) { -- String s = StringUtils.normalizeSpace(p_9841_.m_133837_()); -+ String s = org.apache.commons.lang3.StringUtils.normalizeSpace(p_9841_.m_133837_()); - - for(int i = 0; i < s.length(); ++i) { - if (!SharedConstants.m_136188_(s.charAt(i))) { -@@ -1129,8 +_,11 @@ - String s1 = p_143629_.m_143722_(); - Component component = s1.isEmpty() ? null : new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s1); - Component component1 = new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s); -+ component1 = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, component1); -+ Component finalComponent = component1; -+ if (finalComponent != null) - this.f_9745_.m_6846_().m_143991_(component1, (p_184197_) -> { -- return this.f_9743_.m_143421_(p_184197_) ? component : component1; -+ return this.f_9743_.m_143421_(p_184197_) ? component : finalComponent; - }, ChatType.CHAT, this.f_9743_.m_142081_()); - } - -@@ -1216,12 +_,13 @@ + Component component = Component.m_237110_("build.tooHigh", i - 1).m_130940_(ChatFormatting.RED); +@@ -1383,11 +_,13 @@ return; } -- double d0 = 36.0D; -- if (this.f_9743_.m_20280_(entity) < 36.0D) { +- if (entity.m_20238_(this.f_9743_.m_146892_()) < f_215198_) { + if (true) { //Forge: Perform distance checks below since interactions and attacks differ. p_9866_.m_179617_(new ServerboundInteractPacket.Handler() { private void m_143678_(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) { @@ -68,20 +45,20 @@ if (interactionresult.m_19077_()) { CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity); if (interactionresult.m_19080_()) { -@@ -1243,7 +_,7 @@ +@@ -1409,7 +_,7 @@ public void m_141994_() { if (!(entity instanceof ItemEntity) && !(entity instanceof ExperienceOrb) && !(entity instanceof AbstractArrow) && entity != ServerGamePacketListenerImpl.this.f_9743_) { - ServerGamePacketListenerImpl.this.f_9743_.m_5706_(entity); + if(ServerGamePacketListenerImpl.this.f_9743_.canHit(entity, 3)) ServerGamePacketListenerImpl.this.f_9743_.m_5706_(entity); //Forge: Perform attack range check. Original check was dist < 6, range is 3, so vanilla used padding=3 } else { - ServerGamePacketListenerImpl.this.m_9942_(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked")); + ServerGamePacketListenerImpl.this.m_9942_(Component.m_237115_("multiplayer.disconnect.invalid_entity_attacked")); ServerGamePacketListenerImpl.f_9744_.warn("Player {} tried to attack an invalid entity", (Object)ServerGamePacketListenerImpl.this.f_9743_.m_7755_().getString()); -@@ -1430,6 +_,8 @@ +@@ -1596,6 +_,8 @@ } public void m_7423_(ServerboundCustomPayloadPacket p_9860_) { -+ PacketUtils.m_131359_(p_9860_, this, this.f_9743_.m_183503_()); ++ PacketUtils.m_131359_(p_9860_, this, this.f_9743_.m_9236_()); + net.minecraftforge.network.NetworkHooks.onCustomPayload(p_9860_, this.f_9742_); } diff --git a/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch index 50c6b52a933..3a64fec7877 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -22,6 +_,7 @@ +@@ -20,6 +_,7 @@ } public void m_7322_(ClientIntentionPacket p_9975_) { + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerLogin(p_9975_, this.f_9966_)) return; - switch(p_9975_.m_134735_()) { - case LOGIN: - this.f_9966_.m_129498_(ConnectionProtocol.LOGIN); + switch (p_9975_.m_134735_()) { + case LOGIN: + this.f_9966_.m_129498_(ConnectionProtocol.LOGIN); diff --git a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch index e075a6541cb..aed18079cff 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -59,7 +_,13 @@ +@@ -68,7 +_,13 @@ } public void m_10050_() { @@ -15,16 +15,24 @@ this.m_10055_(); } else if (this.f_10019_ == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { ServerPlayer serverplayer = this.f_10018_.m_6846_().m_11259_(this.f_10021_.getId()); -@@ -148,7 +_,7 @@ - this.f_10019_ = ServerLoginPacketListenerImpl.State.KEY; - this.f_10013_.m_129512_(new ClientboundHelloPacket("", this.f_10018_.m_129790_().getPublic().getEncoded(), this.f_10017_)); - } else { +@@ -192,14 +_,14 @@ + GameProfile gameprofile = this.f_10018_.m_236731_(); + if (gameprofile != null && p_10047_.f_238040_().equalsIgnoreCase(gameprofile.getName())) { + this.f_10021_ = gameprofile; - this.f_10019_ = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -+ this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; - } ++ this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; // FORGE: continue NEGOTIATING, we move to READY_TO_ACCEPT after Forge is ready + } else { + this.f_10021_ = new GameProfile((UUID)null, p_10047_.f_238040_()); + if (this.f_10018_.m_129797_() && !this.f_10013_.m_129531_()) { + this.f_10019_ = ServerLoginPacketListenerImpl.State.KEY; + this.f_10013_.m_129512_(new ClientboundHelloPacket("", this.f_10018_.m_129790_().getPublic().getEncoded(), this.f_10017_)); + } else { +- this.f_10019_ = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; ++ this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; // FORGE: continue NEGOTIATING, we move to READY_TO_ACCEPT after Forge is ready + } - } -@@ -179,7 +_,7 @@ + } +@@ -235,7 +_,7 @@ throw new IllegalStateException("Protocol error", cryptexception); } @@ -33,34 +41,34 @@ public void run() { GameProfile gameprofile = ServerLoginPacketListenerImpl.this.f_10021_; -@@ -187,11 +_,11 @@ +@@ -243,11 +_,11 @@ ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.f_10018_.m_129925_().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.m_10064_()); if (ServerLoginPacketListenerImpl.this.f_10021_ != null) { ServerLoginPacketListenerImpl.f_10015_.info("UUID of player {} is {}", ServerLoginPacketListenerImpl.this.f_10021_.getName(), ServerLoginPacketListenerImpl.this.f_10021_.getId()); - ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -+ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; ++ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; // FORGE: continue NEGOTIATING, we move to READY_TO_ACCEPT after Forge is ready } else if (ServerLoginPacketListenerImpl.this.f_10018_.m_129792_()) { ServerLoginPacketListenerImpl.f_10015_.warn("Failed to verify username but will let them in anyway!"); ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.m_10038_(gameprofile); - ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -+ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; ++ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; // FORGE: continue NEGOTIATING, we move to READY_TO_ACCEPT after Forge is ready } else { - ServerLoginPacketListenerImpl.this.m_10053_(new TranslatableComponent("multiplayer.disconnect.unverified_username")); + ServerLoginPacketListenerImpl.this.m_10053_(Component.m_237115_("multiplayer.disconnect.unverified_username")); ServerLoginPacketListenerImpl.f_10015_.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); -@@ -200,7 +_,7 @@ +@@ -256,7 +_,7 @@ if (ServerLoginPacketListenerImpl.this.f_10018_.m_129792_()) { ServerLoginPacketListenerImpl.f_10015_.warn("Authentication servers are down but will let them in anyway!"); ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.m_10038_(gameprofile); - ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -+ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; ++ ServerLoginPacketListenerImpl.this.f_10019_ = ServerLoginPacketListenerImpl.State.NEGOTIATING; // FORGE: continue NEGOTIATING, we move to READY_TO_ACCEPT after Forge is ready } else { - ServerLoginPacketListenerImpl.this.m_10053_(new TranslatableComponent("multiplayer.disconnect.authservers_down")); + ServerLoginPacketListenerImpl.this.m_10053_(Component.m_237115_("multiplayer.disconnect.authservers_down")); ServerLoginPacketListenerImpl.f_10015_.error("Couldn't verify username because servers are unavailable"); -@@ -220,6 +_,7 @@ +@@ -276,6 +_,7 @@ } public void m_7223_(ServerboundCustomQueryPacket p_10045_) { + if (!net.minecraftforge.network.NetworkHooks.onCustomPayload(p_10045_, this.f_10013_)) - this.m_10053_(new TranslatableComponent("multiplayer.disconnect.unexpected_query_response")); + this.m_10053_(Component.m_237115_("multiplayer.disconnect.unexpected_query_response")); } diff --git a/patches/minecraft/net/minecraft/server/packs/VanillaPackResources.java.patch b/patches/minecraft/net/minecraft/server/packs/VanillaPackResources.java.patch index 97758a31c11..df8e08b103d 100644 --- a/patches/minecraft/net/minecraft/server/packs/VanillaPackResources.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/VanillaPackResources.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/VanillaPackResources.java +++ b/net/minecraft/server/packs/VanillaPackResources.java -@@ -203,7 +_,7 @@ +@@ -209,7 +_,7 @@ try { URL url = VanillaPackResources.class.getResource(s); @@ -9,7 +9,7 @@ } catch (IOException ioexception) { return VanillaPackResources.class.getResourceAsStream(s); } -@@ -219,7 +_,7 @@ +@@ -225,7 +_,7 @@ @Nullable protected InputStream m_5539_(String p_10334_) { @@ -18,7 +18,7 @@ } public boolean m_7211_(PackType p_10355_, ResourceLocation p_10356_) { -@@ -292,6 +_,20 @@ +@@ -298,6 +_,20 @@ } public void close() { @@ -38,4 +38,4 @@ + } } - public Resource m_142591_(final ResourceLocation p_143764_) throws IOException { + public ResourceProvider m_215363_() { diff --git a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch index 557098e2efb..e353c41815e 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/Pack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/Pack.java +++ b/net/minecraft/server/packs/repository/Pack.java -@@ -27,6 +_,7 @@ +@@ -26,6 +_,7 @@ private final Pack.Position f_10406_; private final boolean f_10407_; private final boolean f_10408_; @@ -8,16 +8,16 @@ private final PackSource f_10409_; @Nullable -@@ -39,7 +_,7 @@ +@@ -38,7 +_,7 @@ try { PackMetadataSection packmetadatasection = packresources.m_5550_(PackMetadataSection.f_10366_); if (packmetadatasection != null) { -- pack = p_10434_.m_143873_(p_10431_, new TextComponent(packresources.m_8017_()), p_10432_, p_10433_, packmetadatasection, p_10435_, p_10436_); -+ pack = p_10434_.create(p_10431_, new TextComponent(packresources.m_8017_()), p_10432_, p_10433_, packmetadatasection, p_10435_, p_10436_, packresources.isHidden()); +- pack = p_10434_.m_143873_(p_10431_, Component.m_237113_(packresources.m_8017_()), p_10432_, p_10433_, packmetadatasection, p_10435_, p_10436_); ++ pack = p_10434_.create(p_10431_, Component.m_237113_(packresources.m_8017_()), p_10432_, p_10433_, packmetadatasection, p_10435_, p_10436_, packresources.isHidden()); break label54; } -@@ -74,7 +_,12 @@ +@@ -73,7 +_,12 @@ } } @@ -30,7 +30,7 @@ this.f_10401_ = p_10420_; this.f_10402_ = p_10422_; this.f_10403_ = p_10423_; -@@ -84,10 +_,16 @@ +@@ -83,10 +_,16 @@ this.f_10406_ = p_10426_; this.f_10408_ = p_10427_; this.f_10409_ = p_10428_; @@ -48,7 +48,7 @@ } public Component m_10429_() { -@@ -132,6 +_,8 @@ +@@ -131,6 +_,8 @@ return this.f_10409_; } @@ -57,7 +57,7 @@ public boolean equals(Object p_10448_) { if (this == p_10448_) { return true; -@@ -152,8 +_,15 @@ +@@ -148,8 +_,15 @@ @FunctionalInterface public interface PackConstructor { diff --git a/patches/minecraft/net/minecraft/server/packs/repository/PackCompatibility.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/PackCompatibility.java.patch index cbb3caf97ea..87a0fd63432 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/PackCompatibility.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/PackCompatibility.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/PackCompatibility.java +++ b/net/minecraft/server/packs/repository/PackCompatibility.java -@@ -34,7 +_,7 @@ +@@ -33,7 +_,7 @@ } public static PackCompatibility m_143885_(PackMetadataSection p_143886_, PackType p_143887_) { diff --git a/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch b/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch index b244e129c4d..f2fcc8286a3 100644 --- a/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/repository/PackRepository.java.patch @@ -18,7 +18,7 @@ } public void m_10506_() { -@@ -91,6 +_,10 @@ +@@ -90,6 +_,10 @@ @Nullable public Pack m_10507_(String p_10508_) { return this.f_10498_.get(p_10508_); @@ -28,4 +28,4 @@ + this.f_10497_.add(packFinder); } - public void close() { + public boolean m_10515_(String p_10516_) { diff --git a/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch b/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch index 80b3ab51fb0..a2ff6a42837 100644 --- a/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -106,4 +_,8 @@ +@@ -71,4 +_,8 @@ return map; } diff --git a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch index c30daf656e6..c15d2c0140b 100644 --- a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -118,6 +_,7 @@ +@@ -122,6 +_,7 @@ private boolean f_11209_; private static final boolean f_143988_ = false; private int f_11210_; @@ -8,7 +8,7 @@ public PlayerList(MinecraftServer p_203842_, RegistryAccess.Frozen p_203843_, PlayerDataStorage p_203844_, int p_203845_) { this.f_11195_ = p_203842_; -@@ -153,6 +_,7 @@ +@@ -157,6 +_,7 @@ LevelData leveldata = serverlevel1.m_6106_(); p_11263_.m_143427_(compoundtag); ServerGamePacketListenerImpl servergamepacketlistenerimpl = new ServerGamePacketListenerImpl(this.f_11195_, p_11262_, p_11263_); @@ -16,24 +16,24 @@ GameRules gamerules = serverlevel1.m_46469_(); boolean flag = gamerules.m_46207_(GameRules.f_46156_); boolean flag1 = gamerules.m_46207_(GameRules.f_46145_); -@@ -161,6 +_,7 @@ - servergamepacketlistenerimpl.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); - servergamepacketlistenerimpl.m_141995_(new ClientboundPlayerAbilitiesPacket(p_11263_.m_150110_())); - servergamepacketlistenerimpl.m_141995_(new ClientboundSetCarriedItemPacket(p_11263_.m_150109_().f_35977_)); +@@ -165,6 +_,7 @@ + servergamepacketlistenerimpl.m_9829_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); + servergamepacketlistenerimpl.m_9829_(new ClientboundPlayerAbilitiesPacket(p_11263_.m_150110_())); + servergamepacketlistenerimpl.m_9829_(new ClientboundSetCarriedItemPacket(p_11263_.m_150109_().f_35977_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, p_11263_)); - servergamepacketlistenerimpl.m_141995_(new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_())); - servergamepacketlistenerimpl.m_141995_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_203950_(this.f_11206_))); + servergamepacketlistenerimpl.m_9829_(new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_())); + servergamepacketlistenerimpl.m_9829_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_203950_(this.f_11206_))); this.m_11289_(p_11263_); -@@ -177,7 +_,7 @@ +@@ -181,7 +_,7 @@ - this.m_11264_(mutablecomponent.m_130940_(ChatFormatting.YELLOW), ChatType.SYSTEM, Util.f_137441_); + this.m_215627_(mutablecomponent.m_130940_(ChatFormatting.YELLOW), ChatType.f_130599_); servergamepacketlistenerimpl.m_9774_(p_11263_.m_20185_(), p_11263_.m_20186_(), p_11263_.m_20189_(), p_11263_.m_146908_(), p_11263_.m_146909_()); - this.f_11196_.add(p_11263_); + this.addPlayer(p_11263_); - this.f_11197_.put(p_11263_.m_142081_(), p_11263_); + this.f_11197_.put(p_11263_.m_20148_(), p_11263_); this.m_11268_(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, p_11263_)); -@@ -232,6 +_,7 @@ +@@ -237,6 +_,7 @@ } p_11263_.m_143429_(); @@ -41,44 +41,44 @@ } protected void m_11273_(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -292,6 +_,7 @@ +@@ -297,6 +_,7 @@ compoundtag1 = compoundtag; p_11225_.m_20258_(compoundtag); f_11188_.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_11225_, this.f_11204_, p_11225_.m_142081_().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_11225_, this.f_11204_, p_11225_.m_20148_().toString()); } else { compoundtag1 = this.f_11204_.m_78435_(p_11225_); } -@@ -300,6 +_,7 @@ +@@ -305,6 +_,7 @@ } protected void m_6765_(ServerPlayer p_11277_) { + if (p_11277_.f_8906_ == null) return; this.f_11204_.m_78433_(p_11277_); - ServerStatsCounter serverstatscounter = this.f_11202_.get(p_11277_.m_142081_()); + ServerStatsCounter serverstatscounter = this.f_11202_.get(p_11277_.m_20148_()); if (serverstatscounter != null) { -@@ -314,6 +_,7 @@ +@@ -319,6 +_,7 @@ } public void m_11286_(ServerPlayer p_11287_) { + net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedOut(p_11287_); - ServerLevel serverlevel = p_11287_.m_183503_(); + ServerLevel serverlevel = p_11287_.m_9236_(); p_11287_.m_36220_(Stats.f_12989_); this.m_6765_(p_11287_); -@@ -450,10 +_,11 @@ +@@ -455,10 +_,11 @@ this.m_11229_(serverplayer, serverlevel1); this.m_11289_(serverplayer); serverlevel1.m_8845_(serverplayer); - this.f_11196_.add(serverplayer); + this.addPlayer(serverplayer); - this.f_11197_.put(serverplayer.m_142081_(), serverplayer); + this.f_11197_.put(serverplayer.m_20148_(), serverplayer); serverplayer.m_143429_(); serverplayer.m_21153_(serverplayer.m_21223_()); + net.minecraftforge.event.ForgeEventFactory.firePlayerRespawnEvent(serverplayer, p_11238_); if (flag2) { - serverplayer.f_8906_.m_141995_(new ClientboundSoundPacket(SoundEvents.f_12377_, SoundSource.BLOCKS, (double)blockpos.m_123341_(), (double)blockpos.m_123342_(), (double)blockpos.m_123343_(), 1.0F, 1.0F)); + serverplayer.f_8906_.m_9829_(new ClientboundSoundPacket(SoundEvents.f_12377_, SoundSource.BLOCKS, (double)blockpos.m_123341_(), (double)blockpos.m_123342_(), (double)blockpos.m_123343_(), 1.0F, 1.0F, serverlevel1.m_213780_().m_188505_())); } -@@ -538,6 +_,7 @@ +@@ -543,6 +_,7 @@ } public void m_5749_(GameProfile p_11254_) { @@ -86,7 +86,7 @@ this.f_11200_.m_11381_(new ServerOpListEntry(p_11254_, this.f_11195_.m_7022_(), this.f_11200_.m_11351_(p_11254_))); ServerPlayer serverplayer = this.m_11259_(p_11254_.getId()); if (serverplayer != null) { -@@ -547,6 +_,7 @@ +@@ -552,6 +_,7 @@ } public void m_5750_(GameProfile p_11281_) { @@ -94,7 +94,7 @@ this.f_11200_.m_11393_(p_11281_); ServerPlayer serverplayer = this.m_11259_(p_11281_.getId()); if (serverplayer != null) { -@@ -734,13 +_,6 @@ +@@ -770,13 +_,6 @@ if (serverstatscounter == null) { File file1 = this.f_11195_.m_129843_(LevelResource.f_78175_).toFile(); File file2 = new File(file1, uuid + ".json"); @@ -108,7 +108,7 @@ serverstatscounter = new ServerStatsCounter(this.f_11195_, file2); this.f_11202_.put(uuid, serverstatscounter); -@@ -759,6 +_,8 @@ +@@ -795,6 +_,8 @@ this.f_11203_.put(uuid, playeradvancements); } @@ -117,7 +117,7 @@ playeradvancements.m_135979_(p_11297_); return playeradvancements; } -@@ -788,7 +_,7 @@ +@@ -824,7 +_,7 @@ } public List m_11314_() { @@ -126,7 +126,7 @@ } @Nullable -@@ -805,6 +_,7 @@ +@@ -841,6 +_,7 @@ playeradvancements.m_135981_(this.f_11195_.m_129889_()); } @@ -134,7 +134,7 @@ this.m_11268_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_203950_(this.f_11206_))); ClientboundUpdateRecipesPacket clientboundupdaterecipespacket = new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_()); -@@ -817,5 +_,13 @@ +@@ -853,5 +_,13 @@ public boolean m_11316_() { return this.f_11209_; diff --git a/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch b/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch index b953e653074..5d60e56a160 100644 --- a/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch +++ b/patches/minecraft/net/minecraft/server/rcon/RconConsoleSource.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/rcon/RconConsoleSource.java +++ b/net/minecraft/server/rcon/RconConsoleSource.java -@@ -35,7 +_,7 @@ +@@ -33,7 +_,7 @@ } - public void m_6352_(Component p_11509_, UUID p_11510_) { -- this.f_11501_.append(p_11509_.getString()); -+ this.f_11501_.append(p_11509_.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output + public void m_213846_(Component p_215653_) { +- this.f_11501_.append(p_215653_.getString()); ++ this.f_11501_.append(p_215653_.getString()).append("\n"); // FIX MC-7569 - RCON has no newlines in multiline output } public boolean m_6999_() { diff --git a/patches/minecraft/net/minecraft/sounds/SoundEvent.java.patch b/patches/minecraft/net/minecraft/sounds/SoundEvent.java.patch deleted file mode 100644 index 24a088a8d1e..00000000000 --- a/patches/minecraft/net/minecraft/sounds/SoundEvent.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/sounds/SoundEvent.java -+++ b/net/minecraft/sounds/SoundEvent.java -@@ -3,7 +_,7 @@ - import com.mojang.serialization.Codec; - import net.minecraft.resources.ResourceLocation; - --public class SoundEvent { -+public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Codec f_11655_ = ResourceLocation.f_135803_.xmap(SoundEvent::new, (p_11662_) -> { - return p_11662_.f_11656_; - }); diff --git a/patches/minecraft/net/minecraft/sounds/SoundEvents.java.patch b/patches/minecraft/net/minecraft/sounds/SoundEvents.java.patch deleted file mode 100644 index 726486d8187..00000000000 --- a/patches/minecraft/net/minecraft/sounds/SoundEvents.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/sounds/SoundEvents.java -+++ b/net/minecraft/sounds/SoundEvents.java -@@ -3,6 +_,7 @@ - import net.minecraft.core.Registry; - import net.minecraft.resources.ResourceLocation; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class SoundEvents { - public static final SoundEvent f_11689_ = m_12656_("ambient.cave"); - public static final SoundEvent f_11742_ = m_12656_("ambient.basalt_deltas.additions"); diff --git a/patches/minecraft/net/minecraft/stats/StatType.java.patch b/patches/minecraft/net/minecraft/stats/StatType.java.patch deleted file mode 100644 index 03f6652df0c..00000000000 --- a/patches/minecraft/net/minecraft/stats/StatType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/stats/StatType.java -+++ b/net/minecraft/stats/StatType.java -@@ -8,7 +_,7 @@ - import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.TranslatableComponent; - --public class StatType implements Iterable> { -+public class StatType extends net.minecraftforge.registries.ForgeRegistryEntry> implements Iterable> { - private final Registry f_12888_; - private final Map> f_12889_ = new IdentityHashMap<>(); - @Nullable diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index e03c797aaf8..8e0a5065a50 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 -@@ -145,4 +_,8 @@ +@@ -164,4 +_,8 @@ private static TagKey m_203846_(String p_203847_) { return TagKey.m_203882_(Registry.f_122901_, new ResourceLocation(p_203847_)); } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index bce41f12f07..71cef07c575 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 -@@ -83,4 +_,8 @@ +@@ -89,4 +_,8 @@ private static TagKey m_203854_(String p_203855_) { return TagKey.m_203882_(Registry.f_122904_, new ResourceLocation(p_203855_)); } diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch deleted file mode 100644 index 616c8621c99..00000000000 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/net/minecraft/tags/Tag.java -+++ b/net/minecraft/tags/Tag.java -@@ -31,8 +_,16 @@ - return (Tag)f_203856_; - } - -- public static class Builder { -+ public static class Builder implements net.minecraftforge.common.extensions.IForgeRawTagBuilder { -+ private final List removeEntries = new java.util.ArrayList<>(); // FORGE: internal field for tracking "remove" entries -+ /** FORGE: Gets a view of this builder's "remove" entries (only used during datagen) **/ -+ public Stream getRemoveEntries() { return this.removeEntries.stream(); } -+ public Tag.Builder remove(final Tag.BuilderEntry proxy) { // internal forge method for adding remove entries -+ this.removeEntries.add(proxy); -+ return this; -+ } - private final List f_13302_ = new ArrayList<>(); -+ private boolean replace = false; - - public static Tag.Builder m_13304_() { - return new Tag.Builder(); -@@ -63,6 +_,15 @@ - return this.m_13307_(new Tag.OptionalTagEntry(p_144383_), p_144384_); - } - -+ public Tag.Builder replace(boolean value) { -+ this.replace = value; -+ return this; -+ } -+ -+ public Tag.Builder replace() { -+ return replace(true); -+ } -+ - public Either, Tag> m_144371_(Function> p_144372_, Function p_144373_) { - ImmutableSet.Builder builder = ImmutableSet.builder(); - List list = new ArrayList<>(); -@@ -104,6 +_,7 @@ - this.f_13302_.clear(); - } - -+ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(list, p_13313_, f_13302_); - list.forEach((p_13319_) -> { - this.f_13302_.add(new Tag.BuilderEntry(p_13319_, p_13314_)); - }); -@@ -139,8 +_,9 @@ - tag$builderentry.f_13338_().m_6383_(jsonarray); - } - -- jsonobject.addProperty("replace", false); -+ jsonobject.addProperty("replace", replace); - jsonobject.add("values", jsonarray); -+ this.serializeTagAdditions(jsonobject); - return jsonobject; - } - } -@@ -179,6 +_,7 @@ - public String toString() { - return this.f_13349_.toString(); - } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof Tag.ElementEntry && java.util.Objects.equals(this.f_13349_, ((Tag.ElementEntry) o).f_13349_)); } - } - - public interface Entry { -@@ -287,6 +_,8 @@ - public String toString() { - return "#" + this.f_13383_; - } -+ @Override public boolean equals(Object o) { return o == this || (o instanceof Tag.TagEntry && java.util.Objects.equals(this.f_13383_, ((Tag.TagEntry) o).f_13383_)); } -+ public ResourceLocation getId() { return f_13383_; } - - public boolean m_142746_(Predicate p_144404_, Predicate p_144405_) { - return p_144405_.test(this.f_13383_); diff --git a/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch b/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch new file mode 100644 index 00000000000..f8dc753f363 --- /dev/null +++ b/patches/minecraft/net/minecraft/tags/TagBuilder.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/tags/TagBuilder.java ++++ b/net/minecraft/tags/TagBuilder.java +@@ -4,7 +_,17 @@ + import java.util.List; + import net.minecraft.resources.ResourceLocation; + +-public class TagBuilder { ++public class TagBuilder implements net.minecraftforge.common.extensions.IForgeRawTagBuilder { ++ // FORGE: Remove entries are used for datagen. ++ private final List removeEntries = new ArrayList<>(); ++ public java.util.stream.Stream getRemoveEntries() { return this.removeEntries.stream(); } ++ // FORGE: Add an entry to be removed from this tag in datagen. ++ public TagBuilder remove(final TagEntry entry) { ++ this.removeEntries.add(entry); ++ return this; ++ } ++ // FORGE: is this tag set to replace or not? ++ private boolean replace = false; + private final List f_215897_ = new ArrayList<>(); + + public static TagBuilder m_215899_() { +@@ -34,5 +_,16 @@ + + public TagBuilder m_215909_(ResourceLocation p_215910_) { + return this.m_215902_(TagEntry.m_215953_(p_215910_)); ++ } ++ ++ // FORGE: Set the replace property of this tag. ++ public TagBuilder replace(boolean value) { ++ this.replace = value; ++ return this; ++ } ++ ++ // FORGE: Shorthand version of replace(true) ++ public TagBuilder replace() { ++ return replace(true); + } + } diff --git a/patches/minecraft/net/minecraft/tags/TagEntry.java.patch b/patches/minecraft/net/minecraft/tags/TagEntry.java.patch new file mode 100644 index 00000000000..6d1c5085aaf --- /dev/null +++ b/patches/minecraft/net/minecraft/tags/TagEntry.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/tags/TagEntry.java ++++ b/net/minecraft/tags/TagEntry.java +@@ -113,6 +_,14 @@ + return stringbuilder.toString(); + } + ++ public ResourceLocation getId() { ++ return f_215913_; ++ } ++ ++ public boolean isRequired() { ++ return f_215915_; ++ } ++ + public interface Lookup { + @Nullable + T m_213619_(ResourceLocation p_215956_); diff --git a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch index 6509e76383a..398f175bcca 100644 --- a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/tags/TagLoader.java +++ b/net/minecraft/tags/TagLoader.java -@@ -156,7 +_,7 @@ - p_203899_.keySet().forEach((p_144522_) -> { - m_144523_(p_203899_, multimap, set, p_144522_, (p_144537_, p_144538_) -> { - p_144538_.m_144371_(function, function1).ifLeft((p_144543_) -> { -- f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_144537_, p_144543_.stream().map(Objects::toString).collect(Collectors.joining(", "))); -+ f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_144537_, p_144543_.stream().map(Objects::toString).collect(Collectors.joining(", \n\t"))); - }).ifRight((p_144532_) -> { - map.put(p_144537_, p_144532_); +@@ -164,7 +_,7 @@ + p_203899_.keySet().forEach((p_216008_) -> { + m_144523_(p_203899_, multimap, set, p_216008_, (p_215984_, p_215985_) -> { + this.m_215978_(lookup, p_215985_).ifLeft((p_215977_) -> { +- f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_215984_, p_215977_.stream().map(Objects::toString).collect(Collectors.joining(", "))); ++ f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_215977_, p_215977_.stream().map(Objects::toString).collect(Collectors.joining(", \n\t"))); + }).ifRight((p_216001_) -> { + map.put(p_215984_, p_216001_); }); diff --git a/patches/minecraft/net/minecraft/tags/TagManager.java.patch b/patches/minecraft/net/minecraft/tags/TagManager.java.patch index 97e57d980e8..61d83ec2677 100644 --- a/patches/minecraft/net/minecraft/tags/TagManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/TagManager.java +++ b/net/minecraft/tags/TagManager.java -@@ -29,7 +_,8 @@ +@@ -30,7 +_,8 @@ public static String m_203918_(ResourceKey> p_203919_) { String s = f_203902_.get(p_203919_); diff --git a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch index 8d10f012ea8..73067803ca8 100644 --- a/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java +++ b/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java -@@ -93,7 +_,10 @@ +@@ -92,7 +_,10 @@ private Dynamic m_207723_(Pair, Dynamic> p_207724_, Dynamic p_207725_) { String s = p_207724_.getFirst().asString("UNKNOWN").toLowerCase(Locale.ROOT); StructuresBecomeConfiguredFix.Conversion structuresbecomeconfiguredfix$conversion = f_207676_.get(s); diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch index 1200d5a53b4..4779cd2b5b2 100644 --- a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch +++ b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch @@ -5,19 +5,19 @@ import net.minecraft.world.entity.player.Player; -public class MobEffect { -+public class MobEffect extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeMobEffect { ++public class MobEffect implements net.minecraftforge.common.extensions.IForgeMobEffect { private final Map f_19446_ = Maps.newHashMap(); private final MobEffectCategory f_19447_; private final int f_19448_; -@@ -37,6 +_,7 @@ +@@ -44,6 +_,7 @@ protected MobEffect(MobEffectCategory p_19451_, int p_19452_) { this.f_19447_ = p_19451_; this.f_19448_ = p_19452_; + initClient(); } - public void m_6742_(LivingEntity p_19467_, int p_19468_) { -@@ -179,4 +_,29 @@ + public Optional m_216881_() { +@@ -195,4 +_,29 @@ public boolean m_19486_() { return this.f_19447_ == MobEffectCategory.BENEFICIAL; } diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch index 8ddba771550..5904935cbb0 100644 --- a/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch +++ b/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/effect/MobEffectInstance.java +++ b/net/minecraft/world/effect/MobEffectInstance.java -@@ -7,7 +_,7 @@ +@@ -14,7 +_,7 @@ import net.minecraft.world.entity.LivingEntity; import org.slf4j.Logger; @@ -8,8 +8,8 @@ +public class MobEffectInstance implements Comparable, net.minecraftforge.common.extensions.IForgeMobEffectInstance { private static final Logger f_19501_ = LogUtils.getLogger(); private final MobEffect f_19502_; - private int f_19503_; -@@ -60,6 +_,7 @@ + int f_19503_; +@@ -74,6 +_,7 @@ this.f_19506_ = p_19549_.f_19506_; this.f_19508_ = p_19549_.f_19508_; this.f_19509_ = p_19549_.f_19509_; @@ -17,50 +17,52 @@ } public boolean m_19558_(MobEffectInstance p_19559_) { -@@ -108,7 +_,7 @@ +@@ -130,7 +_,7 @@ } public MobEffect m_19544_() { - return this.f_19502_; -+ return this.f_19502_ == null ? null : this.f_19502_.delegate.get(); ++ return this.f_19502_ == null ? null : net.minecraftforge.registries.ForgeRegistries.MOB_EFFECTS.getDelegateOrThrow(this.f_19502_).get(); } public int m_19557_() { -@@ -206,6 +_,7 @@ +@@ -231,6 +_,7 @@ public CompoundTag m_19555_(CompoundTag p_19556_) { - p_19556_.m_128344_("Id", (byte)MobEffect.m_19459_(this.m_19544_())); + p_19556_.m_128405_("Id", MobEffect.m_19459_(this.m_19544_())); + net.minecraftforge.common.ForgeHooks.saveMobEffect(p_19556_, "forge:id", this.m_19544_()); this.m_19567_(p_19556_); return p_19556_; } -@@ -221,13 +_,15 @@ +@@ -246,6 +_,7 @@ this.f_19510_.m_19555_(compoundtag); p_19568_.m_128365_("HiddenEffect", compoundtag); } + writeCurativeItems(p_19568_); - } + this.f_216885_.ifPresent((p_216903_) -> { + MobEffectInstance.FactorData.f_216907_.encodeStart(NbtOps.f_128958_, p_216903_).resultOrPartial(f_19501_::error).ifPresent((p_216906_) -> { +@@ -256,8 +_,9 @@ @Nullable public static MobEffectInstance m_19560_(CompoundTag p_19561_) { -- int i = p_19561_.m_128445_("Id"); +- int i = p_19561_.m_128451_("Id"); + int i = p_19561_.m_128445_("Id") & 0xFF; MobEffect mobeffect = MobEffect.m_19453_(i); + mobeffect = net.minecraftforge.common.ForgeHooks.loadMobEffect(p_19561_, "forge:id", mobeffect); return mobeffect == null ? null : m_19545_(mobeffect, p_19561_); } -@@ -250,7 +_,7 @@ - mobeffectinstance = m_19545_(p_19546_, p_19547_.m_128469_("HiddenEffect")); +@@ -287,7 +_,7 @@ + optional = Optional.empty(); } -- return new MobEffectInstance(p_19546_, j, i < 0 ? 0 : i, flag, flag1, flag2, mobeffectinstance); -+ return readCurativeItems(new MobEffectInstance(p_19546_, j, i < 0 ? 0 : i, flag, flag1, flag2, mobeffectinstance), p_19547_); +- return new MobEffectInstance(p_19546_, j, Math.max(i, 0), flag, flag1, flag2, mobeffectinstance, optional); ++ return readCurativeItems(new MobEffectInstance(p_19546_, j, Math.max(0, i), flag, flag1, flag2, mobeffectinstance, optional), p_19547_); } public void m_19562_(boolean p_19563_) { -@@ -263,6 +_,32 @@ +@@ -300,7 +_,33 @@ public int compareTo(MobEffectInstance p_19566_) { int i = 32147; @@ -93,4 +95,5 @@ + + return effect; } - } + + public static class FactorData { diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffects.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffects.java.patch deleted file mode 100644 index f426e0c76e0..00000000000 --- a/patches/minecraft/net/minecraft/world/effect/MobEffects.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/effect/MobEffects.java -+++ b/net/minecraft/world/effect/MobEffects.java -@@ -8,6 +_,7 @@ - import net.minecraft.world.entity.ai.attributes.AttributeModifier; - import net.minecraft.world.entity.ai.attributes.Attributes; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class MobEffects { - public static final MobEffect f_19596_ = m_19623_(1, "speed", (new MobEffect(MobEffectCategory.BENEFICIAL, 8171462)).m_19472_(Attributes.f_22279_, "91AEAA56-376B-4498-935B-2F7F68070635", (double)0.2F, AttributeModifier.Operation.MULTIPLY_TOTAL)); - public static final MobEffect f_19597_ = m_19623_(2, "slowness", (new MobEffect(MobEffectCategory.HARMFUL, 5926017)).m_19472_(Attributes.f_22279_, "7107DE5E-7CE8-4030-940E-514C1F160890", (double)-0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL)); diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index 63a389b0390..96eedb2b7a7 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -116,7 +_,7 @@ +@@ -118,7 +_,7 @@ import net.minecraft.world.scores.Team; import org.slf4j.Logger; @@ -9,7 +9,7 @@ private static final Logger f_19849_ = LogUtils.getLogger(); public static final String f_146815_ = "id"; public static final String f_146816_ = "Passengers"; -@@ -135,6 +_,7 @@ +@@ -137,6 +_,7 @@ private static final double f_146812_ = 0.0023333333333333335D; public static final String f_146824_ = "UUID"; private static double f_19846_ = 1.0D; @@ -17,15 +17,15 @@ private final EntityType f_19847_; private int f_19848_ = f_19843_.incrementAndGet(); public boolean f_19850_; -@@ -175,6 +_,7 @@ +@@ -177,6 +_,7 @@ public double f_19790_; public double f_19791_; public double f_19792_; + @Deprecated // Forge - see IForgeEntity#getStepHeight public float f_19793_; public boolean f_19794_; - protected final Random f_19796_ = new Random(); -@@ -229,6 +_,7 @@ + protected final RandomSource f_19796_ = RandomSource.m_216327_(); +@@ -231,6 +_,7 @@ private BlockState f_185934_ = null; public Entity(EntityType p_19870_, Level p_19871_) { @@ -33,7 +33,7 @@ this.f_19847_ = p_19870_; this.f_19853_ = p_19871_; this.f_19815_ = p_19870_.m_20680_(); -@@ -247,7 +_,11 @@ +@@ -248,7 +_,11 @@ this.f_19804_.m_135372_(f_146800_, 0); this.m_8097_(); this.m_6034_(0.0D, 0.0D, 0.0D); @@ -46,29 +46,21 @@ } public boolean m_20039_(BlockPos p_20040_, BlockState p_20041_) { -@@ -343,6 +_,7 @@ - if (p_146834_ == Entity.RemovalReason.KILLED) { - this.m_146850_(GameEvent.f_157809_); - } -+ this.invalidateCaps(); - - } - -@@ -621,7 +_,7 @@ +@@ -623,7 +_,7 @@ double d1 = vec3.f_82479_; double d2 = vec3.f_82480_; double d3 = vec3.f_82481_; - this.f_146794_ += (float)(vec3.m_82553_() * 0.6D); + this.f_146794_ = (float) ((double) this.f_146794_ + vec3.m_82553_() * 0.6D); - if (!blockstate.m_204336_(BlockTags.f_13082_) && !blockstate.m_60713_(Blocks.f_152499_)) { + boolean flag1 = blockstate.m_204336_(BlockTags.f_13082_) || blockstate.m_60713_(Blocks.f_152499_); + if (!flag1) { d2 = 0.0D; - } -@@ -659,25 +_,23 @@ +@@ -662,25 +_,23 @@ this.m_146872_(); float f2 = this.m_6041_(); - this.m_20256_(this.m_20184_().m_82542_((double)f2, 1.0D, (double)f2)); -- if (this.f_19853_.m_46847_(this.m_142469_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> { +- if (this.f_19853_.m_46847_(this.m_20191_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> { - return p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_); - })) { - if (this.f_19831_ <= 0) { @@ -83,7 +75,7 @@ - if (this.m_6060_() && (this.f_146808_ || this.m_20071_())) { + this.m_20256_(this.m_20184_().m_82542_((double) f2, 1.0D, (double) f2)); + } -+ if (this.f_19853_.m_46847_(this.m_142469_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_))) { ++ if (this.f_19853_.m_46847_(this.m_20191_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_))) { + if (this.f_19831_ <= 0) { this.m_7311_(-this.m_6101_()); } @@ -103,8 +95,16 @@ } } -@@ -715,10 +_,10 @@ - int j = Mth.m_14107_(this.f_19825_.f_82480_ - (double)0.2F); +@@ -710,6 +_,7 @@ + this.m_146850_(GameEvent.f_157815_); + } + } ++ this.invalidateCaps(); + + } + +@@ -728,10 +_,10 @@ + int j = Mth.m_14107_(this.f_19825_.f_82480_ - (double)p_216987_); int k = Mth.m_14107_(this.f_19825_.f_82481_); BlockPos blockpos = new BlockPos(i, j, k); - if (this.f_19853_.m_8055_(blockpos).m_60795_()) { @@ -116,7 +116,7 @@ return blockpos1; } } -@@ -791,10 +_,11 @@ +@@ -804,10 +_,11 @@ boolean flag1 = p_20273_.f_82480_ != vec3.f_82480_; boolean flag2 = p_20273_.f_82481_ != vec3.f_82481_; boolean flag3 = this.f_19861_ || flag1 && p_20273_.f_82480_ < 0.0D; @@ -132,7 +132,7 @@ Vec3 vec33 = m_198894_(this, new Vec3(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), aabb.m_82383_(vec32), this.f_19853_, list).m_82549_(vec32); if (vec33.m_165925_() > vec31.m_165925_()) { vec31 = vec33; -@@ -929,7 +_,7 @@ +@@ -934,7 +_,7 @@ protected void m_7355_(BlockPos p_20135_, BlockState p_20136_) { if (!p_20136_.m_60767_().m_76332_()) { BlockState blockstate = this.f_19853_.m_8055_(p_20135_.m_7494_()); @@ -141,27 +141,28 @@ this.m_5496_(soundtype.m_56776_(), soundtype.m_56773_() * 0.15F, soundtype.m_56774_()); } } -@@ -1144,9 +_,10 @@ +@@ -1168,9 +_,10 @@ int k = Mth.m_14107_(this.m_20189_()); BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.f_19853_.m_8055_(blockpos); + if(!blockstate.addRunningEffects(f_19853_, blockpos, this)) if (blockstate.m_60799_() != RenderShape.INVISIBLE) { Vec3 vec3 = this.m_20184_(); -- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + (this.f_19796_.nextDouble() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.nextDouble() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); -+ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(blockpos), this.m_20185_() + (this.f_19796_.nextDouble() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.nextDouble() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); +- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); ++ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(blockpos), this.m_20185_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); } } -@@ -1467,6 +_,7 @@ - if (this.f_146813_) { +@@ -1494,6 +_,8 @@ p_20241_.m_128379_("HasVisualFire", this.f_146813_); } -+ p_20241_.m_128379_("CanUpdate", canUpdate); ++ p_20241_.m_128379_("CanUpdate", canUpdate); ++ if (!this.f_19841_.isEmpty()) { ListTag listtag = new ListTag(); -@@ -1478,6 +_,10 @@ + +@@ -1504,6 +_,10 @@ p_20241_.m_128365_("Tags", listtag); } @@ -172,7 +173,7 @@ this.m_7380_(p_20241_); if (this.m_20160_()) { ListTag listtag1 = new ListTag(); -@@ -1552,6 +_,9 @@ +@@ -1578,6 +_,9 @@ this.m_146915_(p_20259_.m_128471_("Glowing")); this.m_146917_(p_20259_.m_128451_("TicksFrozen")); this.f_146813_ = p_20259_.m_128471_("HasVisualFire"); @@ -182,7 +183,7 @@ if (p_20259_.m_128425_("Tags", 9)) { this.f_19841_.clear(); ListTag listtag3 = p_20259_.m_128437_("Tags", 8); -@@ -1640,6 +_,8 @@ +@@ -1666,6 +_,8 @@ } else { ItemEntity itementity = new ItemEntity(this.f_19853_, this.m_20185_(), this.m_20186_() + (double)p_19986_, this.m_20189_(), p_19985_); itementity.m_32060_(); @@ -191,7 +192,7 @@ this.f_19853_.m_7967_(itementity); return itementity; } -@@ -1676,6 +_,7 @@ +@@ -1702,6 +_,7 @@ public void m_6083_() { this.m_20256_(Vec3.f_82478_); @@ -199,7 +200,7 @@ this.m_8119_(); if (this.m_20159_()) { this.m_20202_().m_7332_(this); -@@ -1722,6 +_,7 @@ +@@ -1748,6 +_,7 @@ } } @@ -207,7 +208,7 @@ if (p_19967_ || this.m_7341_(p_19966_) && p_19966_.m_7310_(this)) { if (this.m_20159_()) { this.m_8127_(); -@@ -1760,6 +_,7 @@ +@@ -1786,6 +_,7 @@ public void m_6038_() { if (this.f_19824_ != null) { Entity entity = this.f_19824_; @@ -215,15 +216,16 @@ this.f_19824_ = null; entity.m_20351_(this); } -@@ -1936,6 +_,7 @@ +@@ -1961,6 +_,8 @@ return !this.f_19823_.isEmpty(); } -+ @Deprecated //Forge: Use rider sensitive version ++ /** @deprecated Forge: Use {@link #canBeRiddenInWater(Entity) rider sensitive version} */ ++ @Deprecated public boolean m_6146_() { return true; } -@@ -2093,7 +_,7 @@ +@@ -2116,7 +_,7 @@ this.m_20254_(8); } @@ -232,7 +234,7 @@ } public void m_6845_(boolean p_20313_) { -@@ -2181,7 +_,7 @@ +@@ -2205,7 +_,7 @@ } protected Component m_5677_() { @@ -241,7 +243,7 @@ } public boolean m_7306_(Entity p_20356_) { -@@ -2237,14 +_,20 @@ +@@ -2261,14 +_,20 @@ @Nullable public Entity m_5489_(ServerLevel p_20118_) { @@ -250,7 +252,7 @@ + @Nullable + public Entity changeDimension(ServerLevel p_20118_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_20118_.m_46472_())) return null; - if (this.f_19853_ instanceof ServerLevel && !this.m_146910_()) { + if (this.f_19853_ instanceof ServerLevel && !this.m_213877_()) { this.f_19853_.m_46473_().m_6180_("changeDimension"); this.m_19877_(); this.f_19853_.m_46473_().m_6180_("reposition"); @@ -263,7 +265,7 @@ this.f_19853_.m_46473_().m_6182_("reloading"); Entity entity = this.m_6095_().m_20615_(p_20118_); if (entity != null) { -@@ -2252,17 +_,19 @@ +@@ -2276,17 +_,19 @@ entity.m_7678_(portalinfo.f_77676_.f_82479_, portalinfo.f_77676_.f_82480_, portalinfo.f_77676_.f_82481_, portalinfo.f_77678_, entity.m_146909_()); entity.m_20256_(portalinfo.f_77677_); p_20118_.m_143334_(entity); @@ -285,7 +287,7 @@ } } else { return null; -@@ -2463,8 +_,10 @@ +@@ -2487,8 +_,10 @@ EntityDimensions entitydimensions = this.f_19815_; Pose pose = this.m_20089_(); EntityDimensions entitydimensions1 = this.m_6972_(pose); @@ -297,7 +299,7 @@ this.m_20090_(); boolean flag = (double)entitydimensions1.f_20377_ <= 4.0D && (double)entitydimensions1.f_20378_ <= 4.0D; if (!this.f_19853_.f_46443_ && !this.f_19803_ && !this.f_19794_ && flag && (entitydimensions1.f_20377_ > entitydimensions.f_20377_ || entitydimensions1.f_20378_ > entitydimensions.f_20378_) && !(this instanceof Player)) { -@@ -2472,8 +_,9 @@ +@@ -2496,8 +_,9 @@ double d0 = (double)Math.max(0.0F, entitydimensions1.f_20377_ - entitydimensions.f_20377_) + 1.0E-6D; double d1 = (double)Math.max(0.0F, entitydimensions1.f_20378_ - entitydimensions.f_20378_) + 1.0E-6D; VoxelShape voxelshape = Shapes.m_83064_(AABB.m_165882_(vec3, d0, d1, d0)); @@ -308,15 +310,15 @@ }); } -@@ -2950,6 +_,7 @@ - gameeventlistenerregistrar.m_157862_(this.f_19853_); - } +@@ -2974,6 +_,7 @@ + + this.f_146801_.m_142044_(); } -+ if (this.isAddedToWorld() && !this.f_19853_.f_46443_ && !this.m_146910_()) this.f_19853_.m_6325_((int) Math.floor(p_20344_) >> 4, (int) Math.floor(p_20346_) >> 4); // Forge - ensure target chunk is loaded. ++ if (this.isAddedToWorld() && !this.f_19853_.f_46443_ && !this.m_213877_()) this.f_19853_.m_6325_((int) Math.floor(p_20344_) >> 4, (int) Math.floor(p_20346_) >> 4); // Forge - ensure target chunk is loaded. } -@@ -3061,6 +_,76 @@ +@@ -3089,6 +_,76 @@ public boolean m_142265_(Level p_146843_, BlockPos p_146844_) { return true; } @@ -352,7 +354,7 @@ + } + @Override + public boolean canTrample(BlockState state, BlockPos pos, float fallDistance) { -+ return f_19853_.f_46441_.nextFloat() < fallDistance - 0.5F ++ return f_19853_.f_46441_.m_188501_() < fallDistance - 0.5F + && this instanceof LivingEntity + && (this instanceof Player || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(f_19853_, this)) + && this.m_20205_() * this.m_20205_() * this.m_20206_() > 0.512F; @@ -391,5 +393,5 @@ + /* ================================== Forge End =====================================*/ + - public Level m_183503_() { + public Level m_9236_() { return this.f_19853_; diff --git a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch index 0489d37b8a9..c70451fd283 100644 --- a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -148,7 +_,7 @@ - import net.minecraft.world.phys.shapes.VoxelShape; - import org.slf4j.Logger; - --public class EntityType implements EntityTypeTest { -+public class EntityType extends net.minecraftforge.registries.ForgeRegistryEntry> implements EntityTypeTest { - private static final Logger f_20534_ = LogUtils.getLogger(); - public static final String f_147037_ = "EntityTag"; - private final Holder.Reference> f_204038_ = Registry.f_122826_.m_203693_(this); -@@ -283,6 +_,11 @@ +@@ -292,6 +_,11 @@ private ResourceLocation f_20546_; private final EntityDimensions f_20547_; @@ -21,7 +12,7 @@ private static EntityType m_20634_(String p_20635_, EntityType.Builder p_20636_) { return Registry.m_122961_(Registry.f_122826_, p_20635_, p_20636_.m_20712_(p_20635_)); } -@@ -296,6 +_,9 @@ +@@ -305,6 +_,9 @@ } public EntityType(EntityType.EntityFactory p_20574_, MobCategory p_20575_, boolean p_20576_, boolean p_20577_, boolean p_20578_, boolean p_20579_, ImmutableSet p_20580_, EntityDimensions p_20581_, int p_20582_, int p_20583_) { @@ -31,7 +22,7 @@ this.f_20535_ = p_20574_; this.f_20536_ = p_20575_; this.f_20541_ = p_20579_; -@@ -306,6 +_,10 @@ +@@ -315,6 +_,10 @@ this.f_20547_ = p_20581_; this.f_20542_ = p_20582_; this.f_20543_ = p_20583_; @@ -42,7 +33,7 @@ } @Nullable -@@ -317,6 +_,7 @@ +@@ -326,6 +_,7 @@ public T m_20600_(ServerLevel p_20601_, @Nullable CompoundTag p_20602_, @Nullable Component p_20603_, @Nullable Player p_20604_, BlockPos p_20605_, MobSpawnType p_20606_, boolean p_20607_, boolean p_20608_) { T t = this.m_20655_(p_20601_, p_20602_, p_20603_, p_20604_, p_20605_, p_20606_, p_20607_, p_20608_); if (t != null) { @@ -50,7 +41,7 @@ p_20601_.m_47205_(t); } -@@ -544,14 +_,23 @@ +@@ -543,14 +_,23 @@ } public int m_20681_() { @@ -74,7 +65,7 @@ return this != f_20532_ && this != f_20467_ && this != f_20496_ && this != f_20549_ && this != f_20462_ && this != f_147033_ && this != f_20464_ && this != f_20506_ && this != f_20564_ && this != f_20569_; } -@@ -574,6 +_,12 @@ +@@ -573,6 +_,12 @@ return this.f_204038_; } @@ -87,7 +78,7 @@ public static class Builder { private final EntityType.EntityFactory f_20685_; private final MobCategory f_20686_; -@@ -586,6 +_,11 @@ +@@ -585,6 +_,11 @@ private int f_20693_ = 3; private EntityDimensions f_20694_ = EntityDimensions.m_20395_(0.6F, 1.8F); @@ -99,7 +90,7 @@ private Builder(EntityType.EntityFactory p_20696_, MobCategory p_20697_) { this.f_20685_ = p_20696_; this.f_20686_ = p_20697_; -@@ -642,12 +_,36 @@ +@@ -641,12 +_,36 @@ return this; } diff --git a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch index 9d4c9301cff..2b0bd088881 100644 --- a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -14,7 +14,7 @@ } public boolean m_6469_(DamageSource p_20785_, float p_20786_) { -+ if (this.f_19853_.f_46443_ || this.m_146910_()) return false; //Forge: Fixes MC-53850 ++ if (this.f_19853_.f_46443_ || this.m_213877_()) return false; //Forge: Fixes MC-53850 if (this.m_6673_(p_20785_)) { return false; } else if (this.f_19853_.f_46443_) { @@ -27,7 +27,7 @@ p_20792_.m_7938_(this, 1); int i = this.m_147092_(p_20792_, this.f_20770_); @@ -219,7 +_,7 @@ - Entry entry = EnchantmentHelper.m_44839_(Enchantments.f_44962_, p_147093_, ItemStack::m_41768_); + Map.Entry entry = EnchantmentHelper.m_44839_(Enchantments.f_44962_, p_147093_, ItemStack::m_41768_); if (entry != null) { ItemStack itemstack = entry.getValue(); - int i = Math.min(this.m_20798_(this.f_20770_), itemstack.m_41773_()); diff --git a/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch b/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch index 16700883030..cdc4e7f8082 100644 --- a/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/world/entity/FlyingMob.java +++ b/net/minecraft/world/entity/FlyingMob.java -@@ -28,15 +_,16 @@ - this.m_6478_(MoverType.SELF, this.m_20184_()); - this.m_20256_(this.m_20184_().m_82490_(0.5D)); - } else { +@@ -29,15 +_,16 @@ + this.m_6478_(MoverType.SELF, this.m_20184_()); + this.m_20256_(this.m_20184_().m_82490_(0.5D)); + } else { + BlockPos ground = new BlockPos(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_()); - float f = 0.91F; - if (this.f_19861_) { -- f = this.f_19853_.m_8055_(new BlockPos(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; + float f = 0.91F; + if (this.f_19861_) { +- f = this.f_19853_.m_8055_(new BlockPos(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; + f = this.f_19853_.m_8055_(ground).getFriction(this.f_19853_, ground, this) * 0.91F; - } + } - float f1 = 0.16277137F / (f * f * f); - f = 0.91F; - if (this.f_19861_) { -- f = this.f_19853_.m_8055_(new BlockPos(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; + float f1 = 0.16277137F / (f * f * f); + f = 0.91F; + if (this.f_19861_) { +- f = this.f_19853_.m_8055_(new BlockPos(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; + f = this.f_19853_.m_8055_(ground).getFriction(this.f_19853_, ground, this) * 0.91F; - } + } - this.m_19920_(this.f_19861_ ? 0.1F * f1 : 0.02F, p_20818_); + this.m_19920_(this.f_19861_ ? 0.1F * f1 : 0.02F, p_20818_); diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index d443c0da4d5..b3eb1101c62 100644 --- a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -122,7 +_,9 @@ +@@ -123,7 +_,9 @@ private static final UUID f_20929_ = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final UUID f_20959_ = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); private static final UUID f_147184_ = UUID.fromString("1eaf83ff-7207-4596-b37a-d7a07b3ec4ce"); @@ -10,7 +10,7 @@ public static final int f_147166_ = 2; public static final int f_147167_ = 4; public static final int f_147168_ = 98; -@@ -272,7 +_,7 @@ +@@ -274,7 +_,7 @@ } public static AttributeSupplier.Builder m_21183_() { @@ -19,7 +19,7 @@ } protected void m_7840_(double p_20990_, boolean p_20991_, BlockState p_20992_, BlockPos p_20993_) { -@@ -290,7 +_,8 @@ +@@ -292,7 +_,8 @@ if (!p_20992_.m_60795_()) { double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); @@ -29,7 +29,7 @@ } } -@@ -354,7 +_,7 @@ +@@ -356,7 +_,7 @@ } } @@ -38,7 +38,7 @@ this.m_8127_(); } } else if (this.m_20146_() < this.m_6062_()) { -@@ -718,7 +_,7 @@ +@@ -740,7 +_,7 @@ if (!mobeffectinstance.m_19552_(this, () -> { this.m_141973_(mobeffectinstance, true, (Entity)null); })) { @@ -47,7 +47,7 @@ iterator.remove(); this.m_7285_(mobeffectinstance); } -@@ -768,8 +_,10 @@ +@@ -790,8 +_,10 @@ this.m_6842_(false); } else { Collection collection = this.f_20945_.values(); @@ -60,7 +60,7 @@ this.m_6842_(this.m_21023_(MobEffects.f_19609_)); } -@@ -805,7 +_,7 @@ +@@ -827,7 +_,7 @@ d0 *= 0.5D; } } @@ -69,7 +69,7 @@ return d0; } -@@ -848,7 +_,9 @@ +@@ -870,7 +_,9 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { @@ -80,7 +80,7 @@ iterator.remove(); } -@@ -882,6 +_,7 @@ +@@ -904,6 +_,7 @@ return false; } else { MobEffectInstance mobeffectinstance = this.f_20945_.get(p_147208_.m_19544_()); @@ -88,7 +88,7 @@ if (mobeffectinstance == null) { this.f_20945_.put(p_147208_.m_19544_(), p_147208_); this.m_142540_(p_147208_, p_147209_); -@@ -896,6 +_,9 @@ +@@ -918,6 +_,9 @@ } public boolean m_7301_(MobEffectInstance p_21197_) { @@ -98,7 +98,7 @@ if (this.m_6336_() == MobType.f_21641_) { MobEffect mobeffect = p_21197_.m_19544_(); if (mobeffect == MobEffects.f_19605_ || mobeffect == MobEffects.f_19614_) { -@@ -928,6 +_,7 @@ +@@ -950,6 +_,7 @@ } public boolean m_21195_(MobEffect p_21196_) { @@ -106,7 +106,7 @@ MobEffectInstance mobeffectinstance = this.m_6234_(p_21196_); if (mobeffectinstance != null) { this.m_7285_(mobeffectinstance); -@@ -964,6 +_,8 @@ +@@ -986,6 +_,8 @@ } public void m_5634_(float p_21116_) { @@ -115,7 +115,7 @@ float f = this.m_21223_(); if (f > 0.0F) { this.m_21153_(f + p_21116_); -@@ -984,6 +_,7 @@ +@@ -1006,6 +_,7 @@ } public boolean m_6469_(DamageSource p_21016_, float p_21017_) { @@ -123,7 +123,7 @@ if (this.m_6673_(p_21016_)) { return false; } else if (this.f_19853_.f_46443_) { -@@ -1002,9 +_,11 @@ +@@ -1024,9 +_,11 @@ boolean flag = false; float f1 = 0.0F; if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) { @@ -138,7 +138,7 @@ if (!p_21016_.m_19360_()) { Entity entity = p_21016_.m_7640_(); if (entity instanceof LivingEntity) { -@@ -1014,6 +_,7 @@ +@@ -1036,6 +_,7 @@ flag = true; } @@ -146,7 +146,7 @@ this.f_20924_ = 1.5F; boolean flag1 = true; -@@ -1048,11 +_,11 @@ +@@ -1070,11 +_,11 @@ if (entity1 instanceof Player) { this.f_20889_ = 100; this.f_20888_ = (Player)entity1; @@ -157,12 +157,12 @@ + net.minecraft.world.entity.TamableAnimal tamableEntity = (net.minecraft.world.entity.TamableAnimal)entity1; + if (tamableEntity.m_21824_()) { this.f_20889_ = 100; -- LivingEntity livingentity = wolf.m_142480_(); -+ LivingEntity livingentity = tamableEntity.m_142480_(); +- LivingEntity livingentity = wolf.m_21826_(); ++ LivingEntity livingentity = tamableEntity.m_21826_(); if (livingentity != null && livingentity.m_6095_() == EntityType.f_20532_) { this.f_20888_ = (Player)livingentity; } else { -@@ -1125,7 +_,7 @@ +@@ -1147,7 +_,7 @@ if (this instanceof ServerPlayer) { CriteriaTriggers.f_10574_.m_35174_((ServerPlayer)this, p_21016_, f, p_21017_, flag); if (f1 > 0.0F && f1 < 3.4028235E37F) { @@ -171,7 +171,7 @@ } } -@@ -1163,7 +_,7 @@ +@@ -1185,7 +_,7 @@ if (itemstack != null) { if (this instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)this; @@ -180,28 +180,28 @@ CriteriaTriggers.f_10551_.m_74431_(serverplayer, itemstack); } -@@ -1233,6 +_,7 @@ +@@ -1254,6 +_,7 @@ } public void m_6667_(DamageSource p_21014_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_21014_)) return; - if (!this.m_146910_() && !this.f_20890_) { + if (!this.m_213877_() && !this.f_20890_) { Entity entity = p_21014_.m_7639_(); LivingEntity livingentity = this.m_21232_(); -@@ -1268,10 +_,10 @@ +@@ -1289,10 +_,10 @@ if (!this.f_19853_.f_46443_) { boolean flag = false; if (p_21269_ instanceof WitherBoss) { - if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, p_21269_)) { - BlockPos blockpos = this.m_142538_(); + BlockPos blockpos = this.m_20183_(); BlockState blockstate = Blocks.f_50070_.m_49966_(); - if (this.f_19853_.m_8055_(blockpos).m_60795_() && blockstate.m_60710_(this.f_19853_, blockpos)) { + if (this.f_19853_.m_46859_(blockpos) && blockstate.m_60710_(this.f_19853_, blockpos)) { this.f_19853_.m_7731_(blockpos, blockstate, 3); flag = true; } -@@ -1288,12 +_,9 @@ +@@ -1309,12 +_,9 @@ protected void m_6668_(DamageSource p_21192_) { Entity entity = p_21192_.m_7639_(); @@ -217,7 +217,7 @@ boolean flag = this.f_20889_ > 0; if (this.m_6125_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_)) { -@@ -1303,6 +_,10 @@ +@@ -1324,6 +_,10 @@ this.m_5907_(); this.m_21226_(); @@ -228,27 +228,27 @@ } protected void m_5907_() { -@@ -1310,7 +_,8 @@ +@@ -1331,7 +_,8 @@ protected void m_21226_() { - if (this.f_19853_ instanceof ServerLevel && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_))) { -- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), this.m_6552_(this.f_20888_)); -+ int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.f_20888_, this.m_6552_(this.f_20888_)); + if (this.f_19853_ instanceof ServerLevel && !this.m_217046_() && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_))) { +- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), this.m_213860_()); ++ int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.f_20888_, this.m_213860_()); + ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), reward); } } -@@ -1326,7 +_,8 @@ +@@ -1347,7 +_,8 @@ ResourceLocation resourcelocation = this.m_5743_(); - LootTable loottable = this.f_19853_.m_142572_().m_129898_().m_79217_(resourcelocation); + LootTable loottable = this.f_19853_.m_7654_().m_129898_().m_79217_(resourcelocation); LootContext.Builder lootcontext$builder = this.m_7771_(p_21022_, p_21021_); - loottable.m_79148_(lootcontext$builder.m_78975_(LootContextParamSets.f_81415_), this::m_19983_); + LootContext ctx = lootcontext$builder.m_78975_(LootContextParamSets.f_81415_); -+ loottable.m_79129_(ctx).forEach(this::m_19983_); ++ loottable.m_230922_(ctx).forEach(this::m_19983_); } protected LootContext.Builder m_7771_(boolean p_21105_, DamageSource p_21106_) { -@@ -1339,6 +_,11 @@ +@@ -1360,6 +_,11 @@ } public void m_147240_(double p_147241_, double p_147242_, double p_147243_) { @@ -260,9 +260,9 @@ p_147241_ *= 1.0D - this.m_21133_(Attributes.f_22278_); if (!(p_147241_ <= 0.0D)) { this.f_19812_ = true; -@@ -1392,15 +_,9 @@ +@@ -1421,15 +_,9 @@ } else { - BlockPos blockpos = this.m_142538_(); + BlockPos blockpos = this.m_20183_(); BlockState blockstate = this.m_146900_(); - if (blockstate.m_204336_(BlockTags.f_13082_)) { - this.f_20957_ = Optional.of(blockpos); @@ -279,7 +279,7 @@ } } -@@ -1420,6 +_,11 @@ +@@ -1449,6 +_,11 @@ } public boolean m_142535_(float p_147187_, float p_147188_, DamageSource p_147189_) { @@ -291,7 +291,7 @@ boolean flag = super.m_142535_(p_147187_, p_147188_, p_147189_); int i = this.m_5639_(p_147187_, p_147188_); if (i > 0) { -@@ -1443,9 +_,10 @@ +@@ -1472,9 +_,10 @@ int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_() - (double)0.2F); int k = Mth.m_14107_(this.m_20189_()); @@ -304,7 +304,7 @@ this.m_5496_(soundtype.m_56779_(), soundtype.m_56773_() * 0.5F, soundtype.m_56774_() * 0.75F); } -@@ -1493,9 +_,9 @@ +@@ -1522,9 +_,9 @@ float f2 = f1 - p_21194_; if (f2 > 0.0F && f2 < 3.4028235E37F) { if (this instanceof ServerPlayer) { @@ -316,7 +316,7 @@ } } } -@@ -1515,19 +_,22 @@ +@@ -1546,19 +_,22 @@ protected void m_6475_(DamageSource p_21240_, float p_21241_) { if (!this.m_6673_(p_21240_)) { @@ -339,9 +339,9 @@ this.m_21231_().m_19289_(p_21240_, f1, f2); + this.m_21153_(f1 - f2); // Forge: moved to fix MC-121048 this.m_7911_(this.m_6103_() - f2); - this.m_146852_(GameEvent.f_157808_, p_21240_.m_7639_()); + this.m_146850_(GameEvent.f_223706_); } -@@ -1582,6 +_,8 @@ +@@ -1613,6 +_,8 @@ } public void m_21011_(InteractionHand p_21012_, boolean p_21013_) { @@ -350,7 +350,7 @@ if (!this.f_20911_ || this.f_20913_ >= this.m_21304_() / 2 || this.f_20913_ < 0) { this.f_20913_ = -1; this.f_20911_ = true; -@@ -1941,14 +_,15 @@ +@@ -1972,14 +_,15 @@ } this.f_19812_ = true; @@ -368,7 +368,7 @@ } protected float m_6108_() { -@@ -1962,11 +_,15 @@ +@@ -1993,11 +_,15 @@ public void m_7023_(Vec3 p_21280_) { if (this.m_6142_() || this.m_6109_()) { double d0 = 0.08D; @@ -383,9 +383,9 @@ } + d0 = gravity.m_22135_(); - FluidState fluidstate = this.f_19853_.m_6425_(this.m_142538_()); + FluidState fluidstate = this.f_19853_.m_6425_(this.m_20183_()); if (this.m_20069_() && this.m_6129_() && !this.m_203441_(fluidstate)) { -@@ -1991,6 +_,7 @@ +@@ -2022,6 +_,7 @@ f4 = 0.96F; } @@ -393,7 +393,7 @@ this.m_19920_(f5, p_21280_); this.m_6478_(MoverType.SELF, this.m_20184_()); Vec3 vec36 = this.m_20184_(); -@@ -2069,7 +_,7 @@ +@@ -2100,7 +_,7 @@ } } else { BlockPos blockpos = this.m_20099_(); @@ -402,7 +402,7 @@ float f3 = this.f_19861_ ? f2 * 0.91F : 0.91F; Vec3 vec35 = this.m_21074_(p_21280_, f2); double d2 = vec35.f_82480_; -@@ -2145,7 +_,7 @@ +@@ -2176,7 +_,7 @@ double d0 = Mth.m_14008_(p_21298_.f_82479_, (double)-0.15F, (double)0.15F); double d1 = Mth.m_14008_(p_21298_.f_82481_, (double)-0.15F, (double)0.15F); double d2 = Math.max(p_21298_.f_82480_, (double)-0.15F); @@ -411,7 +411,7 @@ d2 = 0.0D; } -@@ -2173,6 +_,7 @@ +@@ -2204,6 +_,7 @@ } public void m_8119_() { @@ -419,7 +419,7 @@ super.m_8119_(); this.m_21329_(); this.m_21333_(); -@@ -2321,6 +_,7 @@ +@@ -2352,6 +_,7 @@ ItemStack itemstack1 = this.m_6844_(equipmentslot); if (!ItemStack.m_41728_(itemstack1, itemstack)) { @@ -427,7 +427,7 @@ if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2544,6 +_,8 @@ +@@ -2575,6 +_,8 @@ boolean flag = this.m_20291_(7); if (flag && !this.f_19861_ && !this.m_20159_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -436,7 +436,7 @@ if (itemstack.m_150930_(Items.f_42741_) && ElytraItem.m_41140_(itemstack)) { flag = true; int i = this.f_20937_ + 1; -@@ -2775,8 +_,16 @@ +@@ -2806,8 +_,16 @@ private void m_21329_() { if (this.m_6117_()) { @@ -455,7 +455,7 @@ this.m_142106_(this.f_20935_); } else { this.m_5810_(); -@@ -2799,7 +_,7 @@ +@@ -2830,7 +_,7 @@ private boolean m_21332_() { int i = this.m_21212_(); @@ -464,7 +464,7 @@ boolean flag = foodproperties != null && foodproperties.m_38748_(); flag |= i <= this.f_20935_.m_41779_() - 7; return flag && i % 4 == 0; -@@ -2829,8 +_,10 @@ +@@ -2860,8 +_,10 @@ public void m_6672_(InteractionHand p_21159_) { ItemStack itemstack = this.m_21120_(p_21159_); if (!itemstack.m_41619_() && !this.m_6117_()) { @@ -476,7 +476,7 @@ if (!this.f_19853_.f_46443_) { this.m_21155_(1, true); this.m_21155_(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -2890,6 +_,9 @@ +@@ -2922,6 +_,9 @@ vec31 = vec31.m_82496_(-this.m_146909_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82524_(-this.m_146908_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82520_(this.m_20185_(), this.m_20188_(), this.m_20189_()); @@ -486,7 +486,7 @@ this.f_19853_.m_7106_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_); } -@@ -2903,7 +_,8 @@ +@@ -2935,7 +_,8 @@ } else { if (!this.f_20935_.m_41619_() && this.m_6117_()) { this.m_21137_(this.f_20935_, 16); @@ -496,7 +496,7 @@ if (itemstack != this.f_20935_) { this.m_21008_(interactionhand, itemstack); } -@@ -2929,7 +_,11 @@ +@@ -2961,7 +_,11 @@ public void m_21253_() { if (!this.f_20935_.m_41619_()) { @@ -508,7 +508,7 @@ if (this.f_20935_.m_41781_()) { this.m_21329_(); } -@@ -3076,8 +_,8 @@ +@@ -3112,8 +_,8 @@ } BlockState blockstate = this.f_19853_.m_8055_(p_21141_); @@ -519,7 +519,7 @@ } this.m_20124_(Pose.SLEEPING); -@@ -3093,15 +_,15 @@ +@@ -3129,15 +_,15 @@ private boolean m_21334_() { return this.m_21257_().map((p_147236_) -> { @@ -538,7 +538,7 @@ Vec3 vec31 = BedBlock.m_49458_(this.m_6095_(), this.f_19853_, p_147228_, this.m_146908_()).orElseGet(() -> { BlockPos blockpos = p_147228_.m_7494_(); return new Vec3((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.1D, (double)blockpos.m_123343_() + 0.5D); -@@ -3123,7 +_,9 @@ +@@ -3159,7 +_,9 @@ @Nullable public Direction m_21259_() { BlockPos blockpos = this.m_21257_().orElse((BlockPos)null); @@ -549,7 +549,7 @@ } public boolean m_5830_() { -@@ -3139,7 +_,7 @@ +@@ -3175,7 +_,7 @@ } public ItemStack m_6298_(ItemStack p_21272_) { @@ -558,16 +558,16 @@ } public ItemStack m_5584_(Level p_21067_, ItemStack p_21068_) { -@@ -3160,7 +_,7 @@ +@@ -3195,7 +_,7 @@ private void m_21063_(ItemStack p_21064_, Level p_21065_, LivingEntity p_21066_) { Item item = p_21064_.m_41720_(); if (item.m_41472_()) { - for(Pair pair : item.m_41473_().m_38749_()) { + for(Pair pair : p_21064_.getFoodProperties(this).m_38749_()) { - if (!p_21065_.f_46443_ && pair.getFirst() != null && p_21065_.f_46441_.nextFloat() < pair.getSecond()) { + if (!p_21065_.f_46443_ && pair.getFirst() != null && p_21065_.f_46441_.m_188501_() < pair.getSecond()) { p_21066_.m_7292_(new MobEffectInstance(pair.getFirst())); } -@@ -3196,6 +_,64 @@ +@@ -3231,6 +_,64 @@ this.m_21166_(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); } @@ -632,7 +632,7 @@ public AABB m_6921_() { if (this.m_6844_(EquipmentSlot.HEAD).m_150930_(Items.f_42683_)) { float f = 0.5F; -@@ -3206,6 +_,8 @@ +@@ -3241,6 +_,8 @@ } public static EquipmentSlot m_147233_(ItemStack p_147234_) { @@ -641,7 +641,7 @@ Item item = p_147234_.m_41720_(); if (!p_147234_.m_150930_(Items.f_42047_) && (!(item instanceof BlockItem) || !(((BlockItem)item).m_40614_() instanceof AbstractSkullBlock))) { if (item instanceof ArmorItem) { -@@ -3213,7 +_,7 @@ +@@ -3248,7 +_,7 @@ } else if (p_147234_.m_150930_(Items.f_42741_)) { return EquipmentSlot.CHEST; } else { diff --git a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch index f79ee304b24..81f0bba7c86 100644 --- a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -206,6 +_,7 @@ +@@ -211,6 +_,7 @@ public void m_6710_(@Nullable LivingEntity p_21544_) { this.f_21362_ = p_21544_; @@ -8,16 +8,18 @@ } public boolean m_6549_(EntityType p_21399_) { -@@ -493,7 +_,7 @@ +@@ -499,9 +_,9 @@ public void m_8107_() { super.m_8107_(); this.f_19853_.m_46473_().m_6180_("looting"); - if (!this.f_19853_.f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { + Vec3i vec3i = this.m_213552_(); + + if (!this.f_19853_.f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { - for(ItemEntity itementity : this.f_19853_.m_45976_(ItemEntity.class, this.m_142469_().m_82377_(1.0D, 0.0D, 1.0D))) { - if (!itementity.m_146910_() && !itementity.m_32055_().m_41619_() && !itementity.m_32063_() && this.m_7243_(itementity.m_32055_())) { + for(ItemEntity itementity : this.f_19853_.m_45976_(ItemEntity.class, this.m_20191_().m_82377_((double)vec3i.m_123341_(), (double)vec3i.m_123342_(), (double)vec3i.m_123343_()))) { + if (!itementity.m_213877_() && !itementity.m_32055_().m_41619_() && !itementity.m_32063_() && this.m_7243_(itementity.m_32055_())) { this.m_7581_(itementity); -@@ -646,6 +_,14 @@ +@@ -657,6 +_,14 @@ this.m_146870_(); } else if (!this.m_21532_() && !this.m_8023_()) { Entity entity = this.f_19853_.m_45930_(this, -1.0D); diff --git a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch index 3335563a427..ec234226546 100644 --- a/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/MobCategory.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/MobCategory.java +++ b/net/minecraft/world/entity/MobCategory.java -@@ -6,7 +_,7 @@ - import java.util.stream.Collectors; +@@ -3,7 +_,7 @@ + import com.mojang.serialization.Codec; import net.minecraft.util.StringRepresentable; -public enum MobCategory implements StringRepresentable { @@ -9,16 +9,17 @@ MONSTER("monster", 70, false, false, 128), CREATURE("creature", 10, true, true, 128), AMBIENT("ambient", 15, true, false, 128), -@@ -16,7 +_,7 @@ +@@ -13,7 +_,8 @@ WATER_AMBIENT("water_ambient", 20, true, false, 64), MISC("misc", -1, true, true, 128); -- public static final Codec f_21584_ = StringRepresentable.m_14350_(MobCategory::values, MobCategory::m_21605_); -+ public static final Codec f_21584_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(MobCategory::values, MobCategory::m_21605_); - private static final Map f_21585_ = Arrays.stream(values()).collect(Collectors.toMap(MobCategory::m_21607_, (p_21604_) -> { - return p_21604_; - })); -@@ -57,6 +_,16 @@ +- public static final Codec f_21584_ = StringRepresentable.m_216439_(MobCategory::values); ++ public static final Codec f_21584_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(MobCategory::values, MobCategory::byName); ++ private static final java.util.Map BY_NAME = java.util.Arrays.stream(values()).collect(java.util.stream.Collectors.toMap(MobCategory::m_21607_, mobCategory -> mobCategory)); + private final int f_21586_; + private final boolean f_21587_; + private final boolean f_21588_; +@@ -47,6 +_,21 @@ public boolean m_21610_() { return this.f_21588_; @@ -31,7 +32,12 @@ + @Override + @Deprecated + public void init() { -+ f_21585_.put(this.m_21607_(), this); ++ BY_NAME.put(this.m_21607_(), this); ++ } ++ ++ // Forge: Access enum members by name ++ public static MobCategory byName(String name) { ++ return BY_NAME.get(name); } public int m_21611_() { diff --git a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch index 6d8eda003b2..191cd28aa6a 100644 --- a/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/SpawnPlacements.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java -@@ -153,10 +_,26 @@ - boolean m_21780_(EntityType p_21781_, ServerLevelAccessor p_21782_, MobSpawnType p_21783_, BlockPos p_21784_, Random p_21785_); +@@ -156,10 +_,26 @@ + boolean m_217080_(EntityType p_217081_, ServerLevelAccessor p_217082_, MobSpawnType p_217083_, BlockPos p_217084_, RandomSource p_217085_); } - public static enum Type { diff --git a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch index 9dbafaa6b2a..6ff6bc62e3d 100644 --- a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java -@@ -197,11 +_,15 @@ +@@ -196,11 +_,15 @@ } public void m_6667_(DamageSource p_21809_) { @@ -9,9 +9,9 @@ + super.m_6667_(p_21809_); + + if (this.f_20890_) - if (!this.f_19853_.f_46443_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_) && this.m_142480_() instanceof ServerPlayer) { -- this.m_142480_().m_6352_(this.m_21231_().m_19293_(), Util.f_137441_); -+ this.m_142480_().m_6352_(deathMessage, Util.f_137441_); + if (!this.f_19853_.f_46443_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_) && this.m_21826_() instanceof ServerPlayer) { +- this.m_21826_().m_213846_(this.m_21231_().m_19293_()); ++ this.m_21826_().m_213846_(deathMessage); } - super.m_6667_(p_21809_); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/attributes/Attribute.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/attributes/Attribute.java.patch deleted file mode 100644 index fa71871905c..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/ai/attributes/Attribute.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/entity/ai/attributes/Attribute.java -+++ b/net/minecraft/world/entity/ai/attributes/Attribute.java -@@ -1,6 +_,6 @@ - package net.minecraft.world.entity.ai.attributes; - --public class Attribute { -+public class Attribute extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final int f_147357_ = 64; - private final double f_22076_; - private boolean f_22077_; diff --git a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch index 15f13c9a667..dd004d319cc 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -77,11 +_,12 @@ - private static final Map, AttributeSupplier> f_22294_ = ImmutableMap., AttributeSupplier>builder().put(EntityType.f_20529_, LivingEntity.m_21183_().m_22265_()).put(EntityType.f_147039_, Axolotl.m_149176_().m_22265_()).put(EntityType.f_20549_, Bat.m_27455_().m_22265_()).put(EntityType.f_20550_, Bee.m_27858_().m_22265_()).put(EntityType.f_20551_, Blaze.m_32238_().m_22265_()).put(EntityType.f_20553_, Cat.m_28168_().m_22265_()).put(EntityType.f_20554_, CaveSpider.m_32267_().m_22265_()).put(EntityType.f_20555_, Chicken.m_28263_().m_22265_()).put(EntityType.f_20556_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20557_, Cow.m_28307_().m_22265_()).put(EntityType.f_20558_, Creeper.m_32318_().m_22265_()).put(EntityType.f_20559_, Dolphin.m_28379_().m_22265_()).put(EntityType.f_20560_, AbstractChestedHorse.m_30501_().m_22265_()).put(EntityType.f_20562_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20563_, ElderGuardian.m_32471_().m_22265_()).put(EntityType.f_20566_, EnderMan.m_32541_().m_22265_()).put(EntityType.f_20567_, Endermite.m_32619_().m_22265_()).put(EntityType.f_20565_, EnderDragon.m_31167_().m_22265_()).put(EntityType.f_20568_, Evoker.m_32657_().m_22265_()).put(EntityType.f_20452_, Fox.m_28553_().m_22265_()).put(EntityType.f_20453_, Ghast.m_32752_().m_22265_()).put(EntityType.f_20454_, Giant.m_32796_().m_22265_()).put(EntityType.f_147034_, GlowSquid.m_29988_().m_22265_()).put(EntityType.f_147035_, Goat.m_149401_().m_22265_()).put(EntityType.f_20455_, Guardian.m_32853_().m_22265_()).put(EntityType.f_20456_, Hoglin.m_34551_().m_22265_()).put(EntityType.f_20457_, AbstractHorse.m_30627_().m_22265_()).put(EntityType.f_20458_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20459_, Illusioner.m_32931_().m_22265_()).put(EntityType.f_20460_, IronGolem.m_28883_().m_22265_()).put(EntityType.f_20466_, Llama.m_30824_().m_22265_()).put(EntityType.f_20468_, MagmaCube.m_33000_().m_22265_()).put(EntityType.f_20504_, Cow.m_28307_().m_22265_()).put(EntityType.f_20503_, AbstractChestedHorse.m_30501_().m_22265_()).put(EntityType.f_20505_, Ocelot.m_29036_().m_22265_()).put(EntityType.f_20507_, Panda.m_29157_().m_22265_()).put(EntityType.f_20508_, Parrot.m_29438_().m_22265_()).put(EntityType.f_20509_, Monster.m_33035_().m_22265_()).put(EntityType.f_20510_, Pig.m_29503_().m_22265_()).put(EntityType.f_20511_, Piglin.m_34770_().m_22265_()).put(EntityType.f_20512_, PiglinBrute.m_35075_().m_22265_()).put(EntityType.f_20513_, Pillager.m_33307_().m_22265_()).put(EntityType.f_20532_, Player.m_36340_().m_22265_()).put(EntityType.f_20514_, PolarBear.m_29560_().m_22265_()).put(EntityType.f_20516_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20517_, Rabbit.m_29717_().m_22265_()).put(EntityType.f_20518_, Ravager.m_33371_().m_22265_()).put(EntityType.f_20519_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20520_, Sheep.m_29873_().m_22265_()).put(EntityType.f_20521_, Shulker.m_33477_().m_22265_()).put(EntityType.f_20523_, Silverfish.m_33551_().m_22265_()).put(EntityType.f_20524_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20525_, SkeletonHorse.m_30918_().m_22265_()).put(EntityType.f_20526_, Monster.m_33035_().m_22265_()).put(EntityType.f_20528_, SnowGolem.m_29934_().m_22265_()).put(EntityType.f_20479_, Spider.m_33815_().m_22265_()).put(EntityType.f_20480_, Squid.m_29988_().m_22265_()).put(EntityType.f_20481_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20482_, Strider.m_33937_().m_22265_()).put(EntityType.f_20488_, Llama.m_30824_().m_22265_()).put(EntityType.f_20489_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20490_, Turtle.m_30207_().m_22265_()).put(EntityType.f_20491_, Vex.m_34040_().m_22265_()).put(EntityType.f_20492_, Villager.m_35503_().m_22265_()).put(EntityType.f_20493_, Vindicator.m_34104_().m_22265_()).put(EntityType.f_20494_, Mob.m_21552_().m_22265_()).put(EntityType.f_20495_, Witch.m_34155_().m_22265_()).put(EntityType.f_20496_, WitherBoss.m_31501_().m_22265_()).put(EntityType.f_20497_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20499_, Wolf.m_30425_().m_22265_()).put(EntityType.f_20500_, Zoglin.m_34257_().m_22265_()).put(EntityType.f_20501_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20502_, ZombieHorse.m_31008_().m_22265_()).put(EntityType.f_20530_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20531_, ZombifiedPiglin.m_34470_().m_22265_()).build(); +@@ -81,11 +_,12 @@ + private static final Map, AttributeSupplier> f_22294_ = ImmutableMap., AttributeSupplier>builder().put(EntityType.f_217014_, Allay.m_218388_().m_22265_()).put(EntityType.f_20529_, LivingEntity.m_21183_().m_22265_()).put(EntityType.f_147039_, Axolotl.m_149176_().m_22265_()).put(EntityType.f_20549_, Bat.m_27455_().m_22265_()).put(EntityType.f_20550_, Bee.m_27858_().m_22265_()).put(EntityType.f_20551_, Blaze.m_32238_().m_22265_()).put(EntityType.f_20553_, Cat.m_28168_().m_22265_()).put(EntityType.f_20554_, CaveSpider.m_32267_().m_22265_()).put(EntityType.f_20555_, Chicken.m_28263_().m_22265_()).put(EntityType.f_20556_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20557_, Cow.m_28307_().m_22265_()).put(EntityType.f_20558_, Creeper.m_32318_().m_22265_()).put(EntityType.f_20559_, Dolphin.m_28379_().m_22265_()).put(EntityType.f_20560_, AbstractChestedHorse.m_30501_().m_22265_()).put(EntityType.f_20562_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20563_, ElderGuardian.m_32471_().m_22265_()).put(EntityType.f_20566_, EnderMan.m_32541_().m_22265_()).put(EntityType.f_20567_, Endermite.m_32619_().m_22265_()).put(EntityType.f_20565_, EnderDragon.m_31167_().m_22265_()).put(EntityType.f_20568_, Evoker.m_32657_().m_22265_()).put(EntityType.f_20452_, Fox.m_28553_().m_22265_()).put(EntityType.f_217012_, Frog.m_218525_().m_22265_()).put(EntityType.f_20453_, Ghast.m_32752_().m_22265_()).put(EntityType.f_20454_, Giant.m_32796_().m_22265_()).put(EntityType.f_147034_, GlowSquid.m_29988_().m_22265_()).put(EntityType.f_147035_, Goat.m_149401_().m_22265_()).put(EntityType.f_20455_, Guardian.m_32471_().m_22265_()).put(EntityType.f_20456_, Hoglin.m_34551_().m_22265_()).put(EntityType.f_20457_, AbstractHorse.m_30627_().m_22265_()).put(EntityType.f_20458_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20459_, Illusioner.m_32931_().m_22265_()).put(EntityType.f_20460_, IronGolem.m_28883_().m_22265_()).put(EntityType.f_20466_, Llama.m_30824_().m_22265_()).put(EntityType.f_20468_, MagmaCube.m_33000_().m_22265_()).put(EntityType.f_20504_, Cow.m_28307_().m_22265_()).put(EntityType.f_20503_, AbstractChestedHorse.m_30501_().m_22265_()).put(EntityType.f_20505_, Ocelot.m_29036_().m_22265_()).put(EntityType.f_20507_, Panda.m_29157_().m_22265_()).put(EntityType.f_20508_, Parrot.m_29438_().m_22265_()).put(EntityType.f_20509_, Monster.m_33035_().m_22265_()).put(EntityType.f_20510_, Pig.m_29503_().m_22265_()).put(EntityType.f_20511_, Piglin.m_34770_().m_22265_()).put(EntityType.f_20512_, PiglinBrute.m_35075_().m_22265_()).put(EntityType.f_20513_, Pillager.m_33307_().m_22265_()).put(EntityType.f_20532_, Player.m_36340_().m_22265_()).put(EntityType.f_20514_, PolarBear.m_29560_().m_22265_()).put(EntityType.f_20516_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20517_, Rabbit.m_29717_().m_22265_()).put(EntityType.f_20518_, Ravager.m_33371_().m_22265_()).put(EntityType.f_20519_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20520_, Sheep.m_29873_().m_22265_()).put(EntityType.f_20521_, Shulker.m_33477_().m_22265_()).put(EntityType.f_20523_, Silverfish.m_33551_().m_22265_()).put(EntityType.f_20524_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20525_, SkeletonHorse.m_30918_().m_22265_()).put(EntityType.f_20526_, Monster.m_33035_().m_22265_()).put(EntityType.f_20528_, SnowGolem.m_29934_().m_22265_()).put(EntityType.f_20479_, Spider.m_33815_().m_22265_()).put(EntityType.f_20480_, Squid.m_29988_().m_22265_()).put(EntityType.f_20481_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20482_, Strider.m_33937_().m_22265_()).put(EntityType.f_217013_, Tadpole.m_27495_().m_22265_()).put(EntityType.f_20488_, Llama.m_30824_().m_22265_()).put(EntityType.f_20489_, AbstractFish.m_27495_().m_22265_()).put(EntityType.f_20490_, Turtle.m_30207_().m_22265_()).put(EntityType.f_20491_, Vex.m_34040_().m_22265_()).put(EntityType.f_20492_, Villager.m_35503_().m_22265_()).put(EntityType.f_20493_, Vindicator.m_34104_().m_22265_()).put(EntityType.f_217015_, Warden.m_219463_().m_22265_()).put(EntityType.f_20494_, Mob.m_21552_().m_22265_()).put(EntityType.f_20495_, Witch.m_34155_().m_22265_()).put(EntityType.f_20496_, WitherBoss.m_31501_().m_22265_()).put(EntityType.f_20497_, AbstractSkeleton.m_32166_().m_22265_()).put(EntityType.f_20499_, Wolf.m_30425_().m_22265_()).put(EntityType.f_20500_, Zoglin.m_34257_().m_22265_()).put(EntityType.f_20501_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20502_, ZombieHorse.m_31008_().m_22265_()).put(EntityType.f_20530_, Zombie.m_34328_().m_22265_()).put(EntityType.f_20531_, ZombifiedPiglin.m_34328_().m_22265_()).build(); public static AttributeSupplier m_22297_(EntityType p_22298_) { - return f_22294_.get(p_22298_); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch index 8b9b2ba1796..f47297f2283 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java +++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java -@@ -38,7 +_,7 @@ +@@ -39,7 +_,7 @@ } protected boolean m_6114_(ServerLevel p_23174_, Villager p_23175_) { @@ -9,9 +9,9 @@ return false; } else if (p_23175_.m_7141_().m_35571_() != VillagerProfession.f_35590_) { return false; -@@ -118,6 +_,11 @@ - } else if (itemstack.m_150930_(Items.f_42733_)) { - p_23196_.m_7731_(this.f_23159_, Blocks.f_50444_.m_49966_(), 3); +@@ -127,6 +_,11 @@ + p_23196_.m_46597_(this.f_23159_, blockstate4); + p_23196_.m_220407_(GameEvent.f_157797_, this.f_23159_, GameEvent.Context.m_223719_(p_23197_, blockstate4)); flag = true; + } else if (itemstack.m_41720_() instanceof net.minecraftforge.common.IPlantable) { + if (((net.minecraftforge.common.IPlantable)itemstack.m_41720_()).getPlantType(p_23196_, f_23159_) == net.minecraftforge.common.PlantType.CROP) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch index a2dd305f6f4..a8c72f7191d 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/ai/control/MoveControl.java +++ b/net/minecraft/world/entity/ai/control/MoveControl.java @@ -99,7 +_,7 @@ - BlockPos blockpos = this.f_24974_.m_142538_(); + BlockPos blockpos = this.f_24974_.m_20183_(); BlockState blockstate = this.f_24974_.f_19853_.m_8055_(blockpos); VoxelShape voxelshape = blockstate.m_60812_(this.f_24974_.f_19853_, blockpos); - if (d2 > (double)this.f_24974_.f_19793_ && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.f_24974_.m_20205_()) || !voxelshape.m_83281_() && this.f_24974_.m_20186_() < voxelshape.m_83297_(Direction.Axis.Y) + (double)blockpos.m_123342_() && !blockstate.m_204336_(BlockTags.f_13103_) && !blockstate.m_204336_(BlockTags.f_13039_)) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch index 7cd7c071c23..91bcc7b0fcb 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java -@@ -61,7 +_,7 @@ +@@ -60,7 +_,7 @@ if (this.f_25204_ == this.m_183277_(4)) { - BlockPos blockpos = this.f_25202_.m_142538_(); + BlockPos blockpos = this.f_25202_.m_20183_(); if (f_25201_.test(this.f_25203_.m_8055_(blockpos))) { - if (this.f_25203_.m_46469_().m_46207_(GameRules.f_46132_)) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25203_, this.f_25202_)) { this.f_25203_.m_46961_(blockpos, false); } -@@ -70,7 +_,7 @@ +@@ -68,7 +_,7 @@ } else { BlockPos blockpos1 = blockpos.m_7495_(); if (this.f_25203_.m_8055_(blockpos1).m_60713_(Blocks.f_50440_)) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch index 00ea5e18a57..377c94efcc2 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch @@ -16,7 +16,7 @@ + if (canPenalize) { + if (--this.f_25547_ <= 0) { + this.f_25543_ = this.f_25540_.m_21573_().m_6570_(livingentity, 0); -+ this.f_25547_ = 4 + this.f_25540_.m_21187_().nextInt(7); ++ this.f_25547_ = 4 + this.f_25540_.m_217043_().m_188503_(7); + return this.f_25543_ != null; + } else { + return true; @@ -28,7 +28,7 @@ @@ -98,6 +_,18 @@ this.f_25545_ = livingentity.m_20186_(); this.f_25546_ = livingentity.m_20189_(); - this.f_25547_ = 4 + this.f_25540_.m_21187_().nextInt(7); + this.f_25547_ = 4 + this.f_25540_.m_217043_().m_188503_(7); + if (this.canPenalize) { + this.f_25547_ += failedPathFindingPenalty; + if (this.f_25540_.m_21573_().m_26570_() != null) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch index 2f752e2370d..a1debffc383 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch @@ -4,8 +4,8 @@ if (entity instanceof Player) { int i = this.f_25884_.m_30624_(); int j = this.f_25884_.m_7555_(); -- if (j > 0 && this.f_25884_.m_21187_().nextInt(j) < i) { -+ if (j > 0 && this.f_25884_.m_21187_().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(f_25884_, (Player)entity)) { +- if (j > 0 && this.f_25884_.m_217043_().m_188503_(j) < i) { ++ if (j > 0 && this.f_25884_.m_217043_().m_188503_(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(f_25884_, (Player)entity)) { this.f_25884_.m_30637_((Player)entity); return; } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/memory/MemoryModuleType.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/memory/MemoryModuleType.java.patch deleted file mode 100644 index 3998bb3b58f..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/ai/memory/MemoryModuleType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/ai/memory/MemoryModuleType.java -+++ b/net/minecraft/world/entity/ai/memory/MemoryModuleType.java -@@ -23,7 +_,7 @@ - import net.minecraft.world.level.pathfinder.Path; - import net.minecraft.world.phys.Vec3; - --public class MemoryModuleType { -+public class MemoryModuleType extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final MemoryModuleType f_26349_ = m_26388_("dummy"); - public static final MemoryModuleType f_26359_ = m_26390_("home", GlobalPos.f_122633_); - public static final MemoryModuleType f_26360_ = m_26390_("job_site", GlobalPos.f_122633_); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch index 0627cb0f220..88d2a14113a 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -225,10 +_,10 @@ +@@ -227,10 +_,10 @@ Vec3 vec3 = this.m_7475_(); this.f_26505_ = this.f_26494_.m_20205_() > 0.75F ? this.f_26494_.m_20205_() / 2.0F : 0.75F - this.f_26494_.m_20205_() / 2.0F; Vec3i vec3i = this.f_26496_.m_77400_(); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/sensing/SensorType.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/sensing/SensorType.java.patch deleted file mode 100644 index a733b975b24..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/ai/sensing/SensorType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/ai/sensing/SensorType.java -+++ b/net/minecraft/world/entity/ai/sensing/SensorType.java -@@ -6,7 +_,7 @@ - import net.minecraft.world.entity.animal.axolotl.AxolotlAi; - import net.minecraft.world.entity.animal.goat.GoatAi; - --public class SensorType> { -+public class SensorType> extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final SensorType f_26809_ = m_26828_("dummy", DummySensor::new); - public static final SensorType f_26810_ = m_26828_("nearest_items", NearestItemSensor::new); - public static final SensorType f_26811_ = m_26828_("nearest_living_entities", NearestLivingEntitySensor::new); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch index 98db7e8d4b8..3c95a94834c 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/VillageSiege.java.patch @@ -17,6 +17,6 @@ try { - zombie = new Zombie(p_27017_); + zombie = EntityType.f_20501_.m_20615_(p_27017_); //Forge: Direct Initialization is deprecated, use EntityType. - zombie.m_6518_(p_27017_, p_27017_.m_6436_(zombie.m_142538_()), MobSpawnType.EVENT, (SpawnGroupData)null, (CompoundTag)null); + zombie.m_6518_(p_27017_, p_27017_.m_6436_(zombie.m_20183_()), MobSpawnType.EVENT, (SpawnGroupData)null, (CompoundTag)null); } catch (Exception exception) { f_26997_.warn("Failed to create zombie for village siege at {}", vec3, exception); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiType.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiType.java.patch deleted file mode 100644 index b591fcd16d3..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiType.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/net/minecraft/world/entity/ai/village/poi/PoiType.java -+++ b/net/minecraft/world/entity/ai/village/poi/PoiType.java -@@ -21,7 +_,7 @@ - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.block.state.properties.BedPart; - --public class PoiType { -+public class PoiType extends net.minecraftforge.registries.ForgeRegistryEntry { - private static final Supplier> f_27353_ = Suppliers.memoize(() -> { - return Registry.f_122869_.m_123024_().map(VillagerProfession::m_35622_).collect(Collectors.toSet()); - }); -@@ -39,7 +_,7 @@ - private static final Set f_148686_ = ImmutableList.of(Blocks.f_50256_, Blocks.f_152477_, Blocks.f_152476_, Blocks.f_152478_).stream().flatMap((p_148697_) -> { - return p_148697_.m_49965_().m_61056_().stream(); - }).collect(ImmutableSet.toImmutableSet()); -- private static final Map f_27323_ = Maps.newHashMap(); -+ private static final Map f_27323_ = net.minecraftforge.registries.GameData.getBlockStatePointOfInterestTypeMap(); - public static final PoiType f_27331_ = m_27379_("unemployed", ImmutableSet.of(), 1, f_27329_, 1); - public static final PoiType f_27332_ = m_27374_("armorer", m_27372_(Blocks.f_50620_), 1, 1); - public static final PoiType f_27333_ = m_27374_("butcher", m_27372_(Blocks.f_50619_), 1, 1); -@@ -124,16 +_,14 @@ - } - - private static PoiType m_27367_(PoiType p_27368_) { -- p_27368_.f_27325_.forEach((p_148691_) -> { -- PoiType poitype = f_27323_.put(p_148691_, p_27368_); -- if (poitype != null) { -- throw (IllegalStateException)Util.m_137570_(new IllegalStateException(String.format("%s is defined in too many tags", p_148691_))); -- } -- }); - return p_27368_; - } - - public static Optional m_27390_(BlockState p_27391_) { - return Optional.ofNullable(f_27323_.get(p_27391_)); -+ } -+ -+ public ImmutableSet getBlockStates() { -+ return ImmutableSet.copyOf(this.f_27325_); - } - } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch new file mode 100644 index 00000000000..7eb4bffc006 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/ai/village/poi/PoiTypes.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/world/entity/ai/village/poi/PoiTypes.java ++++ b/net/minecraft/world/entity/ai/village/poi/PoiTypes.java +@@ -47,8 +_,9 @@ + private static final Set f_218069_ = ImmutableList.of(Blocks.f_50256_, Blocks.f_152477_, Blocks.f_152476_, Blocks.f_152478_).stream().flatMap((p_218093_) -> { + return p_218093_.m_49965_().m_61056_().stream(); + }).collect(ImmutableSet.toImmutableSet()); +- private static final Map> f_218070_ = Maps.newHashMap(); +- protected static final Set f_218067_ = new ObjectOpenHashSet<>(f_218070_.keySet()); ++ // Forge: We patch these 2 fields to support modded entries ++ private static final Map f_218070_ = net.minecraftforge.registries.GameData.getBlockStatePointOfInterestTypeMap(); ++ protected static final Set f_218067_ = f_218070_.keySet(); + + private static Set m_218073_(Block p_218074_) { + return ImmutableSet.copyOf(p_218074_.m_49965_().m_61056_()); +@@ -66,16 +_,10 @@ + } + + private static void m_218077_(Holder p_218078_) { +- p_218078_.m_203334_().f_27325_().forEach((p_218081_) -> { +- Holder holder = f_218070_.put(p_218081_, p_218078_); +- if (holder != null) { +- throw (IllegalStateException)Util.m_137570_(new IllegalStateException(String.format("%s is defined in more than one PoI type", p_218081_))); +- } +- }); + } + + public static Optional> m_218075_(BlockState p_218076_) { +- return Optional.ofNullable(f_218070_.get(p_218076_)); ++ return Optional.ofNullable(f_218070_.get(p_218076_)).flatMap(net.minecraftforge.registries.ForgeRegistries.POI_TYPES::getHolder); + } + + public static PoiType m_218082_(Registry p_218083_) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch index 0efb6ac179c..b4ecacfa7c1 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Animal.java +++ b/net/minecraft/world/entity/animal/Animal.java -@@ -208,6 +_,17 @@ +@@ -205,6 +_,17 @@ public void m_27563_(ServerLevel p_27564_, Animal p_27565_) { AgeableMob ageablemob = this.m_142606_(p_27564_, p_27565_); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch index b8e294d9707..24de0286774 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java -@@ -471,7 +_,7 @@ +@@ -472,7 +_,7 @@ return false; } else { BlockEntity blockentity = this.f_19853_.m_7702_(this.f_27698_); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch index 88dde64765e..b2fd6b0788f 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java -@@ -400,7 +_,7 @@ +@@ -366,7 +_,7 @@ if (!(item instanceof DyeItem)) { if (item.m_41472_() && this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) { this.m_142075_(p_28153_, p_28154_, itemstack); @@ -9,12 +9,12 @@ return InteractionResult.CONSUME; } -@@ -425,7 +_,7 @@ +@@ -391,7 +_,7 @@ } } else if (this.m_6898_(itemstack)) { this.m_142075_(p_28153_, p_28154_, itemstack); -- if (this.f_19796_.nextInt(3) == 0) { -+ if (this.f_19796_.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_28153_)) { +- if (this.f_19796_.m_188503_(3) == 0) { ++ if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_28153_)) { this.m_21828_(p_28153_); this.m_21839_(true); this.f_19853_.m_7605_(this, (byte)7); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch index 2f94f28ad1f..8d79817b098 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Fox.java +++ b/net/minecraft/world/entity/animal/Fox.java -@@ -649,13 +_,16 @@ +@@ -648,13 +_,16 @@ } protected void m_6668_(DamageSource p_28536_) { @@ -18,7 +18,7 @@ } public static boolean m_28471_(Fox p_28472_, LivingEntity p_28473_) { -@@ -805,6 +_,17 @@ +@@ -804,6 +_,17 @@ protected void m_8026_() { ServerLevel serverlevel = (ServerLevel)this.f_25114_; Fox fox = (Fox)this.f_25113_.m_142606_(serverlevel, this.f_25115_); @@ -36,7 +36,7 @@ if (fox != null) { ServerPlayer serverplayer = this.f_25113_.m_27592_(); ServerPlayer serverplayer1 = this.f_25115_.m_27592_(); -@@ -876,7 +_,7 @@ +@@ -875,7 +_,7 @@ } protected void m_28686_() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch index 7af7eb13b98..310d5d4c517 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java -@@ -120,9 +_,10 @@ +@@ -119,9 +_,10 @@ int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_() - (double)0.2F); int k = Mth.m_14107_(this.m_20189_()); @@ -8,8 +8,8 @@ + BlockPos pos = new BlockPos(i, j, k); + BlockState blockstate = this.f_19853_.m_8055_(pos); if (!blockstate.m_60795_()) { -- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + ((double)this.f_19796_.nextFloat() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.nextFloat() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.nextFloat() - 0.5D), 0.5D, ((double)this.f_19796_.nextFloat() - 0.5D) * 4.0D); -+ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(pos), this.m_20185_() + ((double)this.f_19796_.nextFloat() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.nextFloat() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.nextFloat() - 0.5D), 0.5D, ((double)this.f_19796_.nextFloat() - 0.5D) * 4.0D); +- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.m_188501_() - 0.5D), 0.5D, ((double)this.f_19796_.m_188501_() - 0.5D) * 4.0D); ++ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(pos), this.m_20185_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.m_188501_() - 0.5D), 0.5D, ((double)this.f_19796_.m_188501_() - 0.5D) * 4.0D); } } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch index 74121160824..fcc9497394e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch @@ -23,7 +23,7 @@ } + @Override -+ public java.util.List onSheared(@javax.annotation.Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) { ++ public java.util.List onSheared(@org.jetbrains.annotations.Nullable Player player, @org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos, int fortune) { + this.m_146852_(GameEvent.f_157781_, player); + return shearInternal(player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS); + } @@ -54,7 +54,7 @@ @@ -182,6 +_,7 @@ p_28944_.m_128359_("Type", this.m_28955_().f_28960_); if (this.f_28909_ != null) { - p_28944_.m_128344_("EffectId", (byte)MobEffect.m_19459_(this.f_28909_)); + p_28944_.m_128405_("EffectId", MobEffect.m_19459_(this.f_28909_)); + net.minecraftforge.common.ForgeHooks.saveMobEffect(p_28944_, "forge:effect_id", this.f_28909_); p_28944_.m_128405_("EffectDuration", this.f_28910_); } @@ -62,7 +62,7 @@ @@ -192,6 +_,7 @@ this.m_28928_(MushroomCow.MushroomType.m_28976_(p_28936_.m_128461_("Type"))); if (p_28936_.m_128425_("EffectId", 1)) { - this.f_28909_ = MobEffect.m_19453_(p_28936_.m_128445_("EffectId")); + this.f_28909_ = MobEffect.m_19453_(p_28936_.m_128451_("EffectId")); + this.f_28909_ = net.minecraftforge.common.ForgeHooks.loadMobEffect(p_28936_, "forge:effect_id", this.f_28909_); } @@ -74,7 +74,7 @@ + } + + @Override -+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos) { ++ public boolean isShearable(@org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos) { + return m_6220_(); } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch index 3834dd4950f..b72623eb00e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch @@ -4,8 +4,8 @@ if ((this.f_28984_ == null || this.f_28984_.m_25955_()) && !this.m_29038_() && this.m_6898_(itemstack) && p_29021_.m_20280_(this) < 9.0D) { this.m_142075_(p_29021_, p_29022_, itemstack); if (!this.f_19853_.f_46443_) { -- if (this.f_19796_.nextInt(3) == 0) { -+ if (this.f_19796_.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29021_)) { +- if (this.f_19796_.m_188503_(3) == 0) { ++ if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29021_)) { this.m_29045_(true); this.m_29047_(true); this.f_19853_.m_7605_(this, (byte)41); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch index c6956a73773..7f3d64cc9d5 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/Parrot.java +++ b/net/minecraft/world/entity/animal/Parrot.java -@@ -240,7 +_,7 @@ +@@ -241,7 +_,7 @@ } if (!this.f_19853_.f_46443_) { -- if (this.f_19796_.nextInt(10) == 0) { -+ if (this.f_19796_.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29414_)) { +- if (this.f_19796_.m_188503_(10) == 0) { ++ if (this.f_19796_.m_188503_(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29414_)) { this.m_21828_(p_29414_); this.f_19853_.m_7605_(this, (byte)7); } else { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Pig.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Pig.java.patch index 8e380b333d5..db6195b185d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Pig.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Pig.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Pig.java +++ b/net/minecraft/world/entity/animal/Pig.java -@@ -201,7 +_,7 @@ +@@ -200,7 +_,7 @@ } public void m_8038_(ServerLevel p_29473_, LightningBolt p_29474_) { @@ -9,7 +9,7 @@ ZombifiedPiglin zombifiedpiglin = EntityType.f_20531_.m_20615_(p_29473_); zombifiedpiglin.m_8061_(EquipmentSlot.MAINHAND, new ItemStack(Items.f_42430_)); zombifiedpiglin.m_7678_(this.m_20185_(), this.m_20186_(), this.m_20189_(), this.m_146908_(), this.m_146909_()); -@@ -213,6 +_,7 @@ +@@ -212,6 +_,7 @@ } zombifiedpiglin.m_21530_(); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch index 591314a3c1f..c705cf9062e 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Rabbit.java +++ b/net/minecraft/world/entity/animal/Rabbit.java -@@ -510,7 +_,7 @@ +@@ -511,7 +_,7 @@ public boolean m_8036_() { if (this.f_25600_ <= 0) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch index b80ccce1f6f..b2f2b5f6093 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch @@ -18,25 +18,25 @@ if (!this.f_19853_.f_46443_ && this.m_6220_()) { this.m_5851_(SoundSource.PLAYERS); this.m_146852_(GameEvent.f_157781_, p_29853_); -@@ -357,5 +_,28 @@ +@@ -362,5 +_,28 @@ protected float m_6431_(Pose p_29850_, EntityDimensions p_29851_) { return 0.95F * p_29851_.f_20378_; + } + + @Override -+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos) { ++ public boolean isShearable(@org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos) { + return m_6220_(); + } + -+ @javax.annotation.Nonnull ++ @org.jetbrains.annotations.NotNull + @Override -+ public java.util.List onSheared(@Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) { ++ public java.util.List onSheared(@Nullable Player player, @org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos, int fortune) { + world.m_6269_(null, this, SoundEvents.f_12344_, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F); + this.m_146852_(GameEvent.f_157781_, player); + if (!world.f_46443_) { + this.m_29878_(true); -+ int i = 1 + this.f_19796_.nextInt(3); ++ int i = 1 + this.f_19796_.m_188503_(3); + + java.util.List items = new java.util.ArrayList<>(); + for (int j = 0; j < i; ++j) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch index c6af29be11a..4e44d76da69 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch @@ -25,9 +25,9 @@ - if (this.f_19853_.m_8055_(blockpos1).m_60795_() && blockstate.m_60710_(this.f_19853_, blockpos1)) { + if (this.f_19853_.m_46859_(blockpos1) && blockstate.m_60710_(this.f_19853_, blockpos1)) { this.f_19853_.m_46597_(blockpos1, blockstate); + this.f_19853_.m_220407_(GameEvent.f_157797_, blockpos1, GameEvent.Context.m_223719_(this, blockstate)); } - } -@@ -134,7 +_,7 @@ +@@ -135,7 +_,7 @@ protected InteractionResult m_6071_(Player p_29920_, InteractionHand p_29921_) { ItemStack itemstack = p_29920_.m_21120_(p_29921_); @@ -36,20 +36,20 @@ this.m_5851_(SoundSource.PLAYERS); this.m_146852_(GameEvent.f_157781_, p_29920_); if (!this.f_19853_.f_46443_) { -@@ -193,5 +_,22 @@ +@@ -194,5 +_,22 @@ public Vec3 m_7939_() { return new Vec3(0.0D, (double)(0.75F * this.m_20192_()), (double)(this.m_20205_() * 0.4F)); + } + + @Override -+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos) { ++ public boolean isShearable(@org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos) { + return m_6220_(); + } + -+ @javax.annotation.Nonnull ++ @org.jetbrains.annotations.NotNull + @Override -+ public java.util.List onSheared(@Nullable Player player, @javax.annotation.Nonnull ItemStack item, Level world, BlockPos pos, int fortune) { ++ public java.util.List onSheared(@Nullable Player player, @org.jetbrains.annotations.NotNull ItemStack item, Level world, BlockPos pos, int fortune) { + world.m_6269_(null, this, SoundEvents.f_12480_, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 1.0F); + this.m_146852_(GameEvent.f_157781_, player); + if (!world.m_5776_()) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch index 4fcf6575db5..1423ba31d03 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,24 +1,25 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -329,7 +_,7 @@ +@@ -329,7 +_,8 @@ itemstack.m_41774_(1); } - this.m_5634_((float)item.m_41473_().m_38744_()); + this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); - this.m_146859_(GameEvent.f_157771_, this.m_146901_()); ++ this.m_146852_(GameEvent.f_157806_, this); return InteractionResult.SUCCESS; } -@@ -361,7 +_,7 @@ + +@@ -360,7 +_,7 @@ itemstack.m_41774_(1); } -- if (this.f_19796_.nextInt(3) == 0) { -+ if (this.f_19796_.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_30412_)) { +- if (this.f_19796_.m_188503_(3) == 0) { ++ if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_30412_)) { this.m_21828_(p_30412_); this.f_21344_.m_26573_(); this.m_6710_((LivingEntity)null); -@@ -401,7 +_,7 @@ +@@ -400,7 +_,7 @@ public boolean m_6898_(ItemStack p_30440_) { Item item = p_30440_.m_41720_(); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index d141ecb194d..ca25d3a4112 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -288,6 +_,7 @@ +@@ -290,6 +_,7 @@ this.f_30520_.m_19164_(this); this.m_7493_(); @@ -8,7 +8,7 @@ } protected void m_7493_() { -@@ -346,9 +_,9 @@ +@@ -348,9 +_,9 @@ protected void m_7355_(BlockPos p_30584_, BlockState p_30585_) { if (!p_30585_.m_60767_().m_76332_()) { BlockState blockstate = this.f_19853_.m_8055_(p_30584_.m_7494_()); @@ -20,7 +20,7 @@ } if (this.m_20160_() && this.f_30523_) { -@@ -700,6 +_,7 @@ +@@ -702,6 +_,7 @@ this.m_20334_(vec3.f_82479_, d1, vec3.f_82481_); this.m_30655_(true); this.f_19812_ = true; @@ -28,9 +28,9 @@ if (f1 > 0.0F) { float f2 = Mth.m_14031_(this.m_146908_() * ((float)Math.PI / 180F)); float f3 = Mth.m_14089_(this.m_146908_() * ((float)Math.PI / 180F)); -@@ -1029,6 +_,25 @@ +@@ -1033,6 +_,25 @@ - this.m_7505_(); + this.m_214179_(p_30555_.m_213780_()); return super.m_6518_(p_30555_, p_30556_, p_30557_, p_30558_, p_30559_); + } + diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch index d509feb6839..e7caff48fed 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/Horse.java +++ b/net/minecraft/world/entity/animal/horse/Horse.java -@@ -139,6 +_,8 @@ +@@ -140,6 +_,8 @@ this.m_5496_(SoundEvents.f_11974_, p_30709_.m_56773_() * 0.6F, p_30709_.m_56774_()); } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch index 6050c9fc6da..b3d71bbebed 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch @@ -6,13 +6,13 @@ ServerLevel serverlevel = (ServerLevel)this.f_30925_.f_19853_; + // Forge: Trigger the trap in a tick task to avoid crashes when mods add goals to skeleton horses + // (MC-206338/Forge PR #7509) -+ serverlevel.m_142572_().m_6937_(new net.minecraft.server.TickTask(serverlevel.m_142572_().m_129921_(), () -> { ++ serverlevel.m_7654_().m_6937_(new net.minecraft.server.TickTask(serverlevel.m_7654_().m_129921_(), () -> { + if (!this.f_30925_.m_6084_()) return; - DifficultyInstance difficultyinstance = serverlevel.m_6436_(this.f_30925_.m_142538_()); + DifficultyInstance difficultyinstance = serverlevel.m_6436_(this.f_30925_.m_20183_()); this.f_30925_.m_30923_(false); this.f_30925_.m_30651_(true); @@ -46,7 +_,7 @@ - abstracthorse.m_5997_(this.f_30925_.m_21187_().nextGaussian() * 0.5D, 0.0D, this.f_30925_.m_21187_().nextGaussian() * 0.5D); + abstracthorse.m_5997_(this.f_30925_.m_217043_().m_216328_(0.0D, 1.1485D), 0.0D, this.f_30925_.m_217043_().m_216328_(0.0D, 1.1485D)); serverlevel.m_47205_(abstracthorse); } - diff --git a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 39c98dcba9d..97139efd696 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -107,6 +_,14 @@ +@@ -106,6 +_,14 @@ } this.f_31074_ = new EnderDragonPhaseManager(this); @@ -15,28 +15,28 @@ } public static AttributeSupplier.Builder m_31167_() { -@@ -150,7 +_,11 @@ +@@ -149,7 +_,11 @@ return adouble; } -+ @javax.annotation.Nullable private Player unlimitedLastHurtByPlayer = null; ++ @org.jetbrains.annotations.Nullable private Player unlimitedLastHurtByPlayer = null; public void m_8107_() { + // lastHurtByPlayer is cleared after 100 ticks, capture it indefinitely in unlimitedLastHurtByPlayer for LivingExperienceDropEvent + if (this.f_20888_ != null) this.unlimitedLastHurtByPlayer = f_20888_; -+ if (this.unlimitedLastHurtByPlayer != null && this.unlimitedLastHurtByPlayer.m_146910_()) this.unlimitedLastHurtByPlayer = null; ++ if (this.unlimitedLastHurtByPlayer != null && this.unlimitedLastHurtByPlayer.m_213877_()) this.unlimitedLastHurtByPlayer = null; this.m_146874_(); if (this.f_19853_.f_46443_) { this.m_21153_(this.m_21223_()); -@@ -420,7 +_,7 @@ +@@ -419,7 +_,7 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); BlockState blockstate = this.f_19853_.m_8055_(blockpos); - if (!blockstate.m_60795_() && blockstate.m_60767_() != Material.f_76309_) { + if (!blockstate.m_60795_() && !blockstate.m_204336_(BlockTags.f_215822_)) { - if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && !blockstate.m_204336_(BlockTags.f_13069_)) { + if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_19853_, blockpos, this) && !blockstate.m_204336_(BlockTags.f_13069_)) { flag1 = this.f_19853_.m_7471_(blockpos, false) || flag1; } else { flag = true; -@@ -514,7 +_,8 @@ +@@ -510,7 +_,8 @@ if (this.f_19853_ instanceof ServerLevel) { if (this.f_31084_ > 150 && this.f_31084_ % 5 == 0 && flag) { @@ -46,7 +46,7 @@ } if (this.f_31084_ == 1 && !this.m_20067_()) { -@@ -527,7 +_,8 @@ +@@ -523,7 +_,8 @@ this.f_20883_ = this.m_146908_(); if (this.f_31084_ == 200 && this.f_19853_ instanceof ServerLevel) { if (flag) { @@ -56,7 +56,7 @@ } if (this.f_31073_ != null) { -@@ -849,8 +_,19 @@ +@@ -846,8 +_,19 @@ return false; } @@ -70,8 +70,8 @@ + return this.f_31089_; + } + - public void m_142223_(ClientboundAddMobPacket p_149572_) { - super.m_142223_(p_149572_); + public void m_141965_(ClientboundAddEntityPacket p_218825_) { + super.m_141965_(p_218825_); + if (true) return; // Forge: Fix MC-158205: Moved into setId() EnderDragonPart[] aenderdragonpart = this.m_31156_(); diff --git a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index ad247522a91..ee71a560190 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -8,7 +8,7 @@ + Explosion.BlockInteraction explosion$blockinteraction = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; this.f_19853_.m_46518_(this, this.m_20185_(), this.m_20188_(), this.m_20189_(), 7.0F, false, explosion$blockinteraction); if (!this.m_20067_()) { - this.f_19853_.m_6798_(1023, this.m_142538_(), 0); + this.f_19853_.m_6798_(1023, this.m_20183_(), 0); @@ -280,7 +_,7 @@ if (this.f_31429_ > 0) { diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch index bbfbf794f09..515aa7a697e 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -118,6 +_,8 @@ +@@ -121,6 +_,8 @@ int j1 = (j - 1) / -2; blockpos$mutableblockpos.m_122190_(blockpos).m_122175_(direction, k + i1).m_122175_(Direction.UP, l + j1); BlockState blockstate = this.f_19853_.m_8055_(blockpos$mutableblockpos); diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/Motive.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/Motive.java.patch deleted file mode 100644 index c738d9d2892..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/decoration/Motive.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/decoration/Motive.java -+++ b/net/minecraft/world/entity/decoration/Motive.java -@@ -2,7 +_,7 @@ - - import net.minecraft.core.Registry; - --public class Motive { -+public class Motive extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Motive f_31866_ = m_31897_("kebab", 16, 16); - public static final Motive f_31867_ = m_31897_("aztec", 16, 16); - public static final Motive f_31868_ = m_31897_("alban", 16, 16); diff --git a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch index 328ea52edd7..521b5b34fe8 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -19,7 +19,7 @@ } private ItemEntity(ItemEntity p_31994_) { -@@ -82,6 +_,7 @@ +@@ -87,6 +_,7 @@ } public void m_8119_() { @@ -27,7 +27,7 @@ if (this.m_32055_().m_41619_()) { this.m_146870_(); } else { -@@ -116,7 +_,7 @@ +@@ -121,7 +_,7 @@ this.m_6478_(MoverType.SELF, this.m_20184_()); float f1 = 0.98F; if (this.f_19861_) { @@ -36,7 +36,7 @@ } this.m_20256_(this.m_20184_().m_82542_((double)f1, 0.98D, (double)f1)); -@@ -146,7 +_,14 @@ +@@ -151,7 +_,14 @@ } } @@ -52,7 +52,7 @@ this.m_146870_(); } -@@ -204,6 +_,8 @@ +@@ -209,6 +_,8 @@ return false; } else if (p_32028_.m_41782_() ^ p_32027_.m_41782_()) { return false; @@ -61,24 +61,24 @@ } else { return !p_32028_.m_41782_() || p_32028_.m_41783_().equals(p_32027_.m_41783_()); } -@@ -237,6 +_,7 @@ +@@ -242,6 +_,7 @@ } public boolean m_6469_(DamageSource p_32013_, float p_32014_) { -+ if (this.f_19853_.f_46443_ || this.m_146910_()) return false; //Forge: Fixes MC-53850 ++ if (this.f_19853_.f_46443_ || this.m_213877_()) return false; //Forge: Fixes MC-53850 if (this.m_6673_(p_32013_)) { return false; } else if (!this.m_32055_().m_41619_() && this.m_32055_().m_150930_(Items.f_42686_) && p_32013_.m_19372_()) { -@@ -250,7 +_,7 @@ +@@ -255,7 +_,7 @@ this.f_31987_ = (int)((float)this.f_31987_ - p_32014_); - this.m_146852_(GameEvent.f_157808_, p_32013_.m_7639_()); + this.m_146852_(GameEvent.f_223706_, p_32013_.m_7639_()); if (this.f_31987_ <= 0) { - this.m_32055_().m_150924_(this); + this.m_32055_().onDestroyed(this, p_32013_); this.m_146870_(); } -@@ -262,6 +_,7 @@ +@@ -267,6 +_,7 @@ p_32050_.m_128376_("Health", (short)this.f_31987_); p_32050_.m_128376_("Age", (short)this.f_31985_); p_32050_.m_128376_("PickupDelay", (short)this.f_31986_); @@ -86,7 +86,7 @@ if (this.m_32057_() != null) { p_32050_.m_128362_("Thrower", this.m_32057_()); } -@@ -282,6 +_,7 @@ +@@ -287,6 +_,7 @@ if (p_32034_.m_128441_("PickupDelay")) { this.f_31986_ = p_32034_.m_128448_("PickupDelay"); } @@ -94,7 +94,7 @@ if (p_32034_.m_128403_("Owner")) { this.f_31982_ = p_32034_.m_128342_("Owner"); -@@ -301,10 +_,18 @@ +@@ -306,10 +_,18 @@ public void m_6123_(Player p_32040_) { if (!this.f_19853_.f_46443_) { @@ -102,19 +102,19 @@ ItemStack itemstack = this.m_32055_(); Item item = itemstack.m_41720_(); int i = itemstack.m_41613_(); -- if (this.f_31986_ == 0 && (this.f_31982_ == null || this.f_31982_.equals(p_32040_.m_142081_())) && p_32040_.m_150109_().m_36054_(itemstack)) { +- if (this.f_31986_ == 0 && (this.f_31982_ == null || this.f_31982_.equals(p_32040_.m_20148_())) && p_32040_.m_150109_().m_36054_(itemstack)) { + + int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_32040_); + if (hook < 0) return; + + ItemStack copy = itemstack.m_41777_(); -+ if (this.f_31986_ == 0 && (this.f_31982_ == null || lifespan - this.f_31985_ <= 200 || this.f_31982_.equals(p_32040_.m_142081_())) && (hook == 1 || i <= 0 || p_32040_.m_150109_().m_36054_(itemstack))) { ++ if (this.f_31986_ == 0 && (this.f_31982_ == null || lifespan - this.f_31985_ <= 200 || this.f_31982_.equals(p_32040_.m_20148_())) && (hook == 1 || i <= 0 || p_32040_.m_150109_().m_36054_(itemstack))) { + copy.m_41764_(copy.m_41613_() - m_32055_().m_41613_()); + net.minecraftforge.event.ForgeEventFactory.firePlayerItemPickupEvent(p_32040_, this, copy); p_32040_.m_7938_(this, i); if (itemstack.m_41619_()) { this.m_146870_(); -@@ -328,8 +_,8 @@ +@@ -333,8 +_,8 @@ } @Nullable @@ -125,7 +125,7 @@ if (!this.f_19853_.f_46443_ && entity instanceof ItemEntity) { ((ItemEntity)entity).m_32069_(); } -@@ -405,7 +_,7 @@ +@@ -410,7 +_,7 @@ public void m_32065_() { this.m_32062_(); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch index 32357f7278c..45da9144abd 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -152,7 +_,7 @@ +@@ -154,7 +_,7 @@ if (this.f_19853_ != null && !this.f_19853_.f_46443_) { this.f_21345_.m_25363_(this.f_32131_); this.f_21345_.m_25363_(this.f_32130_); @@ -9,7 +9,7 @@ if (itemstack.m_150930_(Items.f_42411_)) { int i = 20; if (this.f_19853_.m_46791_() != Difficulty.HARD) { -@@ -169,8 +_,10 @@ +@@ -171,8 +_,10 @@ } public void m_6504_(LivingEntity p_32141_, float p_32142_) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Creeper.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Creeper.java.patch index 416a1e2d314..afbb15fecf9 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Creeper.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Creeper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java -@@ -220,7 +_,7 @@ +@@ -219,7 +_,7 @@ private void m_32315_() { if (!this.f_19853_.f_46443_) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch index 3dfe65e8238..0459a3c2902 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -25,18 +25,19 @@ return false; } else { Vec3 vec3 = p_32535_.m_20252_(1.0F).m_82541_(); -@@ -273,7 +_,9 @@ +@@ -273,8 +_,10 @@ boolean flag = blockstate.m_60767_().m_76334_(); boolean flag1 = blockstate.m_60819_().m_205070_(FluidTags.f_13131_); if (flag && !flag1) { -- boolean flag2 = this.m_20984_(p_32544_, p_32545_, p_32546_, true); + net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, p_32544_, p_32545_, p_32546_); + if (event.isCanceled()) return false; + Vec3 vec3 = this.m_20182_(); +- boolean flag2 = this.m_20984_(p_32544_, p_32545_, p_32546_, true); + boolean flag2 = this.m_20984_(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); - if (flag2 && !this.m_20067_()) { - this.f_19853_.m_6263_((Player)null, this.f_19854_, this.f_19855_, this.f_19856_, SoundEvents.f_11852_, this.m_5720_(), 1.0F, 1.0F); - this.m_5496_(SoundEvents.f_11852_, 1.0F, 1.0F); -@@ -407,7 +_,7 @@ + if (flag2) { + this.f_19853_.m_214171_(GameEvent.f_238175_, vec3, GameEvent.Context.m_223717_(this)); + if (!this.m_20067_()) { +@@ -411,7 +_,7 @@ public boolean m_8036_() { if (this.f_32554_.m_32530_() == null) { return false; @@ -44,17 +45,17 @@ + } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32554_.f_19853_, this.f_32554_)) { return false; } else { - return this.f_32554_.m_21187_().nextInt(m_186073_(2000)) == 0; -@@ -427,7 +_,7 @@ + return this.f_32554_.m_217043_().m_188503_(m_186073_(2000)) == 0; +@@ -431,7 +_,7 @@ BlockState blockstate2 = this.f_32554_.m_32530_(); if (blockstate2 != null) { blockstate2 = Block.m_49931_(blockstate2, this.f_32554_.f_19853_, blockpos); - if (this.m_32558_(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { + if (this.m_32558_(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(f_32554_, net.minecraftforge.common.util.BlockSnapshot.create(level.m_46472_(), level, blockpos1), net.minecraft.core.Direction.UP)) { level.m_7731_(blockpos, blockstate2, 3); - level.m_142346_(this.f_32554_, GameEvent.f_157797_, blockpos); + level.m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(this.f_32554_, blockstate2)); this.f_32554_.m_32521_((BlockState)null); -@@ -437,7 +_,7 @@ +@@ -441,7 +_,7 @@ } private boolean m_32558_(Level p_32559_, BlockPos p_32560_, BlockState p_32561_, BlockState p_32562_, BlockState p_32563_, BlockPos p_32564_) { @@ -63,7 +64,7 @@ } } -@@ -527,7 +_,7 @@ +@@ -531,7 +_,7 @@ public boolean m_8036_() { if (this.f_32583_.m_32530_() != null) { return false; @@ -71,4 +72,4 @@ + } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32583_.f_19853_, this.f_32583_)) { return false; } else { - return this.f_32583_.m_21187_().nextInt(m_186073_(20)) == 0; + return this.f_32583_.m_217043_().m_188503_(m_186073_(20)) == 0; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch index c5f884f9e5b..632d342244f 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch @@ -8,4 +8,4 @@ + } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Evoker.this.f_19853_, Evoker.this)) { return false; } else { - List list = Evoker.this.f_19853_.m_45971_(Sheep.class, this.f_32705_, Evoker.this, Evoker.this.m_142469_().m_82377_(16.0D, 4.0D, 16.0D)); + List list = Evoker.this.f_19853_.m_45971_(Sheep.class, this.f_32705_, Evoker.this, Evoker.this.m_20191_().m_82377_(16.0D, 4.0D, 16.0D)); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch index 9bb81b916b4..278cdeb3a04 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/MagmaCube.java +++ b/net/minecraft/world/entity/monster/MagmaCube.java -@@ -72,6 +_,7 @@ +@@ -66,6 +_,7 @@ Vec3 vec3 = this.m_20184_(); this.m_20334_(vec3.f_82479_, (double)(this.m_6118_() + (float)this.m_33632_() * 0.1F), vec3.f_82481_); this.f_19812_ = true; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch index e2276cf9927..4d7925799df 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Monster.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Monster.java +++ b/net/minecraft/world/entity/monster/Monster.java -@@ -116,9 +_,9 @@ +@@ -121,9 +_,9 @@ if (p_33038_.m_41720_() instanceof ProjectileWeaponItem) { Predicate predicate = ((ProjectileWeaponItem)p_33038_.m_41720_()).m_6442_(); ItemStack itemstack = ProjectileWeaponItem.m_43010_(this, predicate); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch index 56f47545a48..b27b8d77988 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java -@@ -144,7 +_,7 @@ +@@ -145,7 +_,7 @@ this.m_21051_(Attributes.f_22279_).m_22100_(Mth.m_14139_(0.1D, d1, d0)); } - if (this.f_19862_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { + if (this.f_19862_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { boolean flag = false; - AABB aabb = this.m_142469_().m_82400_(0.2D); + AABB aabb = this.m_20191_().m_82400_(0.2D); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch index 4a75bfc8945..cb77e7b61f8 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -3,11 +3,11 @@ @@ -140,7 +_,7 @@ return false; } else { - Random random = this.f_25725_.m_21187_(); -- if (this.f_25725_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && random.nextInt(m_186073_(10)) == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25725_.f_19853_, this.f_25725_) && random.nextInt(10) == 0) { - this.f_33555_ = Direction.m_122404_(random); - BlockPos blockpos = (new BlockPos(this.f_25725_.m_20185_(), this.f_25725_.m_20186_() + 0.5D, this.f_25725_.m_20189_())).m_142300_(this.f_33555_); + RandomSource randomsource = this.f_25725_.m_217043_(); +- if (this.f_25725_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && randomsource.m_188503_(m_186073_(10)) == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25725_.f_19853_, this.f_25725_) && randomsource.m_188503_(m_186073_(10)) == 0) { + this.f_33555_ = Direction.m_235672_(randomsource); + BlockPos blockpos = (new BlockPos(this.f_25725_.m_20185_(), this.f_25725_.m_20186_() + 0.5D, this.f_25725_.m_20189_())).m_121945_(this.f_33555_); BlockState blockstate = this.f_25725_.f_19853_.m_8055_(blockpos); @@ -209,7 +_,7 @@ BlockState blockstate = level.m_8055_(blockpos1); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch index 16a5008b9fd..6696c2ca503 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch @@ -6,9 +6,9 @@ + if (spawnCustomParticles()) i = 0; // don't spawn particles if it's handled by the implementation itself for(int j = 0; j < i * 8; ++j) { - float f = this.f_19796_.nextFloat() * ((float)Math.PI * 2F); - float f1 = this.f_19796_.nextFloat() * 0.5F + 0.5F; -@@ -319,6 +_,12 @@ + float f = this.f_19796_.m_188501_() * ((float)Math.PI * 2F); + float f1 = this.f_19796_.m_188501_() * 0.5F + 0.5F; +@@ -316,6 +_,12 @@ public EntityDimensions m_6972_(Pose p_33597_) { return super.m_6972_(p_33597_).m_20388_(0.255F * (float)this.m_33632_()); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch index b2ae80fb33d..2741308170c 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch @@ -11,7 +11,7 @@ } else if (this.m_7593_()) { @@ -253,6 +_,7 @@ if (zombie != null) { - zombie.m_34339_(zombie.f_19853_.m_6436_(zombie.m_142538_()).m_19057_()); + zombie.m_34339_(zombie.f_19853_.m_6436_(zombie.m_20183_()).m_19057_()); zombie.m_34336_(zombie.m_7586_() && this.m_34330_()); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombie); } @@ -21,7 +21,7 @@ livingentity = (LivingEntity)p_34288_.m_7639_(); } -- if (livingentity != null && this.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.nextFloat() < this.m_21133_(Attributes.f_22287_) && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { +- if (livingentity != null && this.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21133_(Attributes.f_22287_) && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_()); int k = Mth.m_14107_(this.m_20189_()); @@ -29,51 +29,51 @@ + net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, f_19853_, i, j, k, livingentity, this.m_21051_(Attributes.f_22287_).m_22135_()); + 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.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.nextFloat() < this.m_21051_(Attributes.f_22287_).m_22135_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { ++ livingentity != null && this.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21051_(Attributes.f_22287_).m_22135_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { + Zombie zombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.f_20501_.m_20615_(this.f_19853_); for(int l = 0; l < 50; ++l) { - int i1 = i + Mth.m_14072_(this.f_19796_, 7, 40) * Mth.m_14072_(this.f_19796_, -1, 1); + int i1 = i + Mth.m_216271_(this.f_19796_, 7, 40) * Mth.m_216271_(this.f_19796_, -1, 1); @@ -289,6 +_,7 @@ - if (NaturalSpawner.m_47051_(spawnplacements$type, this.f_19853_, blockpos, entitytype) && SpawnPlacements.m_21759_(entitytype, serverlevel, MobSpawnType.REINFORCEMENT, blockpos, this.f_19853_.f_46441_)) { + if (NaturalSpawner.m_47051_(spawnplacements$type, this.f_19853_, blockpos, entitytype) && SpawnPlacements.m_217074_(entitytype, serverlevel, MobSpawnType.REINFORCEMENT, blockpos, this.f_19853_.f_46441_)) { zombie.m_6034_((double)i1, (double)j1, (double)k1); - if (!this.f_19853_.m_45914_((double)i1, (double)j1, (double)k1, 7.0D) && this.f_19853_.m_45784_(zombie) && this.f_19853_.m_45786_(zombie) && !this.f_19853_.m_46855_(zombie.m_142469_())) { + if (!this.f_19853_.m_45914_((double)i1, (double)j1, (double)k1, 7.0D) && this.f_19853_.m_45784_(zombie) && this.f_19853_.m_45786_(zombie) && !this.f_19853_.m_46855_(zombie.m_20191_())) { + if (livingentity != null) zombie.m_6710_(livingentity); - zombie.m_6518_(serverlevel, this.f_19853_.m_6436_(zombie.m_142538_()), MobSpawnType.REINFORCEMENT, (SpawnGroupData)null, (CompoundTag)null); + zombie.m_6518_(serverlevel, this.f_19853_.m_6436_(zombie.m_20183_()), MobSpawnType.REINFORCEMENT, (SpawnGroupData)null, (CompoundTag)null); serverlevel.m_47205_(zombie); @@ -374,7 +_,7 @@ - public void m_5837_(ServerLevel p_34281_, LivingEntity p_34282_) { - super.m_5837_(p_34281_, p_34282_); -- if ((p_34281_.m_46791_() == Difficulty.NORMAL || p_34281_.m_46791_() == Difficulty.HARD) && p_34282_ instanceof Villager) { -+ if ((p_34281_.m_46791_() == Difficulty.NORMAL || p_34281_.m_46791_() == Difficulty.HARD) && p_34282_ instanceof Villager && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(p_34282_, EntityType.f_20530_, (timer) -> {})) { - if (p_34281_.m_46791_() != Difficulty.HARD && this.f_19796_.nextBoolean()) { - return; + public boolean m_214076_(ServerLevel p_219160_, LivingEntity p_219161_) { + boolean flag = super.m_214076_(p_219160_, p_219161_); +- if ((p_219160_.m_46791_() == Difficulty.NORMAL || p_219160_.m_46791_() == Difficulty.HARD) && p_219161_ instanceof Villager) { ++ if ((p_219160_.m_46791_() == Difficulty.NORMAL || p_219160_.m_46791_() == Difficulty.HARD) && p_219161_ instanceof Villager && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(p_219161_, EntityType.f_20530_, (timer) -> {})) { + if (p_219160_.m_46791_() != Difficulty.HARD && this.f_19796_.m_188499_()) { + return flag; } @@ -386,6 +_,7 @@ zombievillager.m_34391_(villager.m_35517_().m_26179_(NbtOps.f_128958_).getValue()); zombievillager.m_34411_(villager.m_6616_().m_45388_()); zombievillager.m_34373_(villager.m_7809_()); -+ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(p_34282_, zombievillager); ++ net.minecraftforge.event.ForgeEventFactory.onLivingConvert(p_219161_, zombievillager); if (!this.m_20067_()) { - p_34281_.m_5898_((Player)null, 1026, this.m_142538_(), 0); + p_219160_.m_5898_((Player)null, 1026, this.m_20183_(), 0); } -@@ -457,7 +_,7 @@ +@@ -460,7 +_,7 @@ } - public static boolean m_34302_(Random p_34303_) { -- return p_34303_.nextFloat() < 0.05F; -+ return p_34303_.nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get(); + public static boolean m_219162_(RandomSource p_219163_) { +- return p_219163_.m_188501_() < 0.05F; ++ return p_219163_.m_188501_() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get(); } protected void m_34339_(float p_34340_) { -@@ -477,7 +_,7 @@ +@@ -480,7 +_,7 @@ } protected void m_7572_() { -- this.m_21051_(Attributes.f_22287_).m_22100_(this.f_19796_.nextDouble() * (double)0.1F); -+ this.m_21051_(Attributes.f_22287_).m_22100_(this.f_19796_.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); +- this.m_21051_(Attributes.f_22287_).m_22100_(this.f_19796_.m_188500_() * (double)0.1F); ++ this.m_21051_(Attributes.f_22287_).m_22100_(this.f_19796_.m_188500_() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); } public double m_6049_() { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch index fba74621905..85abc19d569 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -127,7 +_,7 @@ +@@ -126,7 +_,7 @@ if (!this.f_19853_.f_46443_ && this.m_6084_() && this.m_34408_()) { int i = this.m_34410_(); this.f_34365_ -= i; @@ -9,9 +9,9 @@ this.m_34398_((ServerLevel)this.f_19853_); } } -@@ -229,7 +_,7 @@ +@@ -227,7 +_,7 @@ if (!this.m_20067_()) { - p_34399_.m_5898_((Player)null, 1027, this.m_142538_(), 0); + p_34399_.m_5898_((Player)null, 1027, this.m_20183_(), 0); } - + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, villager); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index dcda2e19bc9..567d9e7a1f8 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -6,7 +6,7 @@ ++this.f_34484_; - if (this.f_34484_ > 300) { + if (this.f_34484_ > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20500_, (timer) -> this.f_34484_ = timer)) { - this.m_34500_(SoundEvents.f_11959_); + this.m_219179_(SoundEvents.f_11959_); this.m_34531_((ServerLevel)this.f_19853_); } @@ -219,6 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch index 4de3c93911b..00279f0a3b6 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch @@ -9,7 +9,7 @@ if (p_34869_ && flag) { m_34860_(p_34868_, m_34996_(p_34868_)); } else if (!flag) { -@@ -345,7 +_,7 @@ +@@ -346,7 +_,7 @@ return false; } else if (m_35024_(p_34858_) && p_34858_.m_6274_().m_21874_(MemoryModuleType.f_26372_)) { return false; diff --git a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch index e9c4bbf4b8a..f53c7a527a5 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java -@@ -90,8 +_,9 @@ +@@ -86,8 +_,9 @@ if (cat == null) { return 0; } else { diff --git a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch index 72ea9082f56..ac3d2d83dcd 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch @@ -9,17 +9,17 @@ if (this.m_6162_()) { this.m_35518_(); return InteractionResult.m_19078_(this.f_19853_.f_46443_); -@@ -658,7 +_,8 @@ +@@ -657,7 +_,8 @@ } protected Component m_5677_() { -- return new TranslatableComponent(this.m_6095_().m_20675_() + "." + Registry.f_122869_.m_7981_(this.m_7141_().m_35571_()).m_135815_()); -+ net.minecraft.resources.ResourceLocation profName = this.m_7141_().m_35571_().getRegistryName(); -+ return new TranslatableComponent(this.m_6095_().m_20675_() + '.' + (!"minecraft".equals(profName.m_135827_()) ? profName.m_135827_() + '.' : "") + profName.m_135815_()); +- return Component.m_237115_(this.m_6095_().m_20675_() + "." + Registry.f_122869_.m_7981_(this.m_7141_().m_35571_()).m_135815_()); ++ net.minecraft.resources.ResourceLocation profName = net.minecraftforge.registries.ForgeRegistries.PROFESSIONS.getKey(this.m_7141_().m_35571_()); ++ return Component.m_237115_(this.m_6095_().m_20675_() + '.' + (!"minecraft".equals(profName.m_135827_()) ? profName.m_135827_() + '.' : "") + profName.m_135815_()); } public void m_7822_(byte p_35391_) { -@@ -710,7 +_,7 @@ +@@ -709,7 +_,7 @@ } public void m_8038_(ServerLevel p_35409_, LightningBolt p_35410_) { @@ -28,7 +28,7 @@ f_201976_.info("Villager {} was struck by lightning {}.", this, p_35410_); Witch witch = EntityType.f_20495_.m_20615_(p_35409_); witch.m_7678_(this.m_20185_(), this.m_20186_(), this.m_20189_(), this.m_146908_(), this.m_146909_()); -@@ -722,6 +_,7 @@ +@@ -721,6 +_,7 @@ } witch.m_21530_(); diff --git a/patches/minecraft/net/minecraft/world/entity/npc/VillagerProfession.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/VillagerProfession.java.patch deleted file mode 100644 index 0346b5d91da..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/npc/VillagerProfession.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/npc/VillagerProfession.java -+++ b/net/minecraft/world/entity/npc/VillagerProfession.java -@@ -12,7 +_,7 @@ - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.Blocks; - --public class VillagerProfession { -+public class VillagerProfession extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final VillagerProfession f_35585_ = m_35612_("none", PoiType.f_27331_, (SoundEvent)null); - public static final VillagerProfession f_35586_ = m_35612_("armorer", PoiType.f_27332_, SoundEvents.f_12510_); - public static final VillagerProfession f_35587_ = m_35612_("butcher", PoiType.f_27333_, SoundEvents.f_12564_); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch index 49386b80e39..b48b495d470 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Inventory.java +++ b/net/minecraft/world/entity/player/Inventory.java -@@ -178,7 +_,8 @@ +@@ -177,7 +_,8 @@ int i = p_36049_.m_41613_(); ItemStack itemstack = this.m_8020_(p_36048_); if (itemstack.m_41619_()) { @@ -10,7 +10,7 @@ if (p_36049_.m_41782_()) { itemstack.m_41751_(p_36049_.m_41783_().m_6426_()); } -@@ -229,7 +_,7 @@ +@@ -228,7 +_,7 @@ } } } @@ -19,11 +19,11 @@ } public boolean m_36054_(ItemStack p_36055_) { -@@ -278,6 +_,8 @@ +@@ -277,6 +_,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.m_127521_(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Item being added"); -+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(p_36042_.m_41720_().getRegistryName())); ++ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_36042_.m_41720_()))); + crashreportcategory.m_128165_("Item Class", () -> p_36042_.m_41720_().getClass().getName()); crashreportcategory.m_128159_("Item ID", Item.m_41393_(p_36042_.m_41720_())); crashreportcategory.m_128159_("Item data", p_36042_.m_41773_()); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch index 96a3f9905db..f926d2372e5 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -111,7 +_,8 @@ - import net.minecraft.world.scores.Scoreboard; +@@ -113,7 +_,8 @@ import net.minecraft.world.scores.Team; + import org.slf4j.Logger; -public abstract class Player extends LivingEntity { +public abstract class Player extends LivingEntity implements net.minecraftforge.common.extensions.IForgePlayer { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; - public static final String f_150081_ = "OfflinePlayer:"; + private static final Logger f_219722_ = LogUtils.getLogger(); public static final int f_150082_ = 16; public static final int f_150083_ = 20; -@@ -162,6 +_,9 @@ - private final ItemCooldowns f_36087_ = this.m_7478_(); +@@ -168,6 +_,9 @@ + private Optional f_238176_ = Optional.empty(); @Nullable public FishingHook f_36083_; + private final java.util.Collection prefixes = new java.util.LinkedList<>(); + private final java.util.Collection suffixes = new java.util.LinkedList<>(); + @Nullable private Pose forcedPose; - public Player(Level p_36114_, BlockPos p_36115_, float p_36116_, GameProfile p_36117_) { - super(EntityType.f_20532_, p_36114_); -@@ -187,7 +_,7 @@ + public Player(Level p_219727_, BlockPos p_219728_, float p_219729_, GameProfile p_219730_, @Nullable ProfilePublicKey p_219731_) { + super(EntityType.f_20532_, p_219727_); +@@ -194,7 +_,7 @@ } public static AttributeSupplier.Builder m_36340_() { @@ -29,7 +29,7 @@ } protected void m_8097_() { -@@ -201,6 +_,7 @@ +@@ -208,6 +_,7 @@ } public void m_8119_() { @@ -37,7 +37,7 @@ this.f_19794_ = this.m_5833_(); if (this.m_5833_()) { this.f_19861_ = false; -@@ -216,7 +_,7 @@ +@@ -223,7 +_,7 @@ this.f_36110_ = 100; } @@ -46,7 +46,7 @@ this.m_6145_(false, true); } } else if (this.f_36110_ > 0) { -@@ -271,6 +_,7 @@ +@@ -279,6 +_,7 @@ this.m_36372_(); this.f_36087_.m_41518_(); this.m_7594_(); @@ -54,7 +54,7 @@ } public boolean m_36341_() { -@@ -346,6 +_,10 @@ +@@ -354,6 +_,10 @@ } protected void m_7594_() { @@ -65,7 +65,7 @@ if (this.m_20175_(Pose.SWIMMING)) { Pose pose; if (this.m_21255_()) { -@@ -569,6 +_,7 @@ +@@ -577,6 +_,7 @@ } public void m_6667_(DamageSource p_36152_) { @@ -73,7 +73,7 @@ super.m_6667_(p_36152_); this.m_20090_(); if (!this.m_5833_()) { -@@ -625,7 +_,7 @@ +@@ -634,7 +_,7 @@ @Nullable public ItemEntity m_36176_(ItemStack p_36177_, boolean p_36178_) { @@ -82,7 +82,7 @@ } @Nullable -@@ -663,7 +_,12 @@ +@@ -672,7 +_,12 @@ } } @@ -95,7 +95,7 @@ float f = this.f_36093_.m_36020_(p_36282_); if (f > 1.0F) { int i = EnchantmentHelper.m_44926_(this); -@@ -705,11 +_,12 @@ +@@ -714,11 +_,12 @@ f /= 5.0F; } @@ -109,7 +109,7 @@ } public void m_7378_(CompoundTag p_36215_) { -@@ -786,6 +_,7 @@ +@@ -813,6 +_,7 @@ } public boolean m_6469_(DamageSource p_36154_, float p_36155_) { @@ -117,16 +117,16 @@ if (this.m_6673_(p_36154_)) { return false; } else if (this.f_36077_.f_35934_ && !p_36154_.m_19378_()) { -@@ -820,7 +_,7 @@ +@@ -847,7 +_,7 @@ protected void m_6728_(LivingEntity p_36295_) { super.m_6728_(p_36295_); -- if (p_36295_.m_21205_().m_41720_() instanceof AxeItem) { +- if (p_36295_.m_213824_()) { + if (p_36295_.m_21205_().canDisableShield(this.f_20935_, this, p_36295_)) { this.m_36384_(true); } -@@ -849,7 +_,7 @@ +@@ -876,7 +_,7 @@ } protected void m_7909_(float p_36383_) { @@ -135,15 +135,15 @@ if (!this.f_19853_.f_46443_) { this.m_36246_(Stats.f_12982_.m_12902_(this.f_20935_.m_41720_())); } -@@ -859,6 +_,7 @@ +@@ -886,6 +_,7 @@ InteractionHand interactionhand = this.m_7655_(); - this.f_20935_.m_41622_(i, this, (p_36149_) -> { - p_36149_.m_21190_(interactionhand); + this.f_20935_.m_41622_(i, this, (p_219739_) -> { + p_219739_.m_21190_(interactionhand); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.f_20935_, interactionhand); }); if (this.f_20935_.m_41619_()) { if (interactionhand == InteractionHand.MAIN_HAND) { -@@ -877,10 +_,13 @@ +@@ -904,10 +_,13 @@ protected void m_6475_(DamageSource p_36312_, float p_36313_) { if (!this.m_6673_(p_36312_)) { @@ -157,7 +157,7 @@ float f = p_36313_ - f2; if (f > 0.0F && f < 3.4028235E37F) { this.m_36222_(Stats.f_12933_, Math.round(f * 10.0F)); -@@ -889,8 +_,8 @@ +@@ -916,8 +_,8 @@ if (f2 != 0.0F) { this.m_36399_(p_36312_.m_19377_()); float f1 = this.m_21223_(); @@ -167,7 +167,7 @@ if (f2 < 3.4028235E37F) { this.m_36222_(Stats.f_12931_, Math.round(f2 * 10.0F)); } -@@ -939,6 +_,8 @@ +@@ -966,6 +_,8 @@ return InteractionResult.PASS; } else { @@ -176,7 +176,7 @@ ItemStack itemstack = this.m_21120_(p_36159_); ItemStack itemstack1 = itemstack.m_41777_(); InteractionResult interactionresult = p_36158_.m_6096_(this, p_36159_); -@@ -947,6 +_,9 @@ +@@ -974,6 +_,9 @@ itemstack.m_41764_(itemstack1.m_41613_()); } @@ -186,7 +186,7 @@ return interactionresult; } else { if (!itemstack.m_41619_() && p_36158_ instanceof LivingEntity) { -@@ -957,6 +_,7 @@ +@@ -984,6 +_,7 @@ InteractionResult interactionresult1 = itemstack.m_41647_(this, (LivingEntity)p_36158_, p_36159_); if (interactionresult1.m_19077_()) { if (itemstack.m_41619_() && !this.f_36077_.f_35937_) { @@ -194,39 +194,39 @@ this.m_21008_(p_36159_, ItemStack.f_41583_); } -@@ -992,7 +_,7 @@ +@@ -1019,7 +_,7 @@ double d1 = p_36201_.f_82481_; double d2 = 0.05D; -- while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.f_19793_), 0.0D))) { -+ while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.getStepHeight()), 0.0D))) { +- while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.f_19793_), 0.0D))) { ++ while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.getStepHeight()), 0.0D))) { if (d0 < 0.05D && d0 >= -0.05D) { d0 = 0.0D; } else if (d0 > 0.0D) { -@@ -1002,7 +_,7 @@ +@@ -1029,7 +_,7 @@ } } -- while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(-this.f_19793_), d1))) { -+ while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(-this.getStepHeight()), d1))) { +- while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(-this.f_19793_), d1))) { ++ while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(-this.getStepHeight()), d1))) { if (d1 < 0.05D && d1 >= -0.05D) { d1 = 0.0D; } else if (d1 > 0.0D) { -@@ -1012,7 +_,7 @@ +@@ -1039,7 +_,7 @@ } } -- while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.f_19793_), d1))) { -+ while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.getStepHeight()), d1))) { +- while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.f_19793_), d1))) { ++ while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.getStepHeight()), d1))) { if (d0 < 0.05D && d0 >= -0.05D) { d0 = 0.0D; } else if (d0 > 0.0D) { -@@ -1037,10 +_,11 @@ +@@ -1064,10 +_,11 @@ } private boolean m_36386_() { -- return this.f_19861_ || this.f_19789_ < this.f_19793_ && !this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(this.f_19789_ - this.f_19793_), 0.0D)); -+ return this.f_19861_ || this.f_19789_ < this.getStepHeight() && !this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(this.f_19789_ - this.getStepHeight()), 0.0D)); +- return this.f_19861_ || this.f_19789_ < this.f_19793_ && !this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(this.f_19789_ - this.f_19793_), 0.0D)); ++ return this.f_19861_ || this.f_19789_ < this.getStepHeight() && !this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(this.f_19789_ - this.getStepHeight()), 0.0D)); } public void m_5706_(Entity p_36347_) { @@ -234,7 +234,7 @@ if (p_36347_.m_6097_()) { if (!p_36347_.m_7313_(this)) { float f = (float)this.m_21133_(Attributes.f_22281_); -@@ -1058,7 +_,7 @@ +@@ -1085,7 +_,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = f2 > 0.9F; boolean flag1 = false; @@ -243,7 +243,7 @@ i += EnchantmentHelper.m_44894_(this); if (this.m_20142_() && flag) { this.f_19853_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12314_, this.m_5720_(), 1.0F, 1.0F); -@@ -1068,8 +_,10 @@ +@@ -1095,8 +_,10 @@ boolean flag2 = flag && this.f_19789_ > 0.0F && !this.f_19861_ && !this.m_6147_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19610_) && !this.m_20159_() && p_36347_ instanceof LivingEntity; flag2 = flag2 && !this.m_20142_(); @@ -255,7 +255,7 @@ } f += f1; -@@ -1077,9 +_,7 @@ +@@ -1104,9 +_,7 @@ double d0 = (double)(this.f_19787_ - this.f_19867_); if (flag && !flag2 && !flag1 && this.f_19861_ && d0 < (double)this.m_6113_()) { ItemStack itemstack = this.m_21120_(InteractionHand.MAIN_HAND); @@ -266,18 +266,18 @@ } float f4 = 0.0F; -@@ -1110,8 +_,8 @@ +@@ -1137,8 +_,8 @@ if (flag3) { float f3 = 1.0F + EnchantmentHelper.m_44821_(this) * f; -- for(LivingEntity livingentity : this.f_19853_.m_45976_(LivingEntity.class, p_36347_.m_142469_().m_82377_(1.0D, 0.25D, 1.0D))) { +- for(LivingEntity livingentity : this.f_19853_.m_45976_(LivingEntity.class, p_36347_.m_20191_().m_82377_(1.0D, 0.25D, 1.0D))) { - if (livingentity != this && livingentity != p_36347_ && !this.m_7307_(livingentity) && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).m_31677_()) && this.m_20280_(livingentity) < 9.0D) { + for(LivingEntity livingentity : this.f_19853_.m_45976_(LivingEntity.class, this.m_21120_(InteractionHand.MAIN_HAND).getSweepHitBox(this, p_36347_))) { + if (livingentity != this && livingentity != p_36347_ && !this.m_7307_(livingentity) && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).m_31677_()) && this.canHit(livingentity, 0)) { // Original check was dist < 3, range is 3, so vanilla used padding=0 livingentity.m_147240_((double)0.4F, (double)Mth.m_14031_(this.m_146908_() * ((float)Math.PI / 180F)), (double)(-Mth.m_14089_(this.m_146908_() * ((float)Math.PI / 180F)))); livingentity.m_6469_(DamageSource.m_19344_(this), f3); } -@@ -1152,13 +_,15 @@ +@@ -1179,13 +_,15 @@ EnchantmentHelper.m_44896_(this, p_36347_); ItemStack itemstack1 = this.m_21205_(); Entity entity = p_36347_; @@ -295,16 +295,16 @@ this.m_21008_(InteractionHand.MAIN_HAND, ItemStack.f_41583_); } } -@@ -1200,7 +_,7 @@ +@@ -1227,7 +_,7 @@ } - if (this.f_19796_.nextFloat() < f) { + if (this.f_19796_.m_188501_() < f) { - this.m_36335_().m_41524_(Items.f_42740_, 100); + this.m_36335_().m_41524_(this.m_21211_().m_41720_(), 100); this.m_5810_(); this.f_19853_.m_7605_(this, (byte)30); } -@@ -1260,6 +_,7 @@ +@@ -1292,6 +_,7 @@ } public void m_6145_(boolean p_36226_, boolean p_36227_) { @@ -312,7 +312,7 @@ super.m_5796_(); if (this.f_19853_ instanceof ServerLevel && p_36227_) { ((ServerLevel)this.f_19853_).m_8878_(); -@@ -1285,7 +_,7 @@ +@@ -1317,7 +_,7 @@ } else if (block instanceof BedBlock && BedBlock.m_49488_(p_36131_)) { return BedBlock.m_49458_(EntityType.f_20532_, p_36131_, p_36132_, p_36133_); } else if (!p_36134_) { @@ -321,7 +321,7 @@ } else { boolean flag = block.m_5568_(); boolean flag1 = p_36131_.m_8055_(p_36132_.m_7494_()).m_60734_().m_5568_(); -@@ -1465,6 +_,7 @@ +@@ -1497,6 +_,7 @@ public boolean m_142535_(float p_150093_, float p_150094_, DamageSource p_150095_) { if (this.f_36077_.f_35936_) { @@ -329,7 +329,7 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1478,7 +_,7 @@ +@@ -1510,7 +_,7 @@ public boolean m_36319_() { if (!this.f_19861_ && !this.m_21255_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -338,7 +338,7 @@ this.m_36320_(); return true; } -@@ -1519,6 +_,10 @@ +@@ -1552,6 +_,10 @@ } public void m_6756_(int p_36291_) { @@ -349,7 +349,7 @@ this.m_36401_(p_36291_); this.f_36080_ += (float)p_36291_ / (float)this.m_36323_(); this.f_36079_ = Mth.m_14045_(this.f_36079_ + p_36291_, 0, Integer.MAX_VALUE); -@@ -1547,7 +_,7 @@ +@@ -1580,7 +_,7 @@ } public void m_7408_(ItemStack p_36172_, int p_36173_) { @@ -358,7 +358,7 @@ if (this.f_36078_ < 0) { this.f_36078_ = 0; this.f_36080_ = 0.0F; -@@ -1558,6 +_,10 @@ +@@ -1591,6 +_,10 @@ } public void m_6749_(int p_36276_) { @@ -369,20 +369,20 @@ this.f_36078_ += p_36276_; if (this.f_36078_ < 0) { this.f_36078_ = 0; -@@ -1745,7 +_,11 @@ +@@ -1782,7 +_,11 @@ } public Component m_5446_() { - MutableComponent mutablecomponent = PlayerTeam.m_83348_(this.m_5647_(), this.m_7755_()); + if (this.displayname == null) this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.m_7755_()); -+ MutableComponent mutablecomponent = new TextComponent(""); ++ MutableComponent mutablecomponent = Component.m_237113_(""); + mutablecomponent = prefixes.stream().reduce(mutablecomponent, MutableComponent::m_7220_); + mutablecomponent = mutablecomponent.m_7220_(PlayerTeam.m_83348_(this.m_5647_(), this.displayname)); + mutablecomponent = suffixes.stream().reduce(mutablecomponent, MutableComponent::m_7220_); return this.m_36218_(mutablecomponent); } -@@ -1895,24 +_,24 @@ +@@ -1919,24 +_,24 @@ Predicate predicate = ((ProjectileWeaponItem)p_36349_.m_41720_()).m_6442_(); ItemStack itemstack = ProjectileWeaponItem.m_43010_(this, predicate); if (!itemstack.m_41619_()) { @@ -409,9 +409,9 @@ - this.m_36324_().m_38712_(p_36186_.m_41720_(), p_36186_); + this.m_36324_().eat(p_36186_.m_41720_(), p_36186_, this); this.m_36246_(Stats.f_12982_.m_12902_(p_36186_.m_41720_())); - p_36185_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12321_, SoundSource.PLAYERS, 0.5F, p_36185_.f_46441_.nextFloat() * 0.1F + 0.9F); + p_36185_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12321_, SoundSource.PLAYERS, 0.5F, p_36185_.f_46441_.m_188501_() * 0.1F + 0.9F); if (this instanceof ServerPlayer) { -@@ -1991,5 +_,63 @@ +@@ -2023,5 +_,63 @@ public Component m_36423_() { return this.f_36413_; } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/AbstractArrow.java.patch index 9fcf1d8f6e9..2ad8b0eacd1 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/AbstractArrow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/AbstractArrow.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -184,7 +_,7 @@ +@@ -185,7 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch index e43d47a4d31..5024d3ed150 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -15,7 +15,7 @@ BlockState blockstate = serverlevel.m_8055_(new BlockPos(d0, d1 - 1.0D, d2)); - if (blockstate.m_60713_(Blocks.f_49990_)) { + if (serverlevel.m_8055_(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).m_60767_() == net.minecraft.world.level.material.Material.f_76305_) { - if (this.f_19796_.nextFloat() < 0.15F) { + if (this.f_19796_.m_188501_() < 0.15F) { serverlevel.m_8767_(ParticleTypes.f_123795_, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); } @@ -331,7 +_,7 @@ @@ -24,7 +24,7 @@ BlockState blockstate1 = serverlevel.m_8055_(new BlockPos(d4, d5 - 1.0D, d6)); - if (blockstate1.m_60713_(Blocks.f_49990_)) { + if (serverlevel.m_8055_(new BlockPos(d4, d5 - 1.0D, d6)).m_60767_() == net.minecraft.world.level.material.Material.f_76305_) { - serverlevel.m_8767_(ParticleTypes.f_123769_, d4, d5, d6, 2 + this.f_19796_.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); + serverlevel.m_8767_(ParticleTypes.f_123769_, d4, d5, d6, 2 + this.f_19796_.m_188503_(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); } } @@ -402,6 +_,7 @@ @@ -38,10 +38,10 @@ @@ -409,8 +_,15 @@ i = this.f_37094_ instanceof ItemEntity ? 3 : 5; } else if (this.f_37089_ > 0) { - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_19853_)).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78972_(LootContextParams.f_81463_, p_37157_).m_78972_(LootContextParams.f_81455_, this).m_78977_(this.f_19796_).m_78963_((float)this.f_37096_ + player.m_36336_()); + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_19853_)).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78972_(LootContextParams.f_81463_, p_37157_).m_78972_(LootContextParams.f_81455_, this).m_230911_(this.f_19796_).m_78963_((float)this.f_37096_ + player.m_36336_()); + lootcontext$builder.m_78972_(LootContextParams.f_81458_, this.m_37282_()).m_78972_(LootContextParams.f_81455_, this); - LootTable loottable = this.f_19853_.m_142572_().m_129898_().m_79217_(BuiltInLootTables.f_78720_); - List list = loottable.m_79129_(lootcontext$builder.m_78975_(LootContextParamSets.f_81414_)); + LootTable loottable = this.f_19853_.m_7654_().m_129898_().m_79217_(BuiltInLootTables.f_78720_); + List list = loottable.m_230922_(lootcontext$builder.m_78975_(LootContextParamSets.f_81414_)); + event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.f_19861_ ? 2 : 1, this); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch index d9b83113c2d..0ed60127429 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/SmallFireball.java +++ b/net/minecraft/world/entity/projectile/SmallFireball.java -@@ -49,7 +_,7 @@ +@@ -46,7 +_,7 @@ super.m_8060_(p_37384_); if (!this.f_19853_.f_46443_) { Entity entity = this.m_37282_(); - if (!(entity instanceof Mob) || this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { + if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { - BlockPos blockpos = p_37384_.m_82425_().m_142300_(p_37384_.m_82434_()); + BlockPos blockpos = p_37384_.m_82425_().m_121945_(p_37384_.m_82434_()); if (this.f_19853_.m_46859_(blockpos)) { this.f_19853_.m_46597_(blockpos, BaseFireBlock.m_49245_(this.f_19853_, blockpos)); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch index f3c9ec1e7f5..bee9d54b066 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch @@ -6,7 +6,7 @@ if (serverplayer.f_8906_.m_6198_().m_129536_() && serverplayer.f_19853_ == this.f_19853_ && !serverplayer.m_5803_()) { + net.minecraftforge.event.entity.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayer, this.m_20185_(), this.m_20186_(), this.m_20189_(), this, 5.0F); + if (!event.isCanceled()) { // Don't indent to lower patch size - if (this.f_19796_.nextFloat() < 0.05F && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { + if (this.f_19796_.m_188501_() < 0.05F && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { Endermite endermite = EntityType.f_20567_.m_20615_(this.f_19853_); endermite.m_7678_(entity.m_20185_(), entity.m_20186_(), entity.m_20189_(), entity.m_146908_(), entity.m_146909_()); @@ -59,8 +_,10 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch index 7bb4d0d4b23..f89740f0541 100644 --- a/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/raid/Raid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -812,7 +_,7 @@ +@@ -813,7 +_,7 @@ } } @@ -9,7 +9,7 @@ VINDICATOR(EntityType.f_20493_, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), EVOKER(EntityType.f_20568_, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), PILLAGER(EntityType.f_20513_, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), -@@ -826,6 +_,20 @@ +@@ -827,6 +_,20 @@ private RaiderType(EntityType p_37821_, int[] p_37822_) { this.f_37814_ = p_37821_; this.f_37815_ = p_37822_; diff --git a/patches/minecraft/net/minecraft/world/entity/schedule/Activity.java.patch b/patches/minecraft/net/minecraft/world/entity/schedule/Activity.java.patch deleted file mode 100644 index 7b6746640e9..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/schedule/Activity.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/schedule/Activity.java -+++ b/net/minecraft/world/entity/schedule/Activity.java -@@ -2,7 +_,7 @@ - - import net.minecraft.core.Registry; - --public class Activity { -+public class Activity extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final Activity f_37978_ = m_37999_("core"); - public static final Activity f_37979_ = m_37999_("idle"); - public static final Activity f_37980_ = m_37999_("work"); diff --git a/patches/minecraft/net/minecraft/world/entity/schedule/Schedule.java.patch b/patches/minecraft/net/minecraft/world/entity/schedule/Schedule.java.patch deleted file mode 100644 index e7e7f927bc5..00000000000 --- a/patches/minecraft/net/minecraft/world/entity/schedule/Schedule.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/schedule/Schedule.java -+++ b/net/minecraft/world/entity/schedule/Schedule.java -@@ -8,7 +_,7 @@ - import java.util.stream.Collectors; - import net.minecraft.core.Registry; - --public class Schedule { -+public class Schedule extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final int f_150241_ = 2000; - public static final int f_150242_ = 7000; - public static final Schedule f_38012_ = m_38029_("empty").m_38040_(0, Activity.f_37979_).m_38039_(); diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index c69b722d308..7ebf2b05d3d 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -25,11 +25,10 @@ protected AbstractMinecart(EntityType p_38087_, Level p_38088_) { super(p_38087_, p_38088_); -@@ -98,6 +_,14 @@ - this.f_19855_ = p_38093_; +@@ -99,6 +_,14 @@ this.f_19856_ = p_38094_; } -+ + + public net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() { + return COLLISIONS; + } @@ -37,9 +36,10 @@ + public static void registerCollisionHandler(@Nullable net.minecraftforge.common.IMinecartCollisionHandler handler) { + COLLISIONS = handler; + } - ++ public static AbstractMinecart m_38119_(Level p_38120_, double p_38121_, double p_38122_, double p_38123_, AbstractMinecart.Type p_38124_) { if (p_38124_ == AbstractMinecart.Type.CHEST) { + return new MinecartChest(p_38120_, p_38121_, p_38122_, p_38123_); @@ -133,7 +_,7 @@ } @@ -49,7 +49,7 @@ } protected Vec3 m_7643_(Direction.Axis p_38132_, BlockUtil.FoundRectangle p_38133_) { -@@ -300,9 +_,9 @@ +@@ -302,9 +_,9 @@ BlockPos blockpos = new BlockPos(k, i, j); BlockState blockstate = this.f_19853_.m_8055_(blockpos); @@ -61,30 +61,30 @@ this.m_6025_(k, i, j, blockstate.m_61143_(PoweredRailBlock.f_55215_)); } } else { -@@ -327,8 +_,11 @@ +@@ -329,8 +_,11 @@ } this.m_19915_(this.m_146908_(), this.m_146909_()); - if (this.m_6064_() == AbstractMinecart.Type.RIDEABLE && this.m_20184_().m_165925_() > 0.01D) { -- List list = this.f_19853_.m_6249_(this, this.m_142469_().m_82377_((double)0.2F, 0.0D, (double)0.2F), EntitySelector.m_20421_(this)); +- List list = this.f_19853_.m_6249_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F), EntitySelector.m_20421_(this)); + AABB box; + if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.m_142469_().m_82377_(0.2F, 0.0D, 0.2F); ++ else box = this.m_20191_().m_82377_(0.2F, 0.0D, 0.2F); + if (canBeRidden() && this.m_20184_().m_165925_() > 0.01D) { + List list = this.f_19853_.m_6249_(this, box, EntitySelector.m_20421_(this)); if (!list.isEmpty()) { for(int l = 0; l < list.size(); ++l) { Entity entity1 = list.get(l); -@@ -340,7 +_,7 @@ +@@ -342,7 +_,7 @@ } } } else { -- for(Entity entity : this.f_19853_.m_45933_(this, this.m_142469_().m_82377_((double)0.2F, 0.0D, (double)0.2F))) { +- for(Entity entity : this.f_19853_.m_45933_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F))) { + for(Entity entity : this.f_19853_.m_45933_(this, box)) { if (!this.m_20363_(entity) && entity.m_6094_() && entity instanceof AbstractMinecart) { entity.m_7334_(this); } -@@ -365,16 +_,23 @@ +@@ -367,16 +_,23 @@ } protected void m_38163_() { @@ -110,7 +110,7 @@ } } -@@ -388,7 +_,8 @@ +@@ -390,7 +_,8 @@ d1 = (double)p_38156_.m_123342_(); boolean flag = false; boolean flag1 = false; @@ -120,35 +120,35 @@ flag = p_38157_.m_61143_(PoweredRailBlock.f_55215_); flag1 = !flag; } -@@ -399,22 +_,22 @@ +@@ -401,22 +_,22 @@ } Vec3 vec31 = this.m_20184_(); - RailShape railshape = p_38157_.m_61143_(((BaseRailBlock)p_38157_.m_60734_()).m_7978_()); + RailShape railshape = ((BaseRailBlock)p_38157_.m_60734_()).getRailDirection(p_38157_, this.f_19853_, p_38156_, this); - switch(railshape) { - case ASCENDING_EAST: -- this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D)); + switch (railshape) { + case ASCENDING_EAST: +- this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D)); + this.m_20256_(vec31.m_82520_(-1 * getSlopeAdjustment(), 0.0D, 0.0D)); - ++d1; - break; - case ASCENDING_WEST: -- this.m_20256_(vec31.m_82520_(d3, 0.0D, 0.0D)); + ++d1; + break; + case ASCENDING_WEST: +- this.m_20256_(vec31.m_82520_(d3, 0.0D, 0.0D)); + this.m_20256_(vec31.m_82520_(getSlopeAdjustment(), 0.0D, 0.0D)); - ++d1; - break; - case ASCENDING_NORTH: -- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, d3)); + ++d1; + break; + case ASCENDING_NORTH: +- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, d3)); + this.m_20256_(vec31.m_82520_(0.0D, 0.0D, getSlopeAdjustment())); - ++d1; - break; - case ASCENDING_SOUTH: -- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, -d3)); + ++d1; + break; + case ASCENDING_SOUTH: +- this.m_20256_(vec31.m_82520_(0.0D, 0.0D, -d3)); + this.m_20256_(vec31.m_82520_(0.0D, 0.0D, -1 * getSlopeAdjustment())); - ++d1; + ++d1; } -@@ -445,7 +_,7 @@ +@@ -447,7 +_,7 @@ } } @@ -157,7 +157,7 @@ double d22 = this.m_20184_().m_165924_(); if (d22 < 0.03D) { this.m_20256_(Vec3.f_82478_); -@@ -474,10 +_,7 @@ +@@ -476,10 +_,7 @@ d0 = d23 + d4 * d14; d2 = d10 + d5 * d14; this.m_6034_(d0, d1, d2); @@ -169,7 +169,7 @@ if (vec3i.m_123342_() != 0 && Mth.m_14107_(this.m_20185_()) - p_38156_.m_123341_() == vec3i.m_123341_() && Mth.m_14107_(this.m_20189_()) - p_38156_.m_123343_() == vec3i.m_123343_()) { this.m_6034_(this.m_20185_(), this.m_20186_() + (double)vec3i.m_123342_(), this.m_20189_()); } else if (vec3i1.m_123342_() != 0 && Mth.m_14107_(this.m_20185_()) - p_38156_.m_123341_() == vec3i1.m_123341_() && Mth.m_14107_(this.m_20189_()) - p_38156_.m_123343_() == vec3i1.m_123343_()) { -@@ -505,7 +_,10 @@ +@@ -507,7 +_,10 @@ this.m_20334_(d26 * (double)(j - p_38156_.m_123341_()), vec35.f_82480_, d26 * (double)(i - p_38156_.m_123343_())); } @@ -181,7 +181,7 @@ Vec3 vec36 = this.m_20184_(); double d27 = vec36.m_165924_(); if (d27 > 0.01D) { -@@ -565,7 +_,7 @@ +@@ -567,7 +_,7 @@ BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); if (BaseRailBlock.m_49416_(blockstate)) { @@ -190,7 +190,7 @@ p_38098_ = (double)j; if (railshape.m_61745_()) { p_38098_ = (double)(j + 1); -@@ -604,7 +_,7 @@ +@@ -606,7 +_,7 @@ BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); if (BaseRailBlock.m_49416_(blockstate)) { @@ -199,7 +199,7 @@ Pair pair = m_38125_(railshape); Vec3i vec3i = pair.getFirst(); Vec3i vec3i1 = pair.getSecond(); -@@ -666,6 +_,10 @@ +@@ -668,6 +_,10 @@ } public void m_7334_(Entity p_38165_) { @@ -210,7 +210,7 @@ if (!this.f_19853_.f_46443_) { if (!p_38165_.f_19794_ && !this.f_19794_) { if (!this.m_20363_(p_38165_)) { -@@ -699,11 +_,11 @@ +@@ -701,11 +_,11 @@ Vec3 vec32 = this.m_20184_(); Vec3 vec33 = p_38165_.m_20184_(); @@ -224,10 +224,11 @@ p_38165_.m_20256_(vec33.m_82542_(0.2D, 1.0D, 0.2D)); p_38165_.m_5997_(vec32.f_82479_ + d0, 0.0D, vec32.f_82481_ + d1); this.m_20256_(vec32.m_82542_(0.95D, 1.0D, 0.95D)); -@@ -807,6 +_,42 @@ +@@ -808,6 +_,42 @@ + public Packet m_5654_() { return new ClientboundAddEntityPacket(this); } - ++ + // Forge Start + private boolean canUseRail = true; + @Override public boolean canUseRail() { return canUseRail; } @@ -263,17 +264,6 @@ + mc.m_6478_(MoverType.SELF, new Vec3(Mth.m_14008_(d24 * vec3d1.f_82479_, -d25, d25), 0.0D, Mth.m_14008_(d24 * vec3d1.f_82481_, -d25, d25))); + } + // Forge end -+ + public ItemStack m_142340_() { Item item; - switch(this.m_6064_()) { -@@ -828,7 +_,8 @@ - default: - item = Items.f_42449_; - } -- -+ // TODO, should this be above? -+ if (item == null) return getCartItem(); - return new ItemStack(item); - } - diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch index cbe7a576d0a..557a55b1cf6 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch @@ -1,24 +1,15 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -156,6 +_,8 @@ +@@ -82,6 +_,8 @@ } public InteractionResult m_6096_(Player p_38232_, InteractionHand p_38233_) { + InteractionResult ret = super.m_6096_(p_38232_, p_38233_); + if (ret.m_19077_()) return ret; - p_38232_.m_5893_(this); - if (!p_38232_.f_19853_.f_46443_) { - this.m_146852_(GameEvent.f_157803_, p_38232_); -@@ -189,6 +_,8 @@ + return this.m_219931_(this::m_146852_, p_38232_); + } - this.f_38204_ = null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_19853_)).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78965_(this.f_38205_); -+ // Forge: add this entity to loot context, however, currently Vanilla uses 'this' for the player creating the chests. So we take over 'killer_entity' for this. -+ lootcontext$builder.m_78972_(LootContextParams.f_81458_, this); - if (p_38255_ != null) { - lootcontext$builder.m_78963_(p_38255_.m_36336_()).m_78972_(LootContextParams.f_81455_, p_38255_); - } -@@ -219,4 +_,26 @@ +@@ -119,6 +_,28 @@ } protected abstract AbstractContainerMenu m_7402_(int p_38222_, Inventory p_38223_); @@ -44,4 +35,6 @@ + super.reviveCaps(); + itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); + } - } + + @Nullable + public ResourceLocation m_214142_() { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch index e14c486000f..8c0519eb6ba 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/Boat.java +++ b/net/minecraft/world/entity/vehicle/Boat.java -@@ -475,7 +_,7 @@ +@@ -480,7 +_,7 @@ blockpos$mutableblockpos.m_122178_(l1, k2, i2); BlockState blockstate = this.f_19853_.m_8055_(blockpos$mutableblockpos); if (!(blockstate.m_60734_() instanceof WaterlilyBlock) && Shapes.m_83157_(blockstate.m_60812_(this.f_19853_, blockpos$mutableblockpos).m_83216_((double)l1, (double)k2, (double)i2), voxelshape, BooleanOp.f_82689_)) { @@ -9,7 +9,7 @@ ++k1; } } -@@ -821,6 +_,16 @@ +@@ -834,6 +_,16 @@ public boolean m_5842_() { return this.f_38279_ == Boat.Status.UNDER_WATER || this.f_38279_ == Boat.Status.UNDER_FLOWING_WATER; diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch new file mode 100644 index 00000000000..590c5c081a2 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java ++++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java +@@ -111,6 +_,9 @@ + + this.m_214199_((ResourceLocation)null); + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.m_9236_())).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78965_(this.m_213803_()); ++ // Forge: set the chest to killer_entity for loot context. ++ if (this instanceof AbstractMinecartContainer entityContainer) ++ lootcontext$builder.m_78972_(LootContextParams.f_81458_, entityContainer); + if (p_219950_ != null) { + lootcontext$builder.m_78963_(p_219950_.m_36336_()).m_78972_(LootContextParams.f_81455_, p_219950_); + } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/Minecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/Minecart.java.patch index 39a97c93975..9e7ae0aa06b 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/Minecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/Minecart.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/Minecart.java +++ b/net/minecraft/world/entity/vehicle/Minecart.java -@@ -16,6 +_,8 @@ +@@ -18,6 +_,8 @@ } public InteractionResult m_6096_(Player p_38483_, InteractionHand p_38484_) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch index 87ab95bd175..a2ca99f2adc 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java +++ b/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java -@@ -72,6 +_,8 @@ +@@ -78,6 +_,8 @@ } public InteractionResult m_6096_(Player p_38522_, InteractionHand p_38523_) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch index ff3e897538f..f1b31a5d149 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch @@ -1,18 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/MinecartFurnace.java +++ b/net/minecraft/world/entity/vehicle/MinecartFurnace.java -@@ -71,6 +_,11 @@ - return (this.m_20069_() ? 3.0D : 4.0D) / 20.0D; - } - -+ @Override -+ public float getMaxCartSpeedOnRail() { -+ return 0.2f; -+ } -+ - public void m_7617_(DamageSource p_38560_) { - super.m_7617_(p_38560_); - if (!p_38560_.m_19372_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46137_)) { -@@ -115,6 +_,8 @@ +@@ -110,6 +_,8 @@ } public InteractionResult m_6096_(Player p_38562_, InteractionHand p_38563_) { @@ -21,3 +9,15 @@ ItemStack itemstack = p_38562_.m_21120_(p_38563_); if (f_38549_.test(itemstack) && this.f_38548_ + 3600 <= 32000) { if (!p_38562_.m_150110_().f_35937_) { +@@ -125,6 +_,11 @@ + } + + return InteractionResult.m_19078_(this.f_19853_.f_46443_); ++ } ++ ++ @Override ++ public float getMaxCartSpeedOnRail() { ++ return 0.2f; + } + + protected void m_7380_(CompoundTag p_38567_) { diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartSpawner.java.patch index ed257982df0..8567b649f2c 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartSpawner.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/vehicle/MinecartSpawner.java +++ b/net/minecraft/world/entity/vehicle/MinecartSpawner.java -@@ -14,6 +_,12 @@ +@@ -16,6 +_,12 @@ public void m_142523_(Level p_150342_, BlockPos p_150343_, int p_150344_) { p_150342_.m_7605_(MinecartSpawner.this, (byte)p_150344_); } + + @Override -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public net.minecraft.world.entity.Entity getSpawnerEntity() { + return MinecartSpawner.this; + } diff --git a/patches/minecraft/net/minecraft/world/food/FoodData.java.patch b/patches/minecraft/net/minecraft/world/food/FoodData.java.patch index 0274fc1003e..15549a40ef2 100644 --- a/patches/minecraft/net/minecraft/world/food/FoodData.java.patch +++ b/patches/minecraft/net/minecraft/world/food/FoodData.java.patch @@ -10,7 +10,7 @@ + this.eat(p_38713_, p_38714_, null); + } + -+ public void eat(Item p_38713_, ItemStack p_38714_, @javax.annotation.Nullable net.minecraft.world.entity.LivingEntity entity) { ++ public void eat(Item p_38713_, ItemStack p_38714_, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.LivingEntity entity) { if (p_38713_.m_41472_()) { - FoodProperties foodproperties = p_38713_.m_41473_(); + FoodProperties foodproperties = p_38714_.getFoodProperties(entity); diff --git a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index edc6d74c423..83e37169a78 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -12,7 +12,7 @@ for(ContainerListener containerlistener : this.f_38848_) { containerlistener.m_7934_(this, p_150408_, itemstack1); } -@@ -603,14 +_,15 @@ +@@ -601,14 +_,15 @@ ItemStack itemstack = slot.m_7993_(); if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) { int j = itemstack.m_41613_() + p_38904_.m_41613_(); @@ -32,11 +32,11 @@ slot.m_6654_(); flag = true; } -@@ -710,7 +_,7 @@ - p_38925_.m_41764_(1); - break; - case 2: -- p_38925_.m_41764_(p_38925_.m_41720_().m_41459_()); +@@ -708,7 +_,7 @@ + p_38925_.m_41764_(1); + break; + case 2: +- p_38925_.m_41764_(p_38925_.m_41720_().m_41459_()); + p_38925_.m_41764_(p_38925_.m_41741_()); } diff --git a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch index bc7c335bfe3..a925d47dd8c 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -13,8 +13,8 @@ this.f_39002_.m_6422_(0); this.f_39770_.m_39292_((p_150479_, p_150480_) -> { BlockState blockstate = p_150479_.m_8055_(p_150480_); -- if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < 0.12F) { -+ if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < breakChance) { +- if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_217043_().m_188501_() < 0.12F) { ++ if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_217043_().m_188501_() < breakChance) { BlockState blockstate1 = AnvilBlock.m_48824_(blockstate); if (blockstate1 == null) { p_150479_.m_7471_(p_150480_, false); @@ -33,7 +33,7 @@ if (l2 <= 0) { @@ -218,6 +_,7 @@ i += k; - itemstack1.m_41714_(new TextComponent(this.f_39001_)); + itemstack1.m_41714_(Component.m_237113_(this.f_39001_)); } + if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.f_41583_; diff --git a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch index bb6fbbcd97b..1ae6b8680c1 100644 --- a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/BeaconMenu.java +++ b/net/minecraft/world/inventory/BeaconMenu.java -@@ -90,10 +_,8 @@ +@@ -91,10 +_,8 @@ } slot.m_40234_(itemstack1, itemstack); diff --git a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch index cb0b93bd2f3..8bae4964f9c 100644 --- a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -19,15 +19,15 @@ for(BlockPos blockpos : EnchantmentTableBlock.f_207902_) { if (EnchantmentTableBlock.m_207909_(p_39485_, p_39486_, blockpos)) { - ++j; -+ j += p_39485_.m_8055_(p_39486_.m_141952_(blockpos)).getEnchantPowerBonus(p_39485_, p_39486_.m_141952_(blockpos)); ++ j += p_39485_.m_8055_(p_39486_.m_121955_(blockpos)).getEnchantPowerBonus(p_39485_, p_39486_.m_121955_(blockpos)); } } - this.f_39451_.setSeed((long)this.f_39452_.m_6501_()); + this.f_39451_.m_188584_((long)this.f_39452_.m_6501_()); for(int k = 0; k < 3; ++k) { -- this.f_39446_[k] = EnchantmentHelper.m_44872_(this.f_39451_, k, j, itemstack); -+ this.f_39446_[k] = EnchantmentHelper.m_44872_(this.f_39451_, k, (int)j, itemstack); +- this.f_39446_[k] = EnchantmentHelper.m_220287_(this.f_39451_, k, j, itemstack); ++ this.f_39446_[k] = EnchantmentHelper.m_220287_(this.f_39451_, k, (int)j, itemstack); this.f_39447_[k] = -1; this.f_39448_[k] = -1; if (this.f_39446_[k] < k + 1) { diff --git a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch index 50f06981962..536abff41ac 100644 --- a/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/net/minecraft/world/inventory/GrindstoneMenu.java -@@ -144,12 +_,13 @@ +@@ -143,12 +_,13 @@ } Item item = itemstack.m_41720_(); diff --git a/patches/minecraft/net/minecraft/world/inventory/InventoryMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/InventoryMenu.java.patch index 6eae97fcad9..48f35abf935 100644 --- a/patches/minecraft/net/minecraft/world/inventory/InventoryMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/InventoryMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/InventoryMenu.java +++ b/net/minecraft/world/inventory/InventoryMenu.java -@@ -57,7 +_,7 @@ +@@ -63,7 +_,7 @@ } public boolean m_5857_(ItemStack p_39746_) { diff --git a/patches/minecraft/net/minecraft/world/inventory/LoomMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/LoomMenu.java.patch deleted file mode 100644 index 662db98248f..00000000000 --- a/patches/minecraft/net/minecraft/world/inventory/LoomMenu.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/world/inventory/LoomMenu.java -+++ b/net/minecraft/world/inventory/LoomMenu.java -@@ -114,8 +_,8 @@ - } - - public boolean m_6366_(Player p_39867_, int p_39868_) { -- if (p_39868_ > 0 && p_39868_ <= BannerPattern.f_58528_) { -- this.f_39846_.m_6422_(p_39868_); -+ if (p_39868_ > 0 && p_39868_ <= net.minecraftforge.common.ForgeHooks.getNonPatternItemCount() - 1) { -+ this.f_39846_.m_6422_(net.minecraftforge.common.ForgeHooks.getActualPatternIndex(p_39868_)); - this.m_39898_(); - return true; - } else { -@@ -128,7 +_,7 @@ - ItemStack itemstack1 = this.f_39849_.m_7993_(); - ItemStack itemstack2 = this.f_39850_.m_7993_(); - ItemStack itemstack3 = this.f_39851_.m_7993_(); -- if (itemstack3.m_41619_() || !itemstack.m_41619_() && !itemstack1.m_41619_() && this.f_39846_.m_6501_() > 0 && (this.f_39846_.m_6501_() < BannerPattern.f_58526_ - BannerPattern.f_58527_ || !itemstack2.m_41619_())) { -+ if (itemstack3.m_41619_() || !itemstack.m_41619_() && !itemstack1.m_41619_() && this.f_39846_.m_6501_() > 0 && (this.f_39846_.m_6501_() < net.minecraftforge.common.ForgeHooks.getNonPatternItemCount() || !itemstack2.m_41619_())) { - if (!itemstack2.m_41619_() && itemstack2.m_41720_() instanceof BannerPatternItem) { - CompoundTag compoundtag = BlockItem.m_186336_(itemstack); - boolean flag = compoundtag != null && compoundtag.m_128425_("Patterns", 9) && !itemstack.m_41619_() && compoundtag.m_128437_("Patterns", 10).size() >= 6; diff --git a/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch b/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch index f9582ab53ed..897b6cfe3de 100644 --- a/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch @@ -5,7 +5,7 @@ import net.minecraft.world.entity.player.Inventory; -public class MenuType { -+public class MenuType extends net.minecraftforge.registries.ForgeRegistryEntry> implements net.minecraftforge.common.extensions.IForgeMenuType { ++public class MenuType implements net.minecraftforge.common.extensions.IForgeMenuType { public static final MenuType f_39957_ = m_39988_("generic_9x1", ChestMenu::m_39234_); public static final MenuType f_39958_ = m_39988_("generic_9x2", ChestMenu::m_39243_); public static final MenuType f_39959_ = m_39988_("generic_9x3", ChestMenu::m_39255_); diff --git a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch index f17ee17df15..8fa5b7819b4 100644 --- a/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/Slot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/Slot.java +++ b/net/minecraft/world/inventory/Slot.java -@@ -74,7 +_,7 @@ +@@ -79,7 +_,7 @@ @Nullable public Pair m_7543_() { @@ -9,7 +9,7 @@ } public ItemStack m_6201_(int p_40227_) { -@@ -87,6 +_,38 @@ +@@ -92,6 +_,38 @@ public boolean m_6659_() { return true; diff --git a/patches/minecraft/net/minecraft/world/item/ArmorItem.java.patch b/patches/minecraft/net/minecraft/world/item/ArmorItem.java.patch index cafce0b3aaf..ec3edebf7c2 100644 --- a/patches/minecraft/net/minecraft/world/item/ArmorItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ArmorItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ArmorItem.java +++ b/net/minecraft/world/item/ArmorItem.java -@@ -71,7 +_,7 @@ +@@ -70,7 +_,7 @@ UUID uuid = f_40380_[p_40387_.m_20749_()]; builder.put(Attributes.f_22284_, new AttributeModifier(uuid, "Armor modifier", (double)this.f_40381_, AttributeModifier.Operation.ADDITION)); builder.put(Attributes.f_22285_, new AttributeModifier(uuid, "Armor toughness", (double)this.f_40382_, AttributeModifier.Operation.ADDITION)); diff --git a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch index 46ee28fd61e..b0952a92eef 100644 --- a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java -@@ -31,11 +_,9 @@ +@@ -32,11 +_,9 @@ BlockPos blockpos = p_40529_.m_8083_(); Player player = p_40529_.m_43723_(); BlockState blockstate = level.m_8055_(blockpos); @@ -15,11 +15,11 @@ ItemStack itemstack = p_40529_.m_43722_(); Optional optional3 = Optional.empty(); if (optional.isPresent()) { -@@ -69,9 +_,20 @@ +@@ -71,9 +_,20 @@ } } -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public static BlockState getAxeStrippingState(BlockState originalState) { + Block block = f_150683_.get(originalState.m_60734_()); + return block != null ? block.m_49966_().m_61124_(RotatedPillarBlock.f_55923_, originalState.m_61143_(RotatedPillarBlock.f_55923_)) : null; diff --git a/patches/minecraft/net/minecraft/world/item/BannerItem.java.patch b/patches/minecraft/net/minecraft/world/item/BannerItem.java.patch index dcd0558808d..9d66f62fe88 100644 --- a/patches/minecraft/net/minecraft/world/item/BannerItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BannerItem.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/item/BannerItem.java +++ b/net/minecraft/world/item/BannerItem.java -@@ -32,7 +_,8 @@ - DyeColor dyecolor = DyeColor.m_41053_(compoundtag1.m_128451_("Color")); - BannerPattern bannerpattern = BannerPattern.m_58575_(compoundtag1.m_128461_("Pattern")); - if (bannerpattern != null) { -- p_40544_.add((new TranslatableComponent("block.minecraft.banner." + bannerpattern.m_58572_() + "." + dyecolor.m_41065_())).m_130940_(ChatFormatting.GRAY)); -+ net.minecraft.resources.ResourceLocation fileLoc = new net.minecraft.resources.ResourceLocation(bannerpattern.m_58572_()); -+ p_40544_.add((new TranslatableComponent("block." + fileLoc.m_135827_() + ".banner." + fileLoc.m_135815_() + "." + dyecolor.m_41065_())).m_130940_(ChatFormatting.GRAY)); +@@ -35,7 +_,8 @@ + holder.m_203543_().map((p_220002_) -> { + return p_220002_.m_135782_().m_214299_(); + }).ifPresent((p_220006_) -> { +- p_40544_.add(Component.m_237115_("block.minecraft.banner." + p_220006_ + "." + dyecolor.m_41065_()).m_130940_(ChatFormatting.GRAY)); ++ net.minecraft.resources.ResourceLocation fileLoc = new net.minecraft.resources.ResourceLocation(p_220006_); ++ p_40544_.add(Component.m_237115_("block." + fileLoc.m_135827_() + ".banner." + fileLoc.m_135815_() + "." + dyecolor.m_41065_()).m_130940_(ChatFormatting.GRAY)); + }); } } - diff --git a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch index c1221179aec..c83bbe306fc 100644 --- a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch @@ -6,7 +6,7 @@ - SoundType soundtype = blockstate1.m_60827_(); - level.m_5594_(player, blockpos, this.m_40587_(blockstate1), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F); - level.m_142346_(player, GameEvent.f_157797_, blockpos); + level.m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(player, blockstate1)); + SoundType soundtype = blockstate1.getSoundType(level, blockpos, p_40577_.m_43723_()); + level.m_5594_(player, blockpos, this.getPlaceSound(blockstate1, level, blockpos, p_40577_.m_43723_()), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F); if (player == null || !player.m_150110_().f_35937_) { @@ -33,7 +33,7 @@ } public Block m_40614_() { -+ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get(); ++ return this.getBlockRaw() == null ? null : net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(this.getBlockRaw()).get(); + } + + private Block getBlockRaw() { diff --git a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch index c0e42868be9..91d1db6bc7c 100644 --- a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch @@ -3,7 +3,7 @@ @@ -33,7 +_,7 @@ Level level = p_40637_.m_43725_(); BlockPos blockpos = p_40637_.m_8083_(); - BlockPos blockpos1 = blockpos.m_142300_(p_40637_.m_43719_()); + BlockPos blockpos1 = blockpos.m_121945_(p_40637_.m_43719_()); - if (m_40627_(p_40637_.m_43722_(), level, blockpos)) { + if (applyBonemeal(p_40637_.m_43722_(), level, blockpos, p_40637_.m_43723_())) { if (!level.f_46443_) { diff --git a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch index 63ea0f60352..1b5b224fd2d 100644 --- a/patches/minecraft/net/minecraft/world/item/BowItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BowItem.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java -@@ -26,18 +_,23 @@ - Player player = (Player)p_40669_; +@@ -25,18 +_,23 @@ + if (p_40669_ instanceof Player player) { boolean flag = player.m_150110_().f_35937_ || EnchantmentHelper.m_44843_(Enchantments.f_44952_, p_40667_) > 0; ItemStack itemstack = player.m_6298_(p_40667_); + @@ -26,7 +26,7 @@ abstractarrow.m_37251_(player, player.m_146909_(), player.m_146908_(), 0.0F, f * 3.0F, 1.0F); if (f == 1.0F) { abstractarrow.m_36762_(true); -@@ -102,6 +_,10 @@ +@@ -101,6 +_,10 @@ public InteractionResultHolder m_7203_(Level p_40672_, Player p_40673_, InteractionHand p_40674_) { ItemStack itemstack = p_40673_.m_21120_(p_40674_); boolean flag = !p_40673_.m_6298_(itemstack).m_41619_(); @@ -37,7 +37,7 @@ if (!p_40673_.m_150110_().f_35937_ && !flag) { return InteractionResultHolder.m_19100_(itemstack); } else { -@@ -112,6 +_,10 @@ +@@ -111,6 +_,10 @@ public Predicate m_6437_() { return f_43005_; diff --git a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch index 2cedb784d63..9634ac57702 100644 --- a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch @@ -9,7 +9,7 @@ public BucketItem(Fluid p_40689_, Item.Properties p_40690_) { super(p_40690_); this.f_40687_ = p_40689_; -+ this.fluidSupplier = p_40689_.delegate; ++ this.fluidSupplier = net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_40689_); + } + + /** diff --git a/patches/minecraft/net/minecraft/world/item/ChorusFruitItem.java.patch b/patches/minecraft/net/minecraft/world/item/ChorusFruitItem.java.patch index 573926f0185..b380d2b3040 100644 --- a/patches/minecraft/net/minecraft/world/item/ChorusFruitItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ChorusFruitItem.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/world/item/ChorusFruitItem.java +++ b/net/minecraft/world/item/ChorusFruitItem.java -@@ -30,7 +_,9 @@ - p_40714_.m_8127_(); +@@ -33,8 +_,10 @@ } + Vec3 vec3 = p_40714_.m_20182_(); - if (p_40714_.m_20984_(d3, d4, d5, true)) { + p_40713_.m_214171_(GameEvent.f_238175_, vec3, GameEvent.Context.m_223717_(p_40714_)); + net.minecraftforge.event.entity.EntityTeleportEvent.ChorusFruit event = net.minecraftforge.event.ForgeEventFactory.onChorusFruitTeleport(p_40714_, d3, d4, d5); + if (event.isCanceled()) return itemstack; + if (p_40714_.m_20984_(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) { diff --git a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch index f4211a5feb3..2092d7824ee 100644 --- a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/CreativeModeTab.java +++ b/net/minecraft/world/item/CreativeModeTab.java -@@ -85,18 +_,23 @@ +@@ -84,18 +_,23 @@ private final String f_40763_; private final Component f_40764_; private String f_40765_; @@ -19,14 +19,14 @@ public CreativeModeTab(int p_40773_, String p_40774_) { - this.f_40762_ = p_40773_; this.f_40763_ = p_40774_; - this.f_40764_ = new TranslatableComponent("itemGroup." + p_40774_); + this.f_40764_ = Component.m_237115_("itemGroup." + p_40774_); this.f_40770_ = ItemStack.f_41583_; - f_40748_[p_40773_] = this; + this.f_40762_ = addGroupSafe(p_40773_, this); } public int m_40775_() { -@@ -121,15 +_,28 @@ +@@ -120,15 +_,28 @@ public abstract ItemStack m_6976_(); @@ -55,7 +55,7 @@ public CreativeModeTab m_40784_(String p_40785_) { this.f_40765_ = p_40785_; return this; -@@ -154,10 +_,12 @@ +@@ -153,10 +_,12 @@ } public int m_40793_() { @@ -68,7 +68,7 @@ return this.f_40762_ < 6; } -@@ -191,5 +_,58 @@ +@@ -190,5 +_,58 @@ item.m_6787_(this, p_40778_); } diff --git a/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch b/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch index 4ab9035fc3b..c1019be816a 100644 --- a/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/DiggerItem.java +++ b/net/minecraft/world/item/DiggerItem.java -@@ -61,7 +_,11 @@ +@@ -60,7 +_,11 @@ return this.f_40981_; } @@ -12,7 +12,7 @@ int i = this.m_43314_().m_6604_(); if (i < 3 && p_150816_.m_204336_(BlockTags.f_144284_)) { return false; -@@ -70,5 +_,11 @@ +@@ -69,5 +_,11 @@ } else { return i < 1 && p_150816_.m_204336_(BlockTags.f_144286_) ? false : p_150816_.m_204336_(this.f_40979_); } diff --git a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch index 9498e22656b..72b33c42e07 100644 --- a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java -@@ -39,6 +_,7 @@ +@@ -40,6 +_,7 @@ private final MaterialColor f_41036_; private final float[] f_41039_; private final int f_41040_; @@ -8,7 +8,7 @@ private final int f_41041_; private DyeColor(int p_41046_, String p_41047_, int p_41048_, MaterialColor p_41049_, int p_41050_, int p_41051_) { -@@ -49,6 +_,7 @@ +@@ -50,6 +_,7 @@ int i = (p_41048_ & 16711680) >> 16; int j = (p_41048_ & '\uff00') >> 8; int k = (p_41048_ & 255) >> 0; @@ -16,7 +16,7 @@ this.f_41039_ = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; this.f_41040_ = p_41050_; } -@@ -106,5 +_,22 @@ +@@ -109,5 +_,22 @@ public String m_7912_() { return this.f_41035_; diff --git a/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch b/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch index cbe6a406aa5..fa14b507255 100644 --- a/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch @@ -17,7 +17,7 @@ + if (nextFlightTick % 20 == 0) { + stack.m_41622_(1, entity, e -> e.m_21166_(net.minecraft.world.entity.EquipmentSlot.CHEST)); + } -+ entity.m_146850_(net.minecraft.world.level.gameevent.GameEvent.f_157807_); ++ entity.m_146850_(net.minecraft.world.level.gameevent.GameEvent.f_223705_); + } + } + return true; diff --git a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch index b245809ecf5..6c308763a96 100644 --- a/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/HoeItem.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/item/HoeItem.java +++ b/net/minecraft/world/item/HoeItem.java -@@ -21,6 +_,12 @@ - import net.minecraft.world.level.block.state.BlockState; +@@ -22,6 +_,12 @@ + import net.minecraft.world.level.gameevent.GameEvent; public class HoeItem extends DiggerItem { + /** @@ -10,15 +10,11 @@ + * or override {@link net.minecraftforge.common.extensions.IForgeBlock#getToolModifiedState(BlockState, UseOnContext, net.minecraftforge.common.ToolAction, boolean)}. + */ + @Deprecated - protected static final Map, Consumer>> f_41332_ = Maps.newHashMap(ImmutableMap.of(Blocks.f_50440_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_152481_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_50493_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_50546_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50493_.m_49966_())), Blocks.f_152549_, Pair.of((p_150861_) -> { + protected static final Map, Consumer>> f_41332_ = Maps.newHashMap(ImmutableMap.of(Blocks.f_50440_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_152481_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_50493_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50093_.m_49966_())), Blocks.f_50546_, Pair.of(HoeItem::m_150856_, m_150858_(Blocks.f_50493_.m_49966_())), Blocks.f_152549_, Pair.of((p_238242_) -> { return true; }, m_150849_(Blocks.f_50493_.m_49966_(), Items.f_151017_)))); -@@ -30,9 +_,12 @@ - } - +@@ -33,7 +_,8 @@ public InteractionResult m_6225_(UseOnContext p_41341_) { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_41341_); -+ if (hook != 0) return hook > 0 ? InteractionResult.SUCCESS : InteractionResult.FAIL; Level level = p_41341_.m_43725_(); BlockPos blockpos = p_41341_.m_8083_(); - Pair, Consumer> pair = f_41332_.get(level.m_8055_(blockpos).m_60734_()); @@ -27,7 +23,7 @@ if (pair == null) { return InteractionResult.PASS; } else { -@@ -72,5 +_,10 @@ +@@ -75,5 +_,10 @@ public static boolean m_150856_(UseOnContext p_150857_) { return p_150857_.m_43719_() != Direction.DOWN && p_150857_.m_43725_().m_8055_(p_150857_.m_8083_().m_7494_()).m_60795_(); diff --git a/patches/minecraft/net/minecraft/world/item/Item.java.patch b/patches/minecraft/net/minecraft/world/item/Item.java.patch index 8ddaf5f0753..5ee6263bc32 100644 --- a/patches/minecraft/net/minecraft/world/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Item.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -47,9 +_,9 @@ +@@ -46,9 +_,9 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; -public class Item implements ItemLike { -+public class Item extends net.minecraftforge.registries.ForgeRegistryEntry implements ItemLike, net.minecraftforge.common.extensions.IForgeItem { ++public class Item implements ItemLike, net.minecraftforge.common.extensions.IForgeItem { private static final Logger f_150883_ = LogUtils.getLogger(); - public static final Map f_41373_ = Maps.newHashMap(); + public static final Map f_41373_ = net.minecraftforge.registries.GameData.getBlockItemMap(); protected static final UUID f_41374_ = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); protected static final UUID f_41375_ = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); public static final int f_150884_ = 64; -@@ -97,7 +_,8 @@ +@@ -96,7 +_,8 @@ f_150883_.error("Item classes should end with Item and {} doesn't.", (Object)s); } } @@ -22,7 +22,7 @@ } /** @deprecated */ -@@ -106,6 +_,8 @@ +@@ -105,6 +_,8 @@ return this.f_204113_; } @@ -31,7 +31,7 @@ public void m_5929_(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { } -@@ -132,9 +_,9 @@ +@@ -131,9 +_,9 @@ } public InteractionResultHolder m_7203_(Level p_41432_, Player p_41433_, InteractionHand p_41434_) { @@ -44,7 +44,7 @@ p_41433_.m_6672_(p_41434_); return InteractionResultHolder.m_19096_(itemstack); } else { -@@ -149,10 +_,12 @@ +@@ -148,10 +_,12 @@ return this.m_41472_() ? p_41411_.m_5584_(p_41410_, p_41409_) : p_41409_; } @@ -57,7 +57,7 @@ public final int m_41462_() { return this.f_41371_; } -@@ -166,11 +_,12 @@ +@@ -165,11 +_,12 @@ } public int m_142158_(ItemStack p_150900_) { @@ -72,7 +72,7 @@ return Mth.m_14169_(f / 3.0F, 1.0F, 1.0F); } -@@ -227,10 +_,12 @@ +@@ -226,10 +_,12 @@ } @Nullable @@ -85,7 +85,7 @@ public boolean m_41470_() { return this.f_41378_ != null; } -@@ -251,7 +_,7 @@ +@@ -250,7 +_,7 @@ public int m_8105_(ItemStack p_41454_) { if (p_41454_.m_41720_().m_41472_()) { @@ -94,7 +94,7 @@ } else { return 0; } -@@ -293,7 +_,7 @@ +@@ -292,7 +_,7 @@ } public boolean m_8120_(ItemStack p_41456_) { @@ -103,7 +103,7 @@ } protected static BlockHitResult m_41435_(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) { -@@ -306,8 +_,8 @@ +@@ -305,8 +_,8 @@ float f5 = Mth.m_14031_(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; @@ -114,15 +114,15 @@ return p_41436_.m_45547_(new ClipContext(vec3, vec31, ClipContext.Block.OUTLINE, p_41438_, p_41437_)); } -@@ -323,6 +_,7 @@ +@@ -322,6 +_,7 @@ } - protected boolean m_41389_(CreativeModeTab p_41390_) { -+ if (getCreativeTabs().stream().anyMatch(tab -> tab == p_41390_)) return true; + protected boolean m_220152_(CreativeModeTab p_220153_) { ++ if (getCreativeTabs().stream().anyMatch(tab -> tab == p_220153_)) return true; CreativeModeTab creativemodetab = this.m_41471_(); - return creativemodetab != null && (p_41390_ == CreativeModeTab.f_40754_ || p_41390_ == creativemodetab); + return creativemodetab != null && (p_220153_ == CreativeModeTab.f_40754_ || p_220153_ == creativemodetab); } -@@ -336,12 +_,20 @@ +@@ -335,12 +_,20 @@ return false; } @@ -144,7 +144,7 @@ } public ItemStack m_7968_() { -@@ -352,6 +_,8 @@ +@@ -351,6 +_,8 @@ return this.f_41380_ != null; } @@ -153,7 +153,7 @@ @Nullable public FoodProperties m_41473_() { return this.f_41380_; -@@ -382,6 +_,32 @@ +@@ -381,6 +_,32 @@ return true; } @@ -186,7 +186,7 @@ public static class Properties { int f_41478_ = 64; int f_41479_; -@@ -393,6 +_,7 @@ +@@ -392,6 +_,7 @@ @Nullable FoodProperties f_41483_; boolean f_41484_; @@ -194,7 +194,7 @@ public Item.Properties m_41489_(FoodProperties p_41490_) { this.f_41483_ = p_41490_; -@@ -435,6 +_,11 @@ +@@ -434,6 +_,11 @@ public Item.Properties m_41486_() { this.f_41484_ = true; diff --git a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch index 06de2aa7ac9..4b1a35a5203 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -72,7 +_,7 @@ +@@ -70,7 +_,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import org.slf4j.Logger; @@ -9,18 +9,18 @@ public static final Codec f_41582_ = RecordCodecBuilder.create((p_41697_) -> { return p_41697_.group(Registry.f_122827_.m_194605_().fieldOf("id").forGetter((p_150946_) -> { return p_150946_.f_41589_; -@@ -82,6 +_,9 @@ +@@ -80,6 +_,9 @@ return Optional.ofNullable(p_150939_.f_41590_); })).apply(p_41697_, ItemStack::new); }); -+ private final net.minecraftforge.registries.IRegistryDelegate delegate; ++ private final net.minecraft.core.Holder.Reference delegate; + private CompoundTag capNBT; + private static final Logger f_41585_ = LogUtils.getLogger(); public static final ItemStack f_41583_ = new ItemStack((Item)null); public static final DecimalFormat f_41584_ = Util.m_137469_(new DecimalFormat("#.##"), (p_41704_) -> { -@@ -132,10 +_,15 @@ - p_41606_.ifPresent(this::m_41751_); +@@ -134,10 +_,15 @@ + this(p_220155_.m_203334_(), p_220156_); } - public ItemStack(ItemLike p_41601_, int p_41602_) { @@ -32,14 +32,14 @@ + super(ItemStack.class, true); + this.capNBT = p_41606_; + this.f_41589_ = p_41604_ == null ? null : p_41604_.m_5456_(); -+ this.delegate = p_41604_ == null ? null : p_41604_.m_5456_().delegate; ++ this.delegate = p_41604_ == null ? null : net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_41604_.m_5456_()); + this.f_41587_ = p_41605_; + this.forgeInit(); + if (this.f_41589_ != null && this.f_41589_.isDamageable(this)) { this.m_41721_(this.m_41773_()); } -@@ -148,14 +_,19 @@ +@@ -150,14 +_,19 @@ } private ItemStack(CompoundTag p_41608_) { @@ -47,7 +47,7 @@ + this.capNBT = p_41608_.m_128441_("ForgeCaps") ? p_41608_.m_128469_("ForgeCaps") : null; + Item rawItem = this.f_41589_ = Registry.f_122827_.m_7745_(new ResourceLocation(p_41608_.m_128461_("id"))); -+ this.delegate = rawItem.delegate; ++ this.delegate = net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(rawItem); this.f_41587_ = p_41608_.m_128445_("Count"); if (p_41608_.m_128425_("tag", 10)) { this.f_41590_ = p_41608_.m_128469_("tag"); @@ -60,7 +60,7 @@ this.m_41721_(this.m_41773_()); } -@@ -190,7 +_,7 @@ +@@ -192,7 +_,7 @@ } public Item m_41720_() { @@ -68,8 +68,8 @@ + return this.f_41591_ || this.delegate == null ? Items.f_41852_ : this.delegate.get(); } - public boolean m_204117_(TagKey p_204118_) { -@@ -206,6 +_,15 @@ + public Holder m_220173_() { +@@ -220,6 +_,15 @@ } public InteractionResult m_41661_(UseOnContext p_41662_) { @@ -85,7 +85,7 @@ Player player = p_41662_.m_43723_(); BlockPos blockpos = p_41662_.m_8083_(); BlockInWorld blockinworld = new BlockInWorld(p_41662_.m_43725_(), blockpos, false); -@@ -213,7 +_,7 @@ +@@ -227,7 +_,7 @@ return InteractionResult.PASS; } else { Item item = this.m_41720_(); @@ -94,7 +94,7 @@ if (player != null && interactionresult.m_146666_()) { player.m_36246_(Stats.f_12982_.m_12902_(item)); } -@@ -242,11 +_,15 @@ +@@ -256,11 +_,15 @@ p_41740_.m_128365_("tag", this.f_41590_.m_6426_()); } @@ -111,7 +111,7 @@ } public boolean m_41753_() { -@@ -254,7 +_,7 @@ +@@ -268,7 +_,7 @@ } public boolean m_41763_() { @@ -120,7 +120,7 @@ CompoundTag compoundtag = this.m_41783_(); return compoundtag == null || !compoundtag.m_128471_("Unbreakable"); } else { -@@ -263,19 +_,19 @@ +@@ -277,19 +_,19 @@ } public boolean m_41768_() { @@ -143,16 +143,16 @@ + return this.m_41720_().getMaxDamage(this); } - public boolean m_41629_(int p_41630_, Random p_41631_, @Nullable ServerPlayer p_41632_) { -@@ -311,6 +_,7 @@ + public boolean m_220157_(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_) { +@@ -325,6 +_,7 @@ public void m_41622_(int p_41623_, T p_41624_, Consumer p_41625_) { if (!p_41624_.f_19853_.f_46443_ && (!(p_41624_ instanceof Player) || !((Player)p_41624_).m_150110_().f_35937_)) { if (this.m_41763_()) { + p_41623_ = this.m_41720_().damageItem(this, p_41623_, p_41624_, p_41625_); - if (this.m_41629_(p_41623_, p_41624_.m_21187_(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { + if (this.m_220157_(p_41623_, p_41624_.m_217043_(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { p_41625_.accept(p_41624_); Item item = this.m_41720_(); -@@ -363,7 +_,7 @@ +@@ -377,7 +_,7 @@ } public boolean m_41735_(BlockState p_41736_) { @@ -161,7 +161,7 @@ } public InteractionResult m_41647_(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) { -@@ -374,7 +_,7 @@ +@@ -388,7 +_,7 @@ if (this.m_41619_()) { return f_41583_; } else { @@ -170,7 +170,7 @@ itemstack.m_41754_(this.m_41612_()); if (this.f_41590_ != null) { itemstack.f_41590_ = this.f_41590_.m_6426_(); -@@ -391,7 +_,7 @@ +@@ -405,7 +_,7 @@ if (p_41659_.f_41590_ == null && p_41660_.f_41590_ != null) { return false; } else { @@ -179,7 +179,7 @@ } } else { return false; -@@ -414,7 +_,7 @@ +@@ -428,7 +_,7 @@ } else if (this.f_41590_ == null && p_41745_.f_41590_ != null) { return false; } else { @@ -188,7 +188,7 @@ } } -@@ -538,7 +_,7 @@ +@@ -552,7 +_,7 @@ public void m_41751_(@Nullable CompoundTag p_41752_) { this.f_41590_ = p_41752_; @@ -197,16 +197,16 @@ this.m_41721_(this.m_41773_()); } -@@ -599,7 +_,7 @@ +@@ -613,7 +_,7 @@ public List m_41651_(@Nullable Player p_41652_, TooltipFlag p_41653_) { List list = Lists.newArrayList(); -- MutableComponent mutablecomponent = (new TextComponent("")).m_7220_(this.m_41786_()).m_130940_(this.m_41791_().f_43022_); -+ MutableComponent mutablecomponent = (new TextComponent("")).m_7220_(this.m_41786_()).m_130938_(this.m_41791_().getStyleModifier()); +- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.m_41786_()).m_130940_(this.m_41791_().f_43022_); ++ MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.m_41786_()).m_130938_(this.m_41791_().getStyleModifier()); if (this.m_41788_()) { mutablecomponent.m_130940_(ChatFormatting.ITALIC); } -@@ -738,6 +_,7 @@ +@@ -752,6 +_,7 @@ } } @@ -214,7 +214,7 @@ return list; } -@@ -746,7 +_,7 @@ +@@ -760,7 +_,7 @@ } private int m_41618_() { @@ -223,7 +223,7 @@ } public void m_41654_(ItemStack.TooltipPart p_41655_) { -@@ -874,9 +_,10 @@ +@@ -875,9 +_,10 @@ } } } else { @@ -235,16 +235,16 @@ return multimap; } -@@ -904,7 +_,7 @@ +@@ -905,7 +_,7 @@ MutableComponent mutablecomponent1 = ComponentUtils.m_130748_(mutablecomponent); if (!this.f_41591_) { -- mutablecomponent1.m_130940_(this.m_41791_().f_43022_).m_130938_((p_204127_) -> { -+ mutablecomponent1.m_130938_(this.m_41791_().getStyleModifier()).m_130938_((p_204127_) -> { - return p_204127_.m_131144_(new HoverEvent(HoverEvent.Action.f_130832_, new HoverEvent.ItemStackInfo(this))); +- mutablecomponent1.m_130940_(this.m_41791_().f_43022_).m_130938_((p_220170_) -> { ++ mutablecomponent1.m_130938_(this.m_41791_().getStyleModifier()).m_130938_((p_220170_) -> { + return p_220170_.m_131144_(new HoverEvent(HoverEvent.Action.f_130832_, new HoverEvent.ItemStackInfo(this))); }); } -@@ -957,12 +_,31 @@ +@@ -958,12 +_,31 @@ this.m_41720_().m_5929_(p_41732_, p_41733_, this, p_41734_); } diff --git a/patches/minecraft/net/minecraft/world/item/Items.java.patch b/patches/minecraft/net/minecraft/world/item/Items.java.patch index 16bbaba9a1c..2bf95c75826 100644 --- a/patches/minecraft/net/minecraft/world/item/Items.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Items.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -14,6 +_,7 @@ - import net.minecraft.world.level.block.entity.BannerPattern; - import net.minecraft.world.level.material.Fluids; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Items { - public static final Item f_41852_ = m_42810_(Blocks.f_50016_, new AirItem(Blocks.f_50016_, new Item.Properties())); - public static final Item f_41905_ = m_42807_(Blocks.f_50069_, CreativeModeTab.f_40749_); -@@ -1138,11 +_,23 @@ +@@ -1190,11 +_,23 @@ } private static Item m_151089_(Block p_151090_, CreativeModeTab p_151091_, Block... p_151092_) { diff --git a/patches/minecraft/net/minecraft/world/item/MapItem.java.patch b/patches/minecraft/net/minecraft/world/item/MapItem.java.patch index f4ae1f5edd8..5703d9dfe41 100644 --- a/patches/minecraft/net/minecraft/world/item/MapItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MapItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/MapItem.java +++ b/net/minecraft/world/item/MapItem.java -@@ -55,8 +_,18 @@ +@@ -56,8 +_,18 @@ @Nullable public static MapItemSavedData m_42853_(ItemStack p_42854_, Level p_42855_) { diff --git a/patches/minecraft/net/minecraft/world/item/MilkBucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/MilkBucketItem.java.patch index 4a06053be20..1676558317d 100644 --- a/patches/minecraft/net/minecraft/world/item/MilkBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MilkBucketItem.java.patch @@ -5,10 +5,10 @@ public ItemStack m_5922_(ItemStack p_42923_, Level p_42924_, LivingEntity p_42925_) { + if (!p_42924_.f_46443_) p_42925_.curePotionEffects(p_42923_); // FORGE - move up so stack.shrink does not turn stack into air - if (p_42925_ instanceof ServerPlayer) { - ServerPlayer serverplayer = (ServerPlayer)p_42925_; + if (p_42925_ instanceof ServerPlayer serverplayer) { CriteriaTriggers.f_10592_.m_23682_(serverplayer, p_42923_); -@@ -27,10 +_,6 @@ + serverplayer.m_36246_(Stats.f_12982_.m_12902_(this)); +@@ -26,10 +_,6 @@ p_42923_.m_41774_(1); } @@ -19,14 +19,14 @@ return p_42923_.m_41619_() ? new ItemStack(Items.f_42446_) : p_42923_; } -@@ -44,5 +_,10 @@ +@@ -43,5 +_,10 @@ public InteractionResultHolder m_7203_(Level p_42927_, Player p_42928_, InteractionHand p_42929_) { return ItemUtils.m_150959_(p_42927_, p_42928_, p_42929_); + } + + @Override -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @javax.annotation.Nullable net.minecraft.nbt.CompoundTag nbt) { ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @org.jetbrains.annotations.Nullable net.minecraft.nbt.CompoundTag nbt) { + return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack); } } diff --git a/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch b/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch index 00bbb14d689..cb7aead10a4 100644 --- a/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/item/MinecartItem.java @@ -28,7 +_,7 @@ double d2 = p_42949_.m_7094_() + (double)direction.m_122431_() * 1.125D; - BlockPos blockpos = p_42949_.m_7961_().m_142300_(direction); + BlockPos blockpos = p_42949_.m_7961_().m_121945_(direction); BlockState blockstate = level.m_8055_(blockpos); - RailShape railshape = blockstate.m_60734_() instanceof BaseRailBlock ? blockstate.m_61143_(((BaseRailBlock)blockstate.m_60734_()).m_7978_()) : RailShape.NORTH_SOUTH; + RailShape railshape = blockstate.m_60734_() instanceof BaseRailBlock ? ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, level, blockpos, null) : RailShape.NORTH_SOUTH; diff --git a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch index ffd239d6363..01ecd00890c 100644 --- a/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MobBucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/MobBucketItem.java +++ b/net/minecraft/world/item/MobBucketItem.java -@@ -23,13 +_,18 @@ +@@ -22,13 +_,18 @@ import net.minecraft.world.level.material.Fluid; public class MobBucketItem extends BucketItem { @@ -24,7 +24,7 @@ } public void m_142131_(@Nullable Player p_151146_, Level p_151147_, ItemStack p_151148_, BlockPos p_151149_) { -@@ -41,11 +_,11 @@ +@@ -40,11 +_,11 @@ } protected void m_7718_(@Nullable Player p_151151_, LevelAccessor p_151152_, BlockPos p_151153_) { @@ -35,10 +35,10 @@ private void m_151141_(ServerLevel p_151142_, ItemStack p_151143_, BlockPos p_151144_) { - Entity entity = this.f_151134_.m_20592_(p_151142_, p_151143_, (Player)null, p_151144_, MobSpawnType.BUCKET, true, false); + Entity entity = getFishType().m_20592_(p_151142_, p_151143_, (Player)null, p_151144_, MobSpawnType.BUCKET, true, false); - if (entity instanceof Bucketable) { - Bucketable bucketable = (Bucketable)entity; + if (entity instanceof Bucketable bucketable) { bucketable.m_142278_(p_151143_.m_41784_()); -@@ -55,7 +_,7 @@ + bucketable.m_27497_(true); +@@ -53,7 +_,7 @@ } public void m_7373_(ItemStack p_151155_, @Nullable Level p_151156_, List p_151157_, TooltipFlag p_151158_) { @@ -47,7 +47,7 @@ CompoundTag compoundtag = p_151155_.m_41783_(); if (compoundtag != null && compoundtag.m_128425_("BucketVariantTag", 3)) { int i = compoundtag.m_128451_("BucketVariantTag"); -@@ -81,5 +_,14 @@ +@@ -79,5 +_,14 @@ } } diff --git a/patches/minecraft/net/minecraft/world/item/RecordItem.java.patch b/patches/minecraft/net/minecraft/world/item/RecordItem.java.patch index 857149edaeb..341fa23d3e7 100644 --- a/patches/minecraft/net/minecraft/world/item/RecordItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/RecordItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/RecordItem.java +++ b/net/minecraft/world/item/RecordItem.java -@@ -20,15 +_,38 @@ +@@ -19,15 +_,38 @@ import net.minecraft.world.level.block.state.BlockState; public class RecordItem extends Item { @@ -17,7 +17,7 @@ this.f_43033_ = p_43037_; this.f_43034_ = p_43038_; f_43032_.put(this.f_43034_, this); -+ this.soundSupplier = this.f_43034_.delegate; ++ this.soundSupplier = net.minecraftforge.registries.ForgeRegistries.SOUND_EVENTS.getDelegateOrThrow(this.f_43034_); + } + + /** @@ -27,7 +27,7 @@ + * @param comparatorValue The value this music disc should output on the comparator. Must be between 0 and 15. + * @param soundSupplier A supplier that provides the sound that should be played. Use a + * {@link net.minecraftforge.registries.RegistryObject} or a -+ * {@link net.minecraftforge.registries.IRegistryDelegate} for this parameter. ++ * {@link net.minecraft.core.Holder} for this parameter. + * @param builder A set of {@link Item.Properties} that describe this item. + */ + public RecordItem(int comparatorValue, java.util.function.Supplier soundSupplier, Item.Properties builder) @@ -39,7 +39,7 @@ } public InteractionResult m_6225_(UseOnContext p_43048_) { -@@ -71,6 +_,6 @@ +@@ -70,6 +_,6 @@ } public SoundEvent m_43051_() { diff --git a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch index 8c8620a70ce..37ab4a8e2dd 100644 --- a/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShovelItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ShovelItem.java +++ b/net/minecraft/world/item/ShovelItem.java -@@ -32,9 +_,9 @@ +@@ -33,9 +_,9 @@ return InteractionResult.PASS; } else { Player player = p_43119_.m_43723_(); @@ -12,13 +12,13 @@ level.m_5594_(player, blockpos, SoundEvents.f_12406_, SoundSource.BLOCKS, 1.0F, 1.0F); blockstate2 = blockstate1; } else if (blockstate.m_60734_() instanceof CampfireBlock && blockstate.m_61143_(CampfireBlock.f_51227_)) { -@@ -61,5 +_,15 @@ +@@ -63,5 +_,15 @@ return InteractionResult.PASS; } } + } + -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public static BlockState getShovelPathingState(BlockState originalState) { + return f_43110_.get(originalState.m_60734_()); + } diff --git a/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch b/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch index 82abe55bc32..25352c2d1f5 100644 --- a/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/SpawnEggItem.java +++ b/net/minecraft/world/item/SpawnEggItem.java -@@ -39,11 +_,14 @@ +@@ -40,11 +_,14 @@ private final int f_151201_; private final EntityType f_43204_; @@ -15,7 +15,7 @@ f_43201_.put(p_43207_, this); } -@@ -125,6 +_,8 @@ +@@ -128,6 +_,8 @@ return p_43212_ == 0 ? this.f_151200_ : this.f_151201_; } diff --git a/patches/minecraft/net/minecraft/world/item/SuspiciousStewItem.java.patch b/patches/minecraft/net/minecraft/world/item/SuspiciousStewItem.java.patch index 5f7fed76c18..4befe5bb3cb 100644 --- a/patches/minecraft/net/minecraft/world/item/SuspiciousStewItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/SuspiciousStewItem.java.patch @@ -3,7 +3,7 @@ @@ -22,6 +_,7 @@ ListTag listtag = compoundtag.m_128437_("Effects", 9); CompoundTag compoundtag1 = new CompoundTag(); - compoundtag1.m_128344_("EffectId", (byte)MobEffect.m_19459_(p_43260_)); + compoundtag1.m_128405_("EffectId", MobEffect.m_19459_(p_43260_)); + net.minecraftforge.common.ForgeHooks.saveMobEffect(compoundtag1, "forge:effect_id", p_43260_); compoundtag1.m_128405_("EffectDuration", p_43261_); listtag.add(compoundtag1); @@ -11,7 +11,7 @@ @@ -41,6 +_,7 @@ } - MobEffect mobeffect = MobEffect.m_19453_(compoundtag1.m_128445_("EffectId")); + MobEffect mobeffect = MobEffect.m_19453_(compoundtag1.m_128451_("EffectId")); + mobeffect = net.minecraftforge.common.ForgeHooks.loadMobEffect(compoundtag1, "forge:effect_id", mobeffect); if (mobeffect != null) { p_43265_.m_7292_(new MobEffectInstance(mobeffect, j)); diff --git a/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch b/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch index 7980a356f93..49174e79cfd 100644 --- a/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/SwordItem.java +++ b/net/minecraft/world/item/SwordItem.java -@@ -70,4 +_,9 @@ +@@ -69,4 +_,9 @@ public Multimap m_7167_(EquipmentSlot p_43274_) { return p_43274_ == EquipmentSlot.MAINHAND ? this.f_43267_ : super.m_7167_(p_43274_); } diff --git a/patches/minecraft/net/minecraft/world/item/Tier.java.patch b/patches/minecraft/net/minecraft/world/item/Tier.java.patch index 75fb95b65d4..3b8e27b9471 100644 --- a/patches/minecraft/net/minecraft/world/item/Tier.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Tier.java.patch @@ -11,5 +11,5 @@ Ingredient m_6282_(); + -+ @javax.annotation.Nullable default net.minecraft.tags.TagKey getTag() { return null; } ++ @org.jetbrains.annotations.Nullable default net.minecraft.tags.TagKey getTag() { return null; } } diff --git a/patches/minecraft/net/minecraft/world/item/Tiers.java.patch b/patches/minecraft/net/minecraft/world/item/Tiers.java.patch index 4db0e19ad35..a31ab01f5f9 100644 --- a/patches/minecraft/net/minecraft/world/item/Tiers.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Tiers.java.patch @@ -5,5 +5,5 @@ return this.f_43326_.m_13971_(); } + -+ @javax.annotation.Nullable public net.minecraft.tags.TagKey getTag() { return net.minecraftforge.common.ForgeHooks.getTagFromVanillaTier(this); } ++ @org.jetbrains.annotations.Nullable public net.minecraft.tags.TagKey getTag() { return net.minecraftforge.common.ForgeHooks.getTagFromVanillaTier(this); } } diff --git a/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch b/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch deleted file mode 100644 index c4ade9013ff..00000000000 --- a/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/alchemy/Potion.java -+++ b/net/minecraft/world/item/alchemy/Potion.java -@@ -7,7 +_,7 @@ - import net.minecraft.resources.ResourceLocation; - import net.minecraft.world.effect.MobEffectInstance; - --public class Potion { -+public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry { - @Nullable - private final String f_43481_; - private final ImmutableList f_43482_; diff --git a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch index 0ff07b686e9..00e1b1f9e0e 100644 --- a/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/world/item/alchemy/PotionBrewing.java.patch @@ -49,24 +49,37 @@ } } } -@@ -212,15 +_,15 @@ - f_43494_.add(new PotionBrewing.Mix<>(p_43514_, Ingredient.m_43929_(p_43515_), p_43516_)); +@@ -196,7 +_,7 @@ + } else if (!(p_43505_ instanceof PotionItem)) { + throw new IllegalArgumentException("Expected a potion, got: " + Registry.f_122827_.m_7981_(p_43505_)); + } else { +- f_43495_.add(new PotionBrewing.Mix<>(p_43503_, Ingredient.m_43929_(p_43504_), p_43505_)); ++ f_43495_.add(new PotionBrewing.Mix<>(net.minecraftforge.registries.ForgeRegistries.ITEMS, p_43503_, Ingredient.m_43929_(p_43504_), p_43505_)); + } + } + +@@ -209,18 +_,18 @@ + } + + private static void m_43513_(Potion p_43514_, Item p_43515_, Potion p_43516_) { +- f_43494_.add(new PotionBrewing.Mix<>(p_43514_, Ingredient.m_43929_(p_43515_), p_43516_)); ++ f_43494_.add(new PotionBrewing.Mix<>(net.minecraftforge.registries.ForgeRegistries.POTIONS, p_43514_, Ingredient.m_43929_(p_43515_), p_43516_)); } -- public static class Mix { + public static class Mix { - final T f_43532_; -+ public static class Mix> { -+ public final net.minecraftforge.registries.IRegistryDelegate f_43532_; ++ public final net.minecraft.core.Holder.Reference f_43532_; public final Ingredient f_43533_; - final T f_43534_; -+ public final net.minecraftforge.registries.IRegistryDelegate f_43534_; ++ public final net.minecraft.core.Holder.Reference f_43534_; - public Mix(T p_43536_, Ingredient p_43537_, T p_43538_) { +- public Mix(T p_43536_, Ingredient p_43537_, T p_43538_) { - this.f_43532_ = p_43536_; -+ this.f_43532_ = p_43536_.delegate; ++ public Mix(net.minecraftforge.registries.IForgeRegistry registry, T p_43536_, Ingredient p_43537_, T p_43538_) { ++ this.f_43532_ = registry.getDelegateOrThrow(p_43536_); this.f_43533_ = p_43537_; - this.f_43534_ = p_43538_; -+ this.f_43534_ = p_43538_.delegate; ++ this.f_43534_ = registry.getDelegateOrThrow(p_43538_); } } } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch index 938f9bbca35..ee40be5e9c8 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -38,7 +38,7 @@ + net.minecraftforge.common.crafting.CraftingHelper.write(p_43924_, this); + return; + } - p_43924_.m_178352_(Arrays.asList(this.f_43903_), FriendlyByteBuf::m_130055_); + p_43924_.m_236828_(Arrays.asList(this.f_43903_), FriendlyByteBuf::m_130055_); } @@ -115,6 +_,38 @@ @@ -84,7 +84,7 @@ } public static Ingredient m_43940_(FriendlyByteBuf p_43941_) { -- return m_43938_(p_43941_.m_178366_(FriendlyByteBuf::m_130267_).stream().map(Ingredient.ItemValue::new)); +- return m_43938_(p_43941_.m_236845_(FriendlyByteBuf::m_130267_).stream().map(Ingredient.ItemValue::new)); + var size = p_43941_.m_130242_(); + if (size == -1) return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_43941_.m_130281_(), p_43941_); + return m_43938_(Stream.generate(() -> new Ingredient.ItemValue(p_43941_.m_130267_())).limit(size)); @@ -115,7 +115,7 @@ } + if (list.size() == 0 && !net.minecraftforge.common.ForgeConfig.SERVER.treatEmptyTagsAsAir.get()) { -+ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.f_50375_).m_41714_(new net.minecraft.network.chat.TextComponent("Empty Tag: " + this.f_43959_.f_203868_()))); ++ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.f_50375_).m_41714_(net.minecraft.network.chat.Component.m_237113_("Empty Tag: " + this.f_43959_.f_203868_()))); + } return list; } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch index 884dff98709..37b3713b3fb 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -20,7 +20,7 @@ protected void m_5787_(Map p_44037_, ResourceManager p_44038_, ProfilerFiller p_44039_) { @@ -49,9 +_,18 @@ - for(Entry entry : p_44037_.entrySet()) { + for(Map.Entry entry : p_44037_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); + if (resourcelocation.m_135815_().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. @@ -38,7 +38,7 @@ map.computeIfAbsent(recipe.m_6671_(), (p_44075_) -> { return ImmutableMap.builder(); }).put(resourcelocation, recipe); -@@ -127,11 +_,17 @@ +@@ -141,11 +_,17 @@ }); } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch index cb6936df937..dc4a0386787 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch @@ -5,7 +5,7 @@ import net.minecraft.resources.ResourceLocation; -public interface RecipeSerializer> { -+public interface RecipeSerializer> extends net.minecraftforge.registries.IForgeRegistryEntry>, net.minecraftforge.common.extensions.IForgeRecipeSerializer { ++public interface RecipeSerializer> extends net.minecraftforge.common.extensions.IForgeRecipeSerializer { RecipeSerializer f_44076_ = m_44098_("crafting_shaped", new ShapedRecipe.Serializer()); RecipeSerializer f_44077_ = m_44098_("crafting_shapeless", new ShapelessRecipe.Serializer()); SimpleRecipeSerializer f_44078_ = m_44098_("crafting_special_armordye", new SimpleRecipeSerializer<>(ArmorDyeRecipe::new)); @@ -16,7 +16,7 @@ + //Forge: use fromJson with IContext if you need the context T m_6729_(ResourceLocation p_44103_, JsonObject p_44104_); -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable T m_8005_(ResourceLocation p_44105_, FriendlyByteBuf p_44106_); void m_6178_(FriendlyByteBuf p_44101_, T p_44102_); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch index b0aab5b3a22..93aea7b9b56 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapedRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/net/minecraft/world/item/crafting/ShapedRecipe.java -@@ -22,7 +_,20 @@ +@@ -21,7 +_,20 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; @@ -22,7 +22,7 @@ final int f_44146_; final int f_44147_; final NonNullList f_44148_; -@@ -110,10 +_,20 @@ +@@ -109,10 +_,20 @@ return this.f_44146_; } @@ -43,7 +43,7 @@ static NonNullList m_44202_(String[] p_44203_, Map p_44204_, int p_44205_, int p_44206_) { NonNullList nonnulllist = NonNullList.m_122780_(p_44205_ * p_44206_, Ingredient.f_43901_); Set set = Sets.newHashSet(p_44204_.keySet()); -@@ -180,7 +_,7 @@ +@@ -179,7 +_,7 @@ return nonnulllist.isEmpty() || nonnulllist.stream().filter((p_151277_) -> { return !p_151277_.m_43947_(); }).anyMatch((p_151273_) -> { @@ -52,7 +52,7 @@ }); } -@@ -202,15 +_,15 @@ +@@ -201,15 +_,15 @@ static String[] m_44196_(JsonArray p_44197_) { String[] astring = new String[p_44197_.size()]; @@ -72,7 +72,7 @@ } if (i > 0 && astring[0].length() != s.length()) { -@@ -244,17 +_,7 @@ +@@ -243,17 +_,7 @@ } public static ItemStack m_151274_(JsonObject p_151275_) { @@ -91,12 +91,10 @@ } public static Item m_151278_(JsonObject p_151279_) { -@@ -269,7 +_,8 @@ - } +@@ -269,6 +_,7 @@ } -- public static class Serializer implements RecipeSerializer { -+ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { + public static class Serializer implements RecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shaped"); public ShapedRecipe m_6729_(ResourceLocation p_44236_, JsonObject p_44237_) { String s = GsonHelper.m_13851_(p_44237_, "group", ""); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch index bda562abfa5..9dba8f579b5 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch @@ -37,12 +37,10 @@ } public ItemStack m_5874_(CraftingContainer p_44260_) { -@@ -69,14 +_,15 @@ - return p_44252_ * p_44253_ >= this.f_44244_.size(); +@@ -70,13 +_,14 @@ } -- public static class Serializer implements RecipeSerializer { -+ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { + public static class Serializer implements RecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shapeless"); public ShapelessRecipe m_6729_(ResourceLocation p_44290_, JsonObject p_44291_) { String s = GsonHelper.m_13851_(p_44291_, "group", ""); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch index 4ed9bf212be..ab74c3b598f 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/world/item/crafting/SimpleCookingSerializer.java +++ b/net/minecraft/world/item/crafting/SimpleCookingSerializer.java -@@ -8,7 +_,7 @@ - import net.minecraft.util.GsonHelper; - import net.minecraft.world.item.ItemStack; - --public class SimpleCookingSerializer implements RecipeSerializer { -+public class SimpleCookingSerializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { - private final int f_44327_; - private final SimpleCookingSerializer.CookieBaker f_44328_; - @@ -21,11 +_,17 @@ String s = GsonHelper.m_13851_(p_44348_, "group", ""); JsonElement jsonelement = (JsonElement)(GsonHelper.m_13885_(p_44348_, "ingredient") ? GsonHelper.m_13933_(p_44348_, "ingredient") : GsonHelper.m_13930_(p_44348_, "ingredient")); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java.patch deleted file mode 100644 index e9eb08797fe..00000000000 --- a/patches/minecraft/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java -+++ b/net/minecraft/world/item/crafting/SimpleRecipeSerializer.java -@@ -5,7 +_,7 @@ - import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.resources.ResourceLocation; - --public class SimpleRecipeSerializer> implements RecipeSerializer { -+public class SimpleRecipeSerializer> extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { - private final Function f_44397_; - - public SimpleRecipeSerializer(Function p_44399_) { diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SingleItemRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SingleItemRecipe.java.patch deleted file mode 100644 index 9e0e51b30d7..00000000000 --- a/patches/minecraft/net/minecraft/world/item/crafting/SingleItemRecipe.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/crafting/SingleItemRecipe.java -+++ b/net/minecraft/world/item/crafting/SingleItemRecipe.java -@@ -60,7 +_,7 @@ - return this.f_44410_.m_41777_(); - } - -- public static class Serializer implements RecipeSerializer { -+ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { - final SingleItemRecipe.Serializer.SingleItemMaker f_44433_; - - protected Serializer(SingleItemRecipe.Serializer.SingleItemMaker p_44435_) { diff --git a/patches/minecraft/net/minecraft/world/item/crafting/UpgradeRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/UpgradeRecipe.java.patch index 670b03ab782..2e37c49fff9 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/UpgradeRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/UpgradeRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/UpgradeRecipe.java +++ b/net/minecraft/world/item/crafting/UpgradeRecipe.java -@@ -68,11 +_,11 @@ +@@ -68,7 +_,7 @@ public boolean m_142505_() { return Stream.of(this.f_44518_, this.f_44519_).anyMatch((p_151284_) -> { @@ -9,8 +9,3 @@ }); } -- public static class Serializer implements RecipeSerializer { -+ public static class Serializer extends net.minecraftforge.registries.ForgeRegistryEntry> implements RecipeSerializer { - public UpgradeRecipe m_6729_(ResourceLocation p_44562_, JsonObject p_44563_) { - Ingredient ingredient = Ingredient.m_43917_(GsonHelper.m_13930_(p_44563_, "base")); - Ingredient ingredient1 = Ingredient.m_43917_(GsonHelper.m_13930_(p_44563_, "addition")); diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch index fc28b1fa473..e2421104a22 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/item/enchantment/Enchantment.java +++ b/net/minecraft/world/item/enchantment/Enchantment.java -@@ -16,7 +_,7 @@ +@@ -15,7 +_,7 @@ import net.minecraft.world.entity.MobType; import net.minecraft.world.item.ItemStack; -public abstract class Enchantment { -+public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeEnchantment { ++public abstract class Enchantment implements net.minecraftforge.common.extensions.IForgeEnchantment { private final EquipmentSlot[] f_44671_; private final Enchantment.Rarity f_44674_; public final EnchantmentCategory f_44672_; -@@ -71,6 +_,7 @@ +@@ -70,6 +_,7 @@ return 0; } @@ -17,7 +17,7 @@ public float m_7335_(int p_44682_, MobType p_44683_) { return 0.0F; } -@@ -111,7 +_,7 @@ +@@ -110,7 +_,7 @@ } public boolean m_6081_(ItemStack p_44689_) { @@ -26,7 +26,7 @@ } public void m_7677_(LivingEntity p_44686_, Entity p_44687_, int p_44688_) { -@@ -133,6 +_,24 @@ +@@ -132,6 +_,24 @@ } public boolean m_6592_() { diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch index 92372e37931..a7d017c796f 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch @@ -9,25 +9,25 @@ }, p_44834_); return mutablefloat.floatValue(); } -@@ -298,7 +_,7 @@ +@@ -302,7 +_,7 @@ - public static int m_44872_(Random p_44873_, int p_44874_, int p_44875_, ItemStack p_44876_) { - Item item = p_44876_.m_41720_(); + public static int m_220287_(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) { + Item item = p_220291_.m_41720_(); - int i = item.m_6473_(); -+ int i = p_44876_.getItemEnchantability(); ++ int i = p_220291_.getItemEnchantability(); if (i <= 0) { return 0; } else { -@@ -336,7 +_,7 @@ - public static List m_44909_(Random p_44910_, ItemStack p_44911_, int p_44912_, boolean p_44913_) { +@@ -340,7 +_,7 @@ + public static List m_220297_(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) { List list = Lists.newArrayList(); - Item item = p_44911_.m_41720_(); + Item item = p_220299_.m_41720_(); - int i = item.m_6473_(); -+ int i = p_44911_.getItemEnchantability(); ++ int i = p_220299_.getItemEnchantability(); if (i <= 0) { return list; } else { -@@ -392,7 +_,7 @@ +@@ -396,7 +_,7 @@ boolean flag = p_44819_.m_150930_(Items.f_42517_); for(Enchantment enchantment : Registry.f_122825_) { diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantments.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/Enchantments.java.patch deleted file mode 100644 index d9d2fafed69..00000000000 --- a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantments.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/enchantment/Enchantments.java -+++ b/net/minecraft/world/item/enchantment/Enchantments.java -@@ -3,6 +_,7 @@ - import net.minecraft.core.Registry; - import net.minecraft.world.entity.EquipmentSlot; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Enchantments { - private static final EquipmentSlot[] f_44964_ = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}; - public static final Enchantment f_44965_ = m_44992_("protection", new ProtectionEnchantment(Enchantment.Rarity.COMMON, ProtectionEnchantment.Type.ALL, f_44964_)); diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch index 4784c00d4b2..9de9496610a 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch @@ -8,5 +8,5 @@ + boolean isFull = blockstate2.m_60734_() == Blocks.f_49990_ && blockstate2.m_61143_(LiquidBlock.f_54688_) == 0; //TODO: Forge, modded waters? + if (blockstate2.m_60767_() == Material.f_76305_ && isFull && blockstate.m_60710_(p_45020_, blockpos) && p_45020_.m_45752_(blockstate, blockpos, CollisionContext.m_82749_()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_45019_, net.minecraftforge.common.util.BlockSnapshot.create(p_45020_.m_46472_(), p_45020_, blockpos), net.minecraft.core.Direction.UP)) { p_45020_.m_46597_(blockpos, blockstate); - p_45020_.m_186460_(blockpos, Blocks.f_50449_, Mth.m_14072_(p_45019_.m_21187_(), 60, 120)); + p_45020_.m_186460_(blockpos, Blocks.f_50449_, Mth.m_216271_(p_45019_.m_217043_(), 60, 120)); } diff --git a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch index 3beb06444aa..ea4968c6fa1 100644 --- a/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -125,11 +_,15 @@ - entity.m_7678_(entity.m_20185_(), entity.m_20186_(), entity.m_20189_(), p_151312_.f_46441_.nextFloat() * 360.0F, 0.0F); +@@ -127,11 +_,15 @@ + entity.m_7678_(entity.m_20185_(), entity.m_20186_(), entity.m_20189_(), randomsource.m_188501_() * 360.0F, 0.0F); if (entity instanceof Mob) { Mob mob = (Mob)entity; + net.minecraftforge.eventbus.api.Event.Result res = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(mob, p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER); @@ -13,10 +13,10 @@ if (this.f_45444_.m_186567_().m_128440_() == 1 && this.f_45444_.m_186567_().m_128425_("id", 8)) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor)p_151312_, (float)entity.m_20185_(), (float)entity.m_20186_(), (float)entity.m_20189_(), this, MobSpawnType.SPAWNER)) - ((Mob)entity).m_6518_(p_151312_, p_151312_.m_6436_(entity.m_142538_()), MobSpawnType.SPAWNER, (SpawnGroupData)null, (CompoundTag)null); + ((Mob)entity).m_6518_(p_151312_, p_151312_.m_6436_(entity.m_20183_()), MobSpawnType.SPAWNER, (SpawnGroupData)null, (CompoundTag)null); } } -@@ -271,4 +_,12 @@ +@@ -275,4 +_,12 @@ public double m_45474_() { return this.f_45446_; } diff --git a/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch b/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch index a9fdcd54589..2965cd7e733 100644 --- a/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch @@ -5,7 +5,7 @@ private final CollisionContext f_45686_; - public ClipContext(Vec3 p_45688_, Vec3 p_45689_, ClipContext.Block p_45690_, ClipContext.Fluid p_45691_, Entity p_45692_) { -+ public ClipContext(Vec3 p_45688_, Vec3 p_45689_, ClipContext.Block p_45690_, ClipContext.Fluid p_45691_, @javax.annotation.Nullable Entity p_45692_) { ++ public ClipContext(Vec3 p_45688_, Vec3 p_45689_, ClipContext.Block p_45690_, ClipContext.Fluid p_45691_, @org.jetbrains.annotations.Nullable Entity p_45692_) { this.f_45682_ = p_45688_; this.f_45683_ = p_45689_; this.f_45684_ = p_45690_; diff --git a/patches/minecraft/net/minecraft/world/level/Explosion.java.patch b/patches/minecraft/net/minecraft/world/level/Explosion.java.patch index b5fda426604..80f822e4b20 100644 --- a/patches/minecraft/net/minecraft/world/level/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Explosion.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/Explosion.java +++ b/net/minecraft/world/level/Explosion.java -@@ -57,6 +_,7 @@ +@@ -56,6 +_,7 @@ private final ExplosionDamageCalculator f_46019_; - private final List f_46020_ = Lists.newArrayList(); + private final ObjectArrayList f_46020_ = new ObjectArrayList<>(); private final Map f_46021_ = Maps.newHashMap(); + private final Vec3 position; public Explosion(Level p_151471_, @Nullable Entity p_151472_, double p_151473_, double p_151474_, double p_151475_, float p_151476_) { this(p_151471_, p_151472_, p_151473_, p_151474_, p_151475_, p_151476_, false, Explosion.BlockInteraction.DESTROY); -@@ -86,6 +_,7 @@ +@@ -85,6 +_,7 @@ this.f_46010_ = p_46060_; this.f_46018_ = p_46053_ == null ? DamageSource.m_19358_(this) : p_46053_; this.f_46019_ = p_46054_ == null ? this.m_46062_(p_46052_) : p_46054_; @@ -16,7 +16,7 @@ } private ExplosionDamageCalculator m_46062_(@Nullable Entity p_46063_) { -@@ -181,6 +_,7 @@ +@@ -180,6 +_,7 @@ int j2 = Mth.m_14107_(this.f_46015_ - (double)f2 - 1.0D); int j1 = Mth.m_14107_(this.f_46015_ + (double)f2 + 1.0D); List list = this.f_46012_.m_45933_(this.f_46016_, new AABB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); @@ -28,13 +28,13 @@ if (!blockstate.m_60795_()) { BlockPos blockpos1 = blockpos.m_7949_(); this.f_46012_.m_46473_().m_6180_("explosion_blocks"); -- if (block.m_6903_(this) && this.f_46012_ instanceof ServerLevel) { -+ if (blockstate.canDropFromExplosion(this.f_46012_, blockpos, this) && this.f_46012_ instanceof ServerLevel) { - BlockEntity blockentity = blockstate.m_155947_() ? this.f_46012_.m_7702_(blockpos) : null; - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_46012_)).m_78977_(this.f_46012_.f_46441_).m_78972_(LootContextParams.f_81460_, Vec3.m_82512_(blockpos)).m_78972_(LootContextParams.f_81463_, ItemStack.f_41583_).m_78984_(LootContextParams.f_81462_, blockentity).m_78984_(LootContextParams.f_81455_, this.f_46016_); - if (this.f_46010_ == Explosion.BlockInteraction.DESTROY) { -@@ -254,8 +_,7 @@ - }); +- if (block.m_6903_(this)) { ++ if (blockstate.canDropFromExplosion(this.f_46012_, blockpos, this)) { + Level $$9 = this.f_46012_; + if ($$9 instanceof ServerLevel) { + ServerLevel serverlevel = (ServerLevel)$$9; +@@ -259,8 +_,7 @@ + } } - this.f_46012_.m_7731_(blockpos, Blocks.f_50016_.m_49966_(), 3); @@ -43,7 +43,7 @@ this.f_46012_.m_46473_().m_7238_(); } } -@@ -327,6 +_,15 @@ +@@ -332,6 +_,15 @@ public List m_46081_() { return this.f_46020_; diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index de78cce4c58..1a012953abf 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -63,7 +_,7 @@ +@@ -65,7 +_,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.scores.Scoreboard; -public abstract class Level implements LevelAccessor, AutoCloseable { +public abstract class Level extends net.minecraftforge.common.capabilities.CapabilityProvider implements LevelAccessor, AutoCloseable, net.minecraftforge.common.extensions.IForgeLevel { - public static final Codec> f_46427_ = ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(Registry.f_122819_), ResourceKey::m_135782_); + public static final Codec> f_46427_ = ResourceKey.m_195966_(Registry.f_122819_); public static final ResourceKey f_46428_ = ResourceKey.m_135785_(Registry.f_122819_, new ResourceLocation("overworld")); public static final ResourceKey f_46429_ = ResourceKey.m_135785_(Registry.f_122819_, new ResourceLocation("the_nether")); -@@ -98,8 +_,14 @@ +@@ -104,8 +_,14 @@ private final BiomeManager f_46420_; private final ResourceKey f_46421_; private long f_186455_; @@ -19,12 +19,12 @@ + private final java.util.ArrayList freshBlockEntities = new java.util.ArrayList<>(); + private final java.util.ArrayList pendingFreshBlockEntities = new java.util.ArrayList<>(); - protected Level(WritableLevelData p_204149_, ResourceKey p_204150_, Holder p_204151_, Supplier p_204152_, boolean p_204153_, boolean p_204154_, long p_204155_) { + protected Level(WritableLevelData p_220352_, ResourceKey p_220353_, Holder p_220354_, Supplier p_220355_, boolean p_220356_, boolean p_220357_, long p_220358_, int p_220359_) { + super(Level.class); - this.f_46446_ = p_204152_; - this.f_46442_ = p_204149_; - this.f_204147_ = p_204151_; -@@ -180,17 +_,45 @@ + this.f_46446_ = p_220355_; + this.f_46442_ = p_220352_; + this.f_204147_ = p_220354_; +@@ -190,17 +_,45 @@ } else { LevelChunk levelchunk = this.m_46745_(p_46605_); Block block = p_46606_.m_60734_(); @@ -49,7 +49,7 @@ - if ((p_46607_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.m_60739_(this, p_46605_) != blockstate.m_60739_(this, p_46605_) || blockstate1.m_60791_() != blockstate.m_60791_() || blockstate1.m_60787_() || blockstate.m_60787_())) { + if ((p_46607_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.m_60739_(this, p_46605_) != oldOpacity || blockstate1.getLightEmission(this, p_46605_) != oldLight || blockstate1.m_60787_() || blockstate.m_60787_())) { this.m_46473_().m_6180_("queueCheckLight"); - this.m_7726_().m_7827_().m_142202_(p_46605_); + this.m_7726_().m_7827_().m_7174_(p_46605_); this.m_46473_().m_7238_(); } @@ -71,7 +71,7 @@ if (blockstate1 == p_46606_) { if (blockstate != blockstate1) { this.m_6550_(p_46605_, blockstate, blockstate1); -@@ -216,8 +_,6 @@ +@@ -226,8 +_,6 @@ this.m_6559_(p_46605_, blockstate, blockstate1); } @@ -80,40 +80,15 @@ } } } -@@ -267,6 +_,8 @@ +@@ -277,6 +_,7 @@ } public void m_46672_(BlockPos p_46673_, Block p_46674_) { -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_46673_, this.m_8055_(p_46673_), java.util.EnumSet.allOf(Direction.class), false).isCanceled()) -+ return; - this.m_46586_(p_46673_.m_142125_(), p_46674_, p_46673_); - this.m_46586_(p_46673_.m_142126_(), p_46674_, p_46673_); - this.m_46586_(p_46673_.m_7495_(), p_46674_, p_46673_); -@@ -276,6 +_,11 @@ ++ net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_46673_, this.m_8055_(p_46673_), java.util.EnumSet.allOf(Direction.class), false).isCanceled(); } public void m_46590_(BlockPos p_46591_, Block p_46592_, Direction p_46593_) { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(Direction.class); -+ directions.remove(p_46593_); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_46591_, this.m_8055_(p_46591_), directions, false).isCanceled()) -+ return; -+ - if (p_46593_ != Direction.WEST) { - this.m_46586_(p_46591_.m_142125_(), p_46592_, p_46591_); - } -@@ -313,9 +_,9 @@ - CrashReportCategory crashreportcategory = crashreport.m_127514_("Block being updated"); - crashreportcategory.m_128165_("Source block type", () -> { - try { -- return String.format("ID #%s (%s // %s)", Registry.f_122824_.m_7981_(p_46588_), p_46588_.m_7705_(), p_46588_.getClass().getCanonicalName()); -+ return String.format("ID #%s (%s // %s)", p_46588_.getRegistryName(), p_46588_.m_7705_(), p_46588_.getClass().getCanonicalName()); - } catch (Throwable throwable1) { -- return "ID #" + Registry.f_122824_.m_7981_(p_46588_); -+ return "ID #" + p_46588_.getRegistryName(); - } - }); - CrashReportCategory.m_178950_(crashreportcategory, this, p_46587_, blockstate); -@@ -401,10 +_,26 @@ +@@ -377,10 +_,26 @@ (this.f_151504_ ? this.f_151503_ : this.f_151512_).add(p_151526_); } @@ -140,7 +115,7 @@ if (!this.f_151503_.isEmpty()) { this.f_151512_.addAll(this.f_151503_); this.f_151503_.clear(); -@@ -427,12 +_,19 @@ +@@ -403,12 +_,19 @@ public void m_46653_(Consumer p_46654_, T p_46655_) { try { @@ -160,7 +135,7 @@ } } -@@ -454,6 +_,7 @@ +@@ -434,6 +_,7 @@ public Explosion m_7703_(@Nullable Entity p_46526_, @Nullable DamageSource p_46527_, @Nullable ExplosionDamageCalculator p_46528_, double p_46529_, double p_46530_, double p_46531_, float p_46532_, boolean p_46533_, Explosion.BlockInteraction p_46534_) { Explosion explosion = new Explosion(this, p_46526_, p_46527_, p_46528_, p_46529_, p_46530_, p_46531_, p_46532_, p_46533_, p_46534_); @@ -168,7 +143,7 @@ explosion.m_46061_(); explosion.m_46075_(true); return explosion; -@@ -481,6 +_,7 @@ +@@ -461,6 +_,7 @@ if (!this.m_151570_(p_46748_)) { this.m_46745_(p_46748_).m_8114_(p_46748_); } @@ -176,7 +151,7 @@ } public boolean m_46749_(BlockPos p_46750_) { -@@ -538,6 +_,7 @@ +@@ -531,6 +_,7 @@ list.add(p_151522_); } @@ -184,41 +159,41 @@ if (p_151522_ instanceof EnderDragon) { for(EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).m_31156_()) { if (p_151522_ != p_46536_ && p_46538_.test(enderdragonpart)) { -@@ -547,6 +_,11 @@ +@@ -540,6 +_,11 @@ } }); + for (net.minecraftforge.entity.PartEntity p : this.getPartEntities()) { -+ if (p != p_46536_ && p.m_142469_().m_82381_(p_46537_) && p_46538_.test(p)) { ++ if (p != p_46536_ && p.m_20191_().m_82381_(p_46537_) && p_46538_.test(p)) { + list.add(p); + } + } return list; } -@@ -558,6 +_,8 @@ +@@ -551,6 +_,8 @@ list.add(p_151539_); } + + if (false) - if (p_151539_ instanceof EnderDragon) { - EnderDragon enderdragon = (EnderDragon)p_151539_; - -@@ -570,6 +_,12 @@ + if (p_151539_ instanceof EnderDragon enderdragon) { + for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) { + T t = p_151528_.m_141992_(enderdragonpart); +@@ -561,6 +_,12 @@ } }); + for (net.minecraftforge.entity.PartEntity p : this.getPartEntities()) { + T t = p_151528_.m_141992_(p); -+ if (t != null && t.m_142469_().m_82381_(p_151529_) && p_151530_.test(t)) { ++ if (t != null && t.m_20191_().m_82381_(p_151529_) && p_151530_.test(t)) { + list.add(t); + } + } return list; } -@@ -581,6 +_,7 @@ +@@ -572,6 +_,7 @@ this.m_46745_(p_151544_).m_8092_(true); } @@ -226,7 +201,7 @@ } public int m_5736_() { -@@ -625,7 +_,7 @@ +@@ -616,7 +_,7 @@ public int m_46681_(BlockPos p_46682_, Direction p_46683_) { BlockState blockstate = this.m_8055_(p_46682_); int i = blockstate.m_60746_(this, p_46682_, p_46683_); @@ -235,28 +210,28 @@ } public boolean m_46753_(BlockPos p_46754_) { -@@ -778,16 +_,15 @@ +@@ -769,16 +_,15 @@ public abstract Scoreboard m_6188_(); public void m_46717_(BlockPos p_46718_, Block p_46719_) { - for(Direction direction : Direction.Plane.HORIZONTAL) { + for(Direction direction : Direction.values()) { - BlockPos blockpos = p_46718_.m_142300_(direction); + BlockPos blockpos = p_46718_.m_121945_(direction); if (this.m_46805_(blockpos)) { BlockState blockstate = this.m_8055_(blockpos); - if (blockstate.m_60713_(Blocks.f_50328_)) { -- blockstate.m_60690_(this, blockpos, p_46719_, p_46718_, false); +- this.m_213960_(blockstate, blockpos, p_46719_, p_46718_, false); - } else if (blockstate.m_60796_(this, blockpos)) { + blockstate.onNeighborChange(this, blockpos, p_46718_); + if (blockstate.m_60796_(this, blockpos)) { - blockpos = blockpos.m_142300_(direction); + blockpos = blockpos.m_121945_(direction); blockstate = this.m_8055_(blockpos); - if (blockstate.m_60713_(Blocks.f_50328_)) { + if (blockstate.getWeakChanges(this, blockpos)) { - blockstate.m_60690_(this, blockpos, p_46719_, p_46718_, false); + this.m_213960_(blockstate, blockpos, p_46719_, p_46718_, false); } } -@@ -868,6 +_,18 @@ +@@ -863,6 +_,18 @@ public BiomeManager m_7062_() { return this.f_46420_; diff --git a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch index 8a07965cde5..bd48d34cc82 100644 --- a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch +++ b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java -@@ -176,6 +_,10 @@ +@@ -182,6 +_,10 @@ } /** @deprecated */ + default boolean isAreaLoaded(BlockPos center, int range) { -+ return this.m_46832_(center.m_142082_(-range, -range, -range), center.m_142082_(range, range, range)); ++ return this.m_46832_(center.m_7918_(-range, -range, -range), center.m_7918_(range, range, range)); + } + @Deprecated diff --git a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch index 96aac8b4924..6ac5a859d7a 100644 --- a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -47,6 +_,7 @@ +@@ -48,6 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -8,7 +8,7 @@ public final class NaturalSpawner { private static final Logger f_46977_ = LogUtils.getLogger(); private static final int f_151589_ = 24; -@@ -83,7 +_,7 @@ +@@ -84,7 +_,7 @@ mob = (Mob)entity; } while(mob.m_21532_() || mob.m_8023_()); @@ -16,16 +16,16 @@ + MobCategory mobcategory = entity.getClassification(true); if (mobcategory != MobCategory.MISC) { Entity entity_f = entity; - BlockPos blockpos = entity.m_142538_(); -@@ -179,13 +_,15 @@ + BlockPos blockpos = entity.m_20183_(); +@@ -180,13 +_,15 @@ } - mob.m_7678_(d0, (double)i, d1, p_47040_.f_46441_.nextFloat() * 360.0F, 0.0F); + mob.m_7678_(d0, (double)i, d1, p_47040_.f_46441_.m_188501_() * 360.0F, 0.0F); - if (m_46991_(p_47040_, mob, d2)) { + int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_47040_, d0, i, d1, null, MobSpawnType.NATURAL); + if (canSpawn != -1 && (canSpawn == 1 || m_46991_(p_47040_, mob, d2))) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor) p_47040_, (float)d0, (float)i, (float)d1, null, MobSpawnType.NATURAL)) - spawngroupdata = mob.m_6518_(p_47040_, p_47040_.m_6436_(mob.m_142538_()), MobSpawnType.NATURAL, spawngroupdata, (CompoundTag)null); + spawngroupdata = mob.m_6518_(p_47040_, p_47040_.m_6436_(mob.m_20183_()), MobSpawnType.NATURAL, spawngroupdata, (CompoundTag)null); ++j; ++l1; p_47040_.m_47205_(mob); @@ -35,7 +35,7 @@ return; } -@@ -304,6 +_,13 @@ +@@ -305,6 +_,13 @@ if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) { return true; } else if (p_47055_ != null && p_47053_.m_6857_().m_61937_(p_47054_)) { @@ -49,27 +49,27 @@ BlockState blockstate = p_47053_.m_8055_(p_47054_); FluidState fluidstate = p_47053_.m_6425_(p_47054_); BlockPos blockpos = p_47054_.m_7494_(); -@@ -316,14 +_,12 @@ - case ON_GROUND: - default: - BlockState blockstate1 = p_47053_.m_8055_(blockpos1); -- if (!blockstate1.m_60643_(p_47053_, blockpos1, p_47055_)) { +@@ -317,14 +_,12 @@ + case ON_GROUND: + default: + BlockState blockstate1 = p_47053_.m_8055_(blockpos1); +- if (!blockstate1.m_60643_(p_47053_, blockpos1, p_47055_)) { + if (!blockstate1.isValidSpawn(p_47053_, blockpos1, p_47052_, p_47055_)) { - return false; - } else { - return m_47056_(p_47053_, p_47054_, blockstate, fluidstate, p_47055_) && m_47056_(p_47053_, blockpos, p_47053_.m_8055_(blockpos), p_47053_.m_6425_(blockpos), p_47055_); - } + return false; + } else { + return m_47056_(p_47053_, p_47054_, blockstate, fluidstate, p_47055_) && m_47056_(p_47053_, blockpos, p_47053_.m_8055_(blockpos), p_47053_.m_6425_(blockpos), p_47055_); + } } - } else { - return false; } } -@@ -369,6 +_,7 @@ - entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_204179_.nextFloat() * 360.0F, 0.0F); +@@ -370,6 +_,7 @@ + entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_220454_.m_188501_() * 360.0F, 0.0F); if (entity instanceof Mob) { Mob mob = (Mob)entity; -+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_204176_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue; - if (mob.m_5545_(p_204176_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_204176_)) { - spawngroupdata = mob.m_6518_(p_204176_, p_204176_.m_6436_(mob.m_142538_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null); - p_204176_.m_47205_(mob); ++ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_220451_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue; + if (mob.m_5545_(p_220451_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_220451_)) { + spawngroupdata = mob.m_6518_(p_220451_, p_220451_.m_6436_(mob.m_20183_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null); + p_220451_.m_47205_(mob); diff --git a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch index 6e93b0ec006..f592a6f6e6d 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch @@ -1,22 +1,75 @@ --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java -@@ -34,7 +_,7 @@ - import net.minecraft.world.level.material.FluidState; - import net.minecraft.world.level.material.Fluids; +@@ -34,9 +_,9 @@ + public final class Biome { + public static final Codec f_47429_ = RecordCodecBuilder.create((p_220544_) -> { + return p_220544_.group(Biome.ClimateSettings.f_47679_.forGetter((p_151717_) -> { +- return p_151717_.f_47437_; ++ return p_151717_.modifiableBiomeInfo().getOriginalBiomeInfo().climateSettings(); // FORGE: Patch codec to ignore field redirect coremods. + }), BiomeSpecialEffects.f_47926_.fieldOf("effects").forGetter((p_220550_) -> { +- return p_220550_.f_47443_; ++ return p_220550_.modifiableBiomeInfo().getOriginalBiomeInfo().effects(); // FORGE: Patch codec to ignore field redirect coremods. + }), BiomeGenerationSettings.f_47778_.forGetter((p_220548_) -> { + return p_220548_.f_47438_; + }), MobSpawnSettings.f_48327_.forGetter((p_220546_) -> { +@@ -82,6 +_,7 @@ + this.f_47438_ = p_220532_; + this.f_47439_ = p_220533_; + this.f_47443_ = p_220531_; ++ this.modifiableBiomeInfo = new net.minecraftforge.common.world.ModifiableBiomeInfo(new net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo(p_220530_, p_220531_, p_220532_, p_220533_)); // FORGE: cache original biome info on construction so we can bypass our field read coremods where necessary + } --public final class Biome { -+public final class Biome extends net.minecraftforge.registries.ForgeRegistryEntry.UncheckedRegistryEntry { - public static final Codec f_47429_ = RecordCodecBuilder.create((p_186636_) -> { - return p_186636_.group(Biome.ClimateSettings.f_47679_.forGetter((p_151717_) -> { - return p_151717_.f_47437_; -@@ -46,7 +_,9 @@ - return p_186642_.f_47438_; - }), MobSpawnSettings.f_48327_.forGetter((p_186640_) -> { - return p_186640_.f_47439_; -- })).apply(p_186636_, Biome::new); -+ }), net.minecraft.resources.ResourceLocation.f_135803_.optionalFieldOf("forge:registry_name").forGetter(b -> Optional.ofNullable(b.getRegistryName()))) -+ .apply(p_186636_, (climate, category, effects, gen, spawns, name) -> -+ net.minecraftforge.common.ForgeHooks.enhanceBiome(name.orElse(null), climate, category, effects, gen, spawns, p_186636_, Biome::new)); - }); - public static final Codec f_47430_ = RecordCodecBuilder.create((p_186632_) -> { - return p_186632_.group(Biome.ClimateSettings.f_47679_.forGetter((p_186638_) -> { + public int m_47463_() { +@@ -89,7 +_,7 @@ + } + + public MobSpawnSettings m_47518_() { +- return this.f_47439_; ++ return this.modifiableBiomeInfo().get().mobSpawnSettings(); + } + + public Biome.Precipitation m_47530_() { +@@ -188,7 +_,7 @@ + } + + public BiomeGenerationSettings m_47536_() { +- return this.f_47438_; ++ return this.modifiableBiomeInfo().get().generationSettings(); + } + + public int m_47539_() { +@@ -393,4 +_,34 @@ + return this.f_47738_; + } + } ++ ++ // FORGE START ++ ++ private final net.minecraftforge.common.world.ModifiableBiomeInfo modifiableBiomeInfo; ++ ++ /** ++ * {@return Cache of original biome data and biome data modified by biome modifiers} ++ * Modified biome data is set by server after datapacks and serverconfigs load. ++ * Climate and effects field reads are coremodded to redirect to this. ++ **/ ++ public net.minecraftforge.common.world.ModifiableBiomeInfo modifiableBiomeInfo() ++ { ++ return this.modifiableBiomeInfo; ++ } ++ ++ /** ++ * {@return The biome's climate settings, with modifications if called after modifiers are applied in server init.} ++ */ ++ public ClimateSettings getModifiedClimateSettings() { ++ return this.modifiableBiomeInfo().get().climateSettings(); ++ } ++ ++ /** ++ * {@return The biome's client effects, with modifications if called after modifiers are applied in server init.} ++ */ ++ public BiomeSpecialEffects getModifiedSpecialEffects() { ++ return this.modifiableBiomeInfo().get().effects(); ++ } ++ ++ // FORGE END + } diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch index 92028737c52..d92c997b1d8 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/BiomeGenerationSettings.java +++ b/net/minecraft/world/level/biome/BiomeGenerationSettings.java -@@ -38,6 +_,7 @@ +@@ -37,6 +_,7 @@ })).apply(p_186655_, BiomeGenerationSettings::new); }); private final Map>> f_47780_; @@ -8,7 +8,7 @@ private final List> f_47781_; private final Supplier>> f_47783_; private final Supplier> f_186648_; -@@ -53,10 +_,15 @@ +@@ -52,10 +_,15 @@ this.f_186648_ = Suppliers.memoize(() -> { return p_186651_.stream().flatMap(HolderSet::m_203614_).map(Holder::m_203334_).collect(Collectors.toSet()); }); diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeSource.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeSource.java.patch new file mode 100644 index 00000000000..031a6c058f0 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeSource.java.patch @@ -0,0 +1,30 @@ +--- a/net/minecraft/world/level/biome/BiomeSource.java ++++ b/net/minecraft/world/level/biome/BiomeSource.java +@@ -23,20 +_,24 @@ + + public abstract class BiomeSource implements BiomeResolver { + public static final Codec f_47888_ = Registry.f_122889_.m_194605_().dispatchStable(BiomeSource::m_5820_, Function.identity()); +- private final Set> f_47891_; ++ private final java.util.function.Supplier>> lazyPossibleBiomes; // FORGE: Allow custom biome sources to lazily evaluate possible biomes. + + protected BiomeSource(Stream> p_47896_) { + this(p_47896_.distinct().toList()); + } + + protected BiomeSource(List> p_47894_) { +- this.f_47891_ = new ObjectLinkedOpenHashSet<>(p_47894_); ++ this(() -> p_47894_); // FORGE: Redirect vanilla constructor to forge's lazy constructor. ++ } ++ ++ protected BiomeSource(java.util.function.Supplier>> biomes) { ++ this.lazyPossibleBiomes = com.google.common.base.Suppliers.memoize(() -> new ObjectLinkedOpenHashSet<>(biomes.get())); + } + + protected abstract Codec m_5820_(); + + public Set> m_207840_() { +- return this.f_47891_; ++ return this.lazyPossibleBiomes.get(); // FORGE: Patch getter to use the lazy field. + } + + public Set> m_183399_(int p_186705_, int p_186706_, int p_186707_, int p_186708_, Climate.Sampler p_186709_) { diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch index 737db24c2a5..c0ab6eb0f91 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeSpecialEffects.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/BiomeSpecialEffects.java +++ b/net/minecraft/world/level/biome/BiomeSpecialEffects.java -@@ -203,7 +_,7 @@ +@@ -200,7 +_,7 @@ } } @@ -9,15 +9,13 @@ NONE("none") { public int m_6583_(double p_48081_, double p_48082_, int p_48083_) { return p_48083_; -@@ -222,17 +_,35 @@ +@@ -219,14 +_,37 @@ }; private final String f_48051_; -- public static final Codec f_48050_ = StringRepresentable.m_14350_(BiomeSpecialEffects.GrassColorModifier::values, BiomeSpecialEffects.GrassColorModifier::m_48070_); -+ public static final Codec f_48050_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(BiomeSpecialEffects.GrassColorModifier::values, BiomeSpecialEffects.GrassColorModifier::m_48070_); - private static final Map f_48052_ = Arrays.stream(values()).collect(Collectors.toMap(BiomeSpecialEffects.GrassColorModifier::m_48072_, (p_48069_) -> { - return p_48069_; - })); +- public static final Codec f_48050_ = StringRepresentable.m_216439_(BiomeSpecialEffects.GrassColorModifier::values); ++ public static final Codec f_48050_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(BiomeSpecialEffects.GrassColorModifier::values, BiomeSpecialEffects.GrassColorModifier::byName); ++ private static final java.util.Map BY_NAME = java.util.Arrays.stream(values()).collect(java.util.stream.Collectors.toMap(BiomeSpecialEffects.GrassColorModifier::m_48072_, grassColorModifier -> grassColorModifier)); - public abstract int m_6583_(double p_48065_, double p_48066_, int p_48067_); + public int m_6583_(double p_48065_, double p_48066_, int p_48067_) { @@ -38,7 +36,11 @@ + } + @Override + public void init() { -+ f_48052_.put(this.m_48072_(), this); ++ BY_NAME.put(this.m_48072_(), this); ++ } ++ // Forge: Access enum members by name ++ public static BiomeSpecialEffects.GrassColorModifier byName(String name) { ++ return BY_NAME.get(name); + } + @FunctionalInterface + public interface ColorModifier { diff --git a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch index 20ac1d73883..4018482d52d 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/MobSpawnSettings.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/biome/MobSpawnSettings.java +++ b/net/minecraft/world/level/biome/MobSpawnSettings.java -@@ -39,20 +_,32 @@ +@@ -38,20 +_,32 @@ private final float f_48328_; private final Map> f_48329_; private final Map, MobSpawnSettings.MobSpawnCost> f_48330_; diff --git a/patches/minecraft/net/minecraft/world/level/block/BambooBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BambooBlock.java.patch index e189d0759d1..8746b3f74ca 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BambooBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BambooBlock.java.patch @@ -9,21 +9,21 @@ protected static final float f_152092_ = 3.0F; protected static final float f_152093_ = 5.0F; protected static final float f_152094_ = 1.5F; -@@ -114,10 +_,11 @@ +@@ -110,10 +_,11 @@ - public void m_7455_(BlockState p_48936_, ServerLevel p_48937_, BlockPos p_48938_, Random p_48939_) { - if (p_48936_.m_61143_(f_48871_) == 0) { -- if (p_48939_.nextInt(3) == 0 && p_48937_.m_46859_(p_48938_.m_7494_()) && p_48937_.m_45524_(p_48938_.m_7494_(), 0) >= 9) { -+ if (p_48937_.m_46859_(p_48938_.m_7494_()) && p_48937_.m_45524_(p_48938_.m_7494_(), 0) >= 9) { - int i = this.m_48932_(p_48937_, p_48938_) + 1; + public void m_213898_(BlockState p_220738_, ServerLevel p_220739_, BlockPos p_220740_, RandomSource p_220741_) { + if (p_220738_.m_61143_(f_48871_) == 0) { +- if (p_220741_.m_188503_(3) == 0 && p_220739_.m_46859_(p_220740_.m_7494_()) && p_220739_.m_45524_(p_220740_.m_7494_(), 0) >= 9) { ++ if (p_220739_.m_46859_(p_220740_.m_7494_()) && p_220739_.m_45524_(p_220740_.m_7494_(), 0) >= 9) { + int i = this.m_48932_(p_220739_, p_220740_) + 1; - if (i < 16) { -+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_48937_, p_48938_, p_48936_, p_48939_.nextInt(3) == 0)) { - this.m_48910_(p_48936_, p_48937_, p_48938_, p_48939_, i); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_48937_, p_48938_, p_48936_); ++ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_220739_, p_220740_, p_220738_, p_220741_.m_188503_(3) == 0)) { + this.m_220731_(p_220738_, p_220739_, p_220740_, p_220741_, i); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_220739_, p_220740_, p_220738_); } } -@@ -171,7 +_,7 @@ +@@ -167,7 +_,7 @@ } public float m_5880_(BlockState p_48901_, Player p_48902_, BlockGetter p_48903_, BlockPos p_48904_) { @@ -31,8 +31,8 @@ + return p_48902_.m_21205_().canPerformAction(net.minecraftforge.common.ToolActions.SWORD_DIG) ? 1.0F : super.m_5880_(p_48901_, p_48902_, p_48903_, p_48904_); } - protected void m_48910_(BlockState p_48911_, Level p_48912_, BlockPos p_48913_, Random p_48914_, int p_48915_) { -@@ -212,5 +_,12 @@ + protected void m_220731_(BlockState p_220732_, Level p_220733_, BlockPos p_220734_, RandomSource p_220735_, int p_220736_) { +@@ -208,5 +_,12 @@ } return i; diff --git a/patches/minecraft/net/minecraft/world/level/block/BambooSaplingBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BambooSaplingBlock.java.patch index 7ddd49cf1f2..146101e85b6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BambooSaplingBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BambooSaplingBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BambooSaplingBlock.java +++ b/net/minecraft/world/level/block/BambooSaplingBlock.java -@@ -77,7 +_,7 @@ +@@ -73,7 +_,7 @@ } public float m_5880_(BlockState p_48981_, Player p_48982_, BlockGetter p_48983_, BlockPos p_48984_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch index 7d61eb335c8..bd9f8a47a9c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BaseFireBlock.java +++ b/net/minecraft/world/level/block/BaseFireBlock.java -@@ -126,6 +_,7 @@ +@@ -125,6 +_,7 @@ if (!p_49282_.m_60713_(p_49279_.m_60734_())) { if (m_49248_(p_49280_)) { Optional optional = PortalShape.m_77708_(p_49280_, p_49281_, Direction.Axis.X); diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch index 0456679ef1a..7d3b25c6d7d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -57,7 +57,7 @@ + } + + @Override -+ public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @javax.annotation.Nullable net.minecraft.world.entity.vehicle.AbstractMinecart cart) { ++ public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.vehicle.AbstractMinecart cart) { + return state.m_61143_(m_7978_()); + } + /* ========================================= FORGE END ======================================*/ diff --git a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch index 48bd9108bfd..77e6ef2042f 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -10,7 +10,7 @@ public void m_6240_(Level p_49584_, Player p_49585_, BlockPos p_49586_, BlockState p_49587_, @Nullable BlockEntity p_49588_, ItemStack p_49589_) { super.m_6240_(p_49584_, p_49585_, p_49586_, p_49587_, p_49588_, p_49589_); -@@ -90,6 +_,7 @@ +@@ -89,6 +_,7 @@ List list = p_49650_.m_45976_(Bee.class, (new AABB(p_49651_)).m_82377_(8.0D, 6.0D, 8.0D)); if (!list.isEmpty()) { List list1 = p_49650_.m_45976_(Player.class, (new AABB(p_49651_)).m_82377_(8.0D, 6.0D, 8.0D)); @@ -18,7 +18,7 @@ int i = list1.size(); for(Bee bee : list) { -@@ -111,7 +_,7 @@ +@@ -110,7 +_,7 @@ boolean flag = false; if (i >= 5) { Item item = itemstack.m_41720_(); diff --git a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch index 1805ab8f7e2..d0ada9a746b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/Block.java +++ b/net/minecraft/world/level/block/Block.java -@@ -62,10 +_,11 @@ +@@ -64,10 +_,11 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.slf4j.Logger; @@ -14,7 +14,7 @@ private static final LoadingCache f_49785_ = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_49972_) { return !Shapes.m_83157_(Shapes.m_83144_(), p_49972_, BooleanOp.f_82687_); -@@ -178,7 +_,7 @@ +@@ -180,7 +_,7 @@ f_49790_.error("Block classes should end with Block and {} doesn't.", (Object)s); } } @@ -23,7 +23,7 @@ } public static boolean m_152463_(BlockState p_152464_) { -@@ -193,6 +_,8 @@ +@@ -195,6 +_,8 @@ BlockState blockstate = p_152446_.m_8055_(p_152449_); if (p_152445_.m_60719_(blockstate, p_152448_)) { return false; @@ -32,7 +32,7 @@ } else if (blockstate.m_60815_()) { Block.BlockStatePairKey block$blockstatepairkey = new Block.BlockStatePairKey(p_152445_, blockstate, p_152448_); Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = f_49789_.get(); -@@ -324,7 +_,7 @@ +@@ -326,7 +_,7 @@ } private static void m_152440_(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { @@ -41,7 +41,7 @@ ItemEntity itementity = p_152442_.get(); itementity.m_32060_(); p_152441_.m_7967_(itementity); -@@ -332,12 +_,13 @@ +@@ -334,12 +_,13 @@ } public void m_49805_(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { @@ -56,7 +56,7 @@ public float m_7325_() { return this.f_60444_; } -@@ -384,8 +_,10 @@ +@@ -386,8 +_,10 @@ public void m_5548_(BlockGetter p_49821_, Entity p_49822_) { p_49822_.m_20256_(p_49822_.m_20184_().m_82542_(1.0D, 0.0D, 1.0D)); @@ -67,7 +67,7 @@ public ItemStack m_7397_(BlockGetter p_49823_, BlockPos p_49824_, BlockState p_49825_) { return new ItemStack(this); } -@@ -422,6 +_,7 @@ +@@ -424,6 +_,7 @@ public void m_141997_(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) { } @@ -75,7 +75,7 @@ public boolean m_6903_(Explosion p_49826_) { return true; } -@@ -457,6 +_,7 @@ +@@ -459,6 +_,7 @@ return p_152456_.m_61124_(p_152457_, p_152455_.m_61143_(p_152457_)); } @@ -83,31 +83,21 @@ public SoundType m_49962_(BlockState p_49963_) { return this.f_60446_; } -@@ -466,7 +_,7 @@ +@@ -468,7 +_,7 @@ this.f_49788_ = Item.m_41439_(this); } - return this.f_49788_; -+ return this.f_49788_.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements. ++ return net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(this.f_49788_).get(); // Forge: Vanilla caches the items, update with registry replacements. } public boolean m_49967_() { -@@ -474,7 +_,7 @@ - } - - public String toString() { -- return "Block{" + Registry.f_122824_.m_7981_(this) + "}"; -+ return "Block{" + getRegistryName() + "}"; - } - - public void m_5871_(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List p_49818_, TooltipFlag p_49819_) { -@@ -487,6 +_,76 @@ +@@ -489,6 +_,75 @@ protected ImmutableMap m_152458_(Function p_152459_) { return this.f_49792_.m_61056_().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), p_152459_)); } + + /* ======================================== FORGE START =====================================*/ -+ protected Random RANDOM = new Random(); + private Object renderProperties; + + /* @@ -134,8 +124,8 @@ + + @Override + public boolean canSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) { -+ BlockState plant = plantable.getPlant(world, pos.m_142300_(facing)); -+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.m_142300_(facing)); ++ BlockState plant = plantable.getPlant(world, pos.m_121945_(facing)); ++ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.m_121945_(facing)); + + if (plant.m_60734_() == Blocks.f_50128_) + return state.m_60713_(Blocks.f_50128_) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); @@ -162,8 +152,8 @@ + boolean isBeach = state.m_60713_(Blocks.f_50440_) || this.m_49966_().m_204336_(BlockTags.f_144274_) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); + boolean hasWater = false; + for (Direction face : Direction.Plane.HORIZONTAL) { -+ BlockState blockState = world.m_8055_(pos.m_142300_(face)); -+ net.minecraft.world.level.material.FluidState fluidState = world.m_6425_(pos.m_142300_(face)); ++ BlockState blockState = world.m_8055_(pos.m_121945_(face)); ++ net.minecraft.world.level.material.FluidState fluidState = world.m_6425_(pos.m_121945_(face)); + hasWater |= blockState.m_60713_(Blocks.f_50449_); + hasWater |= fluidState.m_205070_(net.minecraft.tags.FluidTags.f_13131_); + if (hasWater) diff --git a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch index 3fc1f4c9552..ed4927ee3f5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -35,6 +_,7 @@ - import net.minecraft.world.level.material.Material; - import net.minecraft.world.level.material.MaterialColor; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Blocks { - public static final Block f_50016_ = m_50795_("air", new AirBlock(BlockBehaviour.Properties.m_60939_(Material.f_76296_).m_60910_().m_60993_().m_60996_())); - public static final Block f_50069_ = m_50795_("stone", new Block(BlockBehaviour.Properties.m_60944_(Material.f_76278_, MaterialColor.f_76409_).m_60999_().m_60913_(1.5F, 6.0F))); -@@ -135,7 +_,7 @@ +@@ -144,7 +_,7 @@ public static final Block f_50027_ = m_50795_("green_bed", m_50764_(DyeColor.GREEN)); public static final Block f_50028_ = m_50795_("red_bed", m_50764_(DyeColor.RED)); public static final Block f_50029_ = m_50795_("black_bed", m_50764_(DyeColor.BLACK)); @@ -17,7 +9,7 @@ public static final Block f_50031_ = m_50795_("detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.m_60939_(Material.f_76310_).m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_))); public static final Block f_50032_ = m_50795_("sticky_piston", m_50798_(true)); public static final Block f_50033_ = m_50795_("cobweb", new WebBlock(BlockBehaviour.Properties.m_60939_(Material.f_76311_).m_60910_().m_60999_().m_60978_(4.0F))); -@@ -1111,16 +_,5 @@ +@@ -1153,16 +_,5 @@ public static void m_50758_() { Block.f_49791_.forEach(BlockBehaviour.BlockStateBase::m_60611_); diff --git a/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch index 36afaeb4c6d..6d0ed456254 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch @@ -12,25 +12,29 @@ @@ -34,6 +_,7 @@ } - public void m_7458_(BlockState p_51138_, ServerLevel p_51139_, BlockPos p_51140_, Random p_51141_) { -+ if (!p_51139_.isAreaLoaded(p_51140_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update - if (!p_51138_.m_60710_(p_51139_, p_51140_)) { - p_51139_.m_46961_(p_51140_, true); + public void m_213897_(BlockState p_220908_, ServerLevel p_220909_, BlockPos p_220910_, RandomSource p_220911_) { ++ if (!p_220909_.isAreaLoaded(p_220910_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update + if (!p_220908_.m_60710_(p_220909_, p_220910_)) { + p_220909_.m_46961_(p_220910_, true); } -@@ -49,6 +_,7 @@ +@@ -49,15 +_,17 @@ if (i < 3) { - int j = p_51166_.m_61143_(f_51131_); -+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_51167_, blockpos, p_51166_, true)) { + int j = p_220913_.m_61143_(f_51131_); ++ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_220914_, blockpos, p_220913_, true)) { if (j == 15) { - p_51167_.m_46597_(blockpos, this.m_49966_()); - BlockState blockstate = p_51166_.m_61124_(f_51131_, Integer.valueOf(0)); -@@ -57,7 +_,8 @@ + p_220914_.m_46597_(blockpos, this.m_49966_()); +- BlockState blockstate = p_220913_.m_61124_(f_51131_, Integer.valueOf(0)); ++ BlockState blockstate = p_220913_.m_61124_(f_51131_, 0); + p_220914_.m_7731_(p_220915_, blockstate, 4); + p_220914_.m_213960_(blockstate, blockpos, this, p_220915_, false); } else { - p_51167_.m_7731_(p_51168_, p_51166_.m_61124_(f_51131_, Integer.valueOf(j + 1)), 4); - } +- p_220914_.m_7731_(p_220915_, p_220913_.m_61124_(f_51131_, Integer.valueOf(j + 1)), 4); +- } - -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_51167_, p_51168_, p_51166_); ++ p_220914_.m_7731_(p_220915_, p_220913_.m_61124_(f_51131_, j + 1), 4); ++ } ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_220914_, p_220915_, p_220913_); + } } } diff --git a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch index fb8bb71ce1a..45d6f01f4bc 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -205,7 +_,7 @@ +@@ -204,7 +_,7 @@ return true; } - boolean flag = Shapes.m_83157_(f_51231_, blockstate.m_60742_(p_51249_, p_51250_, CollisionContext.m_82749_()), BooleanOp.f_82689_); -+ boolean flag = Shapes.m_83157_(f_51231_, blockstate.m_60742_(p_51249_, blockpos, CollisionContext.m_82749_()), BooleanOp.f_82689_);//Forge fix: MC-201374 ++ boolean flag = Shapes.m_83157_(f_51231_, blockstate.m_60742_(p_51249_, blockpos, CollisionContext.m_82749_()), BooleanOp.f_82689_); // FORGE: Fix MC-201374 if (flag) { BlockState blockstate1 = p_51249_.m_8055_(blockpos.m_7495_()); return m_51319_(blockstate1); diff --git a/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch index 38ebf5097a8..94cbb86f717 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ChestBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java -@@ -336,7 +_,8 @@ +@@ -335,7 +_,8 @@ } public BlockState m_6943_(BlockState p_51549_, Mirror p_51550_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch index 0c08bd2123e..cc775c663ba 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ChorusFlowerBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/block/ChorusFlowerBlock.java +++ b/net/minecraft/world/level/block/ChorusFlowerBlock.java @@ -43,7 +_,7 @@ - BlockPos blockpos = p_51704_.m_7494_(); - if (p_51703_.m_46859_(blockpos) && blockpos.m_123342_() < p_51703_.m_151558_()) { - int i = p_51702_.m_61143_(f_51647_); + BlockPos blockpos = p_220982_.m_7494_(); + if (p_220981_.m_46859_(blockpos) && blockpos.m_123342_() < p_220981_.m_151558_()) { + int i = p_220980_.m_61143_(f_51647_); - if (i < 5) { -+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_51703_, blockpos, p_51702_, true)) { ++ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_220981_, blockpos, p_220980_, true)) { boolean flag = false; boolean flag1 = false; - BlockState blockstate = p_51703_.m_8055_(p_51704_.m_7495_()); + BlockState blockstate = p_220981_.m_8055_(p_220982_.m_7495_()); @@ -99,7 +_,7 @@ } else { - this.m_51658_(p_51703_, p_51704_); + this.m_51658_(p_220981_, p_220982_); } - -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_51703_, p_51704_, p_51702_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_220981_, p_220982_, p_220980_); } } } diff --git a/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch index bdaadc5b6c2..bae348a412e 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CocoaBlock.java.patch @@ -3,14 +3,15 @@ @@ -47,10 +_,11 @@ } - public void m_7455_(BlockState p_51782_, ServerLevel p_51783_, BlockPos p_51784_, Random p_51785_) { -- if (p_51783_.f_46441_.nextInt(5) == 0) { + public void m_213898_(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { +- if (p_221001_.f_46441_.m_188503_(5) == 0) { + if (true) { - int i = p_51782_.m_61143_(f_51736_); + int i = p_221000_.m_61143_(f_51736_); - if (i < 2) { -+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_51783_, p_51784_, p_51782_, p_51783_.f_46441_.nextInt(5) == 0)) { - p_51783_.m_7731_(p_51784_, p_51782_.m_61124_(f_51736_, Integer.valueOf(i + 1)), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_51783_, p_51784_, p_51782_); +- p_221001_.m_7731_(p_221002_, p_221000_.m_61124_(f_51736_, Integer.valueOf(i + 1)), 2); ++ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221001_, p_221002_, p_221000_, p_221001_.f_46441_.m_188503_(5) == 0)) { ++ p_221001_.m_7731_(p_221002_, p_221000_.m_61124_(f_51736_, i + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221001_, p_221002_, p_221000_); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch index 1a20e43ad14..e90897be30e 100644 --- a/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/ComparatorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java -@@ -166,4 +_,16 @@ +@@ -165,4 +_,16 @@ protected void m_7926_(StateDefinition.Builder p_51887_) { p_51887_.m_61104_(f_54117_, f_51854_, f_52496_); } diff --git a/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch index 22140841d0e..c343e6db293 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CropBlock.java.patch @@ -3,28 +3,28 @@ @@ -64,12 +_,14 @@ } - public void m_7455_(BlockState p_52292_, ServerLevel p_52293_, BlockPos p_52294_, Random p_52295_) { -+ if (!p_52293_.isAreaLoaded(p_52294_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_52293_.m_45524_(p_52294_, 0) >= 9) { - int i = this.m_52305_(p_52292_); + public void m_213898_(BlockState p_221050_, ServerLevel p_221051_, BlockPos p_221052_, RandomSource p_221053_) { ++ if (!p_221051_.isAreaLoaded(p_221052_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_221051_.m_45524_(p_221052_, 0) >= 9) { + int i = this.m_52305_(p_221050_); if (i < this.m_7419_()) { - float f = m_52272_(this, p_52293_, p_52294_); -- if (p_52295_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_52293_, p_52294_, p_52292_, p_52295_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_52293_.m_7731_(p_52294_, this.m_52289_(i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_52293_, p_52294_, p_52292_); + float f = m_52272_(this, p_221051_, p_221052_); +- if (p_221053_.m_188503_((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221051_, p_221052_, p_221050_, p_221053_.m_188503_((int)(25.0F / f) + 1) == 0)) { + p_221051_.m_7731_(p_221052_, this.m_52289_(i + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221051_, p_221052_, p_221050_); } } } @@ -98,9 +_,9 @@ for(int j = -1; j <= 1; ++j) { float f1 = 0.0F; - BlockState blockstate = p_52274_.m_8055_(blockpos.m_142082_(i, 0, j)); + BlockState blockstate = p_52274_.m_8055_(blockpos.m_7918_(i, 0, j)); - if (blockstate.m_60713_(Blocks.f_50093_)) { -+ if (blockstate.canSustainPlant(p_52274_, blockpos.m_142082_(i, 0, j), net.minecraft.core.Direction.UP, (net.minecraftforge.common.IPlantable) p_52273_)) { ++ if (blockstate.canSustainPlant(p_52274_, blockpos.m_7918_(i, 0, j), net.minecraft.core.Direction.UP, (net.minecraftforge.common.IPlantable) p_52273_)) { f1 = 1.0F; - if (blockstate.m_61143_(FarmBlock.f_53243_) > 0) { -+ if (blockstate.isFertile(p_52274_, p_52275_.m_142082_(i, 0, j))) { ++ if (blockstate.isFertile(p_52274_, p_52275_.m_7918_(i, 0, j))) { f1 = 3.0F; } } diff --git a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch index 8ef0463c2c2..7ec957ac3fa 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch @@ -3,7 +3,7 @@ @@ -165,6 +_,8 @@ protected void m_52580_(Level p_52581_, BlockPos p_52582_, BlockState p_52583_) { Direction direction = p_52583_.m_61143_(f_54117_); - BlockPos blockpos = p_52582_.m_142300_(direction.m_122424_()); + BlockPos blockpos = p_52582_.m_121945_(direction.m_122424_()); + if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_52581_, p_52582_, p_52581_.m_8055_(p_52582_), java.util.EnumSet.of(direction.m_122424_()), false).isCanceled()) + return; p_52581_.m_46586_(blockpos, this, p_52582_); diff --git a/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch new file mode 100644 index 00000000000..91a7fe6b45c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/DropExperienceBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/world/level/block/DropExperienceBlock.java ++++ b/net/minecraft/world/level/block/DropExperienceBlock.java +@@ -22,9 +_,11 @@ + + public void m_213646_(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { + super.m_213646_(p_221086_, p_221087_, p_221088_, p_221089_, p_221090_); +- if (p_221090_) { +- this.m_220822_(p_221087_, p_221088_, p_221089_, this.f_221079_); +- } +- ++ ++ } ++ ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader level, net.minecraft.util.RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { ++ return silkTouchLevel == 0 ? this.f_221079_.m_214085_(randomSource) : 0; + } + } diff --git a/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch index a8ccd5e28e0..ffcd84f46a0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DropperBlock.java.patch @@ -7,5 +7,5 @@ - if (!itemstack.m_41619_()) { + if (!itemstack.m_41619_() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_52944_, p_52945_, dispenserblockentity, i, itemstack)) { Direction direction = p_52944_.m_8055_(p_52945_).m_61143_(f_52659_); - Container container = HopperBlockEntity.m_59390_(p_52944_, p_52945_.m_142300_(direction)); + Container container = HopperBlockEntity.m_59390_(p_52944_, p_52945_.m_121945_(direction)); ItemStack itemstack1; diff --git a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch index ba1af1343bd..e28131aa83a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch @@ -4,8 +4,8 @@ } public static boolean m_207909_(Level p_207910_, BlockPos p_207911_, BlockPos p_207912_) { -- return p_207910_.m_8055_(p_207911_.m_141952_(p_207912_)).m_60713_(Blocks.f_50078_) && p_207910_.m_46859_(p_207911_.m_142082_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); -+ return p_207910_.m_8055_(p_207911_.m_141952_(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.m_141952_(p_207912_)) != 0 && p_207910_.m_46859_(p_207911_.m_142082_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); +- return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).m_60713_(Blocks.f_50078_) && p_207910_.m_46859_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); ++ return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.m_121955_(p_207912_)) != 0 && p_207910_.m_46859_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); } public boolean m_7923_(BlockState p_52997_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch index 97ed40c9167..71d9a259764 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch @@ -4,7 +4,7 @@ } public void m_142072_(Level p_153227_, BlockState p_153228_, BlockPos p_153229_, Entity p_153230_, float p_153231_) { -- if (!p_153227_.f_46443_ && p_153227_.f_46441_.nextFloat() < p_153231_ - 0.5F && p_153230_ instanceof LivingEntity && (p_153230_ instanceof Player || p_153227_.m_46469_().m_46207_(GameRules.f_46132_)) && p_153230_.m_20205_() * p_153230_.m_20205_() * p_153230_.m_20206_() > 0.512F) { +- if (!p_153227_.f_46443_ && p_153227_.f_46441_.m_188501_() < p_153231_ - 0.5F && p_153230_ instanceof LivingEntity && (p_153230_ instanceof Player || p_153227_.m_46469_().m_46207_(GameRules.f_46132_)) && p_153230_.m_20205_() * p_153230_.m_20205_() * p_153230_.m_20206_() > 0.512F) { + if (!p_153227_.f_46443_ && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_153227_, p_153229_, Blocks.f_50493_.m_49966_(), p_153231_, p_153230_)) { // Forge: Move logic to Entity#canTrample m_53296_(p_153228_, p_153227_, p_153229_); } diff --git a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch index 917255bdd59..511d01baf75 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch @@ -11,97 +11,104 @@ for(Direction direction : Direction.values()) { BooleanProperty booleanproperty = f_53414_.get(direction); if (booleanproperty != null) { -- blockstate1 = blockstate1.m_61124_(booleanproperty, Boolean.valueOf(this.m_7599_(p_53471_.m_8055_(p_53472_.m_142300_(direction))))); -+ blockstate1 = blockstate1.m_61124_(booleanproperty, Boolean.valueOf(this.canCatchFire(p_53471_, p_53472_.m_142300_(direction), direction.m_122424_()))); +- blockstate1 = blockstate1.m_61124_(booleanproperty, Boolean.valueOf(this.m_7599_(p_53471_.m_8055_(p_53472_.m_121945_(direction))))); ++ blockstate1 = blockstate1.m_61124_(booleanproperty, Boolean.valueOf(this.canCatchFire(p_53471_, p_53472_.m_121945_(direction), direction.m_122424_()))); } } @@ -132,7 +_,7 @@ } - BlockState blockstate = p_53450_.m_8055_(p_53451_.m_7495_()); -- boolean flag = blockstate.m_204336_(p_53450_.m_6042_().m_204517_()); -+ boolean flag = blockstate.isFireSource(p_53450_, p_53451_, Direction.UP); - int i = p_53449_.m_61143_(f_53408_); - if (!flag && p_53450_.m_46471_() && this.m_53428_(p_53450_, p_53451_) && p_53452_.nextFloat() < 0.2F + (float)i * 0.03F) { - p_53450_.m_7471_(p_53451_, false); + BlockState blockstate = p_221161_.m_8055_(p_221162_.m_7495_()); +- boolean flag = blockstate.m_204336_(p_221161_.m_6042_().f_63836_()); ++ boolean flag = blockstate.isFireSource(p_221161_, p_221162_, Direction.UP); + int i = p_221160_.m_61143_(f_53408_); + if (!flag && p_221161_.m_46471_() && this.m_53428_(p_221161_, p_221162_) && p_221163_.m_188501_() < 0.2F + (float)i * 0.03F) { + p_221161_.m_7471_(p_221162_, false); @@ -153,7 +_,7 @@ return; } -- if (i == 15 && p_53452_.nextInt(4) == 0 && !this.m_7599_(p_53450_.m_8055_(p_53451_.m_7495_()))) { -+ if (i == 15 && p_53452_.nextInt(4) == 0 && !this.canCatchFire(p_53450_, p_53451_.m_7495_(), Direction.UP)) { - p_53450_.m_7471_(p_53451_, false); +- if (i == 15 && p_221163_.m_188503_(4) == 0 && !this.m_7599_(p_221161_.m_8055_(p_221162_.m_7495_()))) { ++ if (i == 15 && p_221163_.m_188503_(4) == 0 && !this.canCatchFire(p_221161_, p_221162_.m_7495_(), Direction.UP)) { + p_221161_.m_7471_(p_221162_, false); return; } @@ -161,12 +_,12 @@ - boolean flag1 = p_53450_.m_46761_(p_53451_); + boolean flag1 = p_221161_.m_46761_(p_221162_); int k = flag1 ? -50 : 0; -- this.m_53431_(p_53450_, p_53451_.m_142126_(), 300 + k, p_53452_, i); -- this.m_53431_(p_53450_, p_53451_.m_142125_(), 300 + k, p_53452_, i); -- this.m_53431_(p_53450_, p_53451_.m_7495_(), 250 + k, p_53452_, i); -- this.m_53431_(p_53450_, p_53451_.m_7494_(), 250 + k, p_53452_, i); -- this.m_53431_(p_53450_, p_53451_.m_142127_(), 300 + k, p_53452_, i); -- this.m_53431_(p_53450_, p_53451_.m_142128_(), 300 + k, p_53452_, i); -+ this.tryCatchFire(p_53450_, p_53451_.m_142126_(), 300 + k, p_53452_, i, Direction.WEST); -+ this.tryCatchFire(p_53450_, p_53451_.m_142125_(), 300 + k, p_53452_, i, Direction.EAST); -+ this.tryCatchFire(p_53450_, p_53451_.m_7495_(), 250 + k, p_53452_, i, Direction.UP); -+ this.tryCatchFire(p_53450_, p_53451_.m_7494_(), 250 + k, p_53452_, i, Direction.DOWN); -+ this.tryCatchFire(p_53450_, p_53451_.m_142127_(), 300 + k, p_53452_, i, Direction.SOUTH); -+ this.tryCatchFire(p_53450_, p_53451_.m_142128_(), 300 + k, p_53452_, i, Direction.NORTH); +- this.m_221150_(p_221161_, p_221162_.m_122029_(), 300 + k, p_221163_, i); +- this.m_221150_(p_221161_, p_221162_.m_122024_(), 300 + k, p_221163_, i); +- this.m_221150_(p_221161_, p_221162_.m_7495_(), 250 + k, p_221163_, i); +- this.m_221150_(p_221161_, p_221162_.m_7494_(), 250 + k, p_221163_, i); +- this.m_221150_(p_221161_, p_221162_.m_122012_(), 300 + k, p_221163_, i); +- this.m_221150_(p_221161_, p_221162_.m_122019_(), 300 + k, p_221163_, i); ++ this.tryCatchFire(p_221161_, p_221162_.m_122029_(), 300 + k, p_221163_, i, Direction.WEST); ++ this.tryCatchFire(p_221161_, p_221162_.m_122024_(), 300 + k, p_221163_, i, Direction.EAST); ++ this.tryCatchFire(p_221161_, p_221162_.m_7495_(), 250 + k, p_221163_, i, Direction.UP); ++ this.tryCatchFire(p_221161_, p_221162_.m_7494_(), 250 + k, p_221163_, i, Direction.DOWN); ++ this.tryCatchFire(p_221161_, p_221162_.m_122012_(), 300 + k, p_221163_, i, Direction.SOUTH); ++ this.tryCatchFire(p_221161_, p_221162_.m_122019_(), 300 + k, p_221163_, i, Direction.NORTH); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for(int l = -1; l <= 1; ++l) { -@@ -204,16 +_,18 @@ - return p_53429_.m_46758_(p_53430_) || p_53429_.m_46758_(p_53430_.m_142125_()) || p_53429_.m_46758_(p_53430_.m_142126_()) || p_53429_.m_46758_(p_53430_.m_142127_()) || p_53429_.m_46758_(p_53430_.m_142128_()); +@@ -204,29 +_,28 @@ + return p_53429_.m_46758_(p_53430_) || p_53429_.m_46758_(p_53430_.m_122024_()) || p_53429_.m_46758_(p_53430_.m_122029_()) || p_53429_.m_46758_(p_53430_.m_122012_()) || p_53429_.m_46758_(p_53430_.m_122019_()); } + @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only. - public int m_53492_(BlockState p_53493_) { - return p_53493_.m_61138_(BlockStateProperties.f_61362_) && p_53493_.m_61143_(BlockStateProperties.f_61362_) ? 0 : this.f_53422_.getInt(p_53493_.m_60734_()); + public int m_221164_(BlockState p_221165_) { + return p_221165_.m_61138_(BlockStateProperties.f_61362_) && p_221165_.m_61143_(BlockStateProperties.f_61362_) ? 0 : this.f_53422_.getInt(p_221165_.m_60734_()); } + @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed - public int m_53494_(BlockState p_53495_) { - return p_53495_.m_61138_(BlockStateProperties.f_61362_) && p_53495_.m_61143_(BlockStateProperties.f_61362_) ? 0 : this.f_53421_.getInt(p_53495_.m_60734_()); + public int m_221166_(BlockState p_221167_) { + return p_221167_.m_61138_(BlockStateProperties.f_61362_) && p_221167_.m_61143_(BlockStateProperties.f_61362_) ? 0 : this.f_221147_.getInt(p_221167_.m_60734_()); } -- private void m_53431_(Level p_53432_, BlockPos p_53433_, int p_53434_, Random p_53435_, int p_53436_) { -- int i = this.m_53492_(p_53432_.m_8055_(p_53433_)); -+ private void tryCatchFire(Level p_53432_, BlockPos p_53433_, int p_53434_, Random p_53435_, int p_53436_, Direction face) { +- private void m_221150_(Level p_221151_, BlockPos p_221152_, int p_221153_, RandomSource p_221154_, int p_221155_) { +- int i = this.m_221164_(p_221151_.m_8055_(p_221152_)); +- if (p_221154_.m_188503_(p_221153_) < i) { +- BlockState blockstate = p_221151_.m_8055_(p_221152_); +- if (p_221154_.m_188503_(p_221155_ + 10) < 5 && !p_221151_.m_46758_(p_221152_)) { +- int j = Math.min(p_221155_ + p_221154_.m_188503_(5) / 4, 15); +- p_221151_.m_7731_(p_221152_, this.m_53437_(p_221151_, p_221152_, j), 3); ++ private void tryCatchFire(Level p_53432_, BlockPos p_53433_, int p_53434_, RandomSource p_53435_, int p_53436_, Direction face) { + int i = p_53432_.m_8055_(p_53433_).getFlammability(p_53432_, p_53433_, face); - if (p_53435_.nextInt(p_53434_) < i) { - BlockState blockstate = p_53432_.m_8055_(p_53433_); - if (p_53435_.nextInt(p_53436_ + 10) < 5 && !p_53432_.m_46758_(p_53433_)) { -@@ -223,11 +_,7 @@ - p_53432_.m_7471_(p_53433_, false); ++ if (p_53435_.m_188503_(p_53434_) < i) { ++ BlockState blockstate = p_53432_.m_8055_(p_53433_); ++ if (p_53435_.m_188503_(p_53434_ + 10) < 5 && !p_53432_.m_46758_(p_53433_)) { ++ int j = Math.min(p_53434_ + p_53435_.m_188503_(5) / 4, 15); ++ p_53432_.m_7731_(p_53433_, this.m_53437_(p_53432_, p_53433_, j), 3); + } else { +- p_221151_.m_7471_(p_221152_, false); ++ p_53432_.m_7471_(p_53433_, false); } - Block block = blockstate.m_60734_(); - if (block instanceof TntBlock) { -- TntBlock tntblock = (TntBlock)block; -- TntBlock.m_57433_(p_53432_, p_53433_); +- TntBlock.m_57433_(p_221151_, p_221152_); - } + blockstate.onCaughtFire(p_53432_, p_53433_, face, null); } } -@@ -239,7 +_,7 @@ +@@ -238,7 +_,7 @@ private boolean m_53485_(BlockGetter p_53486_, BlockPos p_53487_) { for(Direction direction : Direction.values()) { -- if (this.m_7599_(p_53486_.m_8055_(p_53487_.m_142300_(direction)))) { -+ if (this.canCatchFire(p_53486_, p_53487_.m_142300_(direction), direction.m_122424_())) { +- if (this.m_7599_(p_53486_.m_8055_(p_53487_.m_121945_(direction)))) { ++ if (this.canCatchFire(p_53486_, p_53487_.m_121945_(direction), direction.m_122424_())) { return true; } } -@@ -255,13 +_,14 @@ +@@ -254,13 +_,14 @@ for(Direction direction : Direction.values()) { - BlockState blockstate = p_53442_.m_8055_(p_53443_.m_142300_(direction)); -- i = Math.max(this.m_53494_(blockstate), i); -+ i = Math.max(blockstate.getFireSpreadSpeed(p_53442_, p_53443_.m_142300_(direction), direction.m_122424_()), i); + BlockState blockstate = p_221157_.m_8055_(p_221158_.m_121945_(direction)); +- i = Math.max(this.m_221166_(blockstate), i); ++ i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.m_121945_(direction), direction.m_122424_()), i); } return i; @@ -110,14 +117,14 @@ + @Deprecated //Forge: Use canCatchFire with more context protected boolean m_7599_(BlockState p_53489_) { - return this.m_53494_(p_53489_) > 0; + return this.m_221166_(p_53489_) > 0; } -@@ -280,8 +_,21 @@ +@@ -279,8 +_,21 @@ } private void m_53444_(Block p_53445_, int p_53446_, int p_53447_) { + if (p_53445_ == Blocks.f_50016_) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.f_53421_.put(p_53445_, p_53446_); + this.f_221147_.put(p_53445_, p_53446_); this.f_53422_.put(p_53445_, p_53447_); + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch index 910de9bc0ca..46afbcafc01 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -9,9 +9,9 @@ - super(p_53529_); - this.f_53525_ = p_53528_; - f_53524_.put(p_53528_, this); -+ this(Blocks.f_50276_ == null ? null : () -> (FlowerPotBlock) Blocks.f_50276_.delegate.get(), () -> p_53528_.delegate.get(), p_53529_); ++ this(Blocks.f_50276_ == null ? null : () -> (FlowerPotBlock) net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.f_50276_).get(), () -> net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_53528_).get(), p_53529_); + if (Blocks.f_50276_ != null) { -+ ((FlowerPotBlock)Blocks.f_50276_).addPlant(p_53528_.getRegistryName(), () -> this); ++ ((FlowerPotBlock)Blocks.f_50276_).addPlant(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(p_53528_), () -> this); + } + } + @@ -23,7 +23,7 @@ + * @param p_53528_ The flower block. + * @param properties + */ -+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_53528_, BlockBehaviour.Properties properties) { ++ public FlowerPotBlock(@org.jetbrains.annotations.Nullable java.util.function.Supplier emptyPot, java.util.function.Supplier p_53528_, BlockBehaviour.Properties properties) { + super(properties); + this.f_53525_ = null; // Unused, redirected by coremod + this.flowerDelegate = p_53528_; @@ -42,7 +42,7 @@ ItemStack itemstack = p_53543_.m_21120_(p_53544_); Item item = itemstack.m_41720_(); - BlockState blockstate = (item instanceof BlockItem ? f_53524_.getOrDefault(((BlockItem)item).m_40614_(), Blocks.f_50016_) : Blocks.f_50016_).m_49966_(); -+ BlockState blockstate = (item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).m_40614_().getRegistryName(), Blocks.f_50016_.delegate).get() : Blocks.f_50016_).m_49966_(); ++ BlockState blockstate = (item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey(((BlockItem)item).m_40614_()), net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.f_50016_)).get() : Blocks.f_50016_).m_49966_(); boolean flag = blockstate.m_60713_(Blocks.f_50016_); boolean flag1 = this.m_153267_(); if (flag != flag1) { diff --git a/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch index 44ee0721d95..864bbbb8379 100644 --- a/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch @@ -3,13 +3,13 @@ @@ -35,10 +_,11 @@ } - public void m_7455_(BlockState p_53963_, ServerLevel p_53964_, BlockPos p_53965_, Random p_53966_) { -- if (p_53963_.m_61143_(f_53924_) < 25 && p_53966_.nextDouble() < this.f_53925_) { -+ if (p_53963_.m_61143_(f_53924_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_53964_, p_53965_.m_142300_(this.f_53859_), p_53964_.m_8055_(p_53965_.m_142300_(this.f_53859_)),p_53966_.nextDouble() < this.f_53925_)) { - BlockPos blockpos = p_53965_.m_142300_(this.f_53859_); - if (this.m_5971_(p_53964_.m_8055_(blockpos))) { - p_53964_.m_46597_(blockpos, this.m_142452_(p_53963_, p_53964_.f_46441_)); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_53964_, blockpos, p_53964_.m_8055_(blockpos)); + public void m_213898_(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { +- if (p_221350_.m_61143_(f_53924_) < 25 && p_221353_.m_188500_() < this.f_53925_) { ++ if (p_221350_.m_61143_(f_53924_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221351_, p_221352_.m_121945_(this.f_53859_), p_221351_.m_8055_(p_221352_.m_121945_(this.f_53859_)),p_221353_.m_188500_() < this.f_53925_)) { + BlockPos blockpos = p_221352_.m_121945_(this.f_53859_); + if (this.m_5971_(p_221351_.m_8055_(blockpos))) { + p_221351_.m_46597_(blockpos, this.m_214070_(p_221350_, p_221351_.f_46441_)); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221351_, blockpos, p_221351_.m_8055_(blockpos)); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch index ffa8c15472e..bf0c70943e1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -19,7 +_,7 @@ +@@ -21,7 +_,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; --public class LeavesBlock extends Block { -+public class LeavesBlock extends Block implements net.minecraftforge.common.IForgeShearable { +-public class LeavesBlock extends Block implements SimpleWaterloggedBlock { ++public class LeavesBlock extends Block implements SimpleWaterloggedBlock, net.minecraftforge.common.IForgeShearable { public static final int f_153563_ = 7; public static final IntegerProperty f_54418_ = BlockStateProperties.f_61414_; public static final BooleanProperty f_54419_ = BlockStateProperties.f_61447_; diff --git a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch index 4655eaeee84..b64a788004f 100644 --- a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -20,7 +20,7 @@ this.f_54691_.add(p_54694_.m_75953_(8, true)); this.m_49959_(this.f_49792_.m_61090_().m_61124_(f_54688_, Integer.valueOf(0))); + fluidStateCacheInitialized = true; -+ supplier = p_54694_.delegate; ++ supplier = net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_54694_); + } + + /** @@ -44,7 +44,7 @@ } @@ -120,13 +_,13 @@ - BlockPos blockpos = p_54698_.m_142300_(direction.m_122424_()); + BlockPos blockpos = p_54698_.m_121945_(direction.m_122424_()); if (p_54697_.m_6425_(blockpos).m_205070_(FluidTags.f_13131_)) { Block block = p_54697_.m_6425_(p_54698_).m_76170_() ? Blocks.f_50080_ : Blocks.f_50652_; - p_54697_.m_46597_(p_54698_, block.m_49966_()); diff --git a/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch index f18affcd9ab..db97209efc3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/NetherWartBlock.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/world/level/block/NetherWartBlock.java @@ -38,9 +_,10 @@ - public void m_7455_(BlockState p_54981_, ServerLevel p_54982_, BlockPos p_54983_, Random p_54984_) { - int i = p_54981_.m_61143_(f_54967_); -- if (i < 3 && p_54984_.nextInt(10) == 0) { -+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_54982_, p_54983_, p_54981_, p_54984_.nextInt(10) == 0)) { - p_54981_ = p_54981_.m_61124_(f_54967_, Integer.valueOf(i + 1)); - p_54982_.m_7731_(p_54983_, p_54981_, 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_54982_, p_54983_, p_54981_); + public void m_213898_(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { + int i = p_221806_.m_61143_(f_54967_); +- if (i < 3 && p_221809_.m_188503_(10) == 0) { ++ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_221807_, p_221808_, p_221806_, p_221809_.m_188503_(10) == 0)) { + p_221806_ = p_221806_.m_61124_(f_54967_, Integer.valueOf(i + 1)); + p_221807_.m_7731_(p_221808_, p_221806_, 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_221807_, p_221808_, p_221806_); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch index 8d03c9190cf..631498721ce 100644 --- a/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java -@@ -62,7 +_,9 @@ +@@ -65,7 +_,9 @@ if (p_55035_.f_46443_) { return InteractionResult.SUCCESS; } else { @@ -9,9 +9,9 @@ + if (_new == -1) return InteractionResult.FAIL; + p_55034_ = p_55034_.m_61124_(f_55013_, _new); p_55035_.m_7731_(p_55036_, p_55034_, 3); - this.m_55019_(p_55035_, p_55036_); + this.m_221820_(p_55037_, p_55035_, p_55036_); p_55037_.m_36220_(Stats.f_12960_); -@@ -78,6 +_,9 @@ +@@ -81,6 +_,9 @@ } public boolean m_8133_(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/OreBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/OreBlock.java.patch deleted file mode 100644 index e51ed4fc973..00000000000 --- a/patches/minecraft/net/minecraft/world/level/block/OreBlock.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/world/level/block/OreBlock.java -+++ b/net/minecraft/world/level/block/OreBlock.java -@@ -23,12 +_,10 @@ - - public void m_8101_(BlockState p_55142_, ServerLevel p_55143_, BlockPos p_55144_, ItemStack p_55145_) { - super.m_8101_(p_55142_, p_55143_, p_55144_, p_55145_); -- if (EnchantmentHelper.m_44843_(Enchantments.f_44985_, p_55145_) == 0) { -- int i = this.f_153990_.m_142270_(p_55143_.f_46441_); -- if (i > 0) { -- this.m_49805_(p_55143_, p_55144_, i); -- } -- } -+ } - -+ @Override -+ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader reader, BlockPos pos, int fortune, int silktouch) { -+ return silktouch == 0 ? this.f_153990_.m_142270_(RANDOM) : 0; - } - } diff --git a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch index b8cd3910548..aaf1f4fc019 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PowderSnowBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/net/minecraft/world/level/block/PowderSnowBlock.java -@@ -109,7 +_,7 @@ +@@ -107,7 +_,7 @@ if (p_154256_.m_6095_().m_204039_(EntityTypeTags.f_144291_)) { return true; } else { diff --git a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch index cfb6604cfb7..e629605df44 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -36,15 +36,15 @@ } else { return false; @@ -156,6 +_,9 @@ - return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_EAST); - case NORTH_EAST: - return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_WEST); + return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_EAST); + case NORTH_EAST: + return p_55240_.m_61124_(f_55214_, RailShape.SOUTH_WEST); + case NORTH_SOUTH: //Forge fix: MC-196102 + case EAST_WEST: + return p_55240_; - } - case COUNTERCLOCKWISE_90: - switch((RailShape)p_55240_.m_61143_(f_55214_)) { + } + case COUNTERCLOCKWISE_90: + switch ((RailShape)p_55240_.m_61143_(f_55214_)) { @@ -254,5 +_,9 @@ protected void m_7926_(StateDefinition.Builder p_55243_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/RailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RailBlock.java.patch index 09b395d0a6f..093be0d3f81 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RailBlock.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/RailBlock.java +++ b/net/minecraft/world/level/block/RailBlock.java @@ -49,6 +_,9 @@ - return p_55405_.m_61124_(f_55392_, RailShape.SOUTH_EAST); - case NORTH_EAST: - return p_55405_.m_61124_(f_55392_, RailShape.SOUTH_WEST); + return p_55405_.m_61124_(f_55392_, RailShape.SOUTH_EAST); + case NORTH_EAST: + return p_55405_.m_61124_(f_55392_, RailShape.SOUTH_WEST); + case NORTH_SOUTH: //Forge fix: MC-196102 + case EAST_WEST: + return p_55405_; - } - case COUNTERCLOCKWISE_90: - switch((RailShape)p_55405_.m_61143_(f_55392_)) { + } + case COUNTERCLOCKWISE_90: + switch ((RailShape)p_55405_.m_61143_(f_55392_)) { diff --git a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch index 10dd60c7267..72da730c7b9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -71,11 +_,11 @@ +@@ -74,11 +_,11 @@ - public void m_8101_(BlockState p_55462_, ServerLevel p_55463_, BlockPos p_55464_, ItemStack p_55465_) { - super.m_8101_(p_55462_, p_55463_, p_55464_, p_55465_); -- if (EnchantmentHelper.m_44843_(Enchantments.f_44985_, p_55465_) == 0) { -- int i = 1 + p_55463_.f_46441_.nextInt(5); -- this.m_49805_(p_55463_, p_55464_, i); + public void m_213646_(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { + super.m_213646_(p_221907_, p_221908_, p_221909_, p_221910_, p_221911_); +- if (p_221911_ && EnchantmentHelper.m_44843_(Enchantments.f_44985_, p_221910_) == 0) { +- int i = 1 + p_221908_.f_46441_.m_188503_(5); +- this.m_49805_(p_221908_, p_221909_, i); - } + } + @Override -+ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader world, BlockPos pos, int fortune, int silktouch) { -+ return silktouch == 0 ? 1 + RANDOM.nextInt(5) : 0; ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader world, RandomSource randomSource, BlockPos pos, int fortune, int silktouch) { ++ return silktouch == 0 ? 1 + randomSource.m_188503_(5) : 0; } - public void m_7100_(BlockState p_55479_, Level p_55480_, BlockPos p_55481_, Random p_55482_) { + public void m_214162_(BlockState p_221913_, Level p_221914_, BlockPos p_221915_, RandomSource p_221916_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch index 0a7730ab2b1..bd6bf719b63 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -199,7 +_,7 @@ +@@ -197,7 +_,7 @@ BlockState blockstate = p_55523_.m_8055_(blockpos); if (p_55526_) { boolean flag = this.m_55612_(p_55523_, blockpos, blockstate); @@ -9,7 +9,7 @@ if (blockstate.m_60783_(p_55523_, blockpos, p_55525_.m_122424_())) { return RedstoneSide.UP; } -@@ -208,7 +_,14 @@ +@@ -206,7 +_,14 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch index 5cf76f43509..4a8c3086325 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -2,17 +2,17 @@ +++ b/net/minecraft/world/level/block/SaplingBlock.java @@ -32,6 +_,7 @@ - public void m_7455_(BlockState p_56003_, ServerLevel p_56004_, BlockPos p_56005_, Random p_56006_) { - if (p_56004_.m_46803_(p_56005_.m_7494_()) >= 9 && p_56006_.nextInt(7) == 0) { -+ if (!p_56004_.isAreaLoaded(p_56005_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - this.m_55980_(p_56004_, p_56005_, p_56003_, p_56006_); + public void m_213898_(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { + if (p_222012_.m_46803_(p_222013_.m_7494_()) >= 9 && p_222014_.m_188503_(7) == 0) { ++ if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + this.m_222000_(p_222012_, p_222013_, p_222011_, p_222014_); } @@ -41,6 +_,7 @@ - if (p_55983_.m_61143_(f_55973_) == 0) { - p_55981_.m_7731_(p_55982_, p_55983_.m_61122_(f_55973_), 4); + if (p_222003_.m_61143_(f_55973_) == 0) { + p_222001_.m_7731_(p_222002_, p_222003_.m_61122_(f_55973_), 4); } else { -+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_55981_, p_55984_, p_55982_)) return; - this.f_55975_.m_6334_(p_55981_, p_55981_.m_7726_().m_8481_(), p_55982_, p_55983_, p_55984_); ++ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_222001_, p_222004_, p_222002_)) return; + this.f_55975_.m_213817_(p_222001_, p_222001_.m_7726_().m_8481_(), p_222002_, p_222003_, p_222004_); } diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch new file mode 100644 index 00000000000..abbfd7df7c6 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/world/level/block/SculkCatalystBlock.java ++++ b/net/minecraft/world/level/block/SculkCatalystBlock.java +@@ -72,9 +_,11 @@ + + public void m_213646_(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { + super.m_213646_(p_222109_, p_222110_, p_222111_, p_222112_, p_222113_); +- if (p_222113_) { +- this.m_220822_(p_222110_, p_222111_, p_222112_, this.f_222087_); +- } +- ++ ++ } ++ ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader level, RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { ++ return silkTouchLevel == 0 ? this.f_222087_.m_214085_(randomSource) : 0; + } + } diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch new file mode 100644 index 00000000000..6bfbc8a3ec7 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/world/level/block/SculkSensorBlock.java ++++ b/net/minecraft/world/level/block/SculkSensorBlock.java +@@ -275,9 +_,11 @@ + + public void m_213646_(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { + super.m_213646_(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); +- if (p_222146_) { +- this.m_220822_(p_222143_, p_222144_, p_222145_, ConstantInt.m_146483_(5)); +- } +- ++ ++ } ++ ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader level, RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { ++ return silkTouchLevel == 0 ? 5 : 0; + } + } diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch new file mode 100644 index 00000000000..acd3b6ab2fe --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/level/block/SculkShriekerBlock.java ++++ b/net/minecraft/world/level/block/SculkShriekerBlock.java +@@ -121,10 +_,12 @@ + + public void m_213646_(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { + super.m_213646_(p_222192_, p_222193_, p_222194_, p_222195_, p_222196_); +- if (p_222196_) { +- this.m_220822_(p_222193_, p_222194_, p_222195_, ConstantInt.m_146483_(5)); +- } +- ++ ++ } ++ ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader level, RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { ++ return silkTouchLevel == 0 ? 5 : 0; + } + + @Nullable diff --git a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch index c3c4501cb93..2990d77ba7f 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java -@@ -88,6 +_,7 @@ +@@ -99,6 +_,7 @@ private final SoundEvent f_56737_; private final SoundEvent f_56738_; diff --git a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch index 071112a23ab..6b5129926b6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpawnerBlock.java.patch @@ -1,16 +1,20 @@ --- a/net/minecraft/world/level/block/SpawnerBlock.java +++ b/net/minecraft/world/level/block/SpawnerBlock.java -@@ -29,8 +_,11 @@ +@@ -29,11 +_,12 @@ - public void m_8101_(BlockState p_56789_, ServerLevel p_56790_, BlockPos p_56791_, ItemStack p_56792_) { - super.m_8101_(p_56789_, p_56790_, p_56791_, p_56792_); -- int i = 15 + p_56790_.f_46441_.nextInt(15) + p_56790_.f_46441_.nextInt(15); -- this.m_49805_(p_56790_, p_56791_, i); + public void m_213646_(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { + super.m_213646_(p_222477_, p_222478_, p_222479_, p_222480_, p_222481_); +- if (p_222481_) { +- int i = 15 + p_222478_.f_46441_.m_188503_(15) + p_222478_.f_46441_.m_188503_(15); +- this.m_49805_(p_222478_, p_222479_, i); +- } +- ++ + } + + @Override -+ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader world, BlockPos pos, int fortune, int silktouch) { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ public int getExpDrop(BlockState state, net.minecraft.world.level.LevelReader world, net.minecraft.util.RandomSource randomSource, BlockPos pos, int fortune, int silktouch) { ++ return 15 + randomSource.m_188503_(15) + randomSource.m_188503_(15); } public RenderShape m_7514_(BlockState p_56794_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch index acc4229bd5d..249cd9263ba 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch @@ -2,12 +2,12 @@ +++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -35,8 +_,10 @@ - public void m_7455_(BlockState p_56819_, ServerLevel p_56820_, BlockPos p_56821_, Random p_56822_) { - if (!m_56823_(p_56819_, p_56820_, p_56821_)) { -+ if (!p_56820_.isAreaLoaded(p_56821_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - p_56820_.m_46597_(p_56821_, Blocks.f_50493_.m_49966_()); + public void m_213898_(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { + if (!m_56823_(p_222508_, p_222509_, p_222510_)) { ++ if (!p_222509_.isAreaLoaded(p_222510_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + p_222509_.m_46597_(p_222510_, Blocks.f_50493_.m_49966_()); } else { -+ if (!p_56820_.isAreaLoaded(p_56821_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - if (p_56820_.m_46803_(p_56821_.m_7494_()) >= 9) { ++ if (!p_222509_.isAreaLoaded(p_222510_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + if (p_222509_.m_46803_(p_222510_.m_7494_()) >= 9) { BlockState blockstate = this.m_49966_(); diff --git a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch index 36f47c2bf93..9b8443fd539 100644 --- a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch @@ -3,29 +3,29 @@ @@ -43,22 +_,24 @@ } - public void m_7455_(BlockState p_57042_, ServerLevel p_57043_, BlockPos p_57044_, Random p_57045_) { -+ if (!p_57043_.isAreaLoaded(p_57044_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_57043_.m_45524_(p_57044_, 0) >= 9) { - float f = CropBlock.m_52272_(this, p_57043_, p_57044_); -- if (p_57045_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_57043_, p_57044_, p_57042_, p_57045_.nextInt((int)(25.0F / f) + 1) == 0)) { - int i = p_57042_.m_61143_(f_57013_); + public void m_213898_(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) { ++ if (!p_222539_.isAreaLoaded(p_222540_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_222539_.m_45524_(p_222540_, 0) >= 9) { + float f = CropBlock.m_52272_(this, p_222539_, p_222540_); +- if (p_222541_.m_188503_((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222539_, p_222540_, p_222538_, p_222541_.m_188503_((int)(25.0F / f) + 1) == 0)) { + int i = p_222538_.m_61143_(f_57013_); if (i < 7) { -- p_57042_ = p_57042_.m_61124_(f_57013_, Integer.valueOf(i + 1)); -- p_57043_.m_7731_(p_57044_, p_57042_, 2); -+ p_57043_.m_7731_(p_57044_, p_57042_.m_61124_(f_57013_, Integer.valueOf(i + 1)), 2); +- p_222538_ = p_222538_.m_61124_(f_57013_, Integer.valueOf(i + 1)); +- p_222539_.m_7731_(p_222540_, p_222538_, 2); ++ p_222539_.m_7731_(p_222540_, p_222538_.m_61124_(f_57013_, Integer.valueOf(i + 1)), 2); } else { - Direction direction = Direction.Plane.HORIZONTAL.m_122560_(p_57045_); - BlockPos blockpos = p_57044_.m_142300_(direction); - BlockState blockstate = p_57043_.m_8055_(blockpos.m_7495_()); -- if (p_57043_.m_8055_(blockpos).m_60795_() && (blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_204336_(BlockTags.f_144274_))) { + Direction direction = Direction.Plane.HORIZONTAL.m_235690_(p_222541_); + BlockPos blockpos = p_222540_.m_121945_(direction); + BlockState blockstate = p_222539_.m_8055_(blockpos.m_7495_()); +- if (p_222539_.m_8055_(blockpos).m_60795_() && (blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_204336_(BlockTags.f_144274_))) { + Block block = blockstate.m_60734_(); -+ if (p_57043_.m_46859_(blockpos) && (blockstate.canSustainPlant(p_57043_, blockpos.m_7495_(), Direction.UP, this) || block == Blocks.f_50093_ || block == Blocks.f_50493_ || block == Blocks.f_50546_ || block == Blocks.f_50599_ || block == Blocks.f_50440_)) { - p_57043_.m_46597_(blockpos, this.f_57015_.m_49966_()); - p_57043_.m_46597_(p_57044_, this.f_57015_.m_7810_().m_49966_().m_61124_(HorizontalDirectionalBlock.f_54117_, direction)); ++ if (p_222539_.m_46859_(blockpos) && (blockstate.canSustainPlant(p_222539_, blockpos.m_7495_(), Direction.UP, this) || block == Blocks.f_50093_ || block == Blocks.f_50493_ || block == Blocks.f_50546_ || block == Blocks.f_50599_ || block == Blocks.f_50440_)) { + p_222539_.m_46597_(blockpos, this.f_57015_.m_49966_()); + p_222539_.m_46597_(p_222540_, this.f_57015_.m_7810_().m_49966_().m_61124_(HorizontalDirectionalBlock.f_54117_, direction)); } } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_57043_, p_57044_, p_57042_); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_222539_, p_222540_, p_222538_); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch index 15699e6f616..574fee56114 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -12,13 +12,13 @@ @@ -47,12 +_,14 @@ if (i < 3) { - int j = p_57188_.m_61143_(f_57164_); -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_57189_, p_57190_, p_57188_, true)) { + int j = p_222548_.m_61143_(f_57164_); ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222549_, p_222550_, p_222548_, true)) { if (j == 15) { - p_57189_.m_46597_(p_57190_.m_7494_(), this.m_49966_()); - p_57189_.m_7731_(p_57190_, p_57188_.m_61124_(f_57164_, Integer.valueOf(0)), 4); + p_222549_.m_46597_(p_222550_.m_7494_(), this.m_49966_()); + p_222549_.m_7731_(p_222550_, p_222548_.m_61124_(f_57164_, Integer.valueOf(0)), 4); } else { - p_57189_.m_7731_(p_57190_, p_57188_.m_61124_(f_57164_, Integer.valueOf(j + 1)), 4); + p_222549_.m_7731_(p_222550_, p_222548_.m_61124_(f_57164_, Integer.valueOf(j + 1)), 4); } + } } diff --git a/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch index a0e52914293..ad740156f5d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch @@ -1,13 +1,15 @@ --- a/net/minecraft/world/level/block/SweetBerryBushBlock.java +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java -@@ -56,8 +_,9 @@ +@@ -57,10 +_,11 @@ - public void m_7455_(BlockState p_57286_, ServerLevel p_57287_, BlockPos p_57288_, Random p_57289_) { - int i = p_57286_.m_61143_(f_57244_); -- if (i < 3 && p_57289_.nextInt(5) == 0 && p_57287_.m_45524_(p_57288_.m_7494_(), 0) >= 9) { -+ if (i < 3 && p_57287_.m_45524_(p_57288_.m_7494_(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_57287_, p_57288_, p_57286_,p_57289_.nextInt(5) == 0)) { - p_57287_.m_7731_(p_57288_, p_57286_.m_61124_(f_57244_, Integer.valueOf(i + 1)), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_57287_, p_57288_, p_57286_); + public void m_213898_(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { + int i = p_222563_.m_61143_(f_57244_); +- if (i < 3 && p_222566_.m_188503_(5) == 0 && p_222564_.m_45524_(p_222565_.m_7494_(), 0) >= 9) { ++ if (i < 3 && p_222564_.m_45524_(p_222565_.m_7494_(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_222564_, p_222565_, p_222563_, p_222566_.m_188503_(5) == 0)) { + BlockState blockstate = p_222563_.m_61124_(f_57244_, Integer.valueOf(i + 1)); + p_222564_.m_7731_(p_222565_, blockstate, 2); + p_222564_.m_220407_(GameEvent.f_157792_, p_222565_, GameEvent.Context.m_223722_(blockstate)); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_222564_, p_222565_, p_222563_); } } diff --git a/patches/minecraft/net/minecraft/world/level/block/TripWireHookBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TripWireHookBlock.java.patch index 9fd183e7e1d..7af2894a6fb 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TripWireHookBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TripWireHookBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/net/minecraft/world/level/block/TripWireHookBlock.java -@@ -155,8 +_,8 @@ +@@ -156,8 +_,8 @@ BlockPos blockpos2 = p_57687_.m_5484_(direction, k); BlockState blockstate2 = ablockstate[k]; if (blockstate2 != null) { diff --git a/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch index 1535ccf2b0d..aa5726d32b9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TurtleEggBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/net/minecraft/world/level/block/TurtleEggBlock.java -@@ -151,7 +_,7 @@ +@@ -156,7 +_,7 @@ if (!(p_57769_ instanceof LivingEntity)) { return false; } else { diff --git a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch index 6924a877dc8..e2a7399bf73 100644 --- a/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/VineBlock.java.patch @@ -9,12 +9,12 @@ public static final BooleanProperty f_57833_ = PipeBlock.f_55152_; public static final BooleanProperty f_57834_ = PipeBlock.f_55148_; public static final BooleanProperty f_57835_ = PipeBlock.f_55149_; -@@ -157,7 +_,7 @@ +@@ -156,7 +_,7 @@ } - public void m_7455_(BlockState p_57892_, ServerLevel p_57893_, BlockPos p_57894_, Random p_57895_) { -- if (p_57895_.nextInt(4) == 0) { -+ if (p_57893_.f_46441_.nextInt(4) == 0 && p_57893_.isAreaLoaded(p_57894_, 4)) { // Forge: check area to prevent loading unloaded chunks - Direction direction = Direction.m_122404_(p_57895_); - BlockPos blockpos = p_57894_.m_7494_(); - if (direction.m_122434_().m_122479_() && !p_57892_.m_61143_(m_57883_(direction))) { + public void m_213898_(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { +- if (p_222658_.m_188503_(4) == 0) { ++ if (p_222656_.f_46441_.m_188503_(4) == 0 && p_222656_.isAreaLoaded(p_222657_, 4)) { // Forge: check area to prevent loading unloaded chunks + Direction direction = Direction.m_235672_(p_222658_); + BlockPos blockpos = p_222657_.m_7494_(); + if (direction.m_122434_().m_122479_() && !p_222655_.m_61143_(m_57883_(direction))) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 75fb6151101..2aa9f0f0ca6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -1,14 +1,25 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -107,6 +_,7 @@ - this.f_58312_ = p_154994_; +@@ -58,6 +_,7 @@ + public static final int f_154987_ = 4; + public static final int f_154988_ = 200; + public static final int f_154989_ = 2; ++ private final RecipeType recipeType; + protected NonNullList f_58310_ = NonNullList.m_122780_(3, ItemStack.f_41583_); + int f_58316_; + int f_58317_; +@@ -106,8 +_,10 @@ + protected AbstractFurnaceBlockEntity(BlockEntityType p_154991_, BlockPos p_154992_, BlockState p_154993_, RecipeType p_154994_) { + super(p_154991_, p_154992_, p_154993_); + this.f_222691_ = RecipeManager.m_220267_((RecipeType)p_154994_); ++ this.recipeType = p_154994_; } + /**@deprecated Forge: get burn times by calling ForgeHooks#getBurnTime(ItemStack)*/ @Deprecated public static Map m_58423_() { Map map = Maps.newLinkedHashMap(); m_58374_(map, Items.f_42448_, 20000); -@@ -206,9 +_,9 @@ +@@ -210,9 +_,9 @@ super.m_142466_(p_155025_); this.f_58310_ = NonNullList.m_122780_(this.m_6643_(), ItemStack.f_41583_); ContainerHelper.m_18980_(p_155025_, this.f_58310_); @@ -21,7 +32,7 @@ this.f_58317_ = this.m_7743_(this.f_58310_.get(1)); CompoundTag compoundtag = p_155025_.m_128469_("RecipesUsed"); -@@ -220,9 +_,9 @@ +@@ -224,9 +_,9 @@ protected void m_183515_(CompoundTag p_187452_) { super.m_183515_(p_187452_); @@ -34,12 +45,9 @@ ContainerHelper.m_18973_(p_187452_, this.f_58310_); CompoundTag compoundtag = new CompoundTag(); this.f_58320_.forEach((p_187449_, p_187450_) -> { -@@ -240,30 +_,32 @@ +@@ -254,28 +_,30 @@ + } - ItemStack itemstack = p_155017_.f_58310_.get(1); - if (p_155017_.m_58425_() || !itemstack.m_41619_() && !p_155017_.f_58310_.get(0).m_41619_()) { -- Recipe recipe = p_155014_.m_7465_().m_44015_((RecipeType)p_155017_.f_58312_, p_155017_, p_155014_).orElse((AbstractCookingRecipe)null); -+ Recipe recipe = p_155014_.m_7465_().m_44015_((RecipeType)p_155017_.f_58312_, p_155017_, p_155014_).orElse(null); int i = p_155017_.m_6893_(); - if (!p_155017_.m_58425_() && m_155005_(recipe, p_155017_.f_58310_, i)) { + if (!p_155017_.m_58425_() && p_155017_.m_155005_(recipe, p_155017_.f_58310_, i)) { @@ -50,7 +58,7 @@ + if (itemstack.hasContainerItem()) + p_155017_.f_58310_.set(1, itemstack.getContainerItem()); + else - if (!itemstack.m_41619_()) { + if (flag3) { Item item = itemstack.m_41720_(); itemstack.m_41774_(1); if (itemstack.m_41619_()) { @@ -67,13 +75,13 @@ ++p_155017_.f_58318_; if (p_155017_.f_58318_ == p_155017_.f_58319_) { p_155017_.f_58318_ = 0; - p_155017_.f_58319_ = m_155009_(p_155014_, p_155017_.f_58312_, p_155017_); + p_155017_.f_58319_ = m_222692_(p_155014_, p_155017_); - if (m_155026_(recipe, p_155017_.f_58310_, i)) { + if (p_155017_.m_155026_(recipe, p_155017_.f_58310_, i)) { p_155017_.m_6029_(recipe); } -@@ -288,9 +_,9 @@ +@@ -300,9 +_,9 @@ } @@ -85,7 +93,7 @@ if (itemstack.m_41619_()) { return false; } else { -@@ -299,10 +_,10 @@ +@@ -311,10 +_,10 @@ return true; } else if (!itemstack1.m_41656_(itemstack)) { return false; @@ -98,7 +106,7 @@ } } } else { -@@ -310,15 +_,15 @@ +@@ -322,15 +_,15 @@ } } @@ -118,16 +126,16 @@ } if (itemstack.m_150930_(Blocks.f_50057_.m_5456_()) && !p_155028_.get(1).m_41619_() && p_155028_.get(1).m_150930_(Items.f_42446_)) { -@@ -337,7 +_,7 @@ +@@ -349,7 +_,7 @@ return 0; } else { Item item = p_58343_.m_41720_(); - return m_58423_().getOrDefault(item, 0); -+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_58343_, this.f_58312_); ++ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_58343_, this.recipeType); } } -@@ -346,7 +_,7 @@ +@@ -358,7 +_,7 @@ } public static boolean m_58399_(ItemStack p_58400_) { @@ -136,16 +144,16 @@ } public int[] m_7071_(Direction p_58363_) { -@@ -426,7 +_,7 @@ +@@ -438,7 +_,7 @@ return true; } else { ItemStack itemstack = this.f_58310_.get(1); - return m_58399_(p_58390_) || p_58390_.m_150930_(Items.f_42446_) && !itemstack.m_150930_(Items.f_42446_); -+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_58390_, this.f_58312_) > 0 || p_58390_.m_150930_(Items.f_42446_) && !itemstack.m_150930_(Items.f_42446_); ++ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_58390_, this.recipeType) > 0 || p_58390_.m_150930_(Items.f_42446_) && !itemstack.m_150930_(Items.f_42446_); } } -@@ -484,5 +_,34 @@ +@@ -496,5 +_,34 @@ p_58342_.m_36491_(itemstack); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BannerPattern.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BannerPattern.java.patch deleted file mode 100644 index c3ca0233851..00000000000 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BannerPattern.java.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/net/minecraft/world/level/block/entity/BannerPattern.java -+++ b/net/minecraft/world/level/block/entity/BannerPattern.java -@@ -10,7 +_,7 @@ - import net.minecraft.resources.ResourceLocation; - import net.minecraft.world.item.DyeColor; - --public enum BannerPattern { -+public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum { - BASE("base", "b", false), - SQUARE_BOTTOM_LEFT("square_bottom_left", "bl"), - SQUARE_BOTTOM_RIGHT("square_bottom_right", "br"), -@@ -54,10 +_,16 @@ - PIGLIN("piglin", "pig", true); - - private static final BannerPattern[] f_58529_ = values(); -+ /** @deprecated Use {@link BannerPattern#values()} and get the length from the array **/ -+ @Deprecated - public static final int f_58526_ = f_58529_.length; -+ /** @deprecated Subtract {@link net.minecraftforge.common.ForgeHooks#getNonPatternItemCount()} from {@link BannerPattern#values()} **/ -+ @Deprecated - public static final int f_58527_ = (int)Arrays.stream(f_58529_).filter((p_58581_) -> { - return p_58581_.f_58530_; - }).count(); -+ /** @deprecated Subtract 1 from {@link net.minecraftforge.common.ForgeHooks#getNonPatternItemCount()} to get the maximum non-pattern item index**/ -+ @Deprecated - public static final int f_58528_ = f_58526_ - f_58527_ - 1; - public final boolean f_58530_; - private final String f_58531_; -@@ -75,7 +_,8 @@ - - public ResourceLocation m_58577_(boolean p_58578_) { - String s = p_58578_ ? "banner" : "shield"; -- return new ResourceLocation("entity/" + s + "/" + this.m_58572_()); -+ ResourceLocation fileLoc = new ResourceLocation(this.m_58572_()); -+ return new ResourceLocation(fileLoc.m_135827_(), "entity/" + s + "/" + fileLoc.m_135815_()); - } - - public String m_58572_() { -@@ -106,6 +_,19 @@ - } - - return null; -+ } -+ -+ public static BannerPattern create(String enumName, String fileNameIn, String hashNameIn) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ public static BannerPattern create(String enumName, String fileNameIn, String hashNameIn, boolean hasPatternItem) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ @Override -+ public void init() { -+ net.minecraftforge.common.ForgeHooks.refreshBannerPatternData(); - } - - public static class Builder { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch index 380a029c69c..2ef92dd4d81 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -@@ -81,4 +_,27 @@ +@@ -80,4 +_,27 @@ } protected abstract AbstractContainerMenu m_6555_(int p_58627_, Inventory p_58628_); @@ -10,7 +10,7 @@ + return new net.minecraftforge.items.wrapper.InvWrapper(this); + } + -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, @javax.annotation.Nullable net.minecraft.core.Direction side) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, @org.jetbrains.annotations.Nullable net.minecraft.core.Direction side) { + if (!this.f_58859_ && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) + return itemHandler.cast(); + return super.getCapability(cap, side); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index 12c88686778..56b641f9ec6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -117,8 +_,8 @@ +@@ -122,8 +_,8 @@ for(int i1 = 0; i1 < 10 && blockpos.m_123342_() <= l; ++i1) { BlockState blockstate = p_155108_.m_8055_(blockpos); Block block = blockstate.m_60734_(); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch deleted file mode 100644 index 5f8a7e84e5f..00000000000 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/entity/BlockEntityType.java -+++ b/net/minecraft/world/level/block/entity/BlockEntityType.java -@@ -17,7 +_,7 @@ - import net.minecraft.world.level.block.state.BlockState; - import org.slf4j.Logger; - --public class BlockEntityType { -+public class BlockEntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final Logger f_58913_ = LogUtils.getLogger(); - public static final BlockEntityType f_58917_ = m_58956_("furnace", BlockEntityType.Builder.m_155273_(FurnaceBlockEntity::new, Blocks.f_50094_)); - public static final BlockEntityType f_58918_ = m_58956_("chest", BlockEntityType.Builder.m_155273_(ChestBlockEntity::new, Blocks.f_50087_)); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index ea94ebd7e3c..ba2a0d4c3ea 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -148,6 +_,7 @@ +@@ -147,6 +_,7 @@ private static boolean m_155294_(NonNullList p_155295_) { ItemStack itemstack = p_155295_.get(3); @@ -8,7 +8,7 @@ if (itemstack.m_41619_()) { return false; } else if (!PotionBrewing.m_43506_(itemstack)) { -@@ -165,21 +_,21 @@ +@@ -164,21 +_,21 @@ } private static void m_155290_(Level p_155291_, BlockPos p_155292_, NonNullList p_155293_) { @@ -37,7 +37,7 @@ p_155293_.set(3, itemstack); p_155291_.m_46796_(1035, p_155292_, 0); -@@ -229,11 +_,11 @@ +@@ -228,11 +_,11 @@ public boolean m_7013_(int p_59017_, ItemStack p_59018_) { if (p_59017_ == 3) { @@ -51,7 +51,7 @@ } } -@@ -259,5 +_,34 @@ +@@ -258,5 +_,34 @@ protected AbstractContainerMenu m_6555_(int p_58990_, Inventory p_58991_) { return new BrewingStandMenu(p_58990_, p_58991_, this, this.f_58971_); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index 0aae35280b8..73a737fdfef 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -161,6 +_,45 @@ +@@ -160,6 +_,45 @@ return ChestMenu.m_39237_(p_59082_, p_59083_, this); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index e75e0f28d9b..86ee9c3673a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java @@ -153,10 +_,8 @@ - BlockPos blockpos1 = p_155416_.m_142082_(j1, k1, l1); + BlockPos blockpos1 = p_155416_.m_7918_(j1, k1, l1); BlockState blockstate = p_155415_.m_8055_(blockpos1); - for(Block block : f_59184_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch index a3e0767c198..9481d8e9ef1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -103,7 +_,7 @@ +@@ -102,7 +_,7 @@ if (!p_155582_.m_59407_() && p_155581_.m_61143_(HopperBlock.f_54022_)) { boolean flag = false; if (!p_155582_.m_7983_()) { @@ -9,7 +9,7 @@ } if (!p_155582_.m_59404_()) { -@@ -131,7 +_,8 @@ +@@ -130,7 +_,8 @@ return true; } @@ -19,7 +19,7 @@ Container container = m_155592_(p_155563_, p_155564_, p_155565_); if (container == null) { return false; -@@ -176,6 +_,8 @@ +@@ -175,6 +_,8 @@ } public static boolean m_155552_(Level p_155553_, Hopper p_155554_) { @@ -28,7 +28,7 @@ Container container = m_155596_(p_155553_, p_155554_); if (container != null) { Direction direction = Direction.DOWN; -@@ -399,5 +_,14 @@ +@@ -397,5 +_,14 @@ protected AbstractContainerMenu m_6555_(int p_59312_, Inventory p_59313_) { return new HopperMenu(p_59312_, p_59313_, this); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch index 948c00afd4e..141e2d7825c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -@@ -236,6 +_,11 @@ +@@ -235,6 +_,11 @@ return this.f_59647_ == ShulkerBoxBlockEntity.AnimationStatus.CLOSED; } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch index b43991b7b0c..c660e53d5e8 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch @@ -5,7 +5,7 @@ } + -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public net.minecraft.world.level.block.entity.BlockEntity getSpawnerBlockEntity(){ return SpawnerBlockEntity.this; } }; diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index 7fdad8e1f47..f70e05b1e23 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -9,22 +9,22 @@ return false; } @@ -176,6 +_,7 @@ - p_60193_.m_5594_((Player)null, p_60194_, SoundEvents.f_12312_, SoundSource.BLOCKS, 0.5F, p_60193_.f_46441_.nextFloat() * 0.25F + 0.6F); - p_60193_.m_151555_(GameEvent.f_157775_, p_60194_); + p_60193_.m_5594_((Player)null, p_60194_, SoundEvents.f_12312_, SoundSource.BLOCKS, 0.5F, p_60193_.f_46441_.m_188501_() * 0.25F + 0.6F); + p_60193_.m_142346_((Entity)null, GameEvent.f_157775_, p_60194_); } else if (p_60195_ == 1 || p_60195_ == 2) { + if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_60193_, p_60194_, direction, false)) return false; - BlockEntity blockentity1 = p_60193_.m_7702_(p_60194_.m_142300_(direction)); + BlockEntity blockentity1 = p_60193_.m_7702_(p_60194_.m_121945_(direction)); if (blockentity1 instanceof PistonMovingBlockEntity) { ((PistonMovingBlockEntity)blockentity1).m_60401_(); @@ -216,6 +_,7 @@ - p_60193_.m_151555_(GameEvent.f_157774_, p_60194_); + p_60193_.m_142346_((Entity)null, GameEvent.f_157774_, p_60194_); } + net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_60193_, p_60194_, direction, (p_60195_ == 0)); return true; } -@@ -352,6 +_,10 @@ +@@ -353,6 +_,10 @@ public BlockState m_6843_(BlockState p_60215_, Rotation p_60216_) { return p_60215_.m_61124_(f_52588_, p_60216_.m_55954_(p_60215_.m_61143_(f_52588_))); diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch index cbc96d42f90..60100d54f64 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch @@ -61,7 +61,7 @@ } @@ -174,7 +_,7 @@ if (direction.m_122434_() != this.f_60413_.m_122434_()) { - BlockPos blockpos = p_60432_.m_142300_(direction); + BlockPos blockpos = p_60432_.m_121945_(direction); BlockState blockstate1 = this.f_60409_.m_8055_(blockpos); - if (m_155939_(blockstate1, blockstate) && !this.m_60433_(blockpos, direction)) { + if (blockstate1.canStickTo(blockstate) && !this.m_60433_(blockpos, direction)) { diff --git a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index cf662902d02..5f4bf81cac1 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -1,25 +1,24 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -66,7 +_,8 @@ - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; - --public abstract class BlockBehaviour { -+//TODO, Delegates are weird here now, because Block extends this. -+public abstract class BlockBehaviour extends net.minecraftforge.registries.ForgeRegistryEntry { - protected static final Direction[] f_60441_ = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; - protected final Material f_60442_; - protected final boolean f_60443_; -@@ -93,6 +_,8 @@ +@@ -94,6 +_,17 @@ this.f_60449_ = p_60452_.f_60893_; this.f_60438_ = p_60452_.f_60903_; this.f_60439_ = p_60452_; + final ResourceLocation lootTableCache = p_60452_.f_60894_; -+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_60452_.lootTableSupplier != null ? p_60452_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().m_135827_(), "blocks/" + this.getRegistryName().m_135815_()); ++ if (lootTableCache != null) { ++ this.lootTableSupplier = () -> lootTableCache; ++ } else if (p_60452_.lootTableSupplier != null) { ++ this.lootTableSupplier = p_60452_.lootTableSupplier; ++ } else { ++ this.lootTableSupplier = () -> { ++ ResourceLocation registryName = net.minecraftforge.registries.ForgeRegistries.BLOCKS.getKey((Block) this); ++ return new ResourceLocation(registryName.m_135827_(), "blocks/" + registryName.m_135815_()); ++ }; ++ } } /** @deprecated */ -@@ -141,7 +_,7 @@ +@@ -142,7 +_,7 @@ /** @deprecated */ @Deprecated public void m_6810_(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { @@ -28,7 +27,7 @@ p_60516_.m_46747_(p_60517_); } -@@ -222,7 +_,7 @@ +@@ -219,7 +_,7 @@ /** @deprecated */ @Deprecated public boolean m_6864_(BlockState p_60470_, BlockPlaceContext p_60471_) { @@ -37,7 +36,7 @@ } /** @deprecated */ -@@ -346,8 +_,8 @@ +@@ -349,8 +_,8 @@ if (f == -1.0F) { return 0.0F; } else { @@ -48,7 +47,7 @@ } } -@@ -380,8 +_,7 @@ +@@ -383,8 +_,7 @@ public final ResourceLocation m_60589_() { if (this.f_60440_ == null) { @@ -58,7 +57,7 @@ } return this.f_60440_; -@@ -404,6 +_,14 @@ +@@ -407,6 +_,14 @@ return this.f_60439_.f_60888_; } @@ -73,7 +72,7 @@ public abstract static class BlockStateBase extends StateHolder { private final int f_60594_; private final boolean f_60595_; -@@ -482,18 +_,22 @@ +@@ -491,18 +_,22 @@ return this.f_60595_; } @@ -97,7 +96,7 @@ public BlockState m_60717_(Rotation p_60718_) { return this.m_60734_().m_6843_(this.m_7160_(), p_60718_); } -@@ -873,8 +_,9 @@ +@@ -885,8 +_,9 @@ ResourceLocation f_60894_; boolean f_60895_ = true; boolean f_60896_; @@ -108,14 +107,14 @@ }; BlockBehaviour.StatePredicate f_60898_ = (p_60985_, p_60986_, p_60987_) -> { return p_60985_.m_60767_().m_76337_() && p_60985_.m_60838_(p_60986_, p_60987_); -@@ -1001,9 +_,15 @@ +@@ -1017,9 +_,15 @@ return this; } + @Deprecated // FORGE: Use the variant that takes a Supplier below public BlockBehaviour.Properties m_60916_(Block p_60917_) { - this.f_60894_ = p_60917_.m_60589_(); -+ this.lootTableSupplier = () -> p_60917_.delegate.get().m_60589_(); ++ this.lootTableSupplier = () -> net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_60917_).get().m_60589_(); return this; + } + diff --git a/patches/minecraft/net/minecraft/world/level/block/state/properties/WoodType.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/properties/WoodType.java.patch index 19a5262a7dc..eff028bb211 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/properties/WoodType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/properties/WoodType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/state/properties/WoodType.java +++ b/net/minecraft/world/level/block/state/properties/WoodType.java -@@ -32,4 +_,11 @@ +@@ -33,4 +_,11 @@ public String m_61846_() { return this.f_61839_; } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch index ff796ab2999..7d421ceb239 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -411,4 +_,7 @@ +@@ -407,4 +_,7 @@ public static record TicksToSave(SerializableTickContainer f_187680_, SerializableTickContainer f_187681_) { } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkStatus.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkStatus.java.patch deleted file mode 100644 index 808d9edeba9..00000000000 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkStatus.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/chunk/ChunkStatus.java -+++ b/net/minecraft/world/level/chunk/ChunkStatus.java -@@ -27,7 +_,7 @@ - import net.minecraft.world.level.levelgen.blending.Blender; - import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; - --public class ChunkStatus { -+public class ChunkStatus extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final int f_187758_ = 8; - private static final EnumSet f_62327_ = EnumSet.of(Heightmap.Types.OCEAN_FLOOR_WG, Heightmap.Types.WORLD_SURFACE_WG); - public static final EnumSet f_62328_ = EnumSet.of(Heightmap.Types.OCEAN_FLOOR, Heightmap.Types.WORLD_SURFACE, Heightmap.Types.MOTION_BLOCKING, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES); diff --git a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch index 3e1e581deac..ed6da7ceee6 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -49,7 +_,7 @@ +@@ -48,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,7 +9,7 @@ static final Logger f_62771_ = LogUtils.getLogger(); private static final TickingBlockEntity f_156361_ = new TickingBlockEntity() { public void m_142224_() { -@@ -97,6 +_,7 @@ +@@ -96,6 +_,7 @@ this.f_62791_ = p_196861_; this.f_62784_ = p_196857_; this.f_187943_ = p_196858_; @@ -17,7 +17,7 @@ } public LevelChunk(ServerLevel p_196850_, ProtoChunk p_196851_, @Nullable LevelChunk.PostLoadProcessor p_196852_) { -@@ -233,14 +_,14 @@ +@@ -237,14 +_,14 @@ boolean flag2 = blockstate.m_155947_(); if (!this.f_62776_.f_46443_) { blockstate.m_60753_(this.f_62776_, p_62865_, p_62866_, p_62867_); @@ -34,7 +34,7 @@ p_62866_.m_60696_(this.f_62776_, p_62865_, blockstate, p_62867_); } -@@ -283,6 +_,10 @@ +@@ -287,6 +_,10 @@ @Nullable public BlockEntity m_5685_(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { BlockEntity blockentity = this.f_187610_.get(p_62868_); @@ -45,7 +45,7 @@ if (blockentity == null) { CompoundTag compoundtag = this.f_187609_.remove(p_62868_); if (compoundtag != null) { -@@ -300,9 +_,6 @@ +@@ -304,9 +_,6 @@ this.m_142170_(blockentity); } } @@ -55,15 +55,15 @@ } return blockentity; -@@ -313,6 +_,7 @@ - if (this.m_156370_()) { - this.m_156404_(p_156391_); +@@ -322,6 +_,7 @@ + } + this.m_156406_(p_156391_); + p_156391_.onLoad(); } } -@@ -352,9 +_,14 @@ +@@ -361,9 +_,14 @@ public CompoundTag m_8051_(BlockPos p_62932_) { BlockEntity blockentity = this.m_7702_(p_62932_); if (blockentity != null && !blockentity.m_58901_()) { @@ -78,7 +78,7 @@ } else { CompoundTag compoundtag = this.f_187609_.get(p_62932_); if (compoundtag != null) { -@@ -433,7 +_,7 @@ +@@ -445,7 +_,7 @@ p_187974_.accept((p_187968_, p_187969_, p_187970_) -> { BlockEntity blockentity = this.m_5685_(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE); if (blockentity != null && p_187970_ != null && blockentity.m_58903_() == p_187969_) { @@ -87,7 +87,7 @@ } }); -@@ -453,7 +_,7 @@ +@@ -465,7 +_,7 @@ public Stream m_6267_() { return StreamSupport.stream(BlockPos.m_121976_(this.f_187604_.m_45604_(), this.m_141937_(), this.f_187604_.m_45605_(), this.f_187604_.m_45608_(), this.m_151558_() - 1, this.f_187604_.m_45609_()).spliterator(), false).filter((p_187990_) -> { @@ -96,7 +96,7 @@ }); } -@@ -541,6 +_,7 @@ +@@ -553,6 +_,7 @@ } public void m_187957_() { @@ -104,15 +104,15 @@ this.f_187610_.values().forEach(BlockEntity::m_7651_); this.f_187610_.clear(); this.f_156362_.values().forEach((p_187966_) -> { -@@ -550,6 +_,7 @@ +@@ -562,6 +_,7 @@ } public void m_156369_() { + this.f_62776_.addFreshBlockEntities(this.f_187610_.values()); this.f_187610_.values().forEach((p_187988_) -> { - this.m_156404_(p_187988_); - this.m_156406_(p_187988_); -@@ -605,6 +_,41 @@ + Level level = this.f_62776_; + if (level instanceof ServerLevel serverlevel) { +@@ -619,6 +_,41 @@ this.f_196848_ = p_196865_; } @@ -154,7 +154,7 @@ class BoundTickingBlockEntity implements TickingBlockEntity { private final T f_156428_; private final BlockEntityTicker f_156429_; -@@ -621,6 +_,7 @@ +@@ -635,6 +_,7 @@ if (LevelChunk.this.m_156410_(blockpos)) { try { ProfilerFiller profilerfiller = LevelChunk.this.f_62776_.m_46473_(); @@ -162,7 +162,7 @@ profilerfiller.m_6521_(this::m_142280_); BlockState blockstate = LevelChunk.this.m_8055_(blockpos); if (this.f_156428_.m_58903_().m_155262_(blockstate)) { -@@ -636,6 +_,12 @@ +@@ -650,6 +_,12 @@ CrashReport crashreport = CrashReport.m_127521_(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Block entity being ticked"); this.f_156428_.m_58886_(crashreportcategory); @@ -175,7 +175,7 @@ throw new ReportedException(crashreport); } } -@@ -664,6 +_,34 @@ +@@ -678,6 +_,34 @@ IMMEDIATE, QUEUED, CHECK; @@ -188,7 +188,7 @@ + * Only public for use in {@link net.minecraft.world.level.chunk.storage.ChunkSerializer}. + */ + @java.lang.Deprecated -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public final CompoundTag writeCapsToNBT() { + return capProvider.serializeInternal(); + } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/PalettedContainer.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/PalettedContainer.java.patch index fcd0aacad01..34c289341a0 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/PalettedContainer.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/PalettedContainer.java.patch @@ -3,8 +3,8 @@ @@ -24,6 +_,7 @@ import net.minecraft.util.ZeroBitStorage; - public class PalettedContainer implements PaletteResize { + public class PalettedContainer implements PaletteResize, PalettedContainerRO { + // TODO: forceBits-parametered setBits function. -C private static final int f_188031_ = 0; - private final PaletteResize f_63070_ = (p_63139_, p_63140_) -> { + private final PaletteResize f_63070_ = (p_238275_, p_238276_) -> { return 0; diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch index bbe33a02b21..868b149a22d 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch @@ -13,6 +13,6 @@ BlockState blockstate = levelchunksection.m_62986_(i & 15, j & 15, k & 15, p_63218_); - if (this.f_63153_.m_62427_(ChunkStatus.f_62322_) && p_63218_ != blockstate && (p_63218_.m_60739_(this, p_63217_) != blockstate.m_60739_(this, p_63217_) || p_63218_.m_60791_() != blockstate.m_60791_() || p_63218_.m_60787_() || blockstate.m_60787_())) { + if (this.f_63153_.m_62427_(ChunkStatus.f_62322_) && p_63218_ != blockstate && (p_63218_.m_60739_(this, p_63217_) != blockstate.m_60739_(this, p_63217_) || p_63218_.getLightEmission(this, p_63217_) != blockstate.getLightEmission(this, p_63217_) || p_63218_.m_60787_() || blockstate.m_60787_())) { - this.f_63151_.m_142202_(p_63217_); + this.f_63151_.m_7174_(p_63217_); } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch index 4b530bc6655..2243231c599 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -146,6 +_,7 @@ +@@ -156,6 +_,7 @@ return Registry.f_122822_.m_6612_(ResourceLocation.m_135820_(p_188285_)); }, p_188233_); chunkaccess = new LevelChunk(p_188231_.m_6018_(), p_188233_, upgradedata, levelchunkticks, levelchunkticks1, j1, alevelchunksection, m_196890_(p_188231_, p_188234_), blendingdata); @@ -8,25 +8,16 @@ } else { ProtoChunkTicks protochunkticks = ProtoChunkTicks.m_193302_(p_188234_.m_128437_("block_ticks", 10), (p_196906_) -> { return Registry.f_122824_.m_6612_(ResourceLocation.m_135820_(p_196906_)); -@@ -170,7 +_,7 @@ - boolean flag2 = chunkstatus.m_62427_(ChunkStatus.f_62323_) || belowzeroretrogen != null && belowzeroretrogen.m_188466_().m_62427_(ChunkStatus.f_62323_); - if (!flag && flag2) { +@@ -180,7 +_,7 @@ + boolean flag3 = chunkstatus.m_62427_(ChunkStatus.f_62323_) || belowzeroretrogen != null && belowzeroretrogen.m_188466_().m_62427_(ChunkStatus.f_62323_); + if (!flag && flag3) { for(BlockPos blockpos : BlockPos.m_121976_(p_188233_.m_45604_(), p_188231_.m_141937_(), p_188233_.m_45605_(), p_188233_.m_45608_(), p_188231_.m_151558_() - 1, p_188233_.m_45609_())) { - if (chunkaccess.m_8055_(blockpos).m_60791_() != 0) { + if (chunkaccess.m_8055_(blockpos).getLightEmission(chunkaccess, blockpos) != 0) { protochunk.m_63277_(blockpos); } } -@@ -193,7 +_,7 @@ - Heightmap.m_64256_(chunkaccess, enumset); - CompoundTag compoundtag3 = p_188234_.m_128469_("structures"); - chunkaccess.m_8040_(m_188254_(StructurePieceSerializationContext.m_192770_(p_188231_), compoundtag3, p_188231_.m_7328_())); -- chunkaccess.m_7946_(m_208154_(p_188231_.m_5962_(), p_188233_, compoundtag3)); -+ net.minecraftforge.common.ForgeHooks.fixNullStructureReferences(chunkaccess, m_208154_(p_188231_.m_5962_(), p_188233_, compoundtag3)); - if (p_188234_.m_128471_("shouldSave")) { - chunkaccess.m_8092_(true); - } -@@ -209,6 +_,7 @@ +@@ -219,6 +_,7 @@ } if (chunkstatus$chunktype == ChunkStatus.ChunkType.LEVELCHUNK) { @@ -34,7 +25,7 @@ return new ImposterProtoChunk((LevelChunk)chunkaccess, false); } else { ProtoChunk protochunk1 = (ProtoChunk)chunkaccess; -@@ -242,6 +_,7 @@ +@@ -252,6 +_,7 @@ protochunk1.m_188186_(generationstep$carving, new CarvingMask(compoundtag4.m_128467_(s1), chunkaccess.m_141937_())); } @@ -42,7 +33,7 @@ return protochunk1; } } -@@ -349,6 +_,15 @@ +@@ -359,6 +_,15 @@ } compoundtag.m_128365_("CarvingMasks", compoundtag4); diff --git a/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch deleted file mode 100644 index d906ff03b3d..00000000000 --- a/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/world/level/dimension/LevelStem.java -+++ b/net/minecraft/world/level/dimension/LevelStem.java -@@ -23,7 +_,9 @@ - - public final class LevelStem { - public static final Codec f_63970_ = RecordCodecBuilder.create((p_63986_) -> { -+ return net.minecraftforge.common.ForgeHooks.expandLevelStemCodec(p_63986_, () -> { // forge: reroute the codec builder here to add extra json fields - return p_63986_.group(DimensionType.f_63853_.fieldOf("type").forGetter(LevelStem::m_204521_), ChunkGenerator.f_62136_.fieldOf("generator").forGetter(LevelStem::m_63990_)).apply(p_63986_, p_63986_.stable(LevelStem::new)); -+ }); // forge: we're wrapping the original codec builder in our expansion up there - }); - public static final ResourceKey f_63971_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("overworld")); - public static final ResourceKey f_63972_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("the_nether")); -@@ -33,6 +_,12 @@ - private final ChunkGenerator f_63976_; - - public LevelStem(Holder p_204519_, ChunkGenerator p_204520_) { -+ this(p_204519_, p_204520_, false); // forge: by default, dimension jsons use the fixed seed required by the vanilla format -+ } // forge: reroute the vanilla constructor to our expanded constructor with default args -+ private final boolean useServerSeed; // forge: whether the dimension parser should use the server seed instead of the fixed seed -+ public boolean useServerSeed() { return this.useServerSeed; } -+ public LevelStem(Holder p_204519_, ChunkGenerator p_204520_, boolean useServerSeed) { // forge: allow dimension jsons to specify that they should use the server seed instead of the fixed seed field -+ this.useServerSeed = useServerSeed; // forge - this.f_63975_ = p_204519_; - this.f_63976_ = p_204520_; - } diff --git a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch index d131027ea2f..3df4e7ee735 100644 --- a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch +++ b/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -100,6 +_,7 @@ +@@ -101,6 +_,7 @@ this.f_64068_ = p_64080_.m_128471_("DragonKilled"); this.f_64069_ = p_64080_.m_128471_("PreviouslyKilled"); @@ -8,11 +8,7 @@ if (p_64080_.m_128471_("IsRespawning")) { this.f_64073_ = DragonRespawnAnimation.START; } -@@ -131,13 +_,14 @@ - compoundtag.m_128379_("NeedsStateScanning", this.f_64071_); - if (this.f_64070_ != null) { - compoundtag.m_128362_("Dragon", this.f_64070_); -- } +@@ -136,6 +_,7 @@ compoundtag.m_128379_("DragonKilled", this.f_64068_); compoundtag.m_128379_("PreviouslyKilled", this.f_64069_); @@ -20,11 +16,7 @@ if (this.f_64072_ != null) { compoundtag.m_128365_("ExitPortalLocation", NbtUtils.m_129224_(this.f_64072_)); } -+ } - - ListTag listtag = new ListTag(); - -@@ -507,6 +_,13 @@ +@@ -508,6 +_,13 @@ endcrystal.m_31052_((BlockPos)null); } } diff --git a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch index c12bd96cd58..6160dcfbd1d 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -@@ -72,7 +_,16 @@ +@@ -71,7 +_,16 @@ return this.m_157538_(p_157534_, false); } @@ -17,7 +17,7 @@ if (!this.m_157557_(p_157539_)) { return false; } else { -@@ -104,12 +_,14 @@ +@@ -103,12 +_,14 @@ public void m_157552_(Stream p_157553_) { p_157553_.forEach((p_157607_) -> { this.m_157538_(p_157607_, true); @@ -32,7 +32,7 @@ }); } -@@ -248,6 +_,7 @@ +@@ -247,6 +_,7 @@ while((chunkentities = this.f_157500_.poll()) != null) { chunkentities.m_156792_().forEach((p_157593_) -> { this.m_157538_(p_157593_, true); @@ -40,7 +40,7 @@ }); this.f_157498_.put(chunkentities.m_156791_().m_45588_(), PersistentEntitySectionManager.ChunkLoadStatus.LOADED); } -@@ -350,11 +_,13 @@ +@@ -349,11 +_,13 @@ class Callback implements EntityInLevelCallback { private final T f_157609_; @@ -54,7 +54,7 @@ this.f_157610_ = p_157615_; this.f_157611_ = p_157616_; } -@@ -371,9 +_,11 @@ +@@ -370,9 +_,11 @@ PersistentEntitySectionManager.this.m_157509_(this.f_157610_, this.f_157611_); EntitySection entitysection = PersistentEntitySectionManager.this.f_157495_.m_156893_(i); entitysection.m_188346_(this.f_157609_); diff --git a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch index 862b212b097..ca16a548797 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/TransientEntitySectionManager.java.patch @@ -21,8 +21,8 @@ + long oldSectionKey = f_157669_; this.f_157670_ = entitysection; this.f_157669_ = i; - if (!this.f_157668_.m_142389_()) { -@@ -124,6 +_,7 @@ + TransientEntitySectionManager.this.f_157636_.m_214006_(this.f_157668_); +@@ -125,6 +_,7 @@ TransientEntitySectionManager.this.f_157636_.m_141987_(this.f_157668_); } } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch index baef5b7f740..217ca48ea4f 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/DebugLevelSource.java +++ b/net/minecraft/world/level/levelgen/DebugLevelSource.java -@@ -117,6 +_,12 @@ +@@ -112,6 +_,12 @@ return blockstate; } @@ -11,5 +11,5 @@ + f_64116_ = Mth.m_14167_((float) (f_64114_.size() / f_64115_)); + } - public Climate.Sampler m_183403_() { - return Climate.m_207841_(); + public void m_213679_(WorldGenRegion p_223970_, long p_223971_, RandomState p_223972_, BiomeManager p_223973_, StructureManager p_223974_, ChunkAccess p_223975_, GenerationStep.Carving p_223976_) { + } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch index 899600618ba..473646ebea4 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch @@ -3,8 +3,8 @@ @@ -104,6 +_,7 @@ } - patrollingmonster.m_6034_((double)p_64566_.m_123341_(), (double)p_64566_.m_123342_(), (double)p_64566_.m_123343_()); -+ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollingmonster, p_64565_, p_64566_.m_123341_(), p_64566_.m_123342_(), p_64566_.m_123343_(), null, MobSpawnType.PATROL) == -1) return false; - patrollingmonster.m_6518_(p_64565_, p_64565_.m_6436_(p_64566_), MobSpawnType.PATROL, (SpawnGroupData)null, (CompoundTag)null); - p_64565_.m_47205_(patrollingmonster); + patrollingmonster.m_6034_((double)p_224534_.m_123341_(), (double)p_224534_.m_123342_(), (double)p_224534_.m_123343_()); ++ if(net.minecraftforge.common.ForgeHooks.canEntitySpawn(patrollingmonster, p_224533_, p_224534_.m_123341_(), p_224534_.m_123342_(), p_224534_.m_123343_(), null, MobSpawnType.PATROL) == -1) return false; + patrollingmonster.m_6518_(p_224533_, p_224533_.m_6436_(p_224534_), MobSpawnType.PATROL, (SpawnGroupData)null, (CompoundTag)null); + p_224533_.m_47205_(patrollingmonster); return true; diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch deleted file mode 100644 index abfbb0d7707..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/WorldGenSettings.java -+++ b/net/minecraft/world/level/levelgen/WorldGenSettings.java -@@ -39,6 +_,7 @@ - return p_64626_.group(Codec.LONG.fieldOf("seed").stable().forGetter(WorldGenSettings::m_64619_), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldGenSettings::m_64657_), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldGenSettings::m_64660_), RegistryCodecs.m_206318_(Registry.f_122820_, Lifecycle.stable(), LevelStem.f_63970_).xmap(LevelStem::m_204525_, Function.identity()).fieldOf("dimensions").forGetter(WorldGenSettings::m_204655_), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((p_158959_) -> { - return p_158959_.f_64606_; - })).apply(p_64626_, p_64626_.stable(WorldGenSettings::new)); -+ }).xmap(net.minecraftforge.common.ForgeHooks::loadDimensionsWithServerSeed, wgs -> {return wgs; // forge: when loading/registering json dimensions, replace hardcoded seeds of custom dimensions with the server/overworld's seed, where requested; fixes MC-195717 - }).comapFlatMap(WorldGenSettings::m_64674_, Function.identity()); - private static final Logger f_64601_ = LogUtils.getLogger(); - private final long f_64602_; -@@ -194,6 +_,8 @@ - Registry registry2 = p_209717_.m_175515_(Registry.f_211073_); - Registry registry3 = DimensionType.m_204490_(p_209717_, i); - String s = p_209718_.f_207545_(); -+ net.minecraftforge.common.world.ForgeWorldPreset type = net.minecraftforge.registries.ForgeRegistries.WORLD_TYPES.get().getValue(new net.minecraft.resources.ResourceLocation(s)); -+ if (type != null) return type.createSettings(p_209717_, i, p_209718_.f_207544_(), false, s); - switch(s) { - case "flat": - Dynamic dynamic = new Dynamic<>(JsonOps.INSTANCE, p_209718_.f_207543_()); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch deleted file mode 100644 index 2901f98bc3f..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/carver/WorldCarver.java -+++ b/net/minecraft/world/level/levelgen/carver/WorldCarver.java -@@ -26,7 +_,7 @@ - import net.minecraft.world.level.material.Fluids; - import org.apache.commons.lang3.mutable.MutableBoolean; - --public abstract class WorldCarver { -+public abstract class WorldCarver extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final WorldCarver f_64974_ = m_65065_("cave", new CaveWorldCarver(CaveCarverConfiguration.f_159154_)); - public static final WorldCarver f_64975_ = m_65065_("nether_cave", new NetherWorldCarver(CaveCarverConfiguration.f_159154_)); - public static final WorldCarver f_64976_ = m_65065_("canyon", new CanyonWorldCarver(CanyonCarverConfiguration.f_158966_)); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch index d08ad7171ec..5d6c28da7d6 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/Feature.java +++ b/net/minecraft/world/level/levelgen/feature/Feature.java -@@ -52,7 +_,7 @@ - import net.minecraft.world.level.levelgen.feature.configurations.UnderwaterMagmaConfiguration; - import net.minecraft.world.level.levelgen.feature.configurations.VegetationPatchConfiguration; - --public abstract class Feature { -+public abstract class Feature extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final Feature f_65759_ = m_65807_("no_op", new NoOpFeature(NoneFeatureConfiguration.f_67815_)); - public static final Feature f_65760_ = m_65807_("tree", new TreeFeature(TreeConfiguration.f_68184_)); - public static final Feature f_65761_ = m_65807_("flower", new RandomPatchFeature(RandomPatchConfiguration.f_67902_)); -@@ -154,7 +_,7 @@ +@@ -155,7 +_,7 @@ } protected static boolean m_159747_(BlockState p_159748_) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch index 8084049f0b4..12ac41c69bf 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch @@ -3,8 +3,8 @@ @@ -129,6 +_,6 @@ } - private EntityType m_66358_(Random p_66359_) { -- return Util.m_137545_(f_66341_, p_66359_); -+ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_66359_); + private EntityType m_225153_(RandomSource p_225154_) { +- return Util.m_214670_(f_66341_, p_225154_); ++ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_225154_); } } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch deleted file mode 100644 index 46c18e7f187..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/StructureFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/StructureFeature.java -@@ -46,7 +_,7 @@ - import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; - import org.slf4j.Logger; - --public class StructureFeature { -+public abstract class StructureFeature extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final Map, GenerationStep.Decoration> f_67032_ = Maps.newHashMap(); - private static final Logger f_67033_ = LogUtils.getLogger(); - public static final StructureFeature f_67013_ = m_67089_("pillager_outpost", new PillagerOutpostFeature(JigsawConfiguration.f_67756_), GenerationStep.Decoration.SURFACE_STRUCTURES); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java.patch index 30e4e0399fe..bdc0043a5d8 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java +++ b/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java -@@ -33,6 +_,7 @@ - return p_161232_.f_161215_; - })).apply(p_191347_, TreeConfiguration::new); +@@ -37,6 +_,7 @@ + return p_225470_.f_161215_; + })).apply(p_225468_, TreeConfiguration::new); }); + //TODO: Review this, see if we can hook in the sapling into the Codec public final BlockStateProvider f_68185_; diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java.patch deleted file mode 100644 index 94f0fc1e84b..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java -+++ b/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType.java -@@ -3,7 +_,7 @@ - import com.mojang.serialization.Codec; - import net.minecraft.core.Registry; - --public class FoliagePlacerType

{ -+public class FoliagePlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final FoliagePlacerType f_68591_ = m_68605_("blob_foliage_placer", BlobFoliagePlacer.f_68392_); - public static final FoliagePlacerType f_68592_ = m_68605_("spruce_foliage_placer", SpruceFoliagePlacer.f_68713_); - public static final FoliagePlacerType f_68593_ = m_68605_("pine_foliage_placer", PineFoliagePlacer.f_68676_); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java.patch deleted file mode 100644 index 98be01c4ef5..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java -+++ b/net/minecraft/world/level/levelgen/feature/stateproviders/BlockStateProviderType.java -@@ -3,7 +_,7 @@ - import com.mojang.serialization.Codec; - import net.minecraft.core.Registry; - --public class BlockStateProviderType

{ -+public class BlockStateProviderType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final BlockStateProviderType f_68752_ = m_68762_("simple_state_provider", SimpleStateProvider.f_68797_); - public static final BlockStateProviderType f_68753_ = m_68762_("weighted_state_provider", WeightedStateProvider.f_68808_); - public static final BlockStateProviderType f_191386_ = m_68762_("noise_threshold_provider", NoiseThresholdProvider.f_191463_); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java.patch deleted file mode 100644 index 55faf71b153..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java -+++ b/net/minecraft/world/level/levelgen/feature/treedecorators/TreeDecoratorType.java -@@ -3,7 +_,7 @@ - import com.mojang.serialization.Codec; - import net.minecraft.core.Registry; - --public class TreeDecoratorType

{ -+public class TreeDecoratorType

extends net.minecraftforge.registries.ForgeRegistryEntry> { - public static final TreeDecoratorType f_70042_ = m_70052_("trunk_vine", TrunkVineDecorator.f_70055_); - public static final TreeDecoratorType f_70043_ = m_70052_("leave_vine", LeaveVineDecorator.f_69996_); - public static final TreeDecoratorType f_70044_ = m_70052_("cocoa", CocoaDecorator.f_69972_); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch deleted file mode 100644 index ea2a13ea289..00000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java -+++ b/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java -@@ -147,7 +_,7 @@ - } - } - -- return Holder.m_205709_(Biome.BiomeBuilder.m_204185_(biome).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47592_()); -+ return Holder.m_205709_(Biome.BiomeBuilder.m_204185_(biome).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47592_().setRegistryName(biome.getRegistryName())); - } - - public Optional> m_209810_() { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 40998037d0a..8a089bfb3b3 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java -@@ -72,6 +_,9 @@ +@@ -71,6 +_,9 @@ } public final CompoundTag m_192644_(StructurePieceSerializationContext p_192645_) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch index b7d012c293d..27e7442a64e 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java -@@ -61,6 +_,9 @@ +@@ -97,6 +_,9 @@ public CompoundTag m_192660_(StructurePieceSerializationContext p_192661_, ChunkPos p_192662_) { CompoundTag compoundtag = new CompoundTag(); if (this.m_73603_()) { -+ if (p_192661_.f_192763_().m_175515_(Registry.f_122882_).m_7981_(this.m_210081_()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.m_210081_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ if (p_192661_.f_192763_().m_175515_(Registry.f_235725_).m_7981_(this.m_226861_()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.m_226861_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } - compoundtag.m_128359_("id", p_192661_.f_192763_().m_175515_(Registry.f_122882_).m_7981_(this.f_73565_).toString()); + compoundtag.m_128359_("id", p_192661_.f_192763_().m_175515_(Registry.f_235725_).m_7981_(this.f_226844_).toString()); compoundtag.m_128405_("ChunkX", p_192662_.f_45578_); compoundtag.m_128405_("ChunkZ", p_192662_.f_45579_); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index b7cb6085e67..8db7d7e78f6 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -8,24 +8,24 @@ + return m_74578_(pos, placementIn.m_74401_(), placementIn.m_74404_(), placementIn.m_74407_()); + } + - public boolean m_74536_(ServerLevelAccessor p_74537_, BlockPos p_74538_, BlockPos p_74539_, StructurePlaceSettings p_74540_, Random p_74541_, int p_74542_) { + public boolean m_230328_(ServerLevelAccessor p_230329_, BlockPos p_230330_, BlockPos p_230331_, StructurePlaceSettings p_230332_, RandomSource p_230333_, int p_230334_) { if (this.f_74482_.isEmpty()) { return false; @@ -217,7 +_,7 @@ int i1 = Integer.MIN_VALUE; int j1 = Integer.MIN_VALUE; -- for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : m_74517_(p_74537_, p_74538_, p_74539_, p_74540_, list)) { -+ for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos(p_74537_, p_74538_, p_74539_, p_74540_, list, this)) { +- for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : m_74517_(p_230329_, p_230330_, p_230331_, p_230332_, list)) { ++ for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos(p_230329_, p_230330_, p_230331_, p_230332_, list, this)) { BlockPos blockpos = structuretemplate$structureblockinfo.f_74675_; if (boundingbox == null || boundingbox.m_71051_(blockpos)) { - FluidState fluidstate = p_74540_.m_74413_() ? p_74537_.m_6425_(blockpos) : null; + FluidState fluidstate = p_230332_.m_74413_() ? p_230329_.m_6425_(blockpos) : null; @@ -329,7 +_,7 @@ } - if (!p_74540_.m_74408_()) { -- this.m_74523_(p_74537_, p_74538_, p_74540_.m_74401_(), p_74540_.m_74404_(), p_74540_.m_74407_(), boundingbox, p_74540_.m_74414_()); -+ this.addEntitiesToWorld(p_74537_, p_74538_, p_74540_); + if (!p_230332_.m_74408_()) { +- this.m_74523_(p_230329_, p_230330_, p_230332_.m_74401_(), p_230332_.m_74404_(), p_230332_.m_74407_(), boundingbox, p_230332_.m_74414_()); ++ this.addEntitiesToWorld(p_230329_, p_230330_, p_230332_); } return true; @@ -42,7 +42,7 @@ List list = Lists.newArrayList(); for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : p_74522_) { - BlockPos blockpos = m_74563_(p_74521_, structuretemplate$structureblockinfo.f_74675_).m_141952_(p_74519_); + BlockPos blockpos = m_74563_(p_74521_, structuretemplate$structureblockinfo.f_74675_).m_121955_(p_74519_); StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo1 = new StructureTemplate.StructureBlockInfo(blockpos, structuretemplate$structureblockinfo.f_74676_, structuretemplate$structureblockinfo.f_74677_ != null ? structuretemplate$structureblockinfo.f_74677_.m_6426_() : null); - for(Iterator iterator = p_74521_.m_74411_().iterator(); structuretemplate$structureblockinfo1 != null && iterator.hasNext(); structuretemplate$structureblockinfo1 = iterator.next().m_7382_(p_74518_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_)) { @@ -50,19 +50,19 @@ } if (structuretemplate$structureblockinfo1 != null) { -@@ -376,13 +_,30 @@ +@@ -376,13 +_,29 @@ return list; } - private void m_74523_(ServerLevelAccessor p_74524_, BlockPos p_74525_, Mirror p_74526_, Rotation p_74527_, BlockPos p_74528_, @Nullable BoundingBox p_74529_, boolean p_74530_) { - for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.f_74483_) { -- BlockPos blockpos = m_74593_(structuretemplate$structureentityinfo.f_74684_, p_74526_, p_74527_, p_74528_).m_141952_(p_74525_); +- BlockPos blockpos = m_74593_(structuretemplate$structureentityinfo.f_74684_, p_74526_, p_74527_, p_74528_).m_121955_(p_74525_); - if (p_74529_ == null || p_74529_.m_71051_(blockpos)) { + public static List processEntityInfos(@Nullable StructureTemplate template, LevelAccessor p_215387_0_, BlockPos p_215387_1_, StructurePlaceSettings p_215387_2_, List p_215387_3_) { + List list = Lists.newArrayList(); + for(StructureTemplate.StructureEntityInfo entityInfo : p_215387_3_) { + Vec3 pos = transformedVec3d(p_215387_2_, entityInfo.f_74683_).m_82549_(Vec3.m_82528_(p_215387_1_)); -+ BlockPos blockpos = m_74563_(p_215387_2_, entityInfo.f_74684_).m_141952_(p_215387_1_); ++ BlockPos blockpos = m_74563_(p_215387_2_, entityInfo.f_74684_).m_121955_(p_215387_1_); + StructureTemplate.StructureEntityInfo info = new StructureTemplate.StructureEntityInfo(pos, blockpos, entityInfo.f_74685_); + for (StructureProcessor proc : p_215387_2_.m_74411_()) { + info = proc.processEntity(p_215387_0_, p_215387_1_, entityInfo, info, p_215387_2_, template); @@ -77,8 +77,7 @@ + + private void addEntitiesToWorld(ServerLevelAccessor p_74524_, BlockPos p_74525_, StructurePlaceSettings placementIn) { + for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : processEntityInfos(this, p_74524_, p_74525_, placementIn, this.f_74483_)) { -+ BlockPos blockpos = m_74593_(structuretemplate$structureentityinfo.f_74684_, placementIn.m_74401_(), placementIn.m_74404_(), placementIn.m_74407_()).m_141952_(p_74525_); -+ blockpos = structuretemplate$structureentityinfo.f_74684_; // FORGE: Position will have already been transformed by processEntityInfos ++ BlockPos blockpos = structuretemplate$structureentityinfo.f_74684_; // FORGE: Position will have already been transformed by processEntityInfos + if (placementIn.m_74409_() == null || placementIn.m_74409_().m_71051_(blockpos)) { CompoundTag compoundtag = structuretemplate$structureentityinfo.f_74685_.m_6426_(); - Vec3 vec3 = m_74578_(structuretemplate$structureentityinfo.f_74683_, p_74526_, p_74527_, p_74528_); diff --git a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch index 6176f21ddfb..117f645e973 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -159,7 +_,7 @@ +@@ -158,7 +_,7 @@ BlockState blockstate = p_76036_.m_8055_(blockpos); FluidState fluidstate = blockstate.m_60819_(); if (fluidstate.m_76152_().m_6212_(this) && this.m_76061_(direction, p_76036_, p_76037_, p_76038_, blockpos, blockstate)) { @@ -9,7 +9,7 @@ ++j; } -@@ -167,7 +_,7 @@ +@@ -166,7 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch index 2475fd8f12f..cbe1d386ccf 100644 --- a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch @@ -5,7 +5,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; -public abstract class Fluid { -+public abstract class Fluid extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeFluid { ++public abstract class Fluid implements net.minecraftforge.common.extensions.IForgeFluid { public static final IdMapper f_76104_ = new IdMapper<>(); protected final StateDefinition f_76105_; private FluidState f_76103_; diff --git a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch index 4f53fb1b6d9..e3512820716 100644 --- a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java @@ -72,7 +_,7 @@ - BlockState blockstate = p_76239_.m_8055_(blockpos); + BlockState blockstate = p_230572_.m_8055_(blockpos); if (blockstate.m_60795_()) { - if (this.m_76227_(p_76239_, blockpos)) { -- p_76239_.m_46597_(blockpos, BaseFireBlock.m_49245_(p_76239_, blockpos)); -+ p_76239_.m_46597_(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_76239_, blockpos, p_76240_, Blocks.f_50083_.m_49966_())); + if (this.m_76227_(p_230572_, blockpos)) { +- p_230572_.m_46597_(blockpos, BaseFireBlock.m_49245_(p_230572_, blockpos)); ++ p_230572_.m_46597_(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_230572_, blockpos, p_230573_, Blocks.f_50083_.m_49966_())); return; } } else if (blockstate.m_60767_().m_76334_()) { @@ -13,10 +13,10 @@ return; } -- if (p_76239_.m_46859_(blockpos1.m_7494_()) && this.m_76245_(p_76239_, blockpos1)) { -- p_76239_.m_46597_(blockpos1.m_7494_(), BaseFireBlock.m_49245_(p_76239_, blockpos1)); -+ if (p_76239_.m_46859_(blockpos1.m_7494_()) && this.isFlammable(p_76239_, blockpos1, Direction.UP)) { -+ p_76239_.m_46597_(blockpos1.m_7494_(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_76239_, blockpos1.m_7494_(), p_76240_, Blocks.f_50083_.m_49966_())); +- if (p_230572_.m_46859_(blockpos1.m_7494_()) && this.m_76245_(p_230572_, blockpos1)) { +- p_230572_.m_46597_(blockpos1.m_7494_(), BaseFireBlock.m_49245_(p_230572_, blockpos1)); ++ if (p_230572_.m_46859_(blockpos1.m_7494_()) && this.isFlammable(p_230572_, blockpos1, Direction.UP)) { ++ p_230572_.m_46597_(blockpos1.m_7494_(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_230572_, blockpos1.m_7494_(), p_230573_, Blocks.f_50083_.m_49966_())); } } } @@ -24,8 +24,8 @@ private boolean m_76227_(LevelReader p_76228_, BlockPos p_76229_) { for(Direction direction : Direction.values()) { -- if (this.m_76245_(p_76228_, p_76229_.m_142300_(direction))) { -+ if (this.isFlammable(p_76228_, p_76229_.m_142300_(direction), direction.m_122424_())) { +- if (this.m_76245_(p_76228_, p_76229_.m_121945_(direction))) { ++ if (this.isFlammable(p_76228_, p_76229_.m_121945_(direction), direction.m_122424_())) { return true; } } diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch index 5e2274dc3b4..b968f4f5444 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -@@ -45,7 +_,7 @@ +@@ -48,7 +_,7 @@ BlockPathTypes blockpathtypes1 = this.m_77567_(this.f_77313_, p_164677_.f_77271_, p_164677_.f_77272_, p_164677_.f_77273_); int j; if (this.f_77313_.m_21439_(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch index 41a07941104..027d26c79ca 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch @@ -5,7 +5,7 @@ return this.f_77117_; } + -+ @javax.annotation.Nullable ++ @org.jetbrains.annotations.Nullable + public BlockPathTypes getDanger() { + return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE : + (this == DAMAGE_CACTUS || this == DANGER_CACTUS) ? DANGER_CACTUS : diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index 0c0d2e2d10a..0477b7ad55e 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -113,7 +_,7 @@ +@@ -120,7 +_,7 @@ BlockPathTypes blockpathtypes = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_ + 1, p_77641_.f_77273_); BlockPathTypes blockpathtypes1 = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_); if (this.f_77313_.m_21439_(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { @@ -9,7 +9,7 @@ } double d0 = this.m_142213_(new BlockPos(p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_)); -@@ -476,6 +_,8 @@ +@@ -496,6 +_,8 @@ protected static BlockPathTypes m_77643_(BlockGetter p_77644_, BlockPos p_77645_) { BlockState blockstate = p_77644_.m_8055_(p_77645_); diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch index bd6101f22ee..2b895ef3bc7 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -324,6 +_,19 @@ - return LevelStorageSource.this.m_78229_(this.f_78271_.toFile(), LevelStorageSource.m_211737_(p_211748_, p_211749_, p_211750_)); +@@ -372,6 +_,19 @@ + return LevelStorageSource.this.m_230817_(this.f_230867_, LevelStorageSource.m_211737_(p_211748_, p_211749_, p_211750_)); } + public void readAdditionalLevelSaveData() { + m_78313_(); -+ LevelStorageSource.this.m_78229_(this.f_78271_.toFile(), (file, dataFixer) -> { ++ LevelStorageSource.this.m_230817_(this.f_230867_, (path, dataFixer) -> { + try { -+ CompoundTag compoundTag = NbtIo.m_128937_(file); ++ CompoundTag compoundTag = NbtIo.m_128937_(path.toFile()); + net.minecraftforge.common.ForgeHooks.readAdditionalLevelSaveData(compoundTag); + } catch (Exception e) { -+ f_78191_.error("Exception reading {}", file, e); ++ f_78191_.error("Exception reading {}", path, e); + } + return ""; // Return non-null to prevent level.dat-old inject + }); @@ -20,7 +20,7 @@ @Nullable public DataPackConfig m_78309_() { this.m_78313_(); -@@ -340,6 +_,8 @@ +@@ -388,6 +_,8 @@ CompoundTag compoundtag1 = new CompoundTag(); compoundtag1.m_128365_("Data", compoundtag); @@ -29,14 +29,14 @@ try { File file2 = File.createTempFile("level", ".dat", file1); NbtIo.m_128944_(compoundtag1, file2); -@@ -354,6 +_,10 @@ +@@ -402,6 +_,10 @@ public Optional m_182514_() { - return !this.f_78270_.m_13639_() ? Optional.empty() : Optional.of(this.f_78271_.resolve("icon.png")); + return !this.f_78270_.m_13639_() ? Optional.empty() : Optional.of(this.f_230867_.m_230860_()); + } + + public Path getWorldDir() { -+ return f_78271_; ++ return f_78194_; } public void m_78311_() throws IOException { diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch index 248147167af..37609faf478 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/LevelSummary.java +++ b/net/minecraft/world/level/storage/LevelSummary.java -@@ -181,4 +_,7 @@ +@@ -179,4 +_,7 @@ return this.f_164922_; } } diff --git a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch index b7c3565f29f..7cfdb1f9e3c 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -1,34 +1,34 @@ --- a/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -76,6 +_,7 @@ +@@ -77,6 +_,7 @@ private final Set f_78439_; private boolean f_78440_; private final TimerQueue f_78441_; + private boolean confirmedExperimentalWarning = false; private PrimaryLevelData(@Nullable DataFixer p_164942_, int p_164943_, @Nullable CompoundTag p_164944_, boolean p_164945_, int p_164946_, int p_164947_, int p_164948_, float p_164949_, long p_164950_, long p_164951_, int p_164952_, int p_164953_, int p_164954_, boolean p_164955_, int p_164956_, boolean p_164957_, boolean p_164958_, boolean p_164959_, WorldBorder.Settings p_164960_, int p_164961_, int p_164962_, @Nullable UUID p_164963_, Set p_164964_, TimerQueue p_164965_, @Nullable CompoundTag p_164966_, CompoundTag p_164967_, LevelSettings p_164968_, WorldGenSettings p_164969_, Lifecycle p_164970_) { - this.f_78452_ = p_164942_; -@@ -104,7 +_,9 @@ - this.f_78441_ = p_164965_; - this.f_78466_ = p_164966_; - this.f_78465_ = p_164967_; -- this.f_78443_ = p_164968_; + if (!p_164969_.m_204655_().m_142003_(LevelStem.f_63971_)) { +@@ -108,7 +_,9 @@ + this.f_78441_ = p_164965_; + this.f_78466_ = p_164966_; + this.f_78465_ = p_164967_; +- this.f_78443_ = p_164968_; + this.f_78443_ = p_164968_.withLifecycle(p_164970_); + if (p_164970_ == Lifecycle.stable()) //Reset to unconfirmed if the lifecycle goes back to stable + this.confirmedExperimentalWarning = false; - this.f_78444_ = p_164969_; - this.f_78445_ = p_164970_; - } -@@ -120,7 +_,7 @@ + this.f_78444_ = p_164969_; + this.f_78445_ = p_164970_; + } +@@ -125,7 +_,7 @@ }); - return new PrimaryLevelData(p_78532_, p_78533_, p_78534_, p_78531_.get("WasModded").asBoolean(false), p_78531_.get("SpawnX").asInt(0), p_78531_.get("SpawnY").asInt(0), p_78531_.get("SpawnZ").asInt(0), p_78531_.get("SpawnAngle").asFloat(0.0F), i, p_78531_.get("DayTime").asLong(i), p_78536_.m_78389_(), p_78531_.get("clearWeatherTime").asInt(0), p_78531_.get("rainTime").asInt(0), p_78531_.get("raining").asBoolean(false), p_78531_.get("thunderTime").asInt(0), p_78531_.get("thundering").asBoolean(false), p_78531_.get("initialized").asBoolean(true), p_78531_.get("DifficultyLocked").asBoolean(false), WorldBorder.Settings.m_62037_(p_78531_, WorldBorder.f_61907_), p_78531_.get("WanderingTraderSpawnDelay").asInt(0), p_78531_.get("WanderingTraderSpawnChance").asInt(0), p_78531_.get("WanderingTraderId").read(SerializableUUID.f_123272_).result().orElse((UUID)null), p_78531_.get("ServerBrands").asStream().flatMap((p_78529_) -> { + return new PrimaryLevelData(p_78532_, p_78533_, p_78534_, p_78531_.get("WasModded").asBoolean(false), p_78531_.get("SpawnX").asInt(0), p_78531_.get("SpawnY").asInt(0), p_78531_.get("SpawnZ").asInt(0), p_78531_.get("SpawnAngle").asFloat(0.0F), i, p_78531_.get("DayTime").asLong(i), p_78536_.m_78389_(), p_78531_.get("clearWeatherTime").asInt(0), p_78531_.get("rainTime").asInt(0), p_78531_.get("raining").asBoolean(false), p_78531_.get("thunderTime").asInt(0), p_78531_.get("thundering").asBoolean(false), p_78531_.get("initialized").asBoolean(true), p_78531_.get("DifficultyLocked").asBoolean(false), WorldBorder.Settings.m_62037_(p_78531_, WorldBorder.f_61907_), p_78531_.get("WanderingTraderSpawnDelay").asInt(0), p_78531_.get("WanderingTraderSpawnChance").asInt(0), p_78531_.get("WanderingTraderId").read(UUIDUtil.f_235867_).result().orElse((UUID)null), p_78531_.get("ServerBrands").asStream().flatMap((p_78529_) -> { return p_78529_.asString().result().stream(); - }).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), compoundtag, p_78535_, p_78537_, p_78538_); + }).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), compoundtag, p_78535_, p_78537_, p_78538_).withConfirmedWarning(p_78538_ != Lifecycle.stable() && p_78531_.get("confirmedExperimentalSettings").asBoolean(false)); } public CompoundTag m_6626_(RegistryAccess p_78543_, @Nullable CompoundTag p_78544_) { -@@ -191,6 +_,8 @@ +@@ -196,6 +_,8 @@ p_78547_.m_128362_("WanderingTraderId", this.f_78438_); } @@ -37,7 +37,7 @@ } public int m_6789_() { -@@ -453,5 +_,13 @@ +@@ -458,5 +_,13 @@ public LevelSettings m_5926_() { return this.f_78443_.m_46935_(); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch index 357d390ce07..0854a50d0b4 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -11,7 +11,7 @@ + + private ResourceLocation queriedLootTableId; + -+ private LootContext(Random rand, float luckIn, ServerLevel worldIn, Function lootTableManagerIn, Function p_i225885_5_, Map, Object> parametersIn, Map conditionsIn, ResourceLocation queriedLootTableId) { ++ private LootContext(RandomSource rand, float luckIn, ServerLevel worldIn, Function lootTableManagerIn, Function p_i225885_5_, Map, Object> parametersIn, Map conditionsIn, ResourceLocation queriedLootTableId) { + this(rand, luckIn, worldIn, lootTableManagerIn, p_i225885_5_, parametersIn, conditionsIn); + if (queriedLootTableId != null) this.queriedLootTableId = queriedLootTableId; + } @@ -28,7 +28,7 @@ private final ServerLevel f_78955_; private final Map, Object> f_78956_ = Maps.newIdentityHashMap(); private final Map f_78957_ = Maps.newHashMap(); - private Random f_78958_; + private RandomSource f_78958_; private float f_78959_; + private ResourceLocation queriedLootTableId; // Forge: correctly pass around loot table ID with copy constructor @@ -45,8 +45,8 @@ + this.queriedLootTableId = context.queriedLootTableId; + } + - public LootContext.Builder m_78977_(Random p_78978_) { - this.f_78958_ = p_78978_; + public LootContext.Builder m_230911_(RandomSource p_230912_) { + this.f_78958_ = p_230912_; return this; @@ -190,7 +_,7 @@ @@ -60,9 +60,9 @@ @@ -203,7 +_,7 @@ } - MinecraftServer minecraftserver = this.f_78955_.m_142572_(); -- return new LootContext(random, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_); -+ return new LootContext(random, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_, this.queriedLootTableId); + MinecraftServer minecraftserver = this.f_78955_.m_7654_(); +- return new LootContext(randomsource, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_); ++ return new LootContext(randomsource, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_, this.queriedLootTableId); } } } diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch index b01635d5ee4..dc42573d09e 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java -@@ -34,13 +_,13 @@ +@@ -35,13 +_,13 @@ public static final LootTable f_79105_ = new LootTable(LootContextParamSets.f_81410_, new LootPool[0], new LootItemFunction[0]); public static final LootContextParamSet f_79106_ = LootContextParamSets.f_81420_; final LootContextParamSet f_79108_; @@ -16,7 +16,7 @@ this.f_79110_ = p_79116_; this.f_79111_ = LootItemFunctions.m_80770_(p_79116_); } -@@ -78,6 +_,7 @@ +@@ -79,6 +_,7 @@ } @@ -24,15 +24,15 @@ public void m_79148_(LootContext p_79149_, Consumer p_79150_) { this.m_79131_(p_79149_, m_79142_(p_79150_)); } -@@ -85,6 +_,7 @@ - public List m_79129_(LootContext p_79130_) { - List list = Lists.newArrayList(); - this.m_79148_(p_79130_, list::add); -+ list = net.minecraftforge.common.ForgeHooks.modifyLoot(this.getLootTableId(), list, p_79130_); - return list; +@@ -86,6 +_,7 @@ + public ObjectArrayList m_230922_(LootContext p_230923_) { + ObjectArrayList objectarraylist = new ObjectArrayList<>(); + this.m_79148_(p_230923_, objectarraylist::add); ++ objectarraylist = net.minecraftforge.common.ForgeHooks.modifyLoot(this.getLootTableId(), objectarraylist, p_230923_); + return objectarraylist; } -@@ -93,8 +_,8 @@ +@@ -94,8 +_,8 @@ } public void m_79136_(ValidationContext p_79137_) { @@ -43,7 +43,7 @@ } for(int j = 0; j < this.f_79110_.length; ++j) { -@@ -176,6 +_,48 @@ +@@ -177,6 +_,48 @@ return new LootTable.Builder(); } @@ -92,7 +92,7 @@ public static class Builder implements FunctionUserBuilder { private final List f_79156_ = Lists.newArrayList(); private final List f_79157_ = Lists.newArrayList(); -@@ -230,7 +_,7 @@ +@@ -231,7 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch index 58e49033733..697ac20d3eb 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch @@ -1,13 +1,12 @@ --- a/net/minecraft/world/level/storage/loot/LootTables.java +++ b/net/minecraft/world/level/storage/loot/LootTables.java -@@ -37,8 +_,8 @@ - } +@@ -37,7 +_,8 @@ p_79214_.forEach((p_79198_, p_79199_) -> { -- try { + try { - LootTable loottable = f_79189_.fromJson(p_79199_, LootTable.class); -+ try (net.minecraft.server.packs.resources.Resource res = p_79215_.m_142591_(getPreparedPath(p_79198_));){ -+ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(f_79189_, p_79198_, p_79199_, res == null || !res.m_7816_().equals("Default"), this); ++ net.minecraft.server.packs.resources.Resource res = p_79215_.m_213713_(getPreparedPath(p_79198_)).orElse(null); ++ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(f_79189_, p_79198_, p_79199_, res == null || !res.m_215506_().equals("Default"), this); builder.put(p_79198_, loottable); } catch (Exception exception) { f_79188_.error("Couldn't parse loot table {}", p_79198_, exception); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceCondition.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceCondition.java.patch index 41870a99ccb..82b1ea3641d 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceCondition.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceCondition.java.patch @@ -4,9 +4,9 @@ } public boolean test(LootContext p_81930_) { -- return p_81930_.m_78933_().nextFloat() < this.f_81921_; +- return p_81930_.m_230907_().m_188501_() < this.f_81921_; + int i = p_81930_.getLootingModifier(); -+ return p_81930_.m_78933_().nextFloat() < this.f_81921_ + (float) i; ++ return p_81930_.m_230907_().m_188501_() < this.f_81921_ + (float) i; } public static LootItemCondition.Builder m_81927_(float p_81928_) { diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch index ccb805ee97a..01040b25313 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch @@ -11,6 +11,6 @@ - } - + int i = p_81967_.getLootingModifier(); - return p_81967_.m_78933_().nextFloat() < this.f_81953_ + (float)i * this.f_81954_; + return p_81967_.m_230907_().m_188501_() < this.f_81953_ + (float)i * this.f_81954_; } diff --git a/server_files/run.bat b/server_files/run.bat index de9ae480d6c..5c7d11358f4 100644 --- a/server_files/run.bat +++ b/server_files/run.bat @@ -1,3 +1,4 @@ +@echo off REM Forge requires a configured set of both JVM and program arguments. REM Add custom JVM arguments to the user_jvm_args.txt REM Add custom program arguments {such as nogui} to this file in the next line before the %* or diff --git a/settings.gradle b/settings.gradle index 57fcacb65a5..2b71cef5f18 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,7 @@ pluginManagement { repositories { gradlePluginPortal() + mavenLocal() maven { url = 'https://maven.minecraftforge.net/' } } } diff --git a/src/docs/stylesheet.css b/src/docs/stylesheet.css new file mode 100644 index 00000000000..5dd0b9fd51b --- /dev/null +++ b/src/docs/stylesheet.css @@ -0,0 +1,892 @@ +/* + * Javadoc style sheet + * Customized for use by Minecraft Forge + */ + +@import url('resources/fonts/dejavu.css'); + +/* + * Custom styling for FCW: Javadocs. + * + * Modifications past this block are for existing properties. + */ + +:root { + --forge-blue: #1e2d42; + --forge-orange: #e0a969; +} + +.top-nav::before { + background-image: url('data:image/svg+xml; utf8, '); + background-size: 64px; + background-repeat: no-repeat; + content: ''; + width: 64px; + height: 32px; + float: left; + margin: -4px 8px; +} + +ul.nav-list li { + font-weight: bold; +} + +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; + padding:0; + height:100%; + width:100%; +} +iframe { + margin:0; + padding:0; + height:100%; + width:100%; + overflow-y:scroll; + border:none; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a[href]:hover, a[href]:focus { + text-decoration:none; + color:#bb7a2a; +} +a[name] { + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; +} +h4 { + font-size:15px; +} +h5 { + font-size:14px; +} +h6 { + font-size:13px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; +} +:not(h1, h2, h3, h4, h5, h6) > code, +:not(h1, h2, h3, h4, h5, h6) > tt { + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +.summary-table dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size: 14px; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.clear { + clear:both; + height:0; + overflow:hidden; +} +.about-language { + float:right; + padding:0 21px 8px 8px; + font-size:11px; + margin-top:-9px; + height:2.9em; +} +.legal-copy { + margin-left:.5em; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* + * Styles for navigation bar. + */ +@media screen { + .flex-box { + position:fixed; + display:flex; + flex-direction:column; + height: 100%; + width: 100%; + } + .flex-header { + flex: 0 0 auto; + } + .flex-content { + flex: 1 1 auto; + overflow-y: auto; + } +} +.top-nav { + background-color: /* #4D7A97 */ var(--forge-blue); + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + min-height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.sub-nav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.sub-nav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list { + padding-top:5px; +} +ul.nav-list { + display:block; + margin:0 25px 0 0; + padding:0; +} +ul.sub-nav-list { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.nav-list li { + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list-search { + float:right; + margin:0 0 0 0; + padding:5px 6px; + clear:none; +} +.nav-list-search label { + position:relative; + right:-16px; +} +ul.sub-nav-list li { + list-style:none; + float:left; + padding-top:10px; +} +.top-nav a:link, .top-nav a:active, .top-nav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.top-nav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.nav-bar-cell1-rev { + background-color: /* #F8981D */ var(--forge-orange); + color:#253441; + margin: auto 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header and footer. + */ +.title { + color:#2c4557; + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3, +body.class-declaration-page .summary .inherited-list h2 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +/* + * Styles for page layout containers. + */ +main { + clear:both; + padding:10px 20px; + position:relative; +} +dl.notes > dt { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +dl.notes > dd { + margin:5px 10px 10px 0; + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:10px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +.summary-table dl, .summary-table dl dt, .summary-table dl dd { + margin-top:0; + margin-bottom:1px; +} +ul.see-list, ul.see-list-long { + padding-left: 0; + list-style: none; +} +ul.see-list li { + display: inline; +} +ul.see-list li:not(:last-child):after, +ul.see-list-long li:not(:last-child):after { + content: ", "; + white-space: pre-wrap; +} +/* + * Styles for tables. + */ +.summary-table, .details-table { + width:100%; + border-spacing:0; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; + padding:0; +} +.caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0; + padding-top:10px; + padding-left:1px; + margin:0; + white-space:pre; +} +.caption a:link, .caption a:visited { + color:#1f389c; +} +.caption a:hover, +.caption a:active { + color:#FFFFFF; +} +.caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color: /* #F8981D */ var(--forge-orange); + border: none; + height:16px; +} +div.table-tabs { + padding:10px 0 0 1px; + margin:0; +} +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; +} +div.table-tabs > button.active-table-tab { + background: /* #F8981D */ var(--forge-orange); + color: #253441; +} +div.table-tabs > button.table-tab { + background: /* #4D7A97 */ var(--forge-blue); + color: #FFFFFF; +} +.two-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); +} +.three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(15%, max-content) minmax(15%, auto); +} +.four-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(10%, max-content) minmax(10%, max-content) minmax(10%, auto); +} +@media screen and (max-width: 600px) { + .two-column-summary { + display: grid; + grid-template-columns: 1fr; + } +} +@media screen and (max-width: 800px) { + .three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(25%, auto); + } + .three-column-summary .col-last { + grid-column-end: span 2; + } +} +@media screen and (max-width: 1000px) { + .four-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); + } +} +.summary-table > div, .details-table > div { + text-align:left; + padding: 8px 3px 3px 7px; +} +.col-first, .col-second, .col-last, .col-constructor-name, .col-summary-item-name { + vertical-align:top; + padding-right:0; + padding-top:8px; + padding-bottom:3px; +} +.table-header { + background:#dee3e9; + font-weight: bold; +} +.col-first, .col-first { + font-size:13px; +} +.col-second, .col-second, .col-last, .col-constructor-name, .col-summary-item-name, .col-last { + font-size:13px; +} +.col-first, .col-second, .col-constructor-name { + vertical-align:top; + overflow: auto; +} +.col-last { + white-space:normal; +} +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-constructor-name a:link, .col-constructor-name a:visited, +.col-summary-item-name a:link, .col-summary-item-name a:visited, +.constant-values-container a:link, .constant-values-container a:visited, +.all-classes-container a:link, .all-classes-container a:visited, +.all-packages-container a:link, .all-packages-container a:visited { + font-weight:bold; +} +.table-sub-heading-color { + background-color:#EEEEFF; +} +.even-row-color, .even-row-color .table-header { + background-color:#FFFFFF; +} +.odd-row-color, .odd-row-color .table-header { + background-color:#EEEEEF; +} +/* + * Styles for contents. + */ +.deprecated-content { + margin:0; + padding:10px 0; +} +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +.col-last div { + padding-top:0; +} +.col-last a { + padding-bottom:3px; +} +.module-signature, +.package-signature, +.type-signature, +.member-signature { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + margin:14px 0; + white-space: pre-wrap; +} +.module-signature, +.package-signature, +.type-signature { + margin-top: 0; +} +.member-signature .type-parameters-long, +.member-signature .parameters, +.member-signature .exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +.member-signature .type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:0 10px 5px 0; + color:#474747; +} +.deprecated-label, .descfrm-type-label, .implementation-label, .member-name-label, .member-name-link, +.module-label-in-package, .module-label-in-type, .override-specify-label, .package-label-in-type, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .preview-comment { + font-style:italic; +} +.deprecation-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +.preview-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment { + font-style:normal; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color: /* #4D7A97 */ var(--forge-blue); + color:#FFFFFF; +} +.result-item { + font-size:13px; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow-y:scroll; + overflow-x:scroll; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +ul.ui-autocomplete { + position:fixed; + z-index:999999; +} +ul.ui-autocomplete li { + float:left; + clear:both; + width:100%; +} +.result-highlight { + font-weight:bold; +} +#search-input { + background-image:url('resources/glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + padding-left:20px; + position:relative; + right:-18px; + width:400px; +} +#reset-button { + background-color: rgb(255,255,255); + background-image:url('resources/x.png'); + background-position:center; + background-repeat:no-repeat; + background-size:12px; + border:0 none; + width:16px; + height:16px; + position:relative; + left:-4px; + top:-4px; + font-size:0px; +} +.watermark { + color:#545454; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:yellow; +} +.module-graph span { + display:none; + position:absolute; +} +.module-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 1; +} +.inherited-list { + margin: 10px 0 10px 0; +} +section.class-description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0px 20px 5px 10px; + border: 1px solid #ededed; + background-color: #f8f8f8; +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +.vertical-separator { + padding: 0 5px; +} +ul.help-section-list { + margin: 0; +} +ul.help-subtoc > li { + display: inline-block; + padding-right: 5px; + font-size: smaller; +} +ul.help-subtoc > li::before { + content: "\2022" ; + padding-right:2px; +} +span.help-note { + font-style: italic; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} + +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #E3E3E3; +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} +table.striped > tbody > tr > th { + font-weight: normal; +} +/** + * Tweak font sizes and paddings for small screens. + */ +@media screen and (max-width: 1050px) { + #search-input { + width: 300px; + } +} +@media screen and (max-width: 800px) { + #search-input { + width: 200px; + } + .top-nav, + .bottom-nav { + font-size: 11px; + padding-top: 6px; + } + .sub-nav { + font-size: 11px; + } + .about-language { + padding-right: 16px; + } + ul.nav-list li, + .sub-nav .nav-list-search { + padding: 6px; + } + ul.sub-nav-list li { + padding-top: 5px; + } + main { + padding: 10px; + } + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0 8px 5px 8px; + } + body { + -webkit-text-size-adjust: none; + } +} +@media screen and (max-width: 500px) { + #search-input { + width: 150px; + } + .top-nav, + .bottom-nav { + font-size: 10px; + } + .sub-nav { + font-size: 10px; + } + .about-language { + font-size: 10px; + padding-right: 12px; + } +} diff --git a/src/fmlcommon/java/net/minecraftforge/fml/core/ModStateProvider.java b/src/fmlcommon/java/net/minecraftforge/fml/core/ModStateProvider.java index 47780d9e2b2..1be49f1fbae 100644 --- a/src/fmlcommon/java/net/minecraftforge/fml/core/ModStateProvider.java +++ b/src/fmlcommon/java/net/minecraftforge/fml/core/ModStateProvider.java @@ -25,20 +25,114 @@ import java.util.List; +/** + * Provider for the core FML mod loading states. + */ public class ModStateProvider implements IModStateProvider { - final ModLoadingState ERROR = ModLoadingState.empty("ERROR", "", ModLoadingPhase.ERROR); - private final ModLoadingState VALIDATE = ModLoadingState.empty("VALIDATE", "", ModLoadingPhase.GATHER); - final ModLoadingState CONSTRUCT = ModLoadingState.withTransition("CONSTRUCT", "VALIDATE", ml->"Constructing %d mods".formatted(ml.size()), ModLoadingPhase.GATHER, new ParallelTransition(ModLoadingStage.CONSTRUCT, FMLConstructModEvent.class)); - private final ModLoadingState CONFIG_LOAD = ModLoadingState.withInline("CONFIG_LOAD", "", ModLoadingPhase.LOAD, ml->{ - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, ()->()-> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get())); - ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); - }); - private final ModLoadingState COMMON_SETUP = ModLoadingState.withTransition("COMMON_SETUP", "CONFIG_LOAD", ModLoadingPhase.LOAD, new ParallelTransition(ModLoadingStage.COMMON_SETUP, FMLCommonSetupEvent.class)); - private final ModLoadingState SIDED_SETUP = ModLoadingState.withTransition("SIDED_SETUP", "COMMON_SETUP", ModLoadingPhase.LOAD, new ParallelTransition(ModLoadingStage.SIDED_SETUP, DistExecutor.unsafeRunForDist(()->()-> FMLClientSetupEvent.class, ()->()-> FMLDedicatedServerSetupEvent.class))); - private final ModLoadingState ENQUEUE_IMC = ModLoadingState.withTransition("ENQUEUE_IMC", "", ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.ENQUEUE_IMC, InterModEnqueueEvent.class)); - private final ModLoadingState PROCESS_IMC = ModLoadingState.withTransition("PROCESS_IMC", "ENQUEUE_IMC",ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.PROCESS_IMC, InterModProcessEvent.class)); - private final ModLoadingState COMPLETE = ModLoadingState.withTransition("COMPLETE", "PROCESS_IMC", ml->"completing load of %d mods".formatted(ml.size()), ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.COMPLETE, FMLLoadCompleteEvent.class)); - private final ModLoadingState DONE = ModLoadingState.empty("DONE", "", ModLoadingPhase.DONE); + /** + * The special mod loading state for exceptional situations and error handling. + * + * @see ModLoadingPhase#ERROR + */ + final ModLoadingState ERROR = ModLoadingState.empty("ERROR", "", + ModLoadingPhase.ERROR); + + /** + * First {@linkplain ModLoadingPhase#GATHER gathering state}, for the validation of the mod list. + * TODO: figure out where this is used and why this exists instead of CONSTRUCT being the first state + */ + private final ModLoadingState VALIDATE = ModLoadingState.empty("VALIDATE", "", + ModLoadingPhase.GATHER); + + /** + * {@linkplain ModLoadingPhase#GATHER Gathering state} after {@linkplain #VALIDATE validation}, for the construction + * of mod containers and their backing mod instances. + * + * @see FMLConstructModEvent + * @see ModLoadingStage#CONSTRUCT + */ + final ModLoadingState CONSTRUCT = ModLoadingState.withTransition("CONSTRUCT", "VALIDATE", + ml -> "Constructing %d mods".formatted(ml.size()), + ModLoadingPhase.GATHER, + new ParallelTransition(ModLoadingStage.CONSTRUCT, FMLConstructModEvent.class)); + + /** + * First {@linkplain ModLoadingPhase#LOAD loading state}, for loading of the common and (if applicable) + * {@linkplain Dist#CLIENT client-side} mod configurations. + */ + private final ModLoadingState CONFIG_LOAD = ModLoadingState.withInline("CONFIG_LOAD", "", + ModLoadingPhase.LOAD, + ml -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get())); + ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get()); + }); + + /** + * {@linkplain ModLoadingPhase#LOAD Loading state} after {@linkplain #CONFIG_LOAD configuration loading}, for + * common (non-side-specific) setup and initialization. + * + * @see FMLCommonSetupEvent + * @see ModLoadingStage#COMMON_SETUP + */ + private final ModLoadingState COMMON_SETUP = ModLoadingState.withTransition("COMMON_SETUP", "CONFIG_LOAD", + ModLoadingPhase.LOAD, + new ParallelTransition(ModLoadingStage.COMMON_SETUP, FMLCommonSetupEvent.class)); + + /** + * {@linkplain ModLoadingPhase#LOAD Loading state} after {@linkplain #COMMON_SETUP common setup}, for side-specific + * setup and initialization. + * + * @see FMLClientSetupEvent + * @see FMLDedicatedServerSetupEvent + * @see ModLoadingStage#SIDED_SETUP + */ + private final ModLoadingState SIDED_SETUP = ModLoadingState.withTransition("SIDED_SETUP", "COMMON_SETUP", + ModLoadingPhase.LOAD, + new ParallelTransition(ModLoadingStage.SIDED_SETUP, + DistExecutor.unsafeRunForDist(()->()-> FMLClientSetupEvent.class, ()->()-> FMLDedicatedServerSetupEvent.class))); + + /** + * First {@linkplain ModLoadingPhase#COMPLETE completion state}, for enqueuing {@link net.minecraftforge.fml.InterModComms} + * messages. + * + * @see InterModEnqueueEvent + * @see ModLoadingStage#ENQUEUE_IMC + */ + private final ModLoadingState ENQUEUE_IMC = ModLoadingState.withTransition("ENQUEUE_IMC", "", + ModLoadingPhase.COMPLETE, + new ParallelTransition(ModLoadingStage.ENQUEUE_IMC, InterModEnqueueEvent.class)); + + /** + * {@linkplain ModLoadingPhase#COMPLETE Completion state} after {@linkplain #ENQUEUE_IMC}, for processing of messages + * received through {@link net.minecraftforge.fml.InterModComms}. + * + * @see InterModProcessEvent + * @see ModLoadingStage#PROCESS_IMC + */ + private final ModLoadingState PROCESS_IMC = ModLoadingState.withTransition("PROCESS_IMC", "ENQUEUE_IMC", + ModLoadingPhase.COMPLETE, + new ParallelTransition(ModLoadingStage.PROCESS_IMC, InterModProcessEvent.class)); + + /** + * {@linkplain ModLoadingPhase#COMPLETE Completion state} after {@linkplain #PROCESS_IMC}, marking the completion + * of the basic mod loading process; however, additional completion states may be present after this. + * + * @see FMLLoadCompleteEvent + * @see ModLoadingStage#COMPLETE + */ + private final ModLoadingState COMPLETE = ModLoadingState.withTransition("COMPLETE", "PROCESS_IMC", + ml -> "completing load of %d mods".formatted(ml.size()), + ModLoadingPhase.COMPLETE, + new ParallelTransition(ModLoadingStage.COMPLETE, FMLLoadCompleteEvent.class)); + + /** + * The marker state for the completion of the full mod loading process. + * + * @see ModLoadingStage#DONE + */ + private final ModLoadingState DONE = ModLoadingState.empty("DONE", "", + ModLoadingPhase.DONE); @Override public List getAllStates() { diff --git a/src/fmlcommon/java/net/minecraftforge/fml/core/ParallelTransition.java b/src/fmlcommon/java/net/minecraftforge/fml/core/ParallelTransition.java index 8ccda96a142..25b63e05cd8 100644 --- a/src/fmlcommon/java/net/minecraftforge/fml/core/ParallelTransition.java +++ b/src/fmlcommon/java/net/minecraftforge/fml/core/ParallelTransition.java @@ -12,8 +12,6 @@ import net.minecraftforge.fml.ThreadSelector; import net.minecraftforge.fml.event.lifecycle.ParallelDispatchEvent; -import java.util.Collections; -import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.BiFunction; @@ -32,7 +30,7 @@ public ThreadSelector threadSelector() { } @Override - public BiFunction>, CompletableFuture>> finalActivityGenerator() { + public BiFunction, CompletableFuture> finalActivityGenerator() { return (e, prev) -> prev.thenApplyAsync(t -> { stage.getDeferredWorkQueue().runTasks(); return t; @@ -40,12 +38,12 @@ public BiFunction>, CompletableFutur } @Override - public BiFunction, CompletableFuture>> preDispatchHook() { - return (t, f) -> CompletableFuture.completedFuture(Collections.emptyList()); + public BiFunction, CompletableFuture> preDispatchHook() { + return (t, f) -> CompletableFuture.completedFuture(null); } @Override - public BiFunction, CompletableFuture>> postDispatchHook() { - return (t, f) -> CompletableFuture.completedFuture(Collections.emptyList()); + public BiFunction, CompletableFuture> postDispatchHook() { + return (t, f) -> CompletableFuture.completedFuture(null); } } diff --git a/src/fmlcommon/java/net/minecraftforge/fml/event/lifecycle/FMLCommonSetupEvent.java b/src/fmlcommon/java/net/minecraftforge/fml/event/lifecycle/FMLCommonSetupEvent.java index a04a5e1e829..e5fac14e614 100644 --- a/src/fmlcommon/java/net/minecraftforge/fml/event/lifecycle/FMLCommonSetupEvent.java +++ b/src/fmlcommon/java/net/minecraftforge/fml/event/lifecycle/FMLCommonSetupEvent.java @@ -14,9 +14,8 @@ /** * This is the first of four commonly called events during mod initialization. * - * Called before {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent} during mod startup. - * - * Called after {@link net.minecraftforge.event.RegistryEvent.Register} events have been fired. + * Called after {@link net.minecraftforge.registries.RegisterEvent} events have been fired and before + * {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent} during mod startup. * * Either register your listener using {@link net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber} and * {@link net.minecraftforge.eventbus.api.SubscribeEvent} or diff --git a/src/generated/resources/data/forge/tags/blocks/barrels.json b/src/generated/resources/data/forge/tags/blocks/barrels.json index 4af754bdecd..1cfb5782c57 100644 --- a/src/generated/resources/data/forge/tags/blocks/barrels.json +++ b/src/generated/resources/data/forge/tags/blocks/barrels.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:barrels/wooden" ] diff --git a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json b/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json index 01825818a4a..b07daae1c09 100644 --- a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json +++ b/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:barrel" ] diff --git a/src/generated/resources/data/forge/tags/blocks/chests.json b/src/generated/resources/data/forge/tags/blocks/chests.json index edd007876cc..9afff2b15ab 100644 --- a/src/generated/resources/data/forge/tags/blocks/chests.json +++ b/src/generated/resources/data/forge/tags/blocks/chests.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:chests/ender", "#forge:chests/trapped", diff --git a/src/generated/resources/data/forge/tags/blocks/chests/ender.json b/src/generated/resources/data/forge/tags/blocks/chests/ender.json index 6416580a378..8c0af53136f 100644 --- a/src/generated/resources/data/forge/tags/blocks/chests/ender.json +++ b/src/generated/resources/data/forge/tags/blocks/chests/ender.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ender_chest" ] diff --git a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json b/src/generated/resources/data/forge/tags/blocks/chests/trapped.json index 7d4855ac214..f8924f5a051 100644 --- a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json +++ b/src/generated/resources/data/forge/tags/blocks/chests/trapped.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:trapped_chest" ] diff --git a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json b/src/generated/resources/data/forge/tags/blocks/chests/wooden.json index 441d80f5b2b..86533f935bf 100644 --- a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json +++ b/src/generated/resources/data/forge/tags/blocks/chests/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:chest", "minecraft:trapped_chest" diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone.json b/src/generated/resources/data/forge/tags/blocks/cobblestone.json index f0884a6f52d..f0ae95b5fcc 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone.json +++ b/src/generated/resources/data/forge/tags/blocks/cobblestone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:cobblestone/normal", "#forge:cobblestone/infested", diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json index f4e249492e6..75f1ba31f44 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json +++ b/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobbled_deepslate" ] diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json index 7fdfc6eff3a..a1d276601e6 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json +++ b/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:infested_cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json index 8bd3f8b93bf..c32be6c962c 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json +++ b/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:mossy_cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json index 5f9fcb470f5..dac674da5d4 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json +++ b/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/blocks/end_stones.json b/src/generated/resources/data/forge/tags/blocks/end_stones.json index 146dcd9a67e..f2d11375bce 100644 --- a/src/generated/resources/data/forge/tags/blocks/end_stones.json +++ b/src/generated/resources/data/forge/tags/blocks/end_stones.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:end_stone" ] diff --git a/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json b/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json index 5e8aecc9865..f72d209df78 100644 --- a/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json +++ b/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json @@ -1,4 +1,3 @@ { - "replace": false, "values": [] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates.json b/src/generated/resources/data/forge/tags/blocks/fence_gates.json index 9508f9133d8..b9a57ac0ef2 100644 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates.json +++ b/src/generated/resources/data/forge/tags/blocks/fence_gates.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:fence_gates/wooden" ] diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json index 0f017436c80..52c3d42462e 100644 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json +++ b/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:oak_fence_gate", "minecraft:spruce_fence_gate", diff --git a/src/generated/resources/data/forge/tags/blocks/fences.json b/src/generated/resources/data/forge/tags/blocks/fences.json index 55a5f8542c1..44358edb048 100644 --- a/src/generated/resources/data/forge/tags/blocks/fences.json +++ b/src/generated/resources/data/forge/tags/blocks/fences.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:fences/nether_brick", "#forge:fences/wooden" diff --git a/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json b/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json index c6f0bd76166..3f1aacfa7ef 100644 --- a/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json +++ b/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_brick_fence" ] diff --git a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json b/src/generated/resources/data/forge/tags/blocks/fences/wooden.json index 80808ad5c9a..81202621144 100644 --- a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json +++ b/src/generated/resources/data/forge/tags/blocks/fences/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:wooden_fences" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass.json b/src/generated/resources/data/forge/tags/blocks/glass.json index 943aa90b5da..fec31169ee1 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass.json +++ b/src/generated/resources/data/forge/tags/blocks/glass.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:glass/colorless", "#forge:stained_glass", diff --git a/src/generated/resources/data/forge/tags/blocks/glass/black.json b/src/generated/resources/data/forge/tags/blocks/glass/black.json index 4f01d11d87d..9965b5e8b4b 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/black.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/black.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:black_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/blue.json b/src/generated/resources/data/forge/tags/blocks/glass/blue.json index f00b8f0a6ca..f59e58c6bf7 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/blue.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blue_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/brown.json b/src/generated/resources/data/forge/tags/blocks/glass/brown.json index b201d9ca08b..490015cbb51 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/brown.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/brown.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json b/src/generated/resources/data/forge/tags/blocks/glass/colorless.json index 41c35c32297..ac8b5e50863 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json b/src/generated/resources/data/forge/tags/blocks/glass/cyan.json index 5663dae0083..24d84747fa8 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/cyan.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cyan_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/gray.json b/src/generated/resources/data/forge/tags/blocks/glass/gray.json index 17f2ac1427a..2f309170cab 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/gray.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gray_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/green.json b/src/generated/resources/data/forge/tags/blocks/glass/green.json index 1af1fa0a99e..d7946c1aca9 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/green.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/green.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:green_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json b/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json index 681d8f5e5ff..dc8e6b71485 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_blue_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json b/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json index bbb35c80d71..f165a46c904 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_gray_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/lime.json b/src/generated/resources/data/forge/tags/blocks/glass/lime.json index a9cf3d59476..b6bb1d9415e 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/lime.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/lime.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lime_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json b/src/generated/resources/data/forge/tags/blocks/glass/magenta.json index c1d51e99b2f..aa6a4825e82 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/magenta.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:magenta_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/orange.json b/src/generated/resources/data/forge/tags/blocks/glass/orange.json index 4f99b379ea3..9322f51fe4d 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/orange.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/orange.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:orange_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/pink.json b/src/generated/resources/data/forge/tags/blocks/glass/pink.json index 2cf72414122..58b65891fc5 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/pink.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/pink.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pink_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/purple.json b/src/generated/resources/data/forge/tags/blocks/glass/purple.json index 25e9a26469e..d75a9e7308f 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/purple.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/purple.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:purple_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/red.json b/src/generated/resources/data/forge/tags/blocks/glass/red.json index 5b04856508a..72af78c0294 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/red.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/silica.json b/src/generated/resources/data/forge/tags/blocks/glass/silica.json index 7ae1f6ddba8..74544c770db 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/silica.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/silica.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass", "minecraft:black_stained_glass", diff --git a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json b/src/generated/resources/data/forge/tags/blocks/glass/tinted.json index 1567b7fd943..4075a1556b3 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/tinted.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:tinted_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/white.json b/src/generated/resources/data/forge/tags/blocks/glass/white.json index ce529c5f099..fb180e703e4 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/white.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/white.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json b/src/generated/resources/data/forge/tags/blocks/glass/yellow.json index e8120972fa0..0831bea4cca 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json +++ b/src/generated/resources/data/forge/tags/blocks/glass/yellow.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:yellow_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes.json b/src/generated/resources/data/forge/tags/blocks/glass_panes.json index 54d1bc517f8..4b95330d4f5 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:glass_panes/colorless", "#forge:stained_glass_panes" diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json index ea0ccfb61a9..ebda555dcd4 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:black_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json index dd2834f5200..2762890aa90 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blue_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json index d428cc7cd9b..0b5b7274916 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json index a0638aacede..eb5756f9643 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json index 90bda4e2e07..9913e90a964 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cyan_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json index cf7cc647571..9fe30b26a89 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gray_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json index 80d123f3b52..ab913210286 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:green_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json index 22c38c65e88..cd6d399022d 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_blue_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json index 08bf8e84626..7be6a4ce81d 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_gray_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json index 6319bf5e67b..46dec64b22e 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lime_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json index e4efb3c414d..7504bc3fa37 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:magenta_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json index 0764afe55c7..1c47e346166 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:orange_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json index 2e34eda30ef..28e36b973f6 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pink_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json index a3d2c78235b..a3cff33a142 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:purple_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json index 191a08d50aa..5edd855d716 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json index 3f759cfc8f1..b514a2839f8 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json index 53793f5fb37..a293eb9dc88 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json +++ b/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:yellow_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/blocks/gravel.json b/src/generated/resources/data/forge/tags/blocks/gravel.json index 087cf289d61..f6968bff68a 100644 --- a/src/generated/resources/data/forge/tags/blocks/gravel.json +++ b/src/generated/resources/data/forge/tags/blocks/gravel.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gravel" ] diff --git a/src/generated/resources/data/forge/tags/blocks/netherrack.json b/src/generated/resources/data/forge/tags/blocks/netherrack.json index d54c65bbb4b..daa9c66701a 100644 --- a/src/generated/resources/data/forge/tags/blocks/netherrack.json +++ b/src/generated/resources/data/forge/tags/blocks/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherrack" ] diff --git a/src/generated/resources/data/forge/tags/blocks/obsidian.json b/src/generated/resources/data/forge/tags/blocks/obsidian.json index 03a3719e301..170248454b1 100644 --- a/src/generated/resources/data/forge/tags/blocks/obsidian.json +++ b/src/generated/resources/data/forge/tags/blocks/obsidian.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:obsidian" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json index 9036a21131d..0012c241a31 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:deepslate" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json index d54c65bbb4b..daa9c66701a 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherrack" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json index 52fd055337c..c2d7c79f3e7 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:stone" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json index 4bd4cb5433b..69cfa783438 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:copper_ore", "minecraft:deepslate_copper_ore", diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json index 43ba2ab490a..79e0f4b9a7c 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ancient_debris", "minecraft:coal_ore", diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json index 31be071fedd..3caf9ffe44e 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json +++ b/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_gold_ore" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores.json b/src/generated/resources/data/forge/tags/blocks/ores.json index a2224abfd25..2c4beabc55b 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores.json +++ b/src/generated/resources/data/forge/tags/blocks/ores.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:ores/coal", "#forge:ores/copper", diff --git a/src/generated/resources/data/forge/tags/blocks/ores/coal.json b/src/generated/resources/data/forge/tags/blocks/ores/coal.json index 3ed033d1571..c1246af5163 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/coal.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/coal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:coal_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/copper.json b/src/generated/resources/data/forge/tags/blocks/ores/copper.json index ed67d21b308..bfa31f2aed5 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/copper.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:copper_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json b/src/generated/resources/data/forge/tags/blocks/ores/diamond.json index 504de740407..e0fe2e9d0ff 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/diamond.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:diamond_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json b/src/generated/resources/data/forge/tags/blocks/ores/emerald.json index ae49017ce33..fe8bed587cd 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/emerald.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:emerald_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/gold.json b/src/generated/resources/data/forge/tags/blocks/ores/gold.json index 01435af8de7..52f7c26ba19 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/gold.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:gold_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/iron.json b/src/generated/resources/data/forge/tags/blocks/ores/iron.json index f8fab468aad..9b135890e97 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/iron.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:iron_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json b/src/generated/resources/data/forge/tags/blocks/ores/lapis.json index 5d36e036f60..901b01187cd 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/lapis.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:lapis_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json b/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json index 6495885079c..910d1fb8e6a 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ancient_debris" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json b/src/generated/resources/data/forge/tags/blocks/ores/quartz.json index 6c65cff932c..f0bc7a4657c 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/quartz.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_quartz_ore" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json b/src/generated/resources/data/forge/tags/blocks/ores/redstone.json index e6f16c33828..252cdcbb38e 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json +++ b/src/generated/resources/data/forge/tags/blocks/ores/redstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:redstone_ores" ] diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json index 7fdb39a762d..13e0c38aa16 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json +++ b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:deepslate_coal_ore", "minecraft:deepslate_copper_ore", diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json index 67ce55b509f..090233bd460 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json +++ b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_gold_ore", "minecraft:nether_quartz_ore" diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json index 788f1d09816..568fbe7cb67 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json +++ b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:coal_ore", "minecraft:copper_ore", diff --git a/src/generated/resources/data/forge/tags/blocks/sand.json b/src/generated/resources/data/forge/tags/blocks/sand.json index 6207c43cc1e..8b049162834 100644 --- a/src/generated/resources/data/forge/tags/blocks/sand.json +++ b/src/generated/resources/data/forge/tags/blocks/sand.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:sand/colorless", "#forge:sand/red" diff --git a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json b/src/generated/resources/data/forge/tags/blocks/sand/colorless.json index 8f570f7b95f..af14f42f568 100644 --- a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json +++ b/src/generated/resources/data/forge/tags/blocks/sand/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:sand" ] diff --git a/src/generated/resources/data/forge/tags/blocks/sand/red.json b/src/generated/resources/data/forge/tags/blocks/sand/red.json index 9c7731079d8..9934cb5bbcf 100644 --- a/src/generated/resources/data/forge/tags/blocks/sand/red.json +++ b/src/generated/resources/data/forge/tags/blocks/sand/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_sand" ] diff --git a/src/generated/resources/data/forge/tags/blocks/sandstone.json b/src/generated/resources/data/forge/tags/blocks/sandstone.json index 12b4f2170e1..bb7fb03ee3e 100644 --- a/src/generated/resources/data/forge/tags/blocks/sandstone.json +++ b/src/generated/resources/data/forge/tags/blocks/sandstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:sandstone", "minecraft:cut_sandstone", diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass.json b/src/generated/resources/data/forge/tags/blocks/stained_glass.json index 85881bd2498..2db7aef9df4 100644 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass.json +++ b/src/generated/resources/data/forge/tags/blocks/stained_glass.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass", "minecraft:orange_stained_glass", diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json b/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json index 7f913160d90..65f2adb8f9e 100644 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json +++ b/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass_pane", "minecraft:orange_stained_glass_pane", diff --git a/src/generated/resources/data/forge/tags/blocks/stone.json b/src/generated/resources/data/forge/tags/blocks/stone.json index f336e9826d1..958f6e25c78 100644 --- a/src/generated/resources/data/forge/tags/blocks/stone.json +++ b/src/generated/resources/data/forge/tags/blocks/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:andesite", "minecraft:diorite", diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks.json index 8d878588704..5f2a7d417e6 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:storage_blocks/amethyst", "#forge:storage_blocks/coal", diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json index e0656d8d83c..7f66725ab4f 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:amethyst_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json index dbe07ace812..4b7921705b6 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:coal_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json index 1b51fad6c54..015bec70c31 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:copper_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json index bc197775503..acd7f52de5e 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:diamond_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json index 30e292c5580..152063ec6c6 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:emerald_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json index 863d47ad21c..546dde03c96 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gold_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json index f9e01c6a9b2..01fb2965f2c 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:iron_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json index 7de86cb6b56..f4ca82bbd4d 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lapis_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json index 11b9a7230dd..83433d44eb8 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherite_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json index 1321f2077e1..9d2533c64a9 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:quartz_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json index 3a578a0277b..1a21e230ef0 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_copper_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json index 4ce9cc47d14..80781ce6675 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_gold_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json index 14f551c5920..13ed9fc651b 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_iron_block" ] diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json index f20a3ced25c..f5fd89c5414 100644 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json +++ b/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:redstone_block" ] diff --git a/src/generated/resources/data/forge/tags/fluids/milk.json b/src/generated/resources/data/forge/tags/fluids/milk.json index 6aea35f4873..3bab1951b34 100644 --- a/src/generated/resources/data/forge/tags/fluids/milk.json +++ b/src/generated/resources/data/forge/tags/fluids/milk.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ { "id": "minecraft:milk", diff --git a/src/generated/resources/data/forge/tags/items/barrels.json b/src/generated/resources/data/forge/tags/items/barrels.json index 4af754bdecd..1cfb5782c57 100644 --- a/src/generated/resources/data/forge/tags/items/barrels.json +++ b/src/generated/resources/data/forge/tags/items/barrels.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:barrels/wooden" ] diff --git a/src/generated/resources/data/forge/tags/items/barrels/wooden.json b/src/generated/resources/data/forge/tags/items/barrels/wooden.json index 01825818a4a..b07daae1c09 100644 --- a/src/generated/resources/data/forge/tags/items/barrels/wooden.json +++ b/src/generated/resources/data/forge/tags/items/barrels/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:barrel" ] diff --git a/src/generated/resources/data/forge/tags/items/bones.json b/src/generated/resources/data/forge/tags/items/bones.json index f6026e3e55d..5af534fcffb 100644 --- a/src/generated/resources/data/forge/tags/items/bones.json +++ b/src/generated/resources/data/forge/tags/items/bones.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:bone" ] diff --git a/src/generated/resources/data/forge/tags/items/bookshelves.json b/src/generated/resources/data/forge/tags/items/bookshelves.json index 6cdb0ddace6..c09b2185bd1 100644 --- a/src/generated/resources/data/forge/tags/items/bookshelves.json +++ b/src/generated/resources/data/forge/tags/items/bookshelves.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:bookshelf" ] diff --git a/src/generated/resources/data/forge/tags/items/chests.json b/src/generated/resources/data/forge/tags/items/chests.json index edd007876cc..9afff2b15ab 100644 --- a/src/generated/resources/data/forge/tags/items/chests.json +++ b/src/generated/resources/data/forge/tags/items/chests.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:chests/ender", "#forge:chests/trapped", diff --git a/src/generated/resources/data/forge/tags/items/chests/ender.json b/src/generated/resources/data/forge/tags/items/chests/ender.json index 6416580a378..8c0af53136f 100644 --- a/src/generated/resources/data/forge/tags/items/chests/ender.json +++ b/src/generated/resources/data/forge/tags/items/chests/ender.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ender_chest" ] diff --git a/src/generated/resources/data/forge/tags/items/chests/trapped.json b/src/generated/resources/data/forge/tags/items/chests/trapped.json index 7d4855ac214..f8924f5a051 100644 --- a/src/generated/resources/data/forge/tags/items/chests/trapped.json +++ b/src/generated/resources/data/forge/tags/items/chests/trapped.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:trapped_chest" ] diff --git a/src/generated/resources/data/forge/tags/items/chests/wooden.json b/src/generated/resources/data/forge/tags/items/chests/wooden.json index 441d80f5b2b..86533f935bf 100644 --- a/src/generated/resources/data/forge/tags/items/chests/wooden.json +++ b/src/generated/resources/data/forge/tags/items/chests/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:chest", "minecraft:trapped_chest" diff --git a/src/generated/resources/data/forge/tags/items/cobblestone.json b/src/generated/resources/data/forge/tags/items/cobblestone.json index f0884a6f52d..f0ae95b5fcc 100644 --- a/src/generated/resources/data/forge/tags/items/cobblestone.json +++ b/src/generated/resources/data/forge/tags/items/cobblestone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:cobblestone/normal", "#forge:cobblestone/infested", diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json b/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json index f4e249492e6..75f1ba31f44 100644 --- a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json +++ b/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobbled_deepslate" ] diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json b/src/generated/resources/data/forge/tags/items/cobblestone/infested.json index 7fdfc6eff3a..a1d276601e6 100644 --- a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json +++ b/src/generated/resources/data/forge/tags/items/cobblestone/infested.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:infested_cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json index 8bd3f8b93bf..c32be6c962c 100644 --- a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json +++ b/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:mossy_cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json b/src/generated/resources/data/forge/tags/items/cobblestone/normal.json index 5f9fcb470f5..dac674da5d4 100644 --- a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json +++ b/src/generated/resources/data/forge/tags/items/cobblestone/normal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobblestone" ] diff --git a/src/generated/resources/data/forge/tags/items/crops.json b/src/generated/resources/data/forge/tags/items/crops.json index 3bacc9fa7f0..ae5f647fbeb 100644 --- a/src/generated/resources/data/forge/tags/items/crops.json +++ b/src/generated/resources/data/forge/tags/items/crops.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:crops/beetroot", "#forge:crops/carrot", diff --git a/src/generated/resources/data/forge/tags/items/crops/beetroot.json b/src/generated/resources/data/forge/tags/items/crops/beetroot.json index cfe05d1345f..b28b723c4b1 100644 --- a/src/generated/resources/data/forge/tags/items/crops/beetroot.json +++ b/src/generated/resources/data/forge/tags/items/crops/beetroot.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:beetroot" ] diff --git a/src/generated/resources/data/forge/tags/items/crops/carrot.json b/src/generated/resources/data/forge/tags/items/crops/carrot.json index d9898ab418b..f9630d13474 100644 --- a/src/generated/resources/data/forge/tags/items/crops/carrot.json +++ b/src/generated/resources/data/forge/tags/items/crops/carrot.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:carrot" ] diff --git a/src/generated/resources/data/forge/tags/items/crops/nether_wart.json b/src/generated/resources/data/forge/tags/items/crops/nether_wart.json index 727025b7cdd..5960d80cb92 100644 --- a/src/generated/resources/data/forge/tags/items/crops/nether_wart.json +++ b/src/generated/resources/data/forge/tags/items/crops/nether_wart.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_wart" ] diff --git a/src/generated/resources/data/forge/tags/items/crops/potato.json b/src/generated/resources/data/forge/tags/items/crops/potato.json index 9e0e20bce61..47fc151cd15 100644 --- a/src/generated/resources/data/forge/tags/items/crops/potato.json +++ b/src/generated/resources/data/forge/tags/items/crops/potato.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:potato" ] diff --git a/src/generated/resources/data/forge/tags/items/crops/wheat.json b/src/generated/resources/data/forge/tags/items/crops/wheat.json index 0e0c3ea2bc0..498cb445f6e 100644 --- a/src/generated/resources/data/forge/tags/items/crops/wheat.json +++ b/src/generated/resources/data/forge/tags/items/crops/wheat.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:wheat" ] diff --git a/src/generated/resources/data/forge/tags/items/dusts.json b/src/generated/resources/data/forge/tags/items/dusts.json index e0f2721010c..87f0fee447e 100644 --- a/src/generated/resources/data/forge/tags/items/dusts.json +++ b/src/generated/resources/data/forge/tags/items/dusts.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:dusts/glowstone", "#forge:dusts/prismarine", diff --git a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json b/src/generated/resources/data/forge/tags/items/dusts/glowstone.json index 08d35494bb9..668258c523d 100644 --- a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json +++ b/src/generated/resources/data/forge/tags/items/dusts/glowstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glowstone_dust" ] diff --git a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json b/src/generated/resources/data/forge/tags/items/dusts/prismarine.json index 09f011cae61..3773c1f1160 100644 --- a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json +++ b/src/generated/resources/data/forge/tags/items/dusts/prismarine.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:prismarine_shard" ] diff --git a/src/generated/resources/data/forge/tags/items/dusts/redstone.json b/src/generated/resources/data/forge/tags/items/dusts/redstone.json index 2703f553aa3..a096239ec12 100644 --- a/src/generated/resources/data/forge/tags/items/dusts/redstone.json +++ b/src/generated/resources/data/forge/tags/items/dusts/redstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:redstone" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes.json b/src/generated/resources/data/forge/tags/items/dyes.json index 10495c077aa..c8f72c5b6ff 100644 --- a/src/generated/resources/data/forge/tags/items/dyes.json +++ b/src/generated/resources/data/forge/tags/items/dyes.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:dyes/white", "#forge:dyes/orange", diff --git a/src/generated/resources/data/forge/tags/items/dyes/black.json b/src/generated/resources/data/forge/tags/items/dyes/black.json index c25071e2119..a2ecf55c464 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/black.json +++ b/src/generated/resources/data/forge/tags/items/dyes/black.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:black_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/blue.json b/src/generated/resources/data/forge/tags/items/dyes/blue.json index e794506ca0a..e7b78e12a35 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/blue.json +++ b/src/generated/resources/data/forge/tags/items/dyes/blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blue_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/brown.json b/src/generated/resources/data/forge/tags/items/dyes/brown.json index d7744fde88f..8c7249234eb 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/brown.json +++ b/src/generated/resources/data/forge/tags/items/dyes/brown.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/cyan.json b/src/generated/resources/data/forge/tags/items/dyes/cyan.json index 384cb9c6406..f0c5a44002d 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/cyan.json +++ b/src/generated/resources/data/forge/tags/items/dyes/cyan.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cyan_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/gray.json b/src/generated/resources/data/forge/tags/items/dyes/gray.json index 3b7b4389d36..6cdbb27a491 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/gray.json +++ b/src/generated/resources/data/forge/tags/items/dyes/gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gray_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/green.json b/src/generated/resources/data/forge/tags/items/dyes/green.json index 096286bf24f..89fe8ccaf39 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/green.json +++ b/src/generated/resources/data/forge/tags/items/dyes/green.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:green_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/light_blue.json b/src/generated/resources/data/forge/tags/items/dyes/light_blue.json index f280f4fe781..76f1a7786cc 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/light_blue.json +++ b/src/generated/resources/data/forge/tags/items/dyes/light_blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_blue_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/light_gray.json b/src/generated/resources/data/forge/tags/items/dyes/light_gray.json index 82c02bce0d6..596b2efb37f 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/light_gray.json +++ b/src/generated/resources/data/forge/tags/items/dyes/light_gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_gray_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/lime.json b/src/generated/resources/data/forge/tags/items/dyes/lime.json index 415993059da..b0ac91f97e4 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/lime.json +++ b/src/generated/resources/data/forge/tags/items/dyes/lime.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lime_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/magenta.json b/src/generated/resources/data/forge/tags/items/dyes/magenta.json index 810b6e5470e..f6898d4c9b6 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/magenta.json +++ b/src/generated/resources/data/forge/tags/items/dyes/magenta.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:magenta_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/orange.json b/src/generated/resources/data/forge/tags/items/dyes/orange.json index 9939b616945..df54849c593 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/orange.json +++ b/src/generated/resources/data/forge/tags/items/dyes/orange.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:orange_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/pink.json b/src/generated/resources/data/forge/tags/items/dyes/pink.json index c5172b16be3..d9f2898629b 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/pink.json +++ b/src/generated/resources/data/forge/tags/items/dyes/pink.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pink_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/purple.json b/src/generated/resources/data/forge/tags/items/dyes/purple.json index cd6a8fef070..b3ebfe3c262 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/purple.json +++ b/src/generated/resources/data/forge/tags/items/dyes/purple.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:purple_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/red.json b/src/generated/resources/data/forge/tags/items/dyes/red.json index 68b06807fa0..9c6fe34671f 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/red.json +++ b/src/generated/resources/data/forge/tags/items/dyes/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/white.json b/src/generated/resources/data/forge/tags/items/dyes/white.json index 1b92baa6af4..3a30d72b10b 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/white.json +++ b/src/generated/resources/data/forge/tags/items/dyes/white.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/dyes/yellow.json b/src/generated/resources/data/forge/tags/items/dyes/yellow.json index 343377909d5..43499598369 100644 --- a/src/generated/resources/data/forge/tags/items/dyes/yellow.json +++ b/src/generated/resources/data/forge/tags/items/dyes/yellow.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:yellow_dye" ] diff --git a/src/generated/resources/data/forge/tags/items/eggs.json b/src/generated/resources/data/forge/tags/items/eggs.json index ae95fb66999..cbcbec3c4ed 100644 --- a/src/generated/resources/data/forge/tags/items/eggs.json +++ b/src/generated/resources/data/forge/tags/items/eggs.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:egg" ] diff --git a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json b/src/generated/resources/data/forge/tags/items/enchanting_fuels.json index ba8dc492b69..2a4a029cca4 100644 --- a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json +++ b/src/generated/resources/data/forge/tags/items/enchanting_fuels.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:gems/lapis" ] diff --git a/src/generated/resources/data/forge/tags/items/end_stones.json b/src/generated/resources/data/forge/tags/items/end_stones.json index 146dcd9a67e..f2d11375bce 100644 --- a/src/generated/resources/data/forge/tags/items/end_stones.json +++ b/src/generated/resources/data/forge/tags/items/end_stones.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:end_stone" ] diff --git a/src/generated/resources/data/forge/tags/items/ender_pearls.json b/src/generated/resources/data/forge/tags/items/ender_pearls.json index 0b410745d42..135cd1d7761 100644 --- a/src/generated/resources/data/forge/tags/items/ender_pearls.json +++ b/src/generated/resources/data/forge/tags/items/ender_pearls.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ender_pearl" ] diff --git a/src/generated/resources/data/forge/tags/items/feathers.json b/src/generated/resources/data/forge/tags/items/feathers.json index 9540a42ac62..8086200700e 100644 --- a/src/generated/resources/data/forge/tags/items/feathers.json +++ b/src/generated/resources/data/forge/tags/items/feathers.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:feather" ] diff --git a/src/generated/resources/data/forge/tags/items/fence_gates.json b/src/generated/resources/data/forge/tags/items/fence_gates.json index 9508f9133d8..b9a57ac0ef2 100644 --- a/src/generated/resources/data/forge/tags/items/fence_gates.json +++ b/src/generated/resources/data/forge/tags/items/fence_gates.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:fence_gates/wooden" ] diff --git a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json index 0f017436c80..52c3d42462e 100644 --- a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json +++ b/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:oak_fence_gate", "minecraft:spruce_fence_gate", diff --git a/src/generated/resources/data/forge/tags/items/fences.json b/src/generated/resources/data/forge/tags/items/fences.json index 55a5f8542c1..44358edb048 100644 --- a/src/generated/resources/data/forge/tags/items/fences.json +++ b/src/generated/resources/data/forge/tags/items/fences.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:fences/nether_brick", "#forge:fences/wooden" diff --git a/src/generated/resources/data/forge/tags/items/fences/nether_brick.json b/src/generated/resources/data/forge/tags/items/fences/nether_brick.json index c6f0bd76166..3f1aacfa7ef 100644 --- a/src/generated/resources/data/forge/tags/items/fences/nether_brick.json +++ b/src/generated/resources/data/forge/tags/items/fences/nether_brick.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_brick_fence" ] diff --git a/src/generated/resources/data/forge/tags/items/fences/wooden.json b/src/generated/resources/data/forge/tags/items/fences/wooden.json index 80808ad5c9a..81202621144 100644 --- a/src/generated/resources/data/forge/tags/items/fences/wooden.json +++ b/src/generated/resources/data/forge/tags/items/fences/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:wooden_fences" ] diff --git a/src/generated/resources/data/forge/tags/items/gems.json b/src/generated/resources/data/forge/tags/items/gems.json index dfa2226a277..60af4bab680 100644 --- a/src/generated/resources/data/forge/tags/items/gems.json +++ b/src/generated/resources/data/forge/tags/items/gems.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:gems/amethyst", "#forge:gems/diamond", diff --git a/src/generated/resources/data/forge/tags/items/gems/amethyst.json b/src/generated/resources/data/forge/tags/items/gems/amethyst.json index 10553e567e2..742ef896d5b 100644 --- a/src/generated/resources/data/forge/tags/items/gems/amethyst.json +++ b/src/generated/resources/data/forge/tags/items/gems/amethyst.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:amethyst_shard" ] diff --git a/src/generated/resources/data/forge/tags/items/gems/diamond.json b/src/generated/resources/data/forge/tags/items/gems/diamond.json index a0b7317d86a..f44f30dd550 100644 --- a/src/generated/resources/data/forge/tags/items/gems/diamond.json +++ b/src/generated/resources/data/forge/tags/items/gems/diamond.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:diamond" ] diff --git a/src/generated/resources/data/forge/tags/items/gems/emerald.json b/src/generated/resources/data/forge/tags/items/gems/emerald.json index 838caf0bd94..07a09821180 100644 --- a/src/generated/resources/data/forge/tags/items/gems/emerald.json +++ b/src/generated/resources/data/forge/tags/items/gems/emerald.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:emerald" ] diff --git a/src/generated/resources/data/forge/tags/items/gems/lapis.json b/src/generated/resources/data/forge/tags/items/gems/lapis.json index e46a6472215..614441df46c 100644 --- a/src/generated/resources/data/forge/tags/items/gems/lapis.json +++ b/src/generated/resources/data/forge/tags/items/gems/lapis.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lapis_lazuli" ] diff --git a/src/generated/resources/data/forge/tags/items/gems/prismarine.json b/src/generated/resources/data/forge/tags/items/gems/prismarine.json index 6e3777b0930..150e7ff7114 100644 --- a/src/generated/resources/data/forge/tags/items/gems/prismarine.json +++ b/src/generated/resources/data/forge/tags/items/gems/prismarine.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:prismarine_crystals" ] diff --git a/src/generated/resources/data/forge/tags/items/gems/quartz.json b/src/generated/resources/data/forge/tags/items/gems/quartz.json index 49ac1fd1527..aad2eef95bf 100644 --- a/src/generated/resources/data/forge/tags/items/gems/quartz.json +++ b/src/generated/resources/data/forge/tags/items/gems/quartz.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:quartz" ] diff --git a/src/generated/resources/data/forge/tags/items/glass.json b/src/generated/resources/data/forge/tags/items/glass.json index 943aa90b5da..fec31169ee1 100644 --- a/src/generated/resources/data/forge/tags/items/glass.json +++ b/src/generated/resources/data/forge/tags/items/glass.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:glass/colorless", "#forge:stained_glass", diff --git a/src/generated/resources/data/forge/tags/items/glass/black.json b/src/generated/resources/data/forge/tags/items/glass/black.json index 4f01d11d87d..9965b5e8b4b 100644 --- a/src/generated/resources/data/forge/tags/items/glass/black.json +++ b/src/generated/resources/data/forge/tags/items/glass/black.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:black_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/blue.json b/src/generated/resources/data/forge/tags/items/glass/blue.json index f00b8f0a6ca..f59e58c6bf7 100644 --- a/src/generated/resources/data/forge/tags/items/glass/blue.json +++ b/src/generated/resources/data/forge/tags/items/glass/blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blue_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/brown.json b/src/generated/resources/data/forge/tags/items/glass/brown.json index b201d9ca08b..490015cbb51 100644 --- a/src/generated/resources/data/forge/tags/items/glass/brown.json +++ b/src/generated/resources/data/forge/tags/items/glass/brown.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/colorless.json b/src/generated/resources/data/forge/tags/items/glass/colorless.json index 41c35c32297..ac8b5e50863 100644 --- a/src/generated/resources/data/forge/tags/items/glass/colorless.json +++ b/src/generated/resources/data/forge/tags/items/glass/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/cyan.json b/src/generated/resources/data/forge/tags/items/glass/cyan.json index 5663dae0083..24d84747fa8 100644 --- a/src/generated/resources/data/forge/tags/items/glass/cyan.json +++ b/src/generated/resources/data/forge/tags/items/glass/cyan.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cyan_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/gray.json b/src/generated/resources/data/forge/tags/items/glass/gray.json index 17f2ac1427a..2f309170cab 100644 --- a/src/generated/resources/data/forge/tags/items/glass/gray.json +++ b/src/generated/resources/data/forge/tags/items/glass/gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gray_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/green.json b/src/generated/resources/data/forge/tags/items/glass/green.json index 1af1fa0a99e..d7946c1aca9 100644 --- a/src/generated/resources/data/forge/tags/items/glass/green.json +++ b/src/generated/resources/data/forge/tags/items/glass/green.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:green_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/light_blue.json b/src/generated/resources/data/forge/tags/items/glass/light_blue.json index 681d8f5e5ff..dc8e6b71485 100644 --- a/src/generated/resources/data/forge/tags/items/glass/light_blue.json +++ b/src/generated/resources/data/forge/tags/items/glass/light_blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_blue_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/light_gray.json b/src/generated/resources/data/forge/tags/items/glass/light_gray.json index bbb35c80d71..f165a46c904 100644 --- a/src/generated/resources/data/forge/tags/items/glass/light_gray.json +++ b/src/generated/resources/data/forge/tags/items/glass/light_gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_gray_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/lime.json b/src/generated/resources/data/forge/tags/items/glass/lime.json index a9cf3d59476..b6bb1d9415e 100644 --- a/src/generated/resources/data/forge/tags/items/glass/lime.json +++ b/src/generated/resources/data/forge/tags/items/glass/lime.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lime_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/magenta.json b/src/generated/resources/data/forge/tags/items/glass/magenta.json index c1d51e99b2f..aa6a4825e82 100644 --- a/src/generated/resources/data/forge/tags/items/glass/magenta.json +++ b/src/generated/resources/data/forge/tags/items/glass/magenta.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:magenta_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/orange.json b/src/generated/resources/data/forge/tags/items/glass/orange.json index 4f99b379ea3..9322f51fe4d 100644 --- a/src/generated/resources/data/forge/tags/items/glass/orange.json +++ b/src/generated/resources/data/forge/tags/items/glass/orange.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:orange_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/pink.json b/src/generated/resources/data/forge/tags/items/glass/pink.json index 2cf72414122..58b65891fc5 100644 --- a/src/generated/resources/data/forge/tags/items/glass/pink.json +++ b/src/generated/resources/data/forge/tags/items/glass/pink.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pink_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/purple.json b/src/generated/resources/data/forge/tags/items/glass/purple.json index 25e9a26469e..d75a9e7308f 100644 --- a/src/generated/resources/data/forge/tags/items/glass/purple.json +++ b/src/generated/resources/data/forge/tags/items/glass/purple.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:purple_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/red.json b/src/generated/resources/data/forge/tags/items/glass/red.json index 5b04856508a..72af78c0294 100644 --- a/src/generated/resources/data/forge/tags/items/glass/red.json +++ b/src/generated/resources/data/forge/tags/items/glass/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/silica.json b/src/generated/resources/data/forge/tags/items/glass/silica.json index 7ae1f6ddba8..74544c770db 100644 --- a/src/generated/resources/data/forge/tags/items/glass/silica.json +++ b/src/generated/resources/data/forge/tags/items/glass/silica.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass", "minecraft:black_stained_glass", diff --git a/src/generated/resources/data/forge/tags/items/glass/tinted.json b/src/generated/resources/data/forge/tags/items/glass/tinted.json index 1567b7fd943..4075a1556b3 100644 --- a/src/generated/resources/data/forge/tags/items/glass/tinted.json +++ b/src/generated/resources/data/forge/tags/items/glass/tinted.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:tinted_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/white.json b/src/generated/resources/data/forge/tags/items/glass/white.json index ce529c5f099..fb180e703e4 100644 --- a/src/generated/resources/data/forge/tags/items/glass/white.json +++ b/src/generated/resources/data/forge/tags/items/glass/white.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass/yellow.json b/src/generated/resources/data/forge/tags/items/glass/yellow.json index e8120972fa0..0831bea4cca 100644 --- a/src/generated/resources/data/forge/tags/items/glass/yellow.json +++ b/src/generated/resources/data/forge/tags/items/glass/yellow.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:yellow_stained_glass" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes.json b/src/generated/resources/data/forge/tags/items/glass_panes.json index 54d1bc517f8..4b95330d4f5 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:glass_panes/colorless", "#forge:stained_glass_panes" diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/black.json b/src/generated/resources/data/forge/tags/items/glass_panes/black.json index ea0ccfb61a9..ebda555dcd4 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/black.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/black.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:black_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/blue.json b/src/generated/resources/data/forge/tags/items/glass_panes/blue.json index dd2834f5200..2762890aa90 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/blue.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blue_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/brown.json b/src/generated/resources/data/forge/tags/items/glass_panes/brown.json index d428cc7cd9b..0b5b7274916 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/brown.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/brown.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json b/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json index a0638aacede..eb5756f9643 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json b/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json index 90bda4e2e07..9913e90a964 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cyan_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/gray.json b/src/generated/resources/data/forge/tags/items/glass_panes/gray.json index cf7cc647571..9fe30b26a89 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/gray.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gray_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/green.json b/src/generated/resources/data/forge/tags/items/glass_panes/green.json index 80d123f3b52..ab913210286 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/green.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/green.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:green_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json b/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json index 22c38c65e88..cd6d399022d 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_blue_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json b/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json index 08bf8e84626..7be6a4ce81d 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:light_gray_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/lime.json b/src/generated/resources/data/forge/tags/items/glass_panes/lime.json index 6319bf5e67b..46dec64b22e 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/lime.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/lime.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lime_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json b/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json index e4efb3c414d..7504bc3fa37 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:magenta_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/orange.json b/src/generated/resources/data/forge/tags/items/glass_panes/orange.json index 0764afe55c7..1c47e346166 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/orange.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/orange.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:orange_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/pink.json b/src/generated/resources/data/forge/tags/items/glass_panes/pink.json index 2e34eda30ef..28e36b973f6 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/pink.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/pink.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pink_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/purple.json b/src/generated/resources/data/forge/tags/items/glass_panes/purple.json index a3d2c78235b..a3cff33a142 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/purple.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/purple.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:purple_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/red.json b/src/generated/resources/data/forge/tags/items/glass_panes/red.json index 191a08d50aa..5edd855d716 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/red.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/white.json b/src/generated/resources/data/forge/tags/items/glass_panes/white.json index 3f759cfc8f1..b514a2839f8 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/white.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/white.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json b/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json index 53793f5fb37..a293eb9dc88 100644 --- a/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json +++ b/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:yellow_stained_glass_pane" ] diff --git a/src/generated/resources/data/forge/tags/items/gravel.json b/src/generated/resources/data/forge/tags/items/gravel.json index 087cf289d61..f6968bff68a 100644 --- a/src/generated/resources/data/forge/tags/items/gravel.json +++ b/src/generated/resources/data/forge/tags/items/gravel.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gravel" ] diff --git a/src/generated/resources/data/forge/tags/items/gunpowder.json b/src/generated/resources/data/forge/tags/items/gunpowder.json index c517ea17563..d5835ce7f91 100644 --- a/src/generated/resources/data/forge/tags/items/gunpowder.json +++ b/src/generated/resources/data/forge/tags/items/gunpowder.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gunpowder" ] diff --git a/src/generated/resources/data/forge/tags/items/heads.json b/src/generated/resources/data/forge/tags/items/heads.json index b5a3caaf24f..430af37ee54 100644 --- a/src/generated/resources/data/forge/tags/items/heads.json +++ b/src/generated/resources/data/forge/tags/items/heads.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:creeper_head", "minecraft:dragon_head", diff --git a/src/generated/resources/data/forge/tags/items/ingots.json b/src/generated/resources/data/forge/tags/items/ingots.json index 1e1a261763b..e9756bb39c0 100644 --- a/src/generated/resources/data/forge/tags/items/ingots.json +++ b/src/generated/resources/data/forge/tags/items/ingots.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:ingots/brick", "#forge:ingots/copper", diff --git a/src/generated/resources/data/forge/tags/items/ingots/brick.json b/src/generated/resources/data/forge/tags/items/ingots/brick.json index b7eabaa8447..8f632e499a6 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/brick.json +++ b/src/generated/resources/data/forge/tags/items/ingots/brick.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brick" ] diff --git a/src/generated/resources/data/forge/tags/items/ingots/copper.json b/src/generated/resources/data/forge/tags/items/ingots/copper.json index 4b0daa0db93..1cc1f065c5f 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/copper.json +++ b/src/generated/resources/data/forge/tags/items/ingots/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:copper_ingot" ] diff --git a/src/generated/resources/data/forge/tags/items/ingots/gold.json b/src/generated/resources/data/forge/tags/items/ingots/gold.json index d88f9571abc..07e9f66a309 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/gold.json +++ b/src/generated/resources/data/forge/tags/items/ingots/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gold_ingot" ] diff --git a/src/generated/resources/data/forge/tags/items/ingots/iron.json b/src/generated/resources/data/forge/tags/items/ingots/iron.json index 549adc47160..c656021bdbe 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/iron.json +++ b/src/generated/resources/data/forge/tags/items/ingots/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:iron_ingot" ] diff --git a/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json b/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json index 709e0c77b1b..ec7ed3ee9ad 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json +++ b/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_brick" ] diff --git a/src/generated/resources/data/forge/tags/items/ingots/netherite.json b/src/generated/resources/data/forge/tags/items/ingots/netherite.json index ff3f383d694..bd6929df75c 100644 --- a/src/generated/resources/data/forge/tags/items/ingots/netherite.json +++ b/src/generated/resources/data/forge/tags/items/ingots/netherite.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherite_ingot" ] diff --git a/src/generated/resources/data/forge/tags/items/leather.json b/src/generated/resources/data/forge/tags/items/leather.json index 8247c9a3a20..71b797d35ba 100644 --- a/src/generated/resources/data/forge/tags/items/leather.json +++ b/src/generated/resources/data/forge/tags/items/leather.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:leather" ] diff --git a/src/generated/resources/data/forge/tags/items/mushrooms.json b/src/generated/resources/data/forge/tags/items/mushrooms.json index 0b6b09481a6..471cd77f070 100644 --- a/src/generated/resources/data/forge/tags/items/mushrooms.json +++ b/src/generated/resources/data/forge/tags/items/mushrooms.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:brown_mushroom", "minecraft:red_mushroom" diff --git a/src/generated/resources/data/forge/tags/items/nether_stars.json b/src/generated/resources/data/forge/tags/items/nether_stars.json index 9c3c474d79a..737a95d0833 100644 --- a/src/generated/resources/data/forge/tags/items/nether_stars.json +++ b/src/generated/resources/data/forge/tags/items/nether_stars.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_star" ] diff --git a/src/generated/resources/data/forge/tags/items/netherrack.json b/src/generated/resources/data/forge/tags/items/netherrack.json index d54c65bbb4b..daa9c66701a 100644 --- a/src/generated/resources/data/forge/tags/items/netherrack.json +++ b/src/generated/resources/data/forge/tags/items/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherrack" ] diff --git a/src/generated/resources/data/forge/tags/items/nuggets.json b/src/generated/resources/data/forge/tags/items/nuggets.json index dfe53a6a1d4..fb0dc26ecdf 100644 --- a/src/generated/resources/data/forge/tags/items/nuggets.json +++ b/src/generated/resources/data/forge/tags/items/nuggets.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:nuggets/iron", "#forge:nuggets/gold" diff --git a/src/generated/resources/data/forge/tags/items/nuggets/gold.json b/src/generated/resources/data/forge/tags/items/nuggets/gold.json index 2fe99bd9df7..4d943459579 100644 --- a/src/generated/resources/data/forge/tags/items/nuggets/gold.json +++ b/src/generated/resources/data/forge/tags/items/nuggets/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gold_nugget" ] diff --git a/src/generated/resources/data/forge/tags/items/nuggets/iron.json b/src/generated/resources/data/forge/tags/items/nuggets/iron.json index 50e3f7a19f7..cbd20ac6e4f 100644 --- a/src/generated/resources/data/forge/tags/items/nuggets/iron.json +++ b/src/generated/resources/data/forge/tags/items/nuggets/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:iron_nugget" ] diff --git a/src/generated/resources/data/forge/tags/items/obsidian.json b/src/generated/resources/data/forge/tags/items/obsidian.json index 03a3719e301..170248454b1 100644 --- a/src/generated/resources/data/forge/tags/items/obsidian.json +++ b/src/generated/resources/data/forge/tags/items/obsidian.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:obsidian" ] diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json index 9036a21131d..0012c241a31 100644 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json +++ b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:deepslate" ] diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json index d54c65bbb4b..daa9c66701a 100644 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json +++ b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherrack" ] diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json index 52fd055337c..c2d7c79f3e7 100644 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json +++ b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:stone" ] diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json b/src/generated/resources/data/forge/tags/items/ore_rates/dense.json index 4bd4cb5433b..69cfa783438 100644 --- a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json +++ b/src/generated/resources/data/forge/tags/items/ore_rates/dense.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:copper_ore", "minecraft:deepslate_copper_ore", diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json b/src/generated/resources/data/forge/tags/items/ore_rates/singular.json index 43ba2ab490a..79e0f4b9a7c 100644 --- a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json +++ b/src/generated/resources/data/forge/tags/items/ore_rates/singular.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ancient_debris", "minecraft:coal_ore", diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json b/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json index 31be071fedd..3caf9ffe44e 100644 --- a/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json +++ b/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_gold_ore" ] diff --git a/src/generated/resources/data/forge/tags/items/ores.json b/src/generated/resources/data/forge/tags/items/ores.json index a2224abfd25..2c4beabc55b 100644 --- a/src/generated/resources/data/forge/tags/items/ores.json +++ b/src/generated/resources/data/forge/tags/items/ores.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:ores/coal", "#forge:ores/copper", diff --git a/src/generated/resources/data/forge/tags/items/ores/coal.json b/src/generated/resources/data/forge/tags/items/ores/coal.json index 3ed033d1571..c1246af5163 100644 --- a/src/generated/resources/data/forge/tags/items/ores/coal.json +++ b/src/generated/resources/data/forge/tags/items/ores/coal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:coal_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/copper.json b/src/generated/resources/data/forge/tags/items/ores/copper.json index ed67d21b308..bfa31f2aed5 100644 --- a/src/generated/resources/data/forge/tags/items/ores/copper.json +++ b/src/generated/resources/data/forge/tags/items/ores/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:copper_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/diamond.json b/src/generated/resources/data/forge/tags/items/ores/diamond.json index 504de740407..e0fe2e9d0ff 100644 --- a/src/generated/resources/data/forge/tags/items/ores/diamond.json +++ b/src/generated/resources/data/forge/tags/items/ores/diamond.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:diamond_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/emerald.json b/src/generated/resources/data/forge/tags/items/ores/emerald.json index ae49017ce33..fe8bed587cd 100644 --- a/src/generated/resources/data/forge/tags/items/ores/emerald.json +++ b/src/generated/resources/data/forge/tags/items/ores/emerald.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:emerald_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/gold.json b/src/generated/resources/data/forge/tags/items/ores/gold.json index 01435af8de7..52f7c26ba19 100644 --- a/src/generated/resources/data/forge/tags/items/ores/gold.json +++ b/src/generated/resources/data/forge/tags/items/ores/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:gold_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/iron.json b/src/generated/resources/data/forge/tags/items/ores/iron.json index f8fab468aad..9b135890e97 100644 --- a/src/generated/resources/data/forge/tags/items/ores/iron.json +++ b/src/generated/resources/data/forge/tags/items/ores/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:iron_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/lapis.json b/src/generated/resources/data/forge/tags/items/ores/lapis.json index 5d36e036f60..901b01187cd 100644 --- a/src/generated/resources/data/forge/tags/items/ores/lapis.json +++ b/src/generated/resources/data/forge/tags/items/ores/lapis.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:lapis_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json b/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json index 6495885079c..910d1fb8e6a 100644 --- a/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json +++ b/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ancient_debris" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/quartz.json b/src/generated/resources/data/forge/tags/items/ores/quartz.json index 6c65cff932c..f0bc7a4657c 100644 --- a/src/generated/resources/data/forge/tags/items/ores/quartz.json +++ b/src/generated/resources/data/forge/tags/items/ores/quartz.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_quartz_ore" ] diff --git a/src/generated/resources/data/forge/tags/items/ores/redstone.json b/src/generated/resources/data/forge/tags/items/ores/redstone.json index e6f16c33828..252cdcbb38e 100644 --- a/src/generated/resources/data/forge/tags/items/ores/redstone.json +++ b/src/generated/resources/data/forge/tags/items/ores/redstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:redstone_ores" ] diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json index 7fdb39a762d..13e0c38aa16 100644 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json +++ b/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:deepslate_coal_ore", "minecraft:deepslate_copper_ore", diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json index 67ce55b509f..090233bd460 100644 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json +++ b/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_gold_ore", "minecraft:nether_quartz_ore" diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json index 788f1d09816..568fbe7cb67 100644 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json +++ b/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:coal_ore", "minecraft:copper_ore", diff --git a/src/generated/resources/data/forge/tags/items/raw_materials.json b/src/generated/resources/data/forge/tags/items/raw_materials.json index 15956f48872..35208231e07 100644 --- a/src/generated/resources/data/forge/tags/items/raw_materials.json +++ b/src/generated/resources/data/forge/tags/items/raw_materials.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:raw_materials/copper", "#forge:raw_materials/gold", diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/copper.json b/src/generated/resources/data/forge/tags/items/raw_materials/copper.json index cb1b852f383..3e03ab9ca8a 100644 --- a/src/generated/resources/data/forge/tags/items/raw_materials/copper.json +++ b/src/generated/resources/data/forge/tags/items/raw_materials/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_copper" ] diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/gold.json b/src/generated/resources/data/forge/tags/items/raw_materials/gold.json index 3ac7724642c..3d1252e5f9d 100644 --- a/src/generated/resources/data/forge/tags/items/raw_materials/gold.json +++ b/src/generated/resources/data/forge/tags/items/raw_materials/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_gold" ] diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/iron.json b/src/generated/resources/data/forge/tags/items/raw_materials/iron.json index 9c072749ce0..8f9af48d8e1 100644 --- a/src/generated/resources/data/forge/tags/items/raw_materials/iron.json +++ b/src/generated/resources/data/forge/tags/items/raw_materials/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_iron" ] diff --git a/src/generated/resources/data/forge/tags/items/rods.json b/src/generated/resources/data/forge/tags/items/rods.json index 6833a3b5cc3..11b8cb38446 100644 --- a/src/generated/resources/data/forge/tags/items/rods.json +++ b/src/generated/resources/data/forge/tags/items/rods.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:rods/blaze", "#forge:rods/wooden" diff --git a/src/generated/resources/data/forge/tags/items/rods/blaze.json b/src/generated/resources/data/forge/tags/items/rods/blaze.json index 8cbb7bc030d..5d2eff8311d 100644 --- a/src/generated/resources/data/forge/tags/items/rods/blaze.json +++ b/src/generated/resources/data/forge/tags/items/rods/blaze.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:blaze_rod" ] diff --git a/src/generated/resources/data/forge/tags/items/rods/wooden.json b/src/generated/resources/data/forge/tags/items/rods/wooden.json index 390efe69243..019b63dd31d 100644 --- a/src/generated/resources/data/forge/tags/items/rods/wooden.json +++ b/src/generated/resources/data/forge/tags/items/rods/wooden.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:stick" ] diff --git a/src/generated/resources/data/forge/tags/items/sand.json b/src/generated/resources/data/forge/tags/items/sand.json index 6207c43cc1e..8b049162834 100644 --- a/src/generated/resources/data/forge/tags/items/sand.json +++ b/src/generated/resources/data/forge/tags/items/sand.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:sand/colorless", "#forge:sand/red" diff --git a/src/generated/resources/data/forge/tags/items/sand/colorless.json b/src/generated/resources/data/forge/tags/items/sand/colorless.json index 8f570f7b95f..af14f42f568 100644 --- a/src/generated/resources/data/forge/tags/items/sand/colorless.json +++ b/src/generated/resources/data/forge/tags/items/sand/colorless.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:sand" ] diff --git a/src/generated/resources/data/forge/tags/items/sand/red.json b/src/generated/resources/data/forge/tags/items/sand/red.json index 9c7731079d8..9934cb5bbcf 100644 --- a/src/generated/resources/data/forge/tags/items/sand/red.json +++ b/src/generated/resources/data/forge/tags/items/sand/red.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:red_sand" ] diff --git a/src/generated/resources/data/forge/tags/items/sandstone.json b/src/generated/resources/data/forge/tags/items/sandstone.json index 12b4f2170e1..bb7fb03ee3e 100644 --- a/src/generated/resources/data/forge/tags/items/sandstone.json +++ b/src/generated/resources/data/forge/tags/items/sandstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:sandstone", "minecraft:cut_sandstone", diff --git a/src/generated/resources/data/forge/tags/items/seeds.json b/src/generated/resources/data/forge/tags/items/seeds.json index 6a1aab958d4..423d5bb52d0 100644 --- a/src/generated/resources/data/forge/tags/items/seeds.json +++ b/src/generated/resources/data/forge/tags/items/seeds.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:seeds/beetroot", "#forge:seeds/melon", diff --git a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json b/src/generated/resources/data/forge/tags/items/seeds/beetroot.json index 7a28601e782..da5a4ab7eff 100644 --- a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json +++ b/src/generated/resources/data/forge/tags/items/seeds/beetroot.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:beetroot_seeds" ] diff --git a/src/generated/resources/data/forge/tags/items/seeds/melon.json b/src/generated/resources/data/forge/tags/items/seeds/melon.json index 3617bfab064..973c52ea124 100644 --- a/src/generated/resources/data/forge/tags/items/seeds/melon.json +++ b/src/generated/resources/data/forge/tags/items/seeds/melon.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:melon_seeds" ] diff --git a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json b/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json index 0c9c3422345..264c06bf04f 100644 --- a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json +++ b/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:pumpkin_seeds" ] diff --git a/src/generated/resources/data/forge/tags/items/seeds/wheat.json b/src/generated/resources/data/forge/tags/items/seeds/wheat.json index d7322a77143..b90459c2910 100644 --- a/src/generated/resources/data/forge/tags/items/seeds/wheat.json +++ b/src/generated/resources/data/forge/tags/items/seeds/wheat.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:wheat_seeds" ] diff --git a/src/generated/resources/data/forge/tags/items/shears.json b/src/generated/resources/data/forge/tags/items/shears.json index 7aeb6cb4716..24000781662 100644 --- a/src/generated/resources/data/forge/tags/items/shears.json +++ b/src/generated/resources/data/forge/tags/items/shears.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:shears" ] diff --git a/src/generated/resources/data/forge/tags/items/slimeballs.json b/src/generated/resources/data/forge/tags/items/slimeballs.json index 2440109f538..533c25d9163 100644 --- a/src/generated/resources/data/forge/tags/items/slimeballs.json +++ b/src/generated/resources/data/forge/tags/items/slimeballs.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:slime_ball" ] diff --git a/src/generated/resources/data/forge/tags/items/stained_glass.json b/src/generated/resources/data/forge/tags/items/stained_glass.json index 85881bd2498..2db7aef9df4 100644 --- a/src/generated/resources/data/forge/tags/items/stained_glass.json +++ b/src/generated/resources/data/forge/tags/items/stained_glass.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass", "minecraft:orange_stained_glass", diff --git a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json b/src/generated/resources/data/forge/tags/items/stained_glass_panes.json index 7f913160d90..65f2adb8f9e 100644 --- a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json +++ b/src/generated/resources/data/forge/tags/items/stained_glass_panes.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:white_stained_glass_pane", "minecraft:orange_stained_glass_pane", diff --git a/src/generated/resources/data/forge/tags/items/stone.json b/src/generated/resources/data/forge/tags/items/stone.json index f336e9826d1..958f6e25c78 100644 --- a/src/generated/resources/data/forge/tags/items/stone.json +++ b/src/generated/resources/data/forge/tags/items/stone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:andesite", "minecraft:diorite", diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks.json b/src/generated/resources/data/forge/tags/items/storage_blocks.json index 8d878588704..5f2a7d417e6 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:storage_blocks/amethyst", "#forge:storage_blocks/coal", diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json b/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json index e0656d8d83c..7f66725ab4f 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:amethyst_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json b/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json index dbe07ace812..4b7921705b6 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:coal_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json b/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json index 1b51fad6c54..015bec70c31 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:copper_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json b/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json index bc197775503..acd7f52de5e 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:diamond_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json b/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json index 30e292c5580..152063ec6c6 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:emerald_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json b/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json index 863d47ad21c..546dde03c96 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:gold_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json b/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json index f9e01c6a9b2..01fb2965f2c 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:iron_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json b/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json index 7de86cb6b56..f4ca82bbd4d 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lapis_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json b/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json index 11b9a7230dd..83433d44eb8 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:netherite_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json b/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json index 1321f2077e1..9d2533c64a9 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:quartz_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json index 3a578a0277b..1a21e230ef0 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_copper_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json index 4ce9cc47d14..80781ce6675 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_gold_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json index 14f551c5920..13ed9fc651b 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:raw_iron_block" ] diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json b/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json index f20a3ced25c..f5fd89c5414 100644 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json +++ b/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:redstone_block" ] diff --git a/src/generated/resources/data/forge/tags/items/string.json b/src/generated/resources/data/forge/tags/items/string.json index 90efbd85941..d018256cf83 100644 --- a/src/generated/resources/data/forge/tags/items/string.json +++ b/src/generated/resources/data/forge/tags/items/string.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:string" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_beach.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_beach.json index 6f849204fb5..a17caed82ce 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_beach.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_beach.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:beach", "minecraft:stony_shore", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json index 4ad2ab0f87a..c259645d12a 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:taiga", "minecraft:the_end", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json index 3c1edbb82b7..73d3eff3b0e 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:the_end", "minecraft:small_end_islands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json index 5a7e50d40a1..4d7cf8a9574 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:taiga", "minecraft:frozen_ocean", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json index 5e148dfb752..6c114dbc656 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:taiga", "minecraft:snowy_taiga", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json index 3cf393899fb..9491a24bc8b 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:jungle", "minecraft:dark_forest", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json index 3cf393899fb..9491a24bc8b 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:jungle", "minecraft:dark_forest", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json index 26285b8ffb8..a8022b3ae22 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:desert", "minecraft:nether_wastes", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json index 3c1edbb82b7..73d3eff3b0e 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:the_end", "minecraft:small_end_islands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json index 077b7bd87dc..340c9d161b2 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_wastes", "minecraft:soul_sand_valley", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json index c8c758008d8..5f0fa0bfeef 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:desert", "minecraft:badlands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_end.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_end.json index 3c1edbb82b7..73d3eff3b0e 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_end.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_end.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:the_end", "minecraft:small_end_islands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json index 533acf4b27f..f4aec3d0fc2 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:desert", "minecraft:nether_wastes", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json index 077b7bd87dc..340c9d161b2 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:nether_wastes", "minecraft:soul_sand_valley", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json index 392d9ab7008..006af083b42 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:desert", "minecraft:jungle", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json index 282a13ea8cb..14035f0a54d 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lush_caves" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json index f97ef264452..05d85d951d7 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:mushroom_fields" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_overworld.json index 636e21e92af..79caff70892 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:ocean", "minecraft:plains", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json index 34f5c0ed94a..c9597b86d04 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:jagged_peaks", "minecraft:frozen_peaks", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json index c5b9f88cb31..9028b691af0 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:plains", "minecraft:snowy_plains", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json index 47c59bdba2c..2fb321e9b71 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:savanna_plateau", "minecraft:wooded_badlands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json index 4f617192839..8b986a6a5e8 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:mushroom_fields", "minecraft:sparse_jungle", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json index 62d24fad3f5..8768992c140 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:desert", "minecraft:badlands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_savanna.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_savanna.json index b39cd12ae64..fc71cb52355 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_savanna.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_savanna.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:savanna", "minecraft:savanna_plateau", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json index 3944e3db159..453f828613d 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:savanna_plateau", "minecraft:wooded_badlands", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json index c8ca4283568..e1310e08ee7 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:frozen_ocean", "minecraft:frozen_river", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json index 6ff5a34937b..e9652824e63 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:windswept_forest", "minecraft:savanna", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json index 6ff5a34937b..e9652824e63 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:windswept_forest", "minecraft:savanna", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json index 4219c7532a6..2d31b9e8e4c 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:dark_forest" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json index cbcd00774d1..6afa2575442 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:swamp" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json index 030d43974db..b01b1bd9095 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:lush_caves", "minecraft:dripstone_caves" diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json index 76ee2112569..f55aea66711 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:the_void" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json index 54db173ca72..05a22cb3c92 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:snowy_plains" ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json index 50334d5c0d6..800c17196b5 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#minecraft:is_ocean", "#minecraft:is_river" diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json index 3d94483dde3..628eed2b870 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:swamp", "minecraft:jungle", diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json index d1231e6f9a8..c7b9b206959 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json +++ b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:swamp", "minecraft:jungle", diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json index b5c1cddd065..50d945a2a85 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:acacia_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,33 +121,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json index fda0e111c67..99c9e1e6ab0 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:azalea" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,33 +121,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json index 053c26954cb..3a2e85a9cb7 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:birch_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,33 +121,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json index 307bc17d003..ed4c91a9b9c 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -47,7 +46,8 @@ } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json index 891c672df63..cd9c3abc00b 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:dark_oak_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,6 +121,10 @@ "name": "minecraft:stick" } ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -102,8 +132,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -121,11 +151,7 @@ ] } } - ] - }, - { - "rolls": 1.0, - "bonus_rolls": 0.0, + ], "entries": [ { "type": "minecraft:item", @@ -134,47 +160,21 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.005, 0.0055555557, 0.00625, 0.008333334, 0.025 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:apple" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json b/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json index feffd6709a0..e4a208c91d9 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -12,8 +11,8 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "name": "minecraft:dead_bush" @@ -22,13 +21,13 @@ "type": "minecraft:item", "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 0.0, - "max": 2.0 + "max": 2.0, + "min": 0.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -38,7 +37,8 @@ } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json b/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json index 38c7bec57f6..2c5a88b3a55 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -12,8 +11,8 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "name": "minecraft:fern" @@ -22,15 +21,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "functions": [ { - "function": "minecraft:apply_bonus", "enchantment": "minecraft:fortune", "formula": "minecraft:uniform_bonus_count", + "function": "minecraft:apply_bonus", "parameters": { "bonusMultiplier": 2 } @@ -43,7 +42,8 @@ } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json index 928f7ebc3bb..bafa47e5678 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:flowering_azalea" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,33 +121,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json b/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json index 07d73ebc2a9..47ed6e39d9c 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json @@ -2,106 +2,105 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "functions": [ { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { - "east": "true" + "down": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { - "west": "true" + "up": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { "north": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { "south": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { - "up": "true" + "west": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:glow_lichen", + "condition": "minecraft:block_state_property", "properties": { - "down": "true" + "east": "true" } } ], "count": 1.0, - "add": true + "function": "minecraft:set_count" }, { - "function": "minecraft:set_count", + "add": true, "count": -1.0, - "add": true + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -109,7 +108,8 @@ ], "name": "minecraft:glow_lichen" } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json index ad3f12719e1..2b65ae05498 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -12,8 +11,8 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "name": "minecraft:grass" @@ -22,15 +21,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "functions": [ { - "function": "minecraft:apply_bonus", "enchantment": "minecraft:fortune", "formula": "minecraft:uniform_bonus_count", + "function": "minecraft:apply_bonus", "parameters": { "bonusMultiplier": 2 } @@ -43,7 +42,8 @@ } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json b/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json index d74ce369239..f7630ca5835 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json @@ -2,20 +2,20 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "name": "minecraft:hanging_roots" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json index 596cb094ce7..e05eab515b5 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,51 +42,78 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:jungle_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -96,33 +122,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json index 701b6862680..ed07012313f 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json @@ -2,8 +2,30 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "block": "minecraft:large_fern", + "condition": "minecraft:block_state_property", + "properties": { + "half": "lower" + } + }, + { + "condition": "minecraft:location_check", + "offsetY": 1, + "predicate": { + "block": { + "blocks": [ + "minecraft:large_fern" + ], + "state": { + "half": "upper" + } + } + } + } + ], "entries": [ { "type": "minecraft:alternatives", @@ -12,15 +34,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": 2.0, - "add": false + "function": "minecraft:set_count" } ], "name": "minecraft:fern" @@ -32,8 +54,8 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "name": "minecraft:wheat_seeds" @@ -41,33 +63,33 @@ ] } ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:large_fern", + "condition": "minecraft:block_state_property", "properties": { - "half": "lower" + "half": "upper" } }, { "condition": "minecraft:location_check", + "offsetY": -1, "predicate": { "block": { "blocks": [ "minecraft:large_fern" ], "state": { - "half": "upper" + "half": "lower" } } - }, - "offsetY": 1 + } } - ] - }, - { - "rolls": 1.0, - "bonus_rolls": 0.0, + ], "entries": [ { "type": "minecraft:alternatives", @@ -76,15 +98,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": 2.0, - "add": false + "function": "minecraft:set_count" } ], "name": "minecraft:fern" @@ -96,8 +118,8 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "name": "minecraft:wheat_seeds" @@ -105,29 +127,7 @@ ] } ], - "conditions": [ - { - "condition": "minecraft:block_state_property", - "block": "minecraft:large_fern", - "properties": { - "half": "upper" - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": [ - "minecraft:large_fern" - ], - "state": { - "half": "lower" - } - } - }, - "offsetY": -1 - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json new file mode 100644 index 00000000000..73fa0d88fe6 --- /dev/null +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json @@ -0,0 +1,75 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "minecraft:mangrove_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json b/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json index 16e25ecb950..eaba9b269d6 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json @@ -2,20 +2,20 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "name": "minecraft:nether_sprouts" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json index a35b8b7639f..dcae44c910b 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:oak_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,6 +121,10 @@ "name": "minecraft:stick" } ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, "conditions": [ { "condition": "minecraft:inverted", @@ -102,8 +132,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -121,11 +151,7 @@ ] } } - ] - }, - { - "rolls": 1.0, - "bonus_rolls": 0.0, + ], "entries": [ { "type": "minecraft:item", @@ -134,47 +160,21 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.005, 0.0055555557, 0.00625, 0.008333334, 0.025 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:apple" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json index 310cc9c3049..43c1bd49785 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json @@ -2,20 +2,20 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "name": "minecraft:seagrass" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json b/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json index b9f2c7e77fc..27e8c5fc0e8 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json @@ -2,20 +2,20 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "name": "minecraft:small_dripleaf" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json index 370b0570178..2f933e9a117 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -43,50 +42,77 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.05, 0.0625, 0.083333336, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:spruce_sapling" } ] } - ] + ], + "rolls": 1.0 }, { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:alternative", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], "entries": [ { "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.02, 0.022222223, 0.025, 0.033333335, 0.1 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": { "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 + "max": 2.0, + "min": 1.0 }, - "add": false + "function": "minecraft:set_count" }, { "function": "minecraft:explosion_decay" @@ -95,33 +121,7 @@ "name": "minecraft:stick" } ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "condition": "minecraft:alternative", - "terms": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - }, - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - } - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json index e2d5ac85e96..0356f1cdb86 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json @@ -2,8 +2,30 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "block": "minecraft:tall_grass", + "condition": "minecraft:block_state_property", + "properties": { + "half": "lower" + } + }, + { + "condition": "minecraft:location_check", + "offsetY": 1, + "predicate": { + "block": { + "blocks": [ + "minecraft:tall_grass" + ], + "state": { + "half": "upper" + } + } + } + } + ], "entries": [ { "type": "minecraft:alternatives", @@ -12,15 +34,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": 2.0, - "add": false + "function": "minecraft:set_count" } ], "name": "minecraft:grass" @@ -32,8 +54,8 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "name": "minecraft:wheat_seeds" @@ -41,33 +63,33 @@ ] } ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, "conditions": [ { - "condition": "minecraft:block_state_property", "block": "minecraft:tall_grass", + "condition": "minecraft:block_state_property", "properties": { - "half": "lower" + "half": "upper" } }, { "condition": "minecraft:location_check", + "offsetY": -1, "predicate": { "block": { "blocks": [ "minecraft:tall_grass" ], "state": { - "half": "upper" + "half": "lower" } } - }, - "offsetY": 1 + } } - ] - }, - { - "rolls": 1.0, - "bonus_rolls": 0.0, + ], "entries": [ { "type": "minecraft:alternatives", @@ -76,15 +98,15 @@ "type": "minecraft:item", "conditions": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" } ], "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": 2.0, - "add": false + "function": "minecraft:set_count" } ], "name": "minecraft:grass" @@ -96,8 +118,8 @@ "condition": "minecraft:survives_explosion" }, { - "condition": "minecraft:random_chance", - "chance": 0.125 + "chance": 0.125, + "condition": "minecraft:random_chance" } ], "name": "minecraft:wheat_seeds" @@ -105,29 +127,7 @@ ] } ], - "conditions": [ - { - "condition": "minecraft:block_state_property", - "block": "minecraft:tall_grass", - "properties": { - "half": "upper" - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": [ - "minecraft:tall_grass" - ], - "state": { - "half": "lower" - } - } - }, - "offsetY": -1 - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json index d4bea9e120b..8ead9c52b1f 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json @@ -2,27 +2,27 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "functions": [ { - "function": "minecraft:set_count", + "add": false, "count": 2.0, - "add": false + "function": "minecraft:set_count" } ], "name": "minecraft:seagrass" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json index 803b81969cb..1156d02d240 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -40,21 +39,22 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.33, 0.55, 0.77, 1.0 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:twisting_vines" } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json b/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json index 2c91a3e9b49..44736b40ac1 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json @@ -2,20 +2,20 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + } + ], "entries": [ { "type": "minecraft:item", "name": "minecraft:vine" } ], - "conditions": [ - { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json index 45b91fb90a5..30e272fe635 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json @@ -2,7 +2,6 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { @@ -15,8 +14,8 @@ "condition": "minecraft:alternative", "terms": [ { - "condition": "forge:can_tool_perform_action", - "action": "shears_dig" + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" }, { "condition": "minecraft:match_tool", @@ -40,21 +39,22 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", "chances": [ 0.33, 0.55, 0.77, 1.0 - ] + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" } ], "name": "minecraft:weeping_vines" } ] } - ] + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json new file mode 100644 index 00000000000..8a9b081a74d --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:acacia_boat" + } + ], + "result": { + "item": "minecraft:acacia_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_fence.json b/src/generated/resources/data/minecraft/recipes/acacia_fence.json index 554e8a55bff..075416e8cbd 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:acacia_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:acacia_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:acacia_fence", - "count": 3 + "count": 3, + "item": "minecraft:acacia_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json b/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json index d3e8134886c..50d03541aa2 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:acacia_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:acacia_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/acacia_sign.json b/src/generated/resources/data/minecraft/recipes/acacia_sign.json index b37b630d2da..d4ef3093655 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_sign.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:acacia_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:acacia_sign", - "count": 3 + "count": 3, + "item": "minecraft:acacia_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/activator_rail.json b/src/generated/resources/data/minecraft/recipes/activator_rail.json index 79a741311fd..6d5174d5ddc 100644 --- a/src/generated/resources/data/minecraft/recipes/activator_rail.json +++ b/src/generated/resources/data/minecraft/recipes/activator_rail.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XSX", - "X#X", - "XSX" - ], "key": { "#": { "item": "minecraft:redstone_torch" @@ -16,8 +11,13 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "XSX", + "X#X", + "XSX" + ], "result": { - "item": "minecraft:activator_rail", - "count": 6 + "count": 6, + "item": "minecraft:activator_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/andesite.json b/src/generated/resources/data/minecraft/recipes/andesite.json index fe7d03f87a4..98ceafc0f9c 100644 --- a/src/generated/resources/data/minecraft/recipes/andesite.json +++ b/src/generated/resources/data/minecraft/recipes/andesite.json @@ -9,7 +9,7 @@ } ], "result": { - "item": "minecraft:andesite", - "count": 2 + "count": 2, + "item": "minecraft:andesite" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/anvil.json b/src/generated/resources/data/minecraft/recipes/anvil.json index 89f8d0deac1..0145a6172ad 100644 --- a/src/generated/resources/data/minecraft/recipes/anvil.json +++ b/src/generated/resources/data/minecraft/recipes/anvil.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "III", - " i ", - "iii" - ], "key": { "I": { "item": "minecraft:iron_block" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "III", + " i ", + "iii" + ], "result": { "item": "minecraft:anvil" } diff --git a/src/generated/resources/data/minecraft/recipes/armor_stand.json b/src/generated/resources/data/minecraft/recipes/armor_stand.json index c520081df3e..a9e98285af4 100644 --- a/src/generated/resources/data/minecraft/recipes/armor_stand.json +++ b/src/generated/resources/data/minecraft/recipes/armor_stand.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "///", - " / ", - "/_/" - ], "key": { "/": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "item": "minecraft:smooth_stone_slab" } }, + "pattern": [ + "///", + " / ", + "/_/" + ], "result": { "item": "minecraft:armor_stand" } diff --git a/src/generated/resources/data/minecraft/recipes/arrow.json b/src/generated/resources/data/minecraft/recipes/arrow.json index fc2f6db8dcf..7d1a62b6380 100644 --- a/src/generated/resources/data/minecraft/recipes/arrow.json +++ b/src/generated/resources/data/minecraft/recipes/arrow.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "Y" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -16,8 +11,13 @@ "item": "minecraft:feather" } }, + "pattern": [ + "X", + "#", + "Y" + ], "result": { - "item": "minecraft:arrow", - "count": 4 + "count": 4, + "item": "minecraft:arrow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json b/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json new file mode 100644 index 00000000000..ce82f9ba228 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:birch_boat" + } + ], + "result": { + "item": "minecraft:birch_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_fence.json b/src/generated/resources/data/minecraft/recipes/birch_fence.json index 63be4c610d3..fc1641e89b2 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:birch_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:birch_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:birch_fence", - "count": 3 + "count": 3, + "item": "minecraft:birch_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json b/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json index 52931a7e1ca..6fd7aa8308d 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:birch_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:birch_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/birch_sign.json b/src/generated/resources/data/minecraft/recipes/birch_sign.json index fc652c51a88..e42906a44b4 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_sign.json +++ b/src/generated/resources/data/minecraft/recipes/birch_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:birch_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:birch_sign", - "count": 3 + "count": 3, + "item": "minecraft:birch_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/black_banner.json b/src/generated/resources/data/minecraft/recipes/black_banner.json index 28821df7ba5..ff39656c6f3 100644 --- a/src/generated/resources/data/minecraft/recipes/black_banner.json +++ b/src/generated/resources/data/minecraft/recipes/black_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:black_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:black_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/blast_furnace.json b/src/generated/resources/data/minecraft/recipes/blast_furnace.json index d373e620766..3c667add357 100644 --- a/src/generated/resources/data/minecraft/recipes/blast_furnace.json +++ b/src/generated/resources/data/minecraft/recipes/blast_furnace.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "III", - "IXI", - "###" - ], "key": { "#": { "item": "minecraft:smooth_stone" }, - "X": { - "item": "minecraft:furnace" - }, "I": { "tag": "forge:ingots/iron" + }, + "X": { + "item": "minecraft:furnace" } }, + "pattern": [ + "III", + "IXI", + "###" + ], "result": { "item": "minecraft:blast_furnace" } diff --git a/src/generated/resources/data/minecraft/recipes/blue_banner.json b/src/generated/resources/data/minecraft/recipes/blue_banner.json index d2e4c543e03..b8fda12803f 100644 --- a/src/generated/resources/data/minecraft/recipes/blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/blue_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:blue_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:blue_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/bow.json b/src/generated/resources/data/minecraft/recipes/bow.json index 8f46cba990e..bd12673d24f 100644 --- a/src/generated/resources/data/minecraft/recipes/bow.json +++ b/src/generated/resources/data/minecraft/recipes/bow.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " #X", - "# X", - " #X" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "item": "minecraft:string" } }, + "pattern": [ + " #X", + "# X", + " #X" + ], "result": { "item": "minecraft:bow" } diff --git a/src/generated/resources/data/minecraft/recipes/brown_banner.json b/src/generated/resources/data/minecraft/recipes/brown_banner.json index 2b08a03a647..8702d570746 100644 --- a/src/generated/resources/data/minecraft/recipes/brown_banner.json +++ b/src/generated/resources/data/minecraft/recipes/brown_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:brown_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:brown_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/bucket.json b/src/generated/resources/data/minecraft/recipes/bucket.json index 77d7d71e81f..9f008052941 100644 --- a/src/generated/resources/data/minecraft/recipes/bucket.json +++ b/src/generated/resources/data/minecraft/recipes/bucket.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "# #", - " # " - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "# #", + " # " + ], "result": { "item": "minecraft:bucket" } diff --git a/src/generated/resources/data/minecraft/recipes/campfire.json b/src/generated/resources/data/minecraft/recipes/campfire.json index a3c400d5d86..f6743fe1127 100644 --- a/src/generated/resources/data/minecraft/recipes/campfire.json +++ b/src/generated/resources/data/minecraft/recipes/campfire.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " S ", - "SCS", - "LLL" - ], "key": { + "C": { + "tag": "minecraft:coals" + }, "L": { "tag": "minecraft:logs" }, "S": { "tag": "forge:rods/wooden" - }, - "C": { - "tag": "minecraft:coals" } }, + "pattern": [ + " S ", + "SCS", + "LLL" + ], "result": { "item": "minecraft:campfire" } diff --git a/src/generated/resources/data/minecraft/recipes/cauldron.json b/src/generated/resources/data/minecraft/recipes/cauldron.json index 2d5443c75c8..8fd36095c9d 100644 --- a/src/generated/resources/data/minecraft/recipes/cauldron.json +++ b/src/generated/resources/data/minecraft/recipes/cauldron.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "# #", - "# #", - "###" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "# #", + "# #", + "###" + ], "result": { "item": "minecraft:cauldron" } diff --git a/src/generated/resources/data/minecraft/recipes/chain.json b/src/generated/resources/data/minecraft/recipes/chain.json index 0a9806e96c4..54e54c37dc5 100644 --- a/src/generated/resources/data/minecraft/recipes/chain.json +++ b/src/generated/resources/data/minecraft/recipes/chain.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "N", - "I", - "N" - ], "key": { "I": { "tag": "forge:ingots/iron" @@ -13,6 +8,11 @@ "item": "minecraft:iron_nugget" } }, + "pattern": [ + "N", + "I", + "N" + ], "result": { "item": "minecraft:chain" } diff --git a/src/generated/resources/data/minecraft/recipes/chest_minecart.json b/src/generated/resources/data/minecraft/recipes/chest_minecart.json index 3d8251e90fc..1d10263f2f5 100644 --- a/src/generated/resources/data/minecraft/recipes/chest_minecart.json +++ b/src/generated/resources/data/minecraft/recipes/chest_minecart.json @@ -1,17 +1,13 @@ { - "type": "minecraft:crafting_shaped", - "pattern": [ - "A", - "B" - ], - "key": { - "A": { + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { "tag": "forge:chests/wooden" }, - "B": { + { "item": "minecraft:minecart" } - }, + ], "result": { "item": "minecraft:chest_minecart" } diff --git a/src/generated/resources/data/minecraft/recipes/clock.json b/src/generated/resources/data/minecraft/recipes/clock.json index 214219d649b..9533574cc72 100644 --- a/src/generated/resources/data/minecraft/recipes/clock.json +++ b/src/generated/resources/data/minecraft/recipes/clock.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " # ", - "#X#", - " # " - ], "key": { "#": { "tag": "forge:ingots/gold" @@ -13,6 +8,11 @@ "item": "minecraft:redstone" } }, + "pattern": [ + " # ", + "#X#", + " # " + ], "result": { "item": "minecraft:clock" } diff --git a/src/generated/resources/data/minecraft/recipes/compass.json b/src/generated/resources/data/minecraft/recipes/compass.json index 15047ad492a..2eb80ab73e4 100644 --- a/src/generated/resources/data/minecraft/recipes/compass.json +++ b/src/generated/resources/data/minecraft/recipes/compass.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " # ", - "#X#", - " # " - ], "key": { "#": { "tag": "forge:ingots/iron" @@ -13,6 +8,11 @@ "item": "minecraft:redstone" } }, + "pattern": [ + " # ", + "#X#", + " # " + ], "result": { "item": "minecraft:compass" } diff --git a/src/generated/resources/data/minecraft/recipes/crimson_fence.json b/src/generated/resources/data/minecraft/recipes/crimson_fence.json index 6ce9b3490c9..f453778bb77 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:crimson_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:crimson_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:crimson_fence", - "count": 3 + "count": 3, + "item": "minecraft:crimson_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json b/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json index 6d23d40e559..8e3a5429f5c 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:crimson_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:crimson_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/crimson_sign.json b/src/generated/resources/data/minecraft/recipes/crimson_sign.json index b5834a279ab..2aaa3b7d8de 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_sign.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:crimson_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:crimson_sign", - "count": 3 + "count": 3, + "item": "minecraft:crimson_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crossbow.json b/src/generated/resources/data/minecraft/recipes/crossbow.json index 01c9d61815f..ce5fb3b7cb7 100644 --- a/src/generated/resources/data/minecraft/recipes/crossbow.json +++ b/src/generated/resources/data/minecraft/recipes/crossbow.json @@ -1,24 +1,24 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "#\u0026#", - "~$~", - " # " - ], "key": { - "~": { - "item": "minecraft:string" - }, "#": { "tag": "forge:rods/wooden" }, - "\u0026": { - "tag": "forge:ingots/iron" - }, "$": { "item": "minecraft:tripwire_hook" + }, + "&": { + "tag": "forge:ingots/iron" + }, + "~": { + "item": "minecraft:string" } }, + "pattern": [ + "#&#", + "~$~", + " # " + ], "result": { "item": "minecraft:crossbow" } diff --git a/src/generated/resources/data/minecraft/recipes/cyan_banner.json b/src/generated/resources/data/minecraft/recipes/cyan_banner.json index 05c5471c893..c6f620a87d1 100644 --- a/src/generated/resources/data/minecraft/recipes/cyan_banner.json +++ b/src/generated/resources/data/minecraft/recipes/cyan_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:cyan_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:cyan_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json b/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json new file mode 100644 index 00000000000..8f83ab07b96 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:dark_oak_boat" + } + ], + "result": { + "item": "minecraft:dark_oak_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json b/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json index 73f7737c8a5..577ef33d771 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:dark_oak_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:dark_oak_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:dark_oak_fence", - "count": 3 + "count": 3, + "item": "minecraft:dark_oak_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json b/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json index 9febb1cd077..6e3bf7940b6 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:dark_oak_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:dark_oak_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json b/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json index 77878767708..55480be9b51 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:dark_oak_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:dark_oak_sign", - "count": 3 + "count": 3, + "item": "minecraft:dark_oak_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/detector_rail.json b/src/generated/resources/data/minecraft/recipes/detector_rail.json index e66c8850980..89abf5bbb0b 100644 --- a/src/generated/resources/data/minecraft/recipes/detector_rail.json +++ b/src/generated/resources/data/minecraft/recipes/detector_rail.json @@ -1,23 +1,23 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X#X", - "XRX" - ], "key": { - "R": { - "item": "minecraft:redstone" - }, "#": { "item": "minecraft:stone_pressure_plate" }, + "R": { + "item": "minecraft:redstone" + }, "X": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "X X", + "X#X", + "XRX" + ], "result": { - "item": "minecraft:detector_rail", - "count": 6 + "count": 6, + "item": "minecraft:detector_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_axe.json b/src/generated/resources/data/minecraft/recipes/diamond_axe.json index a0457247c4d..b53c0898b3e 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_axe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_axe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "X#", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "XX", + "X#", + " #" + ], "result": { "item": "minecraft:diamond_axe" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_boots.json b/src/generated/resources/data/minecraft/recipes/diamond_boots.json index 8f9da8621e6..45c7fa988a1 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_boots.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_boots.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X X" - ], "key": { "X": { "tag": "forge:gems/diamond" } }, + "pattern": [ + "X X", + "X X" + ], "result": { "item": "minecraft:diamond_boots" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json index 8df73f0c819..22a453c8dc8 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "XXX", - "XXX" - ], "key": { "X": { "tag": "forge:gems/diamond" } }, + "pattern": [ + "X X", + "XXX", + "XXX" + ], "result": { "item": "minecraft:diamond_chestplate" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json index 6adbf418c5e..92ea98bf508 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X" - ], "key": { "X": { "tag": "forge:gems/diamond" } }, + "pattern": [ + "XXX", + "X X" + ], "result": { "item": "minecraft:diamond_helmet" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json index 489d8e65e9b..98edd1dcc2b 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - " #", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "XX", + " #", + " #" + ], "result": { "item": "minecraft:diamond_hoe" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json index 4caf75e206d..90dc9d1619b 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X", - "X X" - ], "key": { "X": { "tag": "forge:gems/diamond" } }, + "pattern": [ + "XXX", + "X X", + "X X" + ], "result": { "item": "minecraft:diamond_leggings" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json index 7c8cd4c2198..d1ce09d7dbc 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - " # ", - " # " - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "XXX", + " # ", + " # " + ], "result": { "item": "minecraft:diamond_pickaxe" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json index 6cc412d264c..66ab1ae7e79 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "X", + "#", + "#" + ], "result": { "item": "minecraft:diamond_shovel" } diff --git a/src/generated/resources/data/minecraft/recipes/diamond_sword.json b/src/generated/resources/data/minecraft/recipes/diamond_sword.json index 66a4c384ebb..a9d94cbd350 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_sword.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_sword.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "X", + "X", + "#" + ], "result": { "item": "minecraft:diamond_sword" } diff --git a/src/generated/resources/data/minecraft/recipes/diorite.json b/src/generated/resources/data/minecraft/recipes/diorite.json index c5f2602854b..0bd5d343369 100644 --- a/src/generated/resources/data/minecraft/recipes/diorite.json +++ b/src/generated/resources/data/minecraft/recipes/diorite.json @@ -1,19 +1,19 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "CQ", - "QC" - ], "key": { - "Q": { - "item": "minecraft:quartz" - }, "C": { "tag": "forge:cobblestone/normal" + }, + "Q": { + "item": "minecraft:quartz" } }, + "pattern": [ + "CQ", + "QC" + ], "result": { - "item": "minecraft:diorite", - "count": 2 + "count": 2, + "item": "minecraft:diorite" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dispenser.json b/src/generated/resources/data/minecraft/recipes/dispenser.json index 90874926313..f60d9b7117f 100644 --- a/src/generated/resources/data/minecraft/recipes/dispenser.json +++ b/src/generated/resources/data/minecraft/recipes/dispenser.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#X#", - "#R#" - ], "key": { - "R": { - "item": "minecraft:redstone" - }, "#": { "tag": "forge:cobblestone/normal" }, + "R": { + "item": "minecraft:redstone" + }, "X": { "item": "minecraft:bow" } }, + "pattern": [ + "###", + "#X#", + "#R#" + ], "result": { "item": "minecraft:dispenser" } diff --git a/src/generated/resources/data/minecraft/recipes/dropper.json b/src/generated/resources/data/minecraft/recipes/dropper.json index b70b1e70bb1..f740b3ab3d3 100644 --- a/src/generated/resources/data/minecraft/recipes/dropper.json +++ b/src/generated/resources/data/minecraft/recipes/dropper.json @@ -1,18 +1,18 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "# #", - "#R#" - ], "key": { - "R": { - "item": "minecraft:redstone" - }, "#": { "tag": "forge:cobblestone/normal" + }, + "R": { + "item": "minecraft:redstone" } }, + "pattern": [ + "###", + "# #", + "#R#" + ], "result": { "item": "minecraft:dropper" } diff --git a/src/generated/resources/data/minecraft/recipes/enchanting_table.json b/src/generated/resources/data/minecraft/recipes/enchanting_table.json index 8a436066d04..36572d7ed76 100644 --- a/src/generated/resources/data/minecraft/recipes/enchanting_table.json +++ b/src/generated/resources/data/minecraft/recipes/enchanting_table.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " B ", - "D#D", - "###" - ], "key": { - "B": { - "item": "minecraft:book" - }, "#": { "item": "minecraft:obsidian" }, + "B": { + "item": "minecraft:book" + }, "D": { "tag": "forge:gems/diamond" } }, + "pattern": [ + " B ", + "D#D", + "###" + ], "result": { "item": "minecraft:enchanting_table" } diff --git a/src/generated/resources/data/minecraft/recipes/fishing_rod.json b/src/generated/resources/data/minecraft/recipes/fishing_rod.json index 80d253290c8..37377fc1da1 100644 --- a/src/generated/resources/data/minecraft/recipes/fishing_rod.json +++ b/src/generated/resources/data/minecraft/recipes/fishing_rod.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " #", - " #X", - "# X" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "item": "minecraft:string" } }, + "pattern": [ + " #", + " #X", + "# X" + ], "result": { "item": "minecraft:fishing_rod" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_apple.json b/src/generated/resources/data/minecraft/recipes/golden_apple.json index e8f444ca1cc..07cefc838ce 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_apple.json +++ b/src/generated/resources/data/minecraft/recipes/golden_apple.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#X#", - "###" - ], "key": { "#": { "tag": "forge:ingots/gold" @@ -13,6 +8,11 @@ "item": "minecraft:apple" } }, + "pattern": [ + "###", + "#X#", + "###" + ], "result": { "item": "minecraft:golden_apple" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_axe.json b/src/generated/resources/data/minecraft/recipes/golden_axe.json index ca3fa80be5c..e0d3d34e480 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_axe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "X#", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/gold" } }, + "pattern": [ + "XX", + "X#", + " #" + ], "result": { "item": "minecraft:golden_axe" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_boots.json b/src/generated/resources/data/minecraft/recipes/golden_boots.json index 920df4c9f12..198126cdc0f 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_boots.json +++ b/src/generated/resources/data/minecraft/recipes/golden_boots.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X X" - ], "key": { "X": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "X X", + "X X" + ], "result": { "item": "minecraft:golden_boots" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json index a9cf7a109ca..ed7c6b1087e 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "XXX", - "XXX" - ], "key": { "X": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "X X", + "XXX", + "XXX" + ], "result": { "item": "minecraft:golden_chestplate" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_helmet.json b/src/generated/resources/data/minecraft/recipes/golden_helmet.json index dd0e0f5170f..69210e911ed 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/golden_helmet.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X" - ], "key": { "X": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "XXX", + "X X" + ], "result": { "item": "minecraft:golden_helmet" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_hoe.json b/src/generated/resources/data/minecraft/recipes/golden_hoe.json index ce4f3bd7baa..0e0c30b4113 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_hoe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - " #", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/gold" } }, + "pattern": [ + "XX", + " #", + " #" + ], "result": { "item": "minecraft:golden_hoe" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_leggings.json b/src/generated/resources/data/minecraft/recipes/golden_leggings.json index e09ae5e9e67..d29b59385bf 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/golden_leggings.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X", - "X X" - ], "key": { "X": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "XXX", + "X X", + "X X" + ], "result": { "item": "minecraft:golden_leggings" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json index d10ddcaf993..3936604c845 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - " # ", - " # " - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/gold" } }, + "pattern": [ + "XXX", + " # ", + " # " + ], "result": { "item": "minecraft:golden_pickaxe" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_shovel.json b/src/generated/resources/data/minecraft/recipes/golden_shovel.json index 65981428123..cc5cf38ccbb 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/golden_shovel.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/gold" } }, + "pattern": [ + "X", + "#", + "#" + ], "result": { "item": "minecraft:golden_shovel" } diff --git a/src/generated/resources/data/minecraft/recipes/golden_sword.json b/src/generated/resources/data/minecraft/recipes/golden_sword.json index fed338f60e7..0c3da42abee 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/golden_sword.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/gold" } }, + "pattern": [ + "X", + "X", + "#" + ], "result": { "item": "minecraft:golden_sword" } diff --git a/src/generated/resources/data/minecraft/recipes/gray_banner.json b/src/generated/resources/data/minecraft/recipes/gray_banner.json index c314f677160..5b1d0df531c 100644 --- a/src/generated/resources/data/minecraft/recipes/gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/gray_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:gray_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:gray_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/green_banner.json b/src/generated/resources/data/minecraft/recipes/green_banner.json index 7af876d1f61..aca24fe3419 100644 --- a/src/generated/resources/data/minecraft/recipes/green_banner.json +++ b/src/generated/resources/data/minecraft/recipes/green_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:green_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:green_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/grindstone.json b/src/generated/resources/data/minecraft/recipes/grindstone.json index c962b012257..c1274e2b7b9 100644 --- a/src/generated/resources/data/minecraft/recipes/grindstone.json +++ b/src/generated/resources/data/minecraft/recipes/grindstone.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "I-I", - "# #" - ], "key": { - "I": { - "tag": "forge:rods/wooden" + "#": { + "tag": "minecraft:planks" }, "-": { "item": "minecraft:stone_slab" }, - "#": { - "tag": "minecraft:planks" + "I": { + "tag": "forge:rods/wooden" } }, + "pattern": [ + "I-I", + "# #" + ], "result": { "item": "minecraft:grindstone" } diff --git a/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json b/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json index 279e10403ab..ddb841ee5bf 100644 --- a/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json +++ b/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json @@ -1,13 +1,13 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "##" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "##" + ], "result": { "item": "minecraft:heavy_weighted_pressure_plate" } diff --git a/src/generated/resources/data/minecraft/recipes/hopper.json b/src/generated/resources/data/minecraft/recipes/hopper.json index a430277a4f3..1736918c49b 100644 --- a/src/generated/resources/data/minecraft/recipes/hopper.json +++ b/src/generated/resources/data/minecraft/recipes/hopper.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "I I", - "ICI", - " I " - ], "key": { "C": { "tag": "forge:chests/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "I I", + "ICI", + " I " + ], "result": { "item": "minecraft:hopper" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_axe.json b/src/generated/resources/data/minecraft/recipes/iron_axe.json index caa59f9fcb5..170bd860ad3 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_axe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_axe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "X#", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "XX", + "X#", + " #" + ], "result": { "item": "minecraft:iron_axe" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_bars.json b/src/generated/resources/data/minecraft/recipes/iron_bars.json index 6766dbc5aa8..8449f515e12 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_bars.json +++ b/src/generated/resources/data/minecraft/recipes/iron_bars.json @@ -1,16 +1,16 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "###" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "###", + "###" + ], "result": { - "item": "minecraft:iron_bars", - "count": 16 + "count": 16, + "item": "minecraft:iron_bars" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_boots.json b/src/generated/resources/data/minecraft/recipes/iron_boots.json index d62101499fb..e0d51d9300d 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_boots.json +++ b/src/generated/resources/data/minecraft/recipes/iron_boots.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X X" - ], "key": { "X": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "X X", + "X X" + ], "result": { "item": "minecraft:iron_boots" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json index a2f926ca15e..6dc916734e1 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "XXX", - "XXX" - ], "key": { "X": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "X X", + "XXX", + "XXX" + ], "result": { "item": "minecraft:iron_chestplate" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_door.json b/src/generated/resources/data/minecraft/recipes/iron_door.json index 6bb6f3738f8..2474b801221 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_door.json +++ b/src/generated/resources/data/minecraft/recipes/iron_door.json @@ -1,17 +1,17 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "##", - "##", - "##" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "##", + "##", + "##" + ], "result": { - "item": "minecraft:iron_door", - "count": 3 + "count": 3, + "item": "minecraft:iron_door" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_helmet.json b/src/generated/resources/data/minecraft/recipes/iron_helmet.json index 64d24757dd5..124ee80d4d0 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/iron_helmet.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X" - ], "key": { "X": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "XXX", + "X X" + ], "result": { "item": "minecraft:iron_helmet" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_hoe.json b/src/generated/resources/data/minecraft/recipes/iron_hoe.json index 22195aca5ac..c323331f9bc 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_hoe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - " #", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "XX", + " #", + " #" + ], "result": { "item": "minecraft:iron_hoe" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_leggings.json b/src/generated/resources/data/minecraft/recipes/iron_leggings.json index 638a7df8d6b..b18b8af46e3 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/iron_leggings.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "X X", - "X X" - ], "key": { "X": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "XXX", + "X X", + "X X" + ], "result": { "item": "minecraft:iron_leggings" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json index 875248c226c..84837132590 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - " # ", - " # " - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "XXX", + " # ", + " # " + ], "result": { "item": "minecraft:iron_pickaxe" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_shovel.json b/src/generated/resources/data/minecraft/recipes/iron_shovel.json index ce2d37688ed..b74b8e5dd4d 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/iron_shovel.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "X", + "#", + "#" + ], "result": { "item": "minecraft:iron_shovel" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_sword.json b/src/generated/resources/data/minecraft/recipes/iron_sword.json index f13c0a30dc6..2fd427ba3e6 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_sword.json +++ b/src/generated/resources/data/minecraft/recipes/iron_sword.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "X", + "X", + "#" + ], "result": { "item": "minecraft:iron_sword" } diff --git a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json index a0fde724cd5..93442513fdc 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json +++ b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "##", - "##" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "##", + "##" + ], "result": { "item": "minecraft:iron_trapdoor" } diff --git a/src/generated/resources/data/minecraft/recipes/item_frame.json b/src/generated/resources/data/minecraft/recipes/item_frame.json index f62eda4ee85..0c6d69dc2d0 100644 --- a/src/generated/resources/data/minecraft/recipes/item_frame.json +++ b/src/generated/resources/data/minecraft/recipes/item_frame.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#X#", - "###" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "item": "minecraft:leather" } }, + "pattern": [ + "###", + "#X#", + "###" + ], "result": { "item": "minecraft:item_frame" } diff --git a/src/generated/resources/data/minecraft/recipes/jukebox.json b/src/generated/resources/data/minecraft/recipes/jukebox.json index 7cd4ac54db9..d40922e8291 100644 --- a/src/generated/resources/data/minecraft/recipes/jukebox.json +++ b/src/generated/resources/data/minecraft/recipes/jukebox.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#X#", - "###" - ], "key": { "#": { "tag": "minecraft:planks" @@ -13,6 +8,11 @@ "tag": "forge:gems/diamond" } }, + "pattern": [ + "###", + "#X#", + "###" + ], "result": { "item": "minecraft:jukebox" } diff --git a/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json new file mode 100644 index 00000000000..0d1fff4aa23 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:jungle_boat" + } + ], + "result": { + "item": "minecraft:jungle_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_fence.json b/src/generated/resources/data/minecraft/recipes/jungle_fence.json index 634c0cb9b3e..1e88c5c0b0f 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:jungle_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:jungle_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:jungle_fence", - "count": 3 + "count": 3, + "item": "minecraft:jungle_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json b/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json index af206fa7815..82ff1a0a899 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:jungle_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:jungle_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/jungle_sign.json b/src/generated/resources/data/minecraft/recipes/jungle_sign.json index 2d088aaaf32..46f8608e365 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_sign.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:jungle_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:jungle_sign", - "count": 3 + "count": 3, + "item": "minecraft:jungle_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/ladder.json b/src/generated/resources/data/minecraft/recipes/ladder.json index bf957894536..727396227d6 100644 --- a/src/generated/resources/data/minecraft/recipes/ladder.json +++ b/src/generated/resources/data/minecraft/recipes/ladder.json @@ -1,17 +1,17 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "# #", - "###", - "# #" - ], "key": { "#": { "tag": "forge:rods/wooden" } }, + "pattern": [ + "# #", + "###", + "# #" + ], "result": { - "item": "minecraft:ladder", - "count": 3 + "count": 3, + "item": "minecraft:ladder" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lever.json b/src/generated/resources/data/minecraft/recipes/lever.json index a7d8a6286ba..b9a9ec88e04 100644 --- a/src/generated/resources/data/minecraft/recipes/lever.json +++ b/src/generated/resources/data/minecraft/recipes/lever.json @@ -1,9 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#" - ], "key": { "#": { "tag": "forge:cobblestone/normal" @@ -12,6 +8,10 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "X", + "#" + ], "result": { "item": "minecraft:lever" } diff --git a/src/generated/resources/data/minecraft/recipes/light_blue_banner.json b/src/generated/resources/data/minecraft/recipes/light_blue_banner.json index b0616d5b4c8..ea1dd2b2fbf 100644 --- a/src/generated/resources/data/minecraft/recipes/light_blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_blue_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:light_blue_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:light_blue_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/light_gray_banner.json b/src/generated/resources/data/minecraft/recipes/light_gray_banner.json index bb5c4560719..8be7b2e17f0 100644 --- a/src/generated/resources/data/minecraft/recipes/light_gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_gray_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:light_gray_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:light_gray_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json b/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json index 54eb385526e..6044d7d3251 100644 --- a/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json +++ b/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json @@ -1,13 +1,13 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "##" - ], "key": { "#": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "##" + ], "result": { "item": "minecraft:light_weighted_pressure_plate" } diff --git a/src/generated/resources/data/minecraft/recipes/lightning_rod.json b/src/generated/resources/data/minecraft/recipes/lightning_rod.json index 8f3a9f7980e..fba6e333945 100644 --- a/src/generated/resources/data/minecraft/recipes/lightning_rod.json +++ b/src/generated/resources/data/minecraft/recipes/lightning_rod.json @@ -1,15 +1,15 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "#", - "#", - "#" - ], "key": { "#": { "tag": "forge:ingots/copper" } }, + "pattern": [ + "#", + "#", + "#" + ], "result": { "item": "minecraft:lightning_rod" } diff --git a/src/generated/resources/data/minecraft/recipes/lime_banner.json b/src/generated/resources/data/minecraft/recipes/lime_banner.json index 0ca55606b40..c7d21ed5f11 100644 --- a/src/generated/resources/data/minecraft/recipes/lime_banner.json +++ b/src/generated/resources/data/minecraft/recipes/lime_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:lime_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:lime_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/lodestone.json b/src/generated/resources/data/minecraft/recipes/lodestone.json index ee6d1b22447..241a3d58559 100644 --- a/src/generated/resources/data/minecraft/recipes/lodestone.json +++ b/src/generated/resources/data/minecraft/recipes/lodestone.json @@ -1,18 +1,18 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "SSS", - "S#S", - "SSS" - ], "key": { - "S": { - "item": "minecraft:chiseled_stone_bricks" - }, "#": { "tag": "forge:ingots/netherite" + }, + "S": { + "item": "minecraft:chiseled_stone_bricks" } }, + "pattern": [ + "SSS", + "S#S", + "SSS" + ], "result": { "item": "minecraft:lodestone" } diff --git a/src/generated/resources/data/minecraft/recipes/magenta_banner.json b/src/generated/resources/data/minecraft/recipes/magenta_banner.json index e0bb6212328..055e61de020 100644 --- a/src/generated/resources/data/minecraft/recipes/magenta_banner.json +++ b/src/generated/resources/data/minecraft/recipes/magenta_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:magenta_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:magenta_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json new file mode 100644 index 00000000000..e62c7c33bbe --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:mangrove_boat" + } + ], + "result": { + "item": "minecraft:mangrove_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_fence.json b/src/generated/resources/data/minecraft/recipes/mangrove_fence.json new file mode 100644 index 00000000000..a0b3d497a8c --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "wooden_fence", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + "W#W", + "W#W" + ], + "result": { + "count": 3, + "item": "minecraft:mangrove_fence" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json b/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json new file mode 100644 index 00000000000..6f39d7f17a2 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "wooden_fence_gate", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + "#W#", + "#W#" + ], + "result": { + "item": "minecraft:mangrove_fence_gate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_sign.json b/src/generated/resources/data/minecraft/recipes/mangrove_sign.json new file mode 100644 index 00000000000..3b6e384c3c7 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/mangrove_sign.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "wooden_sign", + "key": { + "#": { + "item": "minecraft:mangrove_planks" + }, + "X": { + "tag": "forge:rods/wooden" + } + }, + "pattern": [ + "###", + "###", + " X " + ], + "result": { + "count": 3, + "item": "minecraft:mangrove_sign" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/minecart.json b/src/generated/resources/data/minecraft/recipes/minecart.json index 30d8f08be1b..b085f9d4d7d 100644 --- a/src/generated/resources/data/minecraft/recipes/minecart.json +++ b/src/generated/resources/data/minecraft/recipes/minecart.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "# #", - "###" - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + "# #", + "###" + ], "result": { "item": "minecraft:minecart" } diff --git a/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json new file mode 100644 index 00000000000..cd6d0591348 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:oak_boat" + } + ], + "result": { + "item": "minecraft:oak_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_fence.json b/src/generated/resources/data/minecraft/recipes/oak_fence.json index 37d4ce46bb9..4a042e78e6d 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:oak_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:oak_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:oak_fence", - "count": 3 + "count": 3, + "item": "minecraft:oak_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json b/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json index 5975bac3e84..02499c520fb 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:oak_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:oak_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/oak_sign.json b/src/generated/resources/data/minecraft/recipes/oak_sign.json index d038be3498c..70be3a28ad9 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/oak_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:oak_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:oak_sign", - "count": 3 + "count": 3, + "item": "minecraft:oak_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/observer.json b/src/generated/resources/data/minecraft/recipes/observer.json index 8ddcd742822..80c290c0cb9 100644 --- a/src/generated/resources/data/minecraft/recipes/observer.json +++ b/src/generated/resources/data/minecraft/recipes/observer.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "RRQ", - "###" - ], "key": { + "#": { + "tag": "forge:cobblestone/normal" + }, "Q": { "item": "minecraft:quartz" }, "R": { "item": "minecraft:redstone" - }, - "#": { - "tag": "forge:cobblestone/normal" } }, + "pattern": [ + "###", + "RRQ", + "###" + ], "result": { "item": "minecraft:observer" } diff --git a/src/generated/resources/data/minecraft/recipes/orange_banner.json b/src/generated/resources/data/minecraft/recipes/orange_banner.json index fc525bdc381..98420a615c4 100644 --- a/src/generated/resources/data/minecraft/recipes/orange_banner.json +++ b/src/generated/resources/data/minecraft/recipes/orange_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:orange_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:orange_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/painting.json b/src/generated/resources/data/minecraft/recipes/painting.json index 3ed24cd540e..5711eab3032 100644 --- a/src/generated/resources/data/minecraft/recipes/painting.json +++ b/src/generated/resources/data/minecraft/recipes/painting.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#X#", - "###" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:wool" } }, + "pattern": [ + "###", + "#X#", + "###" + ], "result": { "item": "minecraft:painting" } diff --git a/src/generated/resources/data/minecraft/recipes/pink_banner.json b/src/generated/resources/data/minecraft/recipes/pink_banner.json index c8a611a16ee..ea396e58e5a 100644 --- a/src/generated/resources/data/minecraft/recipes/pink_banner.json +++ b/src/generated/resources/data/minecraft/recipes/pink_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:pink_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:pink_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/piston.json b/src/generated/resources/data/minecraft/recipes/piston.json index 0054012190c..fd4acf67fd7 100644 --- a/src/generated/resources/data/minecraft/recipes/piston.json +++ b/src/generated/resources/data/minecraft/recipes/piston.json @@ -1,17 +1,12 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "TTT", - "#X#", - "#R#" - ], "key": { - "R": { - "item": "minecraft:redstone" - }, "#": { "tag": "forge:cobblestone/normal" }, + "R": { + "item": "minecraft:redstone" + }, "T": { "tag": "minecraft:planks" }, @@ -19,6 +14,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "TTT", + "#X#", + "#R#" + ], "result": { "item": "minecraft:piston" } diff --git a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json index 7cfd2069a26..f94c439ed22 100644 --- a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json +++ b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json @@ -1,16 +1,16 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "SS", - "SS" - ], "key": { "S": { "tag": "forge:cobblestone/deepslate" } }, + "pattern": [ + "SS", + "SS" + ], "result": { - "item": "minecraft:polished_deepslate", - "count": 4 + "count": 4, + "item": "minecraft:polished_deepslate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/powered_rail.json b/src/generated/resources/data/minecraft/recipes/powered_rail.json index 92c24777e43..771c674bda8 100644 --- a/src/generated/resources/data/minecraft/recipes/powered_rail.json +++ b/src/generated/resources/data/minecraft/recipes/powered_rail.json @@ -1,23 +1,23 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X#X", - "XRX" - ], "key": { - "R": { - "item": "minecraft:redstone" - }, "#": { "tag": "forge:rods/wooden" }, + "R": { + "item": "minecraft:redstone" + }, "X": { "tag": "forge:ingots/gold" } }, + "pattern": [ + "X X", + "X#X", + "XRX" + ], "result": { - "item": "minecraft:powered_rail", - "count": 6 + "count": 6, + "item": "minecraft:powered_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/purple_banner.json b/src/generated/resources/data/minecraft/recipes/purple_banner.json index a3c59d1adee..de3f1b057a3 100644 --- a/src/generated/resources/data/minecraft/recipes/purple_banner.json +++ b/src/generated/resources/data/minecraft/recipes/purple_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:purple_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:purple_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/rail.json b/src/generated/resources/data/minecraft/recipes/rail.json index 275fce0f095..1e450b79e07 100644 --- a/src/generated/resources/data/minecraft/recipes/rail.json +++ b/src/generated/resources/data/minecraft/recipes/rail.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X X", - "X#X", - "X X" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,8 +8,13 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "X X", + "X#X", + "X X" + ], "result": { - "item": "minecraft:rail", - "count": 16 + "count": 16, + "item": "minecraft:rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/red_banner.json b/src/generated/resources/data/minecraft/recipes/red_banner.json index c31db8d39c1..e89daa75c79 100644 --- a/src/generated/resources/data/minecraft/recipes/red_banner.json +++ b/src/generated/resources/data/minecraft/recipes/red_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:red_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:red_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/redstone_torch.json b/src/generated/resources/data/minecraft/recipes/redstone_torch.json index 3f7c2cf9243..4dcf2d8936a 100644 --- a/src/generated/resources/data/minecraft/recipes/redstone_torch.json +++ b/src/generated/resources/data/minecraft/recipes/redstone_torch.json @@ -1,9 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -12,6 +8,10 @@ "item": "minecraft:redstone" } }, + "pattern": [ + "X", + "#" + ], "result": { "item": "minecraft:redstone_torch" } diff --git a/src/generated/resources/data/minecraft/recipes/shears.json b/src/generated/resources/data/minecraft/recipes/shears.json index 0b212e57bc3..4295705b2f2 100644 --- a/src/generated/resources/data/minecraft/recipes/shears.json +++ b/src/generated/resources/data/minecraft/recipes/shears.json @@ -1,14 +1,14 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " #", - "# " - ], "key": { "#": { "tag": "forge:ingots/iron" } }, + "pattern": [ + " #", + "# " + ], "result": { "item": "minecraft:shears" } diff --git a/src/generated/resources/data/minecraft/recipes/shield.json b/src/generated/resources/data/minecraft/recipes/shield.json index ff02e15ee06..9f035547026 100644 --- a/src/generated/resources/data/minecraft/recipes/shield.json +++ b/src/generated/resources/data/minecraft/recipes/shield.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "WoW", - "WWW", - " W " - ], "key": { "W": { "tag": "minecraft:planks" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "WoW", + "WWW", + " W " + ], "result": { "item": "minecraft:shield" } diff --git a/src/generated/resources/data/minecraft/recipes/shulker_box.json b/src/generated/resources/data/minecraft/recipes/shulker_box.json index 0241ba30b88..74d5a6bf16e 100644 --- a/src/generated/resources/data/minecraft/recipes/shulker_box.json +++ b/src/generated/resources/data/minecraft/recipes/shulker_box.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "-", - "#", - "-" - ], "key": { "#": { "tag": "forge:chests/wooden" @@ -13,6 +8,11 @@ "item": "minecraft:shulker_shell" } }, + "pattern": [ + "-", + "#", + "-" + ], "result": { "item": "minecraft:shulker_box" } diff --git a/src/generated/resources/data/minecraft/recipes/smithing_table.json b/src/generated/resources/data/minecraft/recipes/smithing_table.json index f7a5d27c656..69c864a6eee 100644 --- a/src/generated/resources/data/minecraft/recipes/smithing_table.json +++ b/src/generated/resources/data/minecraft/recipes/smithing_table.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "@@", - "##", - "##" - ], "key": { "#": { "tag": "minecraft:planks" @@ -13,6 +8,11 @@ "tag": "forge:ingots/iron" } }, + "pattern": [ + "@@", + "##", + "##" + ], "result": { "item": "minecraft:smithing_table" } diff --git a/src/generated/resources/data/minecraft/recipes/soul_campfire.json b/src/generated/resources/data/minecraft/recipes/soul_campfire.json index cf52c9639f2..6829fa6f3c5 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_campfire.json +++ b/src/generated/resources/data/minecraft/recipes/soul_campfire.json @@ -1,21 +1,21 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " S ", - "S#S", - "LLL" - ], "key": { + "#": { + "tag": "minecraft:soul_fire_base_blocks" + }, "L": { "tag": "minecraft:logs" }, "S": { "tag": "forge:rods/wooden" - }, - "#": { - "tag": "minecraft:soul_fire_base_blocks" } }, + "pattern": [ + " S ", + "S#S", + "LLL" + ], "result": { "item": "minecraft:soul_campfire" } diff --git a/src/generated/resources/data/minecraft/recipes/soul_torch.json b/src/generated/resources/data/minecraft/recipes/soul_torch.json index 8d36f0a97e9..322dc99912f 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_torch.json +++ b/src/generated/resources/data/minecraft/recipes/soul_torch.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "S" - ], "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "S": { + "tag": "minecraft:soul_fire_base_blocks" + }, "X": [ { "item": "minecraft:coal" @@ -13,16 +14,15 @@ { "item": "minecraft:charcoal" } - ], - "#": { - "tag": "forge:rods/wooden" - }, - "S": { - "tag": "minecraft:soul_fire_base_blocks" - } + ] }, + "pattern": [ + "X", + "#", + "S" + ], "result": { - "item": "minecraft:soul_torch", - "count": 4 + "count": 4, + "item": "minecraft:soul_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json b/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json new file mode 100644 index 00000000000..c73c0989c68 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:spruce_boat" + } + ], + "result": { + "item": "minecraft:spruce_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_fence.json b/src/generated/resources/data/minecraft/recipes/spruce_fence.json index e2ddf8e5118..d806938a0fb 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:spruce_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:spruce_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:spruce_fence", - "count": 3 + "count": 3, + "item": "minecraft:spruce_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json b/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json index 3657e711af1..c1c3ff44504 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:spruce_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:spruce_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/spruce_sign.json b/src/generated/resources/data/minecraft/recipes/spruce_sign.json index f8c817b31b1..17ffbd86a26 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_sign.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:spruce_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:spruce_sign", - "count": 3 + "count": 3, + "item": "minecraft:spruce_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spyglass.json b/src/generated/resources/data/minecraft/recipes/spyglass.json index c9d4861d1ab..0ed3c459e8d 100644 --- a/src/generated/resources/data/minecraft/recipes/spyglass.json +++ b/src/generated/resources/data/minecraft/recipes/spyglass.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " # ", - " X ", - " X " - ], "key": { "#": { "tag": "forge:gems/amethyst" @@ -13,6 +8,11 @@ "tag": "forge:ingots/copper" } }, + "pattern": [ + " # ", + " X ", + " X " + ], "result": { "item": "minecraft:spyglass" } diff --git a/src/generated/resources/data/minecraft/recipes/stone_axe.json b/src/generated/resources/data/minecraft/recipes/stone_axe.json index dd76a0389f7..e1693151ebb 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_axe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_axe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "X#", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:stone_tool_materials" } }, + "pattern": [ + "XX", + "X#", + " #" + ], "result": { "item": "minecraft:stone_axe" } diff --git a/src/generated/resources/data/minecraft/recipes/stone_hoe.json b/src/generated/resources/data/minecraft/recipes/stone_hoe.json index 84fbb94d561..a5da911f794 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_hoe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - " #", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:stone_tool_materials" } }, + "pattern": [ + "XX", + " #", + " #" + ], "result": { "item": "minecraft:stone_hoe" } diff --git a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json index 61d09078b6b..0c01cb15c9b 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - " # ", - " # " - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:stone_tool_materials" } }, + "pattern": [ + "XXX", + " # ", + " # " + ], "result": { "item": "minecraft:stone_pickaxe" } diff --git a/src/generated/resources/data/minecraft/recipes/stone_shovel.json b/src/generated/resources/data/minecraft/recipes/stone_shovel.json index b625ee501f2..b65e12519cb 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/stone_shovel.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:stone_tool_materials" } }, + "pattern": [ + "X", + "#", + "#" + ], "result": { "item": "minecraft:stone_shovel" } diff --git a/src/generated/resources/data/minecraft/recipes/stone_sword.json b/src/generated/resources/data/minecraft/recipes/stone_sword.json index 044a1bc1e02..474339f890c 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_sword.json +++ b/src/generated/resources/data/minecraft/recipes/stone_sword.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:stone_tool_materials" } }, + "pattern": [ + "X", + "X", + "#" + ], "result": { "item": "minecraft:stone_sword" } diff --git a/src/generated/resources/data/minecraft/recipes/stonecutter.json b/src/generated/resources/data/minecraft/recipes/stonecutter.json index eed77137961..0cc370dc220 100644 --- a/src/generated/resources/data/minecraft/recipes/stonecutter.json +++ b/src/generated/resources/data/minecraft/recipes/stonecutter.json @@ -1,17 +1,17 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " I ", - "###" - ], "key": { - "I": { - "tag": "forge:ingots/iron" - }, "#": { "item": "minecraft:stone" + }, + "I": { + "tag": "forge:ingots/iron" } }, + "pattern": [ + " I ", + "###" + ], "result": { "item": "minecraft:stonecutter" } diff --git a/src/generated/resources/data/minecraft/recipes/tinted_glass.json b/src/generated/resources/data/minecraft/recipes/tinted_glass.json index 6e3c8d8aec4..01324c6020d 100644 --- a/src/generated/resources/data/minecraft/recipes/tinted_glass.json +++ b/src/generated/resources/data/minecraft/recipes/tinted_glass.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " S ", - "SGS", - " S " - ], "key": { "G": { "item": "minecraft:glass" @@ -13,8 +8,13 @@ "tag": "forge:gems/amethyst" } }, + "pattern": [ + " S ", + "SGS", + " S " + ], "result": { - "item": "minecraft:tinted_glass", - "count": 2 + "count": 2, + "item": "minecraft:tinted_glass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/torch.json b/src/generated/resources/data/minecraft/recipes/torch.json index 1e8f64ebc5e..d14d1cc6b77 100644 --- a/src/generated/resources/data/minecraft/recipes/torch.json +++ b/src/generated/resources/data/minecraft/recipes/torch.json @@ -1,9 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -17,8 +13,12 @@ } ] }, + "pattern": [ + "X", + "#" + ], "result": { - "item": "minecraft:torch", - "count": 4 + "count": 4, + "item": "minecraft:torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tripwire_hook.json b/src/generated/resources/data/minecraft/recipes/tripwire_hook.json index 593c3f29b0b..f7279b1e088 100644 --- a/src/generated/resources/data/minecraft/recipes/tripwire_hook.json +++ b/src/generated/resources/data/minecraft/recipes/tripwire_hook.json @@ -1,23 +1,23 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "I", - "S", - "#" - ], "key": { "#": { "tag": "minecraft:planks" }, - "S": { - "tag": "forge:rods/wooden" - }, "I": { "tag": "forge:ingots/iron" + }, + "S": { + "tag": "forge:rods/wooden" } }, + "pattern": [ + "I", + "S", + "#" + ], "result": { - "item": "minecraft:tripwire_hook", - "count": 2 + "count": 2, + "item": "minecraft:tripwire_hook" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_fence.json b/src/generated/resources/data/minecraft/recipes/warped_fence.json index c1bae5ae983..ca6961725c4 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence", - "pattern": [ - "W#W", - "W#W" - ], "key": { - "W": { - "item": "minecraft:warped_planks" - }, "#": { "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:warped_planks" } }, + "pattern": [ + "W#W", + "W#W" + ], "result": { - "item": "minecraft:warped_fence", - "count": 3 + "count": 3, + "item": "minecraft:warped_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json b/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json index 392d027b427..3673bd554d6 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json @@ -1,10 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_fence_gate", - "pattern": [ - "#W#", - "#W#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +9,10 @@ "item": "minecraft:warped_planks" } }, + "pattern": [ + "#W#", + "#W#" + ], "result": { "item": "minecraft:warped_fence_gate" } diff --git a/src/generated/resources/data/minecraft/recipes/warped_sign.json b/src/generated/resources/data/minecraft/recipes/warped_sign.json index 72b94674296..ce4202b50cc 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_sign.json +++ b/src/generated/resources/data/minecraft/recipes/warped_sign.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "wooden_sign", - "pattern": [ - "###", - "###", - " X " - ], "key": { "#": { "item": "minecraft:warped_planks" @@ -14,8 +9,13 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " X " + ], "result": { - "item": "minecraft:warped_sign", - "count": 3 + "count": 3, + "item": "minecraft:warped_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/white_banner.json b/src/generated/resources/data/minecraft/recipes/white_banner.json index 9ce1e2cc0f6..487d7209e82 100644 --- a/src/generated/resources/data/minecraft/recipes/white_banner.json +++ b/src/generated/resources/data/minecraft/recipes/white_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:white_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:white_banner" } diff --git a/src/generated/resources/data/minecraft/recipes/wooden_axe.json b/src/generated/resources/data/minecraft/recipes/wooden_axe.json index f7f2821bd3c..5ddfd7781f2 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_axe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "X#", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:planks" } }, + "pattern": [ + "XX", + "X#", + " #" + ], "result": { "item": "minecraft:wooden_axe" } diff --git a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json index 5ef92c7500c..c0c64a22171 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - " #", - " #" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:planks" } }, + "pattern": [ + "XX", + " #", + " #" + ], "result": { "item": "minecraft:wooden_hoe" } diff --git a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json index c8bc9193a61..3407fae1a9b 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - " # ", - " # " - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:planks" } }, + "pattern": [ + "XXX", + " # ", + " # " + ], "result": { "item": "minecraft:wooden_pickaxe" } diff --git a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json index df39621cd98..c9013d69120 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "#", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:planks" } }, + "pattern": [ + "X", + "#", + "#" + ], "result": { "item": "minecraft:wooden_shovel" } diff --git a/src/generated/resources/data/minecraft/recipes/wooden_sword.json b/src/generated/resources/data/minecraft/recipes/wooden_sword.json index 99f6d707856..86ad338b15b 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_sword.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "X", - "X", - "#" - ], "key": { "#": { "tag": "forge:rods/wooden" @@ -13,6 +8,11 @@ "tag": "minecraft:planks" } }, + "pattern": [ + "X", + "X", + "#" + ], "result": { "item": "minecraft:wooden_sword" } diff --git a/src/generated/resources/data/minecraft/recipes/yellow_banner.json b/src/generated/resources/data/minecraft/recipes/yellow_banner.json index 4c8dd58c08a..c2f5974207e 100644 --- a/src/generated/resources/data/minecraft/recipes/yellow_banner.json +++ b/src/generated/resources/data/minecraft/recipes/yellow_banner.json @@ -1,11 +1,6 @@ { "type": "minecraft:crafting_shaped", "group": "banner", - "pattern": [ - "###", - "###", - " | " - ], "key": { "#": { "item": "minecraft:yellow_wool" @@ -14,6 +9,11 @@ "tag": "forge:rods/wooden" } }, + "pattern": [ + "###", + "###", + " | " + ], "result": { "item": "minecraft:yellow_banner" } diff --git a/src/generated/resources/data/minecraft/tags/worldgen/biome/is_mountain.json b/src/generated/resources/data/minecraft/tags/worldgen/biome/is_mountain.json index a3fcce5d77e..859b3500796 100644 --- a/src/generated/resources/data/minecraft/tags/worldgen/biome/is_mountain.json +++ b/src/generated/resources/data/minecraft/tags/worldgen/biome/is_mountain.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "#forge:is_peak", "#forge:is_slope" diff --git a/src/generated_test/resources/.cache/cache b/src/generated_test/resources/.cache/cache deleted file mode 100644 index a0b810a1359..00000000000 --- a/src/generated_test/resources/.cache/cache +++ /dev/null @@ -1,131 +0,0 @@ -100d38c291c4b4dabbdec17d5eb512380507e9cb assets/custom_transformtype_test/blockstates/item_hanger.json -9349340d54ae91448ab1ae0bd42fcbff512470cc assets/custom_transformtype_test/models/item/item_hanger.json -a9cf5409aca6b29f95eff8309254d1bd8ec98a21 assets/data_gen_test/lang/en_us.json -372b5ca364635d0d17d08c1402aed45578a52120 assets/data_gen_test/models/block/acacia_button.json -d8ab540b855fa1df2249f9d09c0fa15a1b46a324 assets/data_gen_test/models/block/acacia_button_pressed.json -50b86f9a70b2f9c1c0f65407a53cd0a11274bbc6 assets/data_gen_test/models/block/acacia_door_bottom.json -99ed466fe923281f2239bac1f4ff0d455dbb6fb5 assets/data_gen_test/models/block/acacia_door_bottom_hinge.json -e72eaab1dd012741114d4cb718b257a44420eef8 assets/data_gen_test/models/block/acacia_door_top.json -3cd89a1bf3ee19b6917721796a53dfde5bc4d764 assets/data_gen_test/models/block/acacia_door_top_hinge.json -e267e3cd85282291d97148a330e7857ba75df85d assets/data_gen_test/models/block/acacia_fence_gate.json -a56c3472de2dd6b175f0926b295b7f0b9c92a0b7 assets/data_gen_test/models/block/acacia_fence_gate_open.json -5c8a634491d6465c9da6983878ea22b71c0e0ae6 assets/data_gen_test/models/block/acacia_fence_gate_wall.json -2ebae83ff7451e4c142cd46ae74b523d307618c8 assets/data_gen_test/models/block/acacia_fence_gate_wall_open.json -611969c44ad660c1f6c12c9e5c5a7d784b7f7a22 assets/data_gen_test/models/block/acacia_fence_post.json -e02938f13d9603e2386e35de87f1c4a7e6872747 assets/data_gen_test/models/block/acacia_fence_side.json -874d39d611b7c6276d495596035b796b3d745518 assets/data_gen_test/models/block/acacia_log.json -a3653df2772aebce449fdfa3cb90ca744c63986f assets/data_gen_test/models/block/acacia_log_horizontal.json -ecfe1fea984b156a3f5b0c9b7de2d368801a1f8b assets/data_gen_test/models/block/acacia_pressure_plate.json -925ff7ec97ae2237eacf8d7d298c523be0067dca assets/data_gen_test/models/block/acacia_pressure_plate_down.json -6ff0112826c2254d23efa759d0c003bdda6f9946 assets/data_gen_test/models/block/acacia_sign.json -921e28f174a3e6f99d9862956821fd89b7b433bf assets/data_gen_test/models/block/acacia_slab.json -fb8b01d93255d1363969d9f5ac09bdcc53b26706 assets/data_gen_test/models/block/acacia_slab_top.json -098d5642c4fff739615fbcc676cd7635ecadbb62 assets/data_gen_test/models/block/acacia_stairs.json -f225c575beba9f52fafa9b24ec15b9754d6371c5 assets/data_gen_test/models/block/acacia_stairs_inner.json -909c9ed3baf0acb762dedd4f5e4d5aaf9ef66ee1 assets/data_gen_test/models/block/acacia_stairs_outer.json -d08718b62ded7c528b7b249fb950488a08f487a7 assets/data_gen_test/models/block/acacia_trapdoor_bottom.json -314bfae35e576597a6ede4f2083e1632fe4bf5a7 assets/data_gen_test/models/block/acacia_trapdoor_open.json -545c25cccf3803195a7293cf99cdd6385ac1f96d assets/data_gen_test/models/block/acacia_trapdoor_top.json -b07b4e3dbd294ec20b93615a40b69b18dcd229a2 assets/data_gen_test/models/block/barrel.json -32e192b203624058aa8f7b6af52d1fa7de384725 assets/data_gen_test/models/block/barrel_open.json -0ce1da46399e06a8b9d6314787fe4d94cbdfedc6 assets/data_gen_test/models/block/birch_fence_gate.json -eb28ba3bd186bbfdcf2302ce938d166ac9c87856 assets/data_gen_test/models/block/birch_fence_gate_open.json -cd05c0d5983e415ec4d610591c783cdff8b6a8ca assets/data_gen_test/models/block/birch_fence_gate_wall.json -e701d4ff5aa062ca4fe612ee3efed4aec14f436e assets/data_gen_test/models/block/birch_fence_gate_wall_open.json -49948428acf0defe004ff07718afd9b50fc41326 assets/data_gen_test/models/block/block.json -a11f3003da1d2e8928895c767ceab94468269cdb assets/data_gen_test/models/block/cobblestone_wall_post.json -2119f2dc78e8fb8788db71f1fbf8fd18efc35f12 assets/data_gen_test/models/block/cobblestone_wall_side.json -795b63de0b2793493d862f7d34f2c162cf231af5 assets/data_gen_test/models/block/cobblestone_wall_side_tall.json -26c80ee9a99336b434c9984445bfcf01b25f2cd0 assets/data_gen_test/models/block/cube.json -2438b91cbedbdedb9b6bd59af9e6960b2a44fd4c assets/data_gen_test/models/block/furnace.json -e6a83e45c49c170705d76ae3234119db14220b4a assets/data_gen_test/models/block/furnace_on.json -26798b264a5530d43dfab028c269db3cd9c19ee1 assets/data_gen_test/models/block/glass_pane_noside.json -24654193c65e4e933df05b5c29686039d53e1705 assets/data_gen_test/models/block/glass_pane_noside_alt.json -899c995dfe5cd9eb8f6a9b90e60a2b31b5b835a7 assets/data_gen_test/models/block/glass_pane_post.json -8e4fb1b8dd3be98709ad233d76e914ee7ed5d1e7 assets/data_gen_test/models/block/glass_pane_side.json -725ddf2e14db508478d8d78397a2294d1ee51140 assets/data_gen_test/models/block/glass_pane_side_alt.json -c4d268471ee793597917c966d1aaed29e438d366 assets/data_gen_test/models/block/oak_trapdoor_bottom.json -2abb8b11c91441badd91b7c52f5f8ba3226c92de assets/data_gen_test/models/block/oak_trapdoor_open.json -560d419e3d542cb0509bca078988308d387c15a9 assets/data_gen_test/models/block/oak_trapdoor_top.json -556f0d997250661e0401fba13a4afd1bb0627dcc assets/data_gen_test/models/block/stone.json -556f0d997250661e0401fba13a4afd1bb0627dcc assets/data_gen_test/models/block/test_block.json -db2cd929128c8a6e8e0b02437f90ad8d24238206 assets/data_gen_test/models/block/torch.json -81ce9ac0a7f4ed7a94d5496b918987a6f5a24988 assets/data_gen_test/models/block/wall_torch.json -35f7208abc5014a10a091e792e3524cf3c73b5db assets/data_gen_test/models/item/acacia_button_inventory.json -6b40df2a47c13cd00e295244b6cf74462938359d assets/data_gen_test/models/item/fishing_rod.json -7fecdc30a209fca790df79b973c30b9e84415e0b assets/data_gen_test/models/item/fishing_rod_cast.json -098d8b38409fff6cc14a4e56355bedb1fc5931d1 assets/data_gen_test/models/item/test_block.json -b029993275f16569b0edf093362f55df6ea6f9be assets/data_gen_test/models/item/test_block_model.json -726e1884e53151492ca05bd752c67031603570f6 assets/data_gen_test/models/item/test_generated_model.json -efff3d1ac1640a0d26d059aff55853652a14aca2 assets/data_gen_test/sounds.json -0f434609c4d9a5f36cf7ec56cb2f0ce26a4153fa assets/minecraft/blockstates/acacia_button.json -1767c874758bd7c3235db446b6219e6e1edd25b4 assets/minecraft/blockstates/acacia_door.json -e41383b4c13ec922c0f5cfa2cc313d88fd294685 assets/minecraft/blockstates/acacia_fence.json -967d268bfcf32474b61578bef16e853b6360dd73 assets/minecraft/blockstates/acacia_fence_gate.json -3d8a5e75de9324c98d0e26dcc848ed6545c1a7b2 assets/minecraft/blockstates/acacia_log.json -c78621012664e2044f4da59ada88ad355d50aafd assets/minecraft/blockstates/acacia_pressure_plate.json -3b80461487198c95179c794dae22c3fb35f7873f assets/minecraft/blockstates/acacia_sign.json -2fc1c2cff82aaebdb4ecf298e6de278c62cce3b3 assets/minecraft/blockstates/acacia_slab.json -075938fd82340c895eff226d11898abae9a5e178 assets/minecraft/blockstates/acacia_stairs.json -9384d458574395650a976b3ad1fe5905b100ddbf assets/minecraft/blockstates/acacia_trapdoor.json -3b80461487198c95179c794dae22c3fb35f7873f assets/minecraft/blockstates/acacia_wall_sign.json -42a10a132337264c8821426e17d0c09b92ad42f9 assets/minecraft/blockstates/barrel.json -9bc8ba4b8e4ad3cc7074838cf1bf8dad89e2b339 assets/minecraft/blockstates/birch_fence_gate.json -cd097e56cf2332a07ae31c2cacb01cba69e53ab3 assets/minecraft/blockstates/cobblestone_wall.json -6a3c8e2691b6b7f39f1236a17bb6aa145a9db53f assets/minecraft/blockstates/furnace.json -1b2a1344020237ab877e27c43934b042d259bf36 assets/minecraft/blockstates/glass_pane.json -bf2e445b48b024354a69138b20a4a4a8aa5d15d1 assets/minecraft/blockstates/oak_trapdoor.json -9c4cc92efb78811e8d70a383a1a89eb75b69db04 assets/minecraft/blockstates/stone.json -570fdd86046df75a073b759ff7aaf4c4caf43115 assets/minecraft/blockstates/torch.json -a012d6d92bab1c91913bd0f2dc0492a0fce916f2 assets/minecraft/blockstates/wall_torch.json -734ce54b91487abaf64d62bef91223d9c416dcff assets/minecraft/models/item/stick.json -0a1909376adb28354443930b18fb832ed577f5a0 assets/new_model_loader_test/blockstates/obj_block.json -bab7cd04569c8aa63320772acdc3c91a5ceda14a assets/new_model_loader_test/models/block/obj_block.json -9fa44308a52fbc384d5befee4e117531642299fb assets/new_model_loader_test/models/item/item_layers.json -fff744b6ee36d8cffb5797389b00d096263583d9 assets/new_model_loader_test/models/item/separate_perspective.json -273e0ed992d227f09f1c83bc22d066fb68d03c84 assets/piston_event_test/blockstates/shiftonmove.json -d2c8e860521c5e738ed0798337f5728d610825ff assets/piston_event_test/models/block/shiftonmove.json -f51f026a75e27a0a53a76771d553c0e3385a2966 assets/piston_event_test/models/item/shiftonmove.json -cf16f861eaf5815238c2278eb48bde0688cb73b7 assets/scaffolding_test/blockstates/scaffolding_method_test.json -7b03828e34fedcdea09e689bea11e16fc849f080 assets/tag_based_tool_types/blockstates/test_stone.json -79167e317e2f247baca693404b657252157b2349 assets/tag_based_tool_types/models/block/test_stone.json -ba49dc1068fd9c93a458f4267896ea4476187411 assets/tag_based_tool_types/models/item/test_stone.json -15c4780e8ea8e13179a35f045ac7975c76f4471d assets/tag_based_tool_types/models/item/test_tool.json -806659ba3e9c12797df0fe7211a222795834fdfd data/data_gen_test/advancements/conditional.json -0001aa55877ddee50e3180db7337e926797d7e4d data/data_gen_test/advancements/obtain_dirt.json -9142f390548b2aba862f29e05ac44452b6083d31 data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json -ed9a05f407f40fcf73bf16a488540f33e69d79df data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json -a9b940a9341ba1e6836f6cccde57fd84ac6cefde data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json -76e760c8e8a1bbd3fb5538bc2d773c117016c0ce data/data_gen_test/advancements/recipes/conditional2.json -08dbf1b9a554bc216b3cbf29cc54754fb427b0f4 data/data_gen_test/advancements/recipes/conditional3.json -eb5a3c9b0eece693b02c1d13095e395b702a0f9d data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json -5b8b202b81157845e9065a0a92cfd777d0f6dc97 data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json -139a68aa4991369581091633c15ead8c212a70ce data/data_gen_test/advancements/recipes/tools/difference_ingredient.json -b9f392d257ce4622bd7daa98d601f461b78934c9 data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json -094ed894c5a3d86df27b40cca803ae842f783db6 data/data_gen_test/recipes/compound_ingredient_custom_types.json -4b6e057c4ca229e22f57c2fb929173b6ed7dc187 data/data_gen_test/recipes/compound_ingredient_only_vanilla.json -ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data/data_gen_test/recipes/conditional.json -ca9827bff0a49957e01cf3887ef5131ad8710320 data/data_gen_test/recipes/conditional2.json -586eb688e4af6fc7e0fc16e5237fddf8f93e9c0d data/data_gen_test/recipes/conditional3.json -82ef22fdcd68a56bfd89fcd65a7d3472761c2b67 data/data_gen_test/recipes/contains_nbt_ingredient_item_set.json -9befa598e96e2ed26ce13290164373e4a37808a7 data/data_gen_test/recipes/contains_nbt_ingredient_single_item.json -d39a07652a4e5b7d38e94a00ceb3ae54298ed169 data/data_gen_test/recipes/difference_ingredient.json -1af57f3033a3ac89842f210d55ac39a7b3e43c5b data/data_gen_test/recipes/exact_nbt_ingredient.json -d769b2a8ef432cd2de02b81ceac7f747aa1f7e8d data/data_gen_test/recipes/intersection_ingredient.json -8831e79c8d15b1bc00eb29d354bb22b64d9ddcdd data/data_gen_test/tags/blocks/test.json -d65c425e740dc833f29d16606a1171825876be0d data/data_gen_test/tags/blocks/thing/one.json -1f70ed4ddc878bada5e43d3c44a34157806beda8 data/data_gen_test/tags/blocks/thing/three.json -2c648bca262caaa826ddbbde796d35bb2ee5f03a data/data_gen_test/tags/blocks/thing/two.json -b0565ce75fc7880be7517e86a218d1ed9d9e346f data/data_gen_test/tags/blocks/things.json -e6215cc7edbba7c10b8d40dbdb837239a37b46b3 data/data_pack_registries_test/data_pack_registries_test/unsyncable/datagen_test.json -f4d3a59005dafa334c835e43ed0047487e17324d data/forge/loot_modifiers/global_loot_modifiers.json -5bd8a05038d2633f89b3b1c5ac319eb4b347b335 data/global_loot_test/loot_modifiers/dungeon_loot.json -f65e40b06ce7ad18e053ec88058b951f98ae5f40 data/global_loot_test/loot_modifiers/smelting.json -a263b2535439eb5af22cbc9aa48252d8e983eb08 data/global_loot_test/loot_modifiers/wheat_harvest.json -be30fbd8ad753b35166ef534123df4e852515cc5 data/minecraft/advancements/good_parent.json -d344b06ab85a35c448ea3fa1561c0be2978f3f1a data/minecraft/advancements/obtain_diamond_block.json -7c42eede6fe98d1291c00b084e4c1be8642102cd data/minecraft/advancements/story/root.json -f10f0cf9694892eccfddfa67e0ef4aa1f24fb6db data/minecraft/tags/blocks/test_tag.json -04db4e62a40a90a43f53c0b971f5f8b33941e380 data/tag_based_tool_types/loot_tables/blocks/test_stone.json -ea47ac90d561c40f01a29110f0dbf189671d390e data/tag_based_tool_types/tags/blocks/minable/my_tool.json -ea47ac90d561c40f01a29110f0dbf189671d390e data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json diff --git a/src/generated_test/resources/assets/custom_transformtype_test/blockstates/item_hanger.json b/src/generated_test/resources/assets/custom_transformtype_test/blockstates/item_hanger.json index 2ee8e634d0b..8d1e89da3f3 100644 --- a/src/generated_test/resources/assets/custom_transformtype_test/blockstates/item_hanger.json +++ b/src/generated_test/resources/assets/custom_transformtype_test/blockstates/item_hanger.json @@ -1,5 +1,9 @@ { "variants": { + "facing=east": { + "model": "custom_transformtype_test:block/item_hanger", + "y": 90 + }, "facing=north": { "model": "custom_transformtype_test:block/item_hanger" }, @@ -10,10 +14,6 @@ "facing=west": { "model": "custom_transformtype_test:block/item_hanger", "y": 270 - }, - "facing=east": { - "model": "custom_transformtype_test:block/item_hanger", - "y": 90 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/lang/en_us.json b/src/generated_test/resources/assets/data_gen_test/lang/en_us.json index ba4c5b31e03..b65f2b200c4 100644 --- a/src/generated_test/resources/assets/data_gen_test/lang/en_us.json +++ b/src/generated_test/resources/assets/data_gen_test/lang/en_us.json @@ -1,6 +1,6 @@ { "block.minecraft.stone": "Stone", - "data_gen_test.test.unicode": "\u0287s\u01DD\u2534 \u01DDpo\u0254\u1D09u\u2229", + "data_gen_test.test.unicode": "ʇsÇâ”´ Çpoɔᴉu∩", "effect.minecraft.poison": "Poison", "enchantment.minecraft.sharpness": "Sharpness", "entity.minecraft.cat": "Cat", diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom.json deleted file mode 100644 index 4759e060f6d..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom", - "textures": { - "bottom": "minecraft:block/acacia_door_bottom", - "top": "minecraft:block/acacia_door_top" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom_hinge.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom_hinge.json deleted file mode 100644 index d248e08b0d9..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_bottom_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom_rh", - "textures": { - "bottom": "minecraft:block/acacia_door_bottom", - "top": "minecraft:block/acacia_door_top" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top.json deleted file mode 100644 index e921147cada..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top", - "textures": { - "bottom": "minecraft:block/acacia_door_bottom", - "top": "minecraft:block/acacia_door_top" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top_hinge.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top_hinge.json deleted file mode 100644 index 37647bbca9c..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_door_top_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top_rh", - "textures": { - "bottom": "minecraft:block/acacia_door_bottom", - "top": "minecraft:block/acacia_door_top" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_post.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_post.json deleted file mode 100644 index 96e4d4449e7..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/fence_post", - "textures": { - "texture": "minecraft:block/acacia_planks" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_side.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_side.json deleted file mode 100644 index 9d7c83ea471..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_fence_side.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/fence_side", - "textures": { - "texture": "minecraft:block/acacia_planks" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log.json index 7e3ac44b69f..6eab23b0ca6 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log.json @@ -1,7 +1,7 @@ { "parent": "minecraft:block/cube_column", "textures": { - "side": "minecraft:block/acacia_log", - "end": "minecraft:block/acacia_log_top" + "end": "minecraft:block/acacia_log_top", + "side": "minecraft:block/acacia_log" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log_horizontal.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log_horizontal.json index 6ff6b467a75..c0ff6ac498c 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log_horizontal.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_log_horizontal.json @@ -1,7 +1,7 @@ { "parent": "minecraft:block/cube_column_horizontal", "textures": { - "side": "minecraft:block/acacia_log", - "end": "minecraft:block/acacia_log_top" + "end": "minecraft:block/acacia_log_top", + "side": "minecraft:block/acacia_log" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab.json index 1657fd3a5f6..b8d31c827f0 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/slab", "textures": { - "side": "minecraft:block/acacia_planks", "bottom": "minecraft:block/acacia_planks", + "side": "minecraft:block/acacia_planks", "top": "minecraft:block/acacia_planks" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab_top.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab_top.json index f8f498978ea..a2995410cb4 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab_top.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_slab_top.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/slab_top", "textures": { - "side": "minecraft:block/acacia_planks", "bottom": "minecraft:block/acacia_planks", + "side": "minecraft:block/acacia_planks", "top": "minecraft:block/acacia_planks" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs.json index b655fcfda5d..fee16e55c4f 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/stairs", "textures": { - "side": "minecraft:block/acacia_planks", "bottom": "minecraft:block/acacia_planks", + "side": "minecraft:block/acacia_planks", "top": "minecraft:block/acacia_planks" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_inner.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_inner.json index e1bb8326228..323018d5556 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_inner.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_inner.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/inner_stairs", "textures": { - "side": "minecraft:block/acacia_planks", "bottom": "minecraft:block/acacia_planks", + "side": "minecraft:block/acacia_planks", "top": "minecraft:block/acacia_planks" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_outer.json b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_outer.json index c6fed2be6f7..a4978fbd9a4 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_outer.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/acacia_stairs_outer.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/outer_stairs", "textures": { - "side": "minecraft:block/acacia_planks", "bottom": "minecraft:block/acacia_planks", + "side": "minecraft:block/acacia_planks", "top": "minecraft:block/acacia_planks" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/barrel.json b/src/generated_test/resources/assets/data_gen_test/models/block/barrel.json index 85006318768..cff930084d4 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/barrel.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/barrel.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/cube_bottom_top", "textures": { - "side": "minecraft:block/barrel_side", "bottom": "minecraft:block/barrel_bottom", + "side": "minecraft:block/barrel_side", "top": "minecraft:block/barrel_top" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/barrel_open.json b/src/generated_test/resources/assets/data_gen_test/models/block/barrel_open.json index 560545cb6f8..c7d013e7b44 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/barrel_open.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/barrel_open.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/cube_bottom_top", "textures": { - "side": "minecraft:block/barrel_side", "bottom": "minecraft:block/barrel_bottom", + "side": "minecraft:block/barrel_side", "top": "minecraft:block/barrel_top_open" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/block.json b/src/generated_test/resources/assets/data_gen_test/models/block/block.json index c69c0f6b939..68ae9d17752 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/block.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/block.json @@ -1,28 +1,27 @@ { - "gui_light": "side", "display": { - "gui": { + "firstperson_lefthand": { "rotation": [ - 30, + 0, 225, 0 ], "scale": [ - 0.625, - 0.625, - 0.625 + 0.4, + 0.4, + 0.4 ] }, - "ground": { - "translation": [ + "firstperson_righthand": { + "rotation": [ 0, - 3, + 45, 0 ], "scale": [ - 0.25, - 0.25, - 0.25 + 0.4, + 0.4, + 0.4 ] }, "fixed": { @@ -32,46 +31,47 @@ 0.5 ] }, - "thirdperson_righthand": { - "rotation": [ - 75, - 45, - 0 + "ground": { + "scale": [ + 0.25, + 0.25, + 0.25 ], "translation": [ 0, - 2.5, + 3, 0 - ], - "scale": [ - 0.375, - 0.375, - 0.375 ] }, - "firstperson_righthand": { + "gui": { "rotation": [ - 0, - 45, + 30, + 225, 0 ], "scale": [ - 0.4, - 0.4, - 0.4 + 0.625, + 0.625, + 0.625 ] }, - "firstperson_lefthand": { + "thirdperson_righthand": { "rotation": [ - 0, - 225, + 75, + 45, 0 ], "scale": [ - 0.4, - 0.4, - 0.4 + 0.375, + 0.375, + 0.375 + ], + "translation": [ + 0, + 2.5, + 0 ] } - } + }, + "gui_light": "side" } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_post.json b/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_post.json deleted file mode 100644 index 7f47c03ff18..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/template_wall_post", - "textures": { - "wall": "minecraft:block/cobblestone" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side.json b/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side.json deleted file mode 100644 index f0eabd2b3a0..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/template_wall_side", - "textures": { - "wall": "minecraft:block/cobblestone" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side_tall.json b/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side_tall.json deleted file mode 100644 index d6f6625626a..00000000000 --- a/src/generated_test/resources/assets/data_gen_test/models/block/cobblestone_wall_side_tall.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/template_wall_side_tall", - "textures": { - "wall": "minecraft:block/cobblestone" - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/cube.json b/src/generated_test/resources/assets/data_gen_test/models/block/cube.json index 6916e6421b5..0aee54dd4e3 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/cube.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/cube.json @@ -2,42 +2,42 @@ "parent": "data_gen_test:block/block", "elements": [ { - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ], "faces": { "down": { - "texture": "#down", - "cullface": "down" + "cullface": "down", + "texture": "#down" }, - "up": { - "texture": "#up", - "cullface": "up" + "east": { + "cullface": "east", + "texture": "#east" }, "north": { - "texture": "#north", - "cullface": "north" + "cullface": "north", + "texture": "#north" }, "south": { - "texture": "#south", - "cullface": "south" + "cullface": "south", + "texture": "#south" }, - "west": { - "texture": "#west", - "cullface": "west" + "up": { + "cullface": "up", + "texture": "#up" }, - "east": { - "texture": "#east", - "cullface": "east" + "west": { + "cullface": "west", + "texture": "#west" } - } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] } ] } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/furnace.json b/src/generated_test/resources/assets/data_gen_test/models/block/furnace.json index 602d252ea48..9603b454d5d 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/furnace.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/furnace.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/orientable", "textures": { - "side": "minecraft:block/furnace_side", "front": "minecraft:block/furnace_front", + "side": "minecraft:block/furnace_side", "top": "minecraft:block/furnace_top" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/furnace_on.json b/src/generated_test/resources/assets/data_gen_test/models/block/furnace_on.json index b8ef10cfc59..37c4d394180 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/furnace_on.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/furnace_on.json @@ -1,8 +1,8 @@ { "parent": "minecraft:block/orientable", "textures": { - "side": "minecraft:block/furnace_side", "front": "minecraft:block/furnace_front_on", + "side": "minecraft:block/furnace_side", "top": "minecraft:block/furnace_top" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_post.json b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_post.json index a88c26d2a05..6067b6a8c3c 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_post.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_post.json @@ -1,7 +1,7 @@ { "parent": "minecraft:block/template_glass_pane_post", "textures": { - "pane": "minecraft:block/glass", - "edge": "minecraft:block/glass_pane_top" + "edge": "minecraft:block/glass_pane_top", + "pane": "minecraft:block/glass" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side.json b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side.json index 78597546c25..0b03be05ea9 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side.json @@ -1,7 +1,7 @@ { "parent": "minecraft:block/template_glass_pane_side", "textures": { - "pane": "minecraft:block/glass", - "edge": "minecraft:block/glass_pane_top" + "edge": "minecraft:block/glass_pane_top", + "pane": "minecraft:block/glass" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side_alt.json b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side_alt.json index 0830c5e51ce..e8bd700f967 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side_alt.json +++ b/src/generated_test/resources/assets/data_gen_test/models/block/glass_pane_side_alt.json @@ -1,7 +1,7 @@ { "parent": "minecraft:block/template_glass_pane_side_alt", "textures": { - "pane": "minecraft:block/glass", - "edge": "minecraft:block/glass_pane_top" + "edge": "minecraft:block/glass_pane_top", + "pane": "minecraft:block/glass" } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/item/fishing_rod.json b/src/generated_test/resources/assets/data_gen_test/models/item/fishing_rod.json index c5a2e7f1d6d..b762ab762f7 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/item/fishing_rod.json +++ b/src/generated_test/resources/assets/data_gen_test/models/item/fishing_rod.json @@ -1,14 +1,14 @@ { "parent": "minecraft:item/handheld_rod", - "textures": { - "layer0": "minecraft:item/fishing_rod" - }, "overrides": [ { + "model": "minecraft:item/fishing_rod_cast", "predicate": { "minecraft:cast": 1.0 - }, - "model": "minecraft:item/fishing_rod_cast" + } } - ] + ], + "textures": { + "layer0": "minecraft:item/fishing_rod" + } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/models/item/test_block_model.json b/src/generated_test/resources/assets/data_gen_test/models/item/test_block_model.json index 0cee77b34f8..f730eb78c57 100644 --- a/src/generated_test/resources/assets/data_gen_test/models/item/test_block_model.json +++ b/src/generated_test/resources/assets/data_gen_test/models/item/test_block_model.json @@ -1,48 +1,48 @@ { "parent": "minecraft:block/block", - "textures": { - "all": "minecraft:block/dirt", - "top": "minecraft:block/stone" - }, "elements": [ { - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ], "faces": { "down": { - "texture": "#all", - "cullface": "down" + "cullface": "down", + "texture": "#all" }, - "up": { - "texture": "#top", - "cullface": "up", - "tintindex": 0 + "east": { + "cullface": "east", + "texture": "#all" }, "north": { - "texture": "#all", - "cullface": "north" + "cullface": "north", + "texture": "#all" }, "south": { - "texture": "#all", - "cullface": "south" + "cullface": "south", + "texture": "#all" }, - "west": { - "texture": "#all", - "cullface": "west" + "up": { + "cullface": "up", + "texture": "#top", + "tintindex": 0 }, - "east": { - "texture": "#all", - "cullface": "east" + "west": { + "cullface": "west", + "texture": "#all" } - } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] } - ] + ], + "textures": { + "all": "minecraft:block/dirt", + "top": "minecraft:block/stone" + } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/data_gen_test/sounds.json b/src/generated_test/resources/assets/data_gen_test/sounds.json index 0dc8103c959..1fb6dd5c400 100644 --- a/src/generated_test/resources/assets/data_gen_test/sounds.json +++ b/src/generated_test/resources/assets/data_gen_test/sounds.json @@ -24,13 +24,12 @@ ] }, "block.lava.ambient": { - "subtitle": "subtitles.block.lava.ambient", "sounds": [ "liquid/lava" - ] + ], + "subtitle": "subtitles.block.lava.ambient" }, "entity.dolphin.ambient_water": { - "subtitle": "subtitles.entity.dolphin.ambient_water", "sounds": [ { "name": "mob/dolphin/idle_water1", @@ -54,21 +53,21 @@ "name": "mob/dolphin/idle_water10", "volume": 0.8 } - ] + ], + "subtitle": "subtitles.entity.dolphin.ambient_water" }, "entity.parrot.imitate.drowned": { - "subtitle": "subtitles.entity.parrot.imitate.drowned", "sounds": [ { - "name": "entity.drowned.ambient", "type": "event", - "volume": 0.6, - "pitch": 1.8 + "name": "entity.drowned.ambient", + "pitch": 1.8, + "volume": 0.6 } - ] + ], + "subtitle": "subtitles.entity.parrot.imitate.drowned" }, "item.trident.return": { - "subtitle": "subtitles.item.trident.return", "sounds": [ { "name": "item/trident/return1", @@ -80,18 +79,18 @@ }, { "name": "item/trident/return2", - "volume": 0.8, - "pitch": 0.8 + "pitch": 0.8, + "volume": 0.8 }, { "name": "item/trident/return2", - "volume": 0.8, - "pitch": 1.2 + "pitch": 1.2, + "volume": 0.8 }, { "name": "item/trident/return2", - "volume": 0.8, - "pitch": 1.2 + "pitch": 1.2, + "volume": 0.8 }, { "name": "item/trident/return3", @@ -99,20 +98,21 @@ }, { "name": "item/trident/return3", - "volume": 0.8, - "pitch": 0.8 + "pitch": 0.8, + "volume": 0.8 }, { "name": "item/trident/return3", - "volume": 0.8, - "pitch": 0.8 + "pitch": 0.8, + "volume": 0.8 }, { "name": "item/trident/return3", - "volume": 0.8, - "pitch": 1.2 + "pitch": 1.2, + "volume": 0.8 } - ] + ], + "subtitle": "subtitles.item.trident.return" }, "music_disc.blocks": { "sounds": [ diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_button.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_button.json index 9017fee3cae..f70bffd4f04 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_button.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/acacia_button.json @@ -1,117 +1,117 @@ { "variants": { - "face=floor,facing=north,powered=false": { - "model": "data_gen_test:block/acacia_button" - }, - "face=wall,facing=north,powered=false": { + "face=ceiling,facing=east,powered=false": { "model": "data_gen_test:block/acacia_button", - "x": 90, - "uvlock": true + "x": 180, + "y": 270 + }, + "face=ceiling,facing=east,powered=true": { + "model": "data_gen_test:block/acacia_button_pressed", + "x": 180, + "y": 270 }, "face=ceiling,facing=north,powered=false": { "model": "data_gen_test:block/acacia_button", "x": 180, "y": 180 }, - "face=floor,facing=south,powered=false": { - "model": "data_gen_test:block/acacia_button", + "face=ceiling,facing=north,powered=true": { + "model": "data_gen_test:block/acacia_button_pressed", + "x": 180, "y": 180 }, - "face=wall,facing=south,powered=false": { - "model": "data_gen_test:block/acacia_button", - "x": 90, - "y": 180, - "uvlock": true - }, "face=ceiling,facing=south,powered=false": { "model": "data_gen_test:block/acacia_button", "x": 180 }, - "face=floor,facing=west,powered=false": { - "model": "data_gen_test:block/acacia_button", - "y": 270 - }, - "face=wall,facing=west,powered=false": { - "model": "data_gen_test:block/acacia_button", - "x": 90, - "y": 270, - "uvlock": true + "face=ceiling,facing=south,powered=true": { + "model": "data_gen_test:block/acacia_button_pressed", + "x": 180 }, "face=ceiling,facing=west,powered=false": { "model": "data_gen_test:block/acacia_button", "x": 180, "y": 90 }, + "face=ceiling,facing=west,powered=true": { + "model": "data_gen_test:block/acacia_button_pressed", + "x": 180, + "y": 90 + }, "face=floor,facing=east,powered=false": { "model": "data_gen_test:block/acacia_button", "y": 90 }, - "face=wall,facing=east,powered=false": { - "model": "data_gen_test:block/acacia_button", - "x": 90, - "y": 90, - "uvlock": true + "face=floor,facing=east,powered=true": { + "model": "data_gen_test:block/acacia_button_pressed", + "y": 90 }, - "face=ceiling,facing=east,powered=false": { - "model": "data_gen_test:block/acacia_button", - "x": 180, - "y": 270 + "face=floor,facing=north,powered=false": { + "model": "data_gen_test:block/acacia_button" }, "face=floor,facing=north,powered=true": { "model": "data_gen_test:block/acacia_button_pressed" }, - "face=wall,facing=north,powered=true": { - "model": "data_gen_test:block/acacia_button_pressed", - "x": 90, - "uvlock": true - }, - "face=ceiling,facing=north,powered=true": { - "model": "data_gen_test:block/acacia_button_pressed", - "x": 180, + "face=floor,facing=south,powered=false": { + "model": "data_gen_test:block/acacia_button", "y": 180 }, "face=floor,facing=south,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", "y": 180 }, - "face=wall,facing=south,powered=true": { - "model": "data_gen_test:block/acacia_button_pressed", - "x": 90, - "y": 180, - "uvlock": true - }, - "face=ceiling,facing=south,powered=true": { - "model": "data_gen_test:block/acacia_button_pressed", - "x": 180 + "face=floor,facing=west,powered=false": { + "model": "data_gen_test:block/acacia_button", + "y": 270 }, "face=floor,facing=west,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", "y": 270 }, - "face=wall,facing=west,powered=true": { - "model": "data_gen_test:block/acacia_button_pressed", + "face=wall,facing=east,powered=false": { + "model": "data_gen_test:block/acacia_button", + "uvlock": true, "x": 90, - "y": 270, - "uvlock": true + "y": 90 }, - "face=ceiling,facing=west,powered=true": { + "face=wall,facing=east,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", - "x": 180, + "uvlock": true, + "x": 90, "y": 90 }, - "face=floor,facing=east,powered=true": { + "face=wall,facing=north,powered=false": { + "model": "data_gen_test:block/acacia_button", + "uvlock": true, + "x": 90 + }, + "face=wall,facing=north,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", - "y": 90 + "uvlock": true, + "x": 90 }, - "face=wall,facing=east,powered=true": { + "face=wall,facing=south,powered=false": { + "model": "data_gen_test:block/acacia_button", + "uvlock": true, + "x": 90, + "y": 180 + }, + "face=wall,facing=south,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", + "uvlock": true, "x": 90, - "y": 90, - "uvlock": true + "y": 180 }, - "face=ceiling,facing=east,powered=true": { + "face=wall,facing=west,powered=false": { + "model": "data_gen_test:block/acacia_button", + "uvlock": true, + "x": 90, + "y": 270 + }, + "face=wall,facing=west,powered=true": { "model": "data_gen_test:block/acacia_button_pressed", - "x": 180, + "uvlock": true, + "x": 90, "y": 270 } } diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_door.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_door.json deleted file mode 100644 index 2e1ac652649..00000000000 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_door.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "variants": { - "facing=north,half=upper,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_top", - "y": 270 - }, - "facing=south,half=upper,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_top", - "y": 90 - }, - "facing=west,half=upper,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_top", - "y": 180 - }, - "facing=east,half=upper,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_top" - }, - "facing=north,half=lower,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 270 - }, - "facing=south,half=lower,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 90 - }, - "facing=west,half=lower,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 180 - }, - "facing=east,half=lower,hinge=left,open=false": { - "model": "data_gen_test:block/acacia_door_bottom" - }, - "facing=north,half=upper,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 270 - }, - "facing=south,half=upper,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 90 - }, - "facing=west,half=upper,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 180 - }, - "facing=east,half=upper,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_top_hinge" - }, - "facing=north,half=lower,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 270 - }, - "facing=south,half=lower,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 90 - }, - "facing=west,half=lower,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 180 - }, - "facing=east,half=lower,hinge=right,open=false": { - "model": "data_gen_test:block/acacia_door_bottom_hinge" - }, - "facing=north,half=upper,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_top_hinge" - }, - "facing=south,half=upper,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 180 - }, - "facing=west,half=upper,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 270 - }, - "facing=east,half=upper,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_top_hinge", - "y": 90 - }, - "facing=north,half=lower,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_bottom_hinge" - }, - "facing=south,half=lower,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 180 - }, - "facing=west,half=lower,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 270 - }, - "facing=east,half=lower,hinge=left,open=true": { - "model": "data_gen_test:block/acacia_door_bottom_hinge", - "y": 90 - }, - "facing=north,half=upper,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_top", - "y": 180 - }, - "facing=south,half=upper,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_top" - }, - "facing=west,half=upper,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_top", - "y": 90 - }, - "facing=east,half=upper,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_top", - "y": 270 - }, - "facing=north,half=lower,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 180 - }, - "facing=south,half=lower,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_bottom" - }, - "facing=west,half=lower,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 90 - }, - "facing=east,half=lower,hinge=right,open=true": { - "model": "data_gen_test:block/acacia_door_bottom", - "y": 270 - } - } -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence.json deleted file mode 100644 index f51a6d3d27f..00000000000 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "multipart": [ - { - "apply": { - "model": "data_gen_test:block/acacia_fence_post" - } - }, - { - "when": { - "north": "true" - }, - "apply": { - "model": "data_gen_test:block/acacia_fence_side", - "uvlock": true - } - }, - { - "when": { - "south": "true" - }, - "apply": { - "model": "data_gen_test:block/acacia_fence_side", - "y": 180, - "uvlock": true - } - }, - { - "when": { - "west": "true" - }, - "apply": { - "model": "data_gen_test:block/acacia_fence_side", - "y": 270, - "uvlock": true - } - }, - { - "when": { - "east": "true" - }, - "apply": { - "model": "data_gen_test:block/acacia_fence_side", - "y": 90, - "uvlock": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence_gate.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence_gate.json index 637165670c3..8d6fdbbe4a7 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence_gate.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/acacia_fence_gate.json @@ -1,80 +1,80 @@ { "variants": { - "facing=north,in_wall=false,open=false": { - "model": "data_gen_test:block/acacia_fence_gate", - "y": 180, - "uvlock": true - }, - "facing=south,in_wall=false,open=false": { - "model": "data_gen_test:block/acacia_fence_gate", - "uvlock": true - }, - "facing=west,in_wall=false,open=false": { - "model": "data_gen_test:block/acacia_fence_gate", - "y": 90, - "uvlock": true - }, "facing=east,in_wall=false,open=false": { "model": "data_gen_test:block/acacia_fence_gate", - "y": 270, - "uvlock": true + "uvlock": true, + "y": 270 }, - "facing=north,in_wall=true,open=false": { - "model": "data_gen_test:block/acacia_fence_gate_wall", - "y": 180, - "uvlock": true + "facing=east,in_wall=false,open=true": { + "model": "data_gen_test:block/acacia_fence_gate_open", + "uvlock": true, + "y": 270 }, - "facing=south,in_wall=true,open=false": { + "facing=east,in_wall=true,open=false": { "model": "data_gen_test:block/acacia_fence_gate_wall", - "uvlock": true + "uvlock": true, + "y": 270 }, - "facing=west,in_wall=true,open=false": { - "model": "data_gen_test:block/acacia_fence_gate_wall", - "y": 90, - "uvlock": true + "facing=east,in_wall=true,open=true": { + "model": "data_gen_test:block/acacia_fence_gate_wall_open", + "uvlock": true, + "y": 270 }, - "facing=east,in_wall=true,open=false": { - "model": "data_gen_test:block/acacia_fence_gate_wall", - "y": 270, - "uvlock": true + "facing=north,in_wall=false,open=false": { + "model": "data_gen_test:block/acacia_fence_gate", + "uvlock": true, + "y": 180 }, "facing=north,in_wall=false,open=true": { "model": "data_gen_test:block/acacia_fence_gate_open", - "y": 180, - "uvlock": true + "uvlock": true, + "y": 180 }, - "facing=south,in_wall=false,open=true": { - "model": "data_gen_test:block/acacia_fence_gate_open", - "uvlock": true + "facing=north,in_wall=true,open=false": { + "model": "data_gen_test:block/acacia_fence_gate_wall", + "uvlock": true, + "y": 180 }, - "facing=west,in_wall=false,open=true": { - "model": "data_gen_test:block/acacia_fence_gate_open", - "y": 90, + "facing=north,in_wall=true,open=true": { + "model": "data_gen_test:block/acacia_fence_gate_wall_open", + "uvlock": true, + "y": 180 + }, + "facing=south,in_wall=false,open=false": { + "model": "data_gen_test:block/acacia_fence_gate", "uvlock": true }, - "facing=east,in_wall=false,open=true": { + "facing=south,in_wall=false,open=true": { "model": "data_gen_test:block/acacia_fence_gate_open", - "y": 270, "uvlock": true }, - "facing=north,in_wall=true,open=true": { - "model": "data_gen_test:block/acacia_fence_gate_wall_open", - "y": 180, + "facing=south,in_wall=true,open=false": { + "model": "data_gen_test:block/acacia_fence_gate_wall", "uvlock": true }, "facing=south,in_wall=true,open=true": { "model": "data_gen_test:block/acacia_fence_gate_wall_open", "uvlock": true }, - "facing=west,in_wall=true,open=true": { - "model": "data_gen_test:block/acacia_fence_gate_wall_open", - "y": 90, - "uvlock": true + "facing=west,in_wall=false,open=false": { + "model": "data_gen_test:block/acacia_fence_gate", + "uvlock": true, + "y": 90 }, - "facing=east,in_wall=true,open=true": { + "facing=west,in_wall=false,open=true": { + "model": "data_gen_test:block/acacia_fence_gate_open", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=false": { + "model": "data_gen_test:block/acacia_fence_gate_wall", + "uvlock": true, + "y": 90 + }, + "facing=west,in_wall=true,open=true": { "model": "data_gen_test:block/acacia_fence_gate_wall_open", - "y": 270, - "uvlock": true + "uvlock": true, + "y": 90 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_slab.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_slab.json index 5d28d6bad6f..9177e1fbf13 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_slab.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/acacia_slab.json @@ -1,13 +1,13 @@ { "variants": { - "type=top": { - "model": "data_gen_test:block/acacia_slab_top" - }, "type=bottom": { "model": "data_gen_test:block/acacia_slab" }, "type=double": { "model": "minecraft:block/acacia_planks" + }, + "type=top": { + "model": "data_gen_test:block/acacia_slab_top" } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_stairs.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_stairs.json index 1c5ac6f2e77..a6c2019cb17 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_stairs.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/acacia_stairs.json @@ -1,209 +1,209 @@ { "variants": { - "facing=north,half=top,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "x": 180, - "y": 270, - "uvlock": true - }, - "facing=south,half=top,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "x": 180, - "y": 90, - "uvlock": true - }, - "facing=west,half=top,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "x": 180, - "y": 180, - "uvlock": true - }, - "facing=east,half=top,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "x": 180, - "uvlock": true + "facing=east,half=bottom,shape=inner_left": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, + "y": 270 }, - "facing=north,half=bottom,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "y": 270, - "uvlock": true + "facing=east,half=bottom,shape=inner_right": { + "model": "data_gen_test:block/acacia_stairs_inner" }, - "facing=south,half=bottom,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "y": 90, - "uvlock": true + "facing=east,half=bottom,shape=outer_left": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "y": 270 }, - "facing=west,half=bottom,shape=straight": { - "model": "data_gen_test:block/acacia_stairs", - "y": 180, - "uvlock": true + "facing=east,half=bottom,shape=outer_right": { + "model": "data_gen_test:block/acacia_stairs_outer" }, "facing=east,half=bottom,shape=straight": { "model": "data_gen_test:block/acacia_stairs" }, - "facing=north,half=top,shape=inner_left": { + "facing=east,half=top,shape=inner_left": { "model": "data_gen_test:block/acacia_stairs_inner", - "x": 180, - "y": 270, - "uvlock": true + "uvlock": true, + "x": 180 }, - "facing=south,half=top,shape=inner_left": { + "facing=east,half=top,shape=inner_right": { "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, "x": 180, - "y": 90, - "uvlock": true + "y": 90 }, - "facing=west,half=top,shape=inner_left": { - "model": "data_gen_test:block/acacia_stairs_inner", - "x": 180, - "y": 180, - "uvlock": true + "facing=east,half=top,shape=outer_left": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "x": 180 }, - "facing=east,half=top,shape=inner_left": { - "model": "data_gen_test:block/acacia_stairs_inner", + "facing=east,half=top,shape=outer_right": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, "x": 180, - "uvlock": true + "y": 90 + }, + "facing=east,half=top,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, + "x": 180 }, "facing=north,half=bottom,shape=inner_left": { "model": "data_gen_test:block/acacia_stairs_inner", - "y": 180, - "uvlock": true + "uvlock": true, + "y": 180 }, - "facing=south,half=bottom,shape=inner_left": { - "model": "data_gen_test:block/acacia_stairs_inner" - }, - "facing=west,half=bottom,shape=inner_left": { + "facing=north,half=bottom,shape=inner_right": { "model": "data_gen_test:block/acacia_stairs_inner", - "y": 90, - "uvlock": true + "uvlock": true, + "y": 270 }, - "facing=east,half=bottom,shape=inner_left": { - "model": "data_gen_test:block/acacia_stairs_inner", - "y": 270, - "uvlock": true + "facing=north,half=bottom,shape=outer_left": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "y": 180 }, - "facing=north,half=top,shape=inner_right": { - "model": "data_gen_test:block/acacia_stairs_inner", - "x": 180, - "uvlock": true + "facing=north,half=bottom,shape=outer_right": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "y": 270 }, - "facing=south,half=top,shape=inner_right": { + "facing=north,half=bottom,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, + "y": 270 + }, + "facing=north,half=top,shape=inner_left": { "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, "x": 180, - "y": 180, - "uvlock": true + "y": 270 }, - "facing=west,half=top,shape=inner_right": { + "facing=north,half=top,shape=inner_right": { "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=outer_left": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, "x": 180, - "y": 270, - "uvlock": true + "y": 270 }, - "facing=east,half=top,shape=inner_right": { - "model": "data_gen_test:block/acacia_stairs_inner", + "facing=north,half=top,shape=outer_right": { + "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, "x": 180, - "y": 90, - "uvlock": true + "y": 270 }, - "facing=north,half=bottom,shape=inner_right": { - "model": "data_gen_test:block/acacia_stairs_inner", - "y": 270, - "uvlock": true + "facing=south,half=bottom,shape=inner_left": { + "model": "data_gen_test:block/acacia_stairs_inner" }, "facing=south,half=bottom,shape=inner_right": { "model": "data_gen_test:block/acacia_stairs_inner", - "y": 90, - "uvlock": true - }, - "facing=west,half=bottom,shape=inner_right": { - "model": "data_gen_test:block/acacia_stairs_inner", - "y": 180, - "uvlock": true + "uvlock": true, + "y": 90 }, - "facing=east,half=bottom,shape=inner_right": { - "model": "data_gen_test:block/acacia_stairs_inner" + "facing=south,half=bottom,shape=outer_left": { + "model": "data_gen_test:block/acacia_stairs_outer" }, - "facing=north,half=top,shape=outer_left": { + "facing=south,half=bottom,shape=outer_right": { "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, + "y": 90 + }, + "facing=south,half=top,shape=inner_left": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=inner_right": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, "x": 180, - "y": 270, - "uvlock": true + "y": 180 }, "facing=south,half=top,shape=outer_left": { "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, "x": 180, - "y": 90, - "uvlock": true + "y": 90 }, - "facing=west,half=top,shape=outer_left": { + "facing=south,half=top,shape=outer_right": { "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, "x": 180, - "y": 180, - "uvlock": true + "y": 180 }, - "facing=east,half=top,shape=outer_left": { - "model": "data_gen_test:block/acacia_stairs_outer", + "facing=south,half=top,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, "x": 180, - "uvlock": true + "y": 90 }, - "facing=north,half=bottom,shape=outer_left": { - "model": "data_gen_test:block/acacia_stairs_outer", - "y": 180, - "uvlock": true + "facing=west,half=bottom,shape=inner_left": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, + "y": 90 }, - "facing=south,half=bottom,shape=outer_left": { - "model": "data_gen_test:block/acacia_stairs_outer" + "facing=west,half=bottom,shape=inner_right": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, + "y": 180 }, "facing=west,half=bottom,shape=outer_left": { "model": "data_gen_test:block/acacia_stairs_outer", - "y": 90, - "uvlock": true + "uvlock": true, + "y": 90 }, - "facing=east,half=bottom,shape=outer_left": { + "facing=west,half=bottom,shape=outer_right": { "model": "data_gen_test:block/acacia_stairs_outer", - "y": 270, - "uvlock": true + "uvlock": true, + "y": 180 }, - "facing=north,half=top,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer", - "x": 180, - "uvlock": true + "facing=west,half=bottom,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, + "y": 180 }, - "facing=south,half=top,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer", + "facing=west,half=top,shape=inner_left": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, "x": 180, - "y": 180, - "uvlock": true + "y": 180 }, - "facing=west,half=top,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer", + "facing=west,half=top,shape=inner_right": { + "model": "data_gen_test:block/acacia_stairs_inner", + "uvlock": true, "x": 180, - "y": 270, - "uvlock": true + "y": 270 }, - "facing=east,half=top,shape=outer_right": { + "facing=west,half=top,shape=outer_left": { "model": "data_gen_test:block/acacia_stairs_outer", + "uvlock": true, "x": 180, - "y": 90, - "uvlock": true - }, - "facing=north,half=bottom,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer", - "y": 270, - "uvlock": true - }, - "facing=south,half=bottom,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer", - "y": 90, - "uvlock": true + "y": 180 }, - "facing=west,half=bottom,shape=outer_right": { + "facing=west,half=top,shape=outer_right": { "model": "data_gen_test:block/acacia_stairs_outer", - "y": 180, - "uvlock": true + "uvlock": true, + "x": 180, + "y": 270 }, - "facing=east,half=bottom,shape=outer_right": { - "model": "data_gen_test:block/acacia_stairs_outer" + "facing=west,half=top,shape=straight": { + "model": "data_gen_test:block/acacia_stairs", + "uvlock": true, + "x": 180, + "y": 180 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/acacia_trapdoor.json b/src/generated_test/resources/assets/minecraft/blockstates/acacia_trapdoor.json index f3a766046f1..05295b137ad 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/acacia_trapdoor.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/acacia_trapdoor.json @@ -1,67 +1,67 @@ { "variants": { - "facing=north,half=top,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_top" - }, - "facing=south,half=top,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_top", - "y": 180 + "facing=east,half=bottom,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_bottom", + "y": 90 }, - "facing=west,half=top,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_top", - "y": 270 + "facing=east,half=bottom,open=true": { + "model": "data_gen_test:block/acacia_trapdoor_open", + "y": 90 }, "facing=east,half=top,open=false": { "model": "data_gen_test:block/acacia_trapdoor_top", "y": 90 }, + "facing=east,half=top,open=true": { + "model": "data_gen_test:block/acacia_trapdoor_open", + "x": 180, + "y": 270 + }, "facing=north,half=bottom,open=false": { "model": "data_gen_test:block/acacia_trapdoor_bottom" }, - "facing=south,half=bottom,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_bottom", - "y": 180 - }, - "facing=west,half=bottom,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_bottom", - "y": 270 + "facing=north,half=bottom,open=true": { + "model": "data_gen_test:block/acacia_trapdoor_open" }, - "facing=east,half=bottom,open=false": { - "model": "data_gen_test:block/acacia_trapdoor_bottom", - "y": 90 + "facing=north,half=top,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_top" }, "facing=north,half=top,open=true": { "model": "data_gen_test:block/acacia_trapdoor_open", "x": 180, "y": 180 }, - "facing=south,half=top,open=true": { - "model": "data_gen_test:block/acacia_trapdoor_open", - "x": 180 - }, - "facing=west,half=top,open=true": { - "model": "data_gen_test:block/acacia_trapdoor_open", - "x": 180, - "y": 90 + "facing=south,half=bottom,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_bottom", + "y": 180 }, - "facing=east,half=top,open=true": { + "facing=south,half=bottom,open=true": { "model": "data_gen_test:block/acacia_trapdoor_open", - "x": 180, - "y": 270 + "y": 180 }, - "facing=north,half=bottom,open=true": { - "model": "data_gen_test:block/acacia_trapdoor_open" + "facing=south,half=top,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_top", + "y": 180 }, - "facing=south,half=bottom,open=true": { + "facing=south,half=top,open=true": { "model": "data_gen_test:block/acacia_trapdoor_open", - "y": 180 + "x": 180 + }, + "facing=west,half=bottom,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_bottom", + "y": 270 }, "facing=west,half=bottom,open=true": { "model": "data_gen_test:block/acacia_trapdoor_open", "y": 270 }, - "facing=east,half=bottom,open=true": { + "facing=west,half=top,open=false": { + "model": "data_gen_test:block/acacia_trapdoor_top", + "y": 270 + }, + "facing=west,half=top,open=true": { "model": "data_gen_test:block/acacia_trapdoor_open", + "x": 180, "y": 90 } } diff --git a/src/generated_test/resources/assets/minecraft/blockstates/barrel.json b/src/generated_test/resources/assets/minecraft/blockstates/barrel.json index a7da394f82c..9edf8012909 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/barrel.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/barrel.json @@ -4,53 +4,53 @@ "model": "data_gen_test:block/barrel", "x": 180 }, - "facing=up,open=false": { - "model": "data_gen_test:block/barrel" - }, - "facing=north,open=false": { - "model": "data_gen_test:block/barrel", - "x": 90 - }, - "facing=south,open=false": { - "model": "data_gen_test:block/barrel", - "x": 90, - "y": 180 - }, - "facing=west,open=false": { - "model": "data_gen_test:block/barrel", - "x": 90, - "y": 270 + "facing=down,open=true": { + "model": "data_gen_test:block/barrel_open", + "x": 180 }, "facing=east,open=false": { "model": "data_gen_test:block/barrel", "x": 90, "y": 90 }, - "facing=down,open=true": { + "facing=east,open=true": { "model": "data_gen_test:block/barrel_open", - "x": 180 + "x": 90, + "y": 90 }, - "facing=up,open=true": { - "model": "data_gen_test:block/barrel_open" + "facing=north,open=false": { + "model": "data_gen_test:block/barrel", + "x": 90 }, "facing=north,open=true": { "model": "data_gen_test:block/barrel_open", "x": 90 }, + "facing=south,open=false": { + "model": "data_gen_test:block/barrel", + "x": 90, + "y": 180 + }, "facing=south,open=true": { "model": "data_gen_test:block/barrel_open", "x": 90, "y": 180 }, - "facing=west,open=true": { - "model": "data_gen_test:block/barrel_open", + "facing=up,open=false": { + "model": "data_gen_test:block/barrel" + }, + "facing=up,open=true": { + "model": "data_gen_test:block/barrel_open" + }, + "facing=west,open=false": { + "model": "data_gen_test:block/barrel", "x": 90, "y": 270 }, - "facing=east,open=true": { + "facing=west,open=true": { "model": "data_gen_test:block/barrel_open", "x": 90, - "y": 90 + "y": 270 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/birch_fence_gate.json b/src/generated_test/resources/assets/minecraft/blockstates/birch_fence_gate.json index db89c438409..180551be7b2 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/birch_fence_gate.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/birch_fence_gate.json @@ -1,104 +1,104 @@ { "variants": { - "facing=north,in_wall=false,open=false": [ - { - "model": "minecraft:builtin/generated" - }, - { - "model": "data_gen_test:block/birch_fence_gate", - "y": 180, - "uvlock": true, - "weight": 100 - } - ], - "facing=south,in_wall=false,open=false": [ + "facing=east,in_wall=false,open=false": [ { "model": "minecraft:builtin/generated" }, { "model": "data_gen_test:block/birch_fence_gate", "uvlock": true, - "weight": 100 + "weight": 100, + "y": 270 } ], - "facing=west,in_wall=false,open=false": [ + "facing=east,in_wall=false,open=true": { + "model": "data_gen_test:block/birch_fence_gate_open", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=false": { + "model": "data_gen_test:block/birch_fence_gate_wall", + "uvlock": true, + "y": 270 + }, + "facing=east,in_wall=true,open=true": { + "model": "data_gen_test:block/birch_fence_gate_wall_open", + "uvlock": true, + "y": 270 + }, + "facing=north,in_wall=false,open=false": [ { "model": "minecraft:builtin/generated" }, { "model": "data_gen_test:block/birch_fence_gate", - "y": 90, "uvlock": true, - "weight": 100 + "weight": 100, + "y": 180 } ], - "facing=east,in_wall=false,open=false": [ + "facing=north,in_wall=false,open=true": { + "model": "data_gen_test:block/birch_fence_gate_open", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=false": { + "model": "data_gen_test:block/birch_fence_gate_wall", + "uvlock": true, + "y": 180 + }, + "facing=north,in_wall=true,open=true": { + "model": "data_gen_test:block/birch_fence_gate_wall_open", + "uvlock": true, + "y": 180 + }, + "facing=south,in_wall=false,open=false": [ { "model": "minecraft:builtin/generated" }, { "model": "data_gen_test:block/birch_fence_gate", - "y": 270, "uvlock": true, "weight": 100 } ], - "facing=north,in_wall=true,open=false": { - "model": "data_gen_test:block/birch_fence_gate_wall", - "y": 180, + "facing=south,in_wall=false,open=true": { + "model": "data_gen_test:block/birch_fence_gate_open", "uvlock": true }, "facing=south,in_wall=true,open=false": { "model": "data_gen_test:block/birch_fence_gate_wall", "uvlock": true }, - "facing=west,in_wall=true,open=false": { - "model": "data_gen_test:block/birch_fence_gate_wall", - "y": 90, - "uvlock": true - }, - "facing=east,in_wall=true,open=false": { - "model": "data_gen_test:block/birch_fence_gate_wall", - "y": 270, - "uvlock": true - }, - "facing=north,in_wall=false,open=true": { - "model": "data_gen_test:block/birch_fence_gate_open", - "y": 180, - "uvlock": true - }, - "facing=south,in_wall=false,open=true": { - "model": "data_gen_test:block/birch_fence_gate_open", + "facing=south,in_wall=true,open=true": { + "model": "data_gen_test:block/birch_fence_gate_wall_open", "uvlock": true }, + "facing=west,in_wall=false,open=false": [ + { + "model": "minecraft:builtin/generated" + }, + { + "model": "data_gen_test:block/birch_fence_gate", + "uvlock": true, + "weight": 100, + "y": 90 + } + ], "facing=west,in_wall=false,open=true": { "model": "data_gen_test:block/birch_fence_gate_open", - "y": 90, - "uvlock": true - }, - "facing=east,in_wall=false,open=true": { - "model": "data_gen_test:block/birch_fence_gate_open", - "y": 270, - "uvlock": true - }, - "facing=north,in_wall=true,open=true": { - "model": "data_gen_test:block/birch_fence_gate_wall_open", - "y": 180, - "uvlock": true + "uvlock": true, + "y": 90 }, - "facing=south,in_wall=true,open=true": { - "model": "data_gen_test:block/birch_fence_gate_wall_open", - "uvlock": true + "facing=west,in_wall=true,open=false": { + "model": "data_gen_test:block/birch_fence_gate_wall", + "uvlock": true, + "y": 90 }, "facing=west,in_wall=true,open=true": { "model": "data_gen_test:block/birch_fence_gate_wall_open", - "y": 90, - "uvlock": true - }, - "facing=east,in_wall=true,open=true": { - "model": "data_gen_test:block/birch_fence_gate_wall_open", - "y": 270, - "uvlock": true + "uvlock": true, + "y": 90 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/cobblestone_wall.json b/src/generated_test/resources/assets/minecraft/blockstates/cobblestone_wall.json deleted file mode 100644 index a44cb81b6cc..00000000000 --- a/src/generated_test/resources/assets/minecraft/blockstates/cobblestone_wall.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "multipart": [ - { - "when": { - "up": "true" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_post" - } - }, - { - "when": { - "east": "low" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side", - "y": 90, - "uvlock": true - } - }, - { - "when": { - "east": "tall" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side_tall", - "y": 90, - "uvlock": true - } - }, - { - "when": { - "north": "low" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side", - "uvlock": true - } - }, - { - "when": { - "north": "tall" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side_tall", - "uvlock": true - } - }, - { - "when": { - "south": "low" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side", - "y": 180, - "uvlock": true - } - }, - { - "when": { - "south": "tall" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side_tall", - "y": 180, - "uvlock": true - } - }, - { - "when": { - "west": "low" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side", - "y": 270, - "uvlock": true - } - }, - { - "when": { - "west": "tall" - }, - "apply": { - "model": "data_gen_test:block/cobblestone_wall_side_tall", - "y": 270, - "uvlock": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/furnace.json b/src/generated_test/resources/assets/minecraft/blockstates/furnace.json index ea7fe45c3fd..16f35f28c43 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/furnace.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/furnace.json @@ -1,34 +1,34 @@ { "variants": { - "facing=north,lit=false": { - "model": "data_gen_test:block/furnace" - }, - "facing=south,lit=false": { - "model": "data_gen_test:block/furnace", - "y": 180 - }, - "facing=west,lit=false": { - "model": "data_gen_test:block/furnace", - "y": 270 - }, "facing=east,lit=false": { "model": "data_gen_test:block/furnace", "y": 90 }, + "facing=east,lit=true": { + "model": "data_gen_test:block/furnace_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "data_gen_test:block/furnace" + }, "facing=north,lit=true": { "model": "data_gen_test:block/furnace_on" }, + "facing=south,lit=false": { + "model": "data_gen_test:block/furnace", + "y": 180 + }, "facing=south,lit=true": { "model": "data_gen_test:block/furnace_on", "y": 180 }, - "facing=west,lit=true": { - "model": "data_gen_test:block/furnace_on", + "facing=west,lit=false": { + "model": "data_gen_test:block/furnace", "y": 270 }, - "facing=east,lit=true": { + "facing=west,lit=true": { "model": "data_gen_test:block/furnace_on", - "y": 90 + "y": 270 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/glass_pane.json b/src/generated_test/resources/assets/minecraft/blockstates/glass_pane.json index 40fcd41e8cd..734113dc1eb 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/glass_pane.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/glass_pane.json @@ -6,71 +6,71 @@ } }, { - "when": { - "north": "true" - }, "apply": { "model": "data_gen_test:block/glass_pane_side" + }, + "when": { + "north": "true" } }, { - "when": { - "north": "false" - }, "apply": { "model": "data_gen_test:block/glass_pane_noside" + }, + "when": { + "north": "false" } }, { - "when": { - "south": "true" - }, "apply": { "model": "data_gen_test:block/glass_pane_side_alt" + }, + "when": { + "south": "true" } }, { - "when": { - "south": "false" - }, "apply": { "model": "data_gen_test:block/glass_pane_noside_alt", "y": 90 + }, + "when": { + "south": "false" } }, { - "when": { - "west": "true" - }, "apply": { "model": "data_gen_test:block/glass_pane_side_alt", "y": 90 + }, + "when": { + "west": "true" } }, { - "when": { - "west": "false" - }, "apply": { "model": "data_gen_test:block/glass_pane_noside", "y": 270 + }, + "when": { + "west": "false" } }, { - "when": { - "east": "true" - }, "apply": { "model": "data_gen_test:block/glass_pane_side", "y": 90 + }, + "when": { + "east": "true" } }, { - "when": { - "east": "false" - }, "apply": { "model": "data_gen_test:block/glass_pane_noside_alt" + }, + "when": { + "east": "false" } } ] diff --git a/src/generated_test/resources/assets/minecraft/blockstates/oak_trapdoor.json b/src/generated_test/resources/assets/minecraft/blockstates/oak_trapdoor.json index b6f8afcf168..c02032d65c7 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/oak_trapdoor.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/oak_trapdoor.json @@ -1,58 +1,58 @@ { "variants": { - "facing=north,half=top,open=false": { - "model": "data_gen_test:block/oak_trapdoor_top" - }, - "facing=south,half=top,open=false": { - "model": "data_gen_test:block/oak_trapdoor_top" + "facing=east,half=bottom,open=false": { + "model": "data_gen_test:block/oak_trapdoor_bottom" }, - "facing=west,half=top,open=false": { - "model": "data_gen_test:block/oak_trapdoor_top" + "facing=east,half=bottom,open=true": { + "model": "data_gen_test:block/oak_trapdoor_open", + "y": 90 }, "facing=east,half=top,open=false": { "model": "data_gen_test:block/oak_trapdoor_top" }, - "facing=north,half=bottom,open=false": { - "model": "data_gen_test:block/oak_trapdoor_bottom" + "facing=east,half=top,open=true": { + "model": "data_gen_test:block/oak_trapdoor_open", + "y": 90 }, - "facing=south,half=bottom,open=false": { + "facing=north,half=bottom,open=false": { "model": "data_gen_test:block/oak_trapdoor_bottom" }, - "facing=west,half=bottom,open=false": { - "model": "data_gen_test:block/oak_trapdoor_bottom" + "facing=north,half=bottom,open=true": { + "model": "data_gen_test:block/oak_trapdoor_open" }, - "facing=east,half=bottom,open=false": { - "model": "data_gen_test:block/oak_trapdoor_bottom" + "facing=north,half=top,open=false": { + "model": "data_gen_test:block/oak_trapdoor_top" }, "facing=north,half=top,open=true": { "model": "data_gen_test:block/oak_trapdoor_open" }, - "facing=south,half=top,open=true": { - "model": "data_gen_test:block/oak_trapdoor_open", - "y": 180 - }, - "facing=west,half=top,open=true": { - "model": "data_gen_test:block/oak_trapdoor_open", - "y": 270 + "facing=south,half=bottom,open=false": { + "model": "data_gen_test:block/oak_trapdoor_bottom" }, - "facing=east,half=top,open=true": { + "facing=south,half=bottom,open=true": { "model": "data_gen_test:block/oak_trapdoor_open", - "y": 90 + "y": 180 }, - "facing=north,half=bottom,open=true": { - "model": "data_gen_test:block/oak_trapdoor_open" + "facing=south,half=top,open=false": { + "model": "data_gen_test:block/oak_trapdoor_top" }, - "facing=south,half=bottom,open=true": { + "facing=south,half=top,open=true": { "model": "data_gen_test:block/oak_trapdoor_open", "y": 180 }, + "facing=west,half=bottom,open=false": { + "model": "data_gen_test:block/oak_trapdoor_bottom" + }, "facing=west,half=bottom,open=true": { "model": "data_gen_test:block/oak_trapdoor_open", "y": 270 }, - "facing=east,half=bottom,open=true": { + "facing=west,half=top,open=false": { + "model": "data_gen_test:block/oak_trapdoor_top" + }, + "facing=west,half=top,open=true": { "model": "data_gen_test:block/oak_trapdoor_open", - "y": 90 + "y": 270 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/blockstates/wall_torch.json b/src/generated_test/resources/assets/minecraft/blockstates/wall_torch.json index cda96218805..209dc9fa143 100644 --- a/src/generated_test/resources/assets/minecraft/blockstates/wall_torch.json +++ b/src/generated_test/resources/assets/minecraft/blockstates/wall_torch.json @@ -1,5 +1,8 @@ { "variants": { + "facing=east": { + "model": "data_gen_test:block/wall_torch" + }, "facing=north": { "model": "data_gen_test:block/wall_torch", "y": 270 @@ -11,9 +14,6 @@ "facing=west": { "model": "data_gen_test:block/wall_torch", "y": 180 - }, - "facing=east": { - "model": "data_gen_test:block/wall_torch" } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/minecraft/models/item/stick.json b/src/generated_test/resources/assets/minecraft/models/item/stick.json index ce67a9f55f8..e3c18581e54 100644 --- a/src/generated_test/resources/assets/minecraft/models/item/stick.json +++ b/src/generated_test/resources/assets/minecraft/models/item/stick.json @@ -7,15 +7,15 @@ 147, 40 ], - "translation": [ - -2.25, - 1.5, - -0.25 - ], "scale": [ 0.48, 0.48, 0.48 + ], + "translation": [ + -2.25, + 1.5, + -0.25 ] } }, diff --git a/src/generated_test/resources/assets/new_model_loader_test/blockstates/obj_block.json b/src/generated_test/resources/assets/new_model_loader_test/blockstates/obj_block.json index 17580ea8556..c2f0e5971ef 100644 --- a/src/generated_test/resources/assets/new_model_loader_test/blockstates/obj_block.json +++ b/src/generated_test/resources/assets/new_model_loader_test/blockstates/obj_block.json @@ -1,5 +1,9 @@ { "variants": { + "facing=east": { + "model": "new_model_loader_test:block/obj_block", + "y": 90 + }, "facing=north": { "model": "new_model_loader_test:block/obj_block" }, @@ -10,10 +14,6 @@ "facing=west": { "model": "new_model_loader_test:block/obj_block", "y": 270 - }, - "facing=east": { - "model": "new_model_loader_test:block/obj_block", - "y": 90 } } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/new_model_loader_test/models/block/obj_block.json b/src/generated_test/resources/assets/new_model_loader_test/models/block/obj_block.json index 9593d135302..c65b02d36a9 100644 --- a/src/generated_test/resources/assets/new_model_loader_test/models/block/obj_block.json +++ b/src/generated_test/resources/assets/new_model_loader_test/models/block/obj_block.json @@ -1,9 +1,9 @@ { - "textures": { - "qr": "minecraft:block/oak_planks", - "particle": "#qr" - }, + "flip-v": true, "loader": "forge:obj", "model": "new_model_loader_test:models/item/sugar_glider.obj", - "flip-v": true + "textures": { + "particle": "#qr", + "qr": "minecraft:block/oak_planks" + } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/new_model_loader_test/models/item/item_layers.json b/src/generated_test/resources/assets/new_model_loader_test/models/item/item_layers.json index a46691d2eef..2a00daeb3a1 100644 --- a/src/generated_test/resources/assets/new_model_loader_test/models/item/item_layers.json +++ b/src/generated_test/resources/assets/new_model_loader_test/models/item/item_layers.json @@ -1,11 +1,11 @@ { "parent": "forge:item/default", + "fullbright_layers": [ + 1 + ], + "loader": "forge:item-layers", "textures": { "layer0": "minecraft:item/coal", "layer1": "minecraft:item/stick" - }, - "loader": "forge:item-layers", - "fullbright_layers": [ - 1 - ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/assets/new_model_loader_test/models/item/separate_perspective.json b/src/generated_test/resources/assets/new_model_loader_test/models/item/separate_perspective.json index 75aa29b27cd..68610609c67 100644 --- a/src/generated_test/resources/assets/new_model_loader_test/models/item/separate_perspective.json +++ b/src/generated_test/resources/assets/new_model_loader_test/models/item/separate_perspective.json @@ -1,15 +1,15 @@ { "parent": "forge:item/default", - "loader": "forge:separate-perspective", "base": { "parent": "minecraft:item/coal" }, + "loader": "forge:separate-perspective", "perspectives": { - "gui": { - "parent": "minecraft:item/snowball" - }, "firstperson_lefthand": { "parent": "minecraft:item/bone" + }, + "gui": { + "parent": "minecraft:item/snowball" } } } \ No newline at end of file diff --git a/src/generated_test/resources/data/biome_modifiers_test/forge/biome_modifier/modify_badlands.json b/src/generated_test/resources/data/biome_modifiers_test/forge/biome_modifier/modify_badlands.json new file mode 100644 index 00000000000..18110a46d31 --- /dev/null +++ b/src/generated_test/resources/data/biome_modifiers_test/forge/biome_modifier/modify_badlands.json @@ -0,0 +1,14 @@ +{ + "type": "biome_modifiers_test:test", + "biomes": "#minecraft:is_badlands", + "features": "biome_modifiers_test:large_basalt_columns", + "generation_stage": "TOP_LAYER_MODIFICATION", + "precipitation": "snow", + "spawn": { + "type": "minecraft:magma_cube", + "maxCount": 4, + "minCount": 1, + "weight": 100 + }, + "water_color": 16711680 +} \ No newline at end of file diff --git a/src/generated_test/resources/data/biome_modifiers_test/worldgen/placed_feature/large_basalt_columns.json b/src/generated_test/resources/data/biome_modifiers_test/worldgen/placed_feature/large_basalt_columns.json new file mode 100644 index 00000000000..8b5ee4dc466 --- /dev/null +++ b/src/generated_test/resources/data/biome_modifiers_test/worldgen/placed_feature/large_basalt_columns.json @@ -0,0 +1,12 @@ +{ + "feature": "minecraft:large_basalt_columns", + "placement": [ + { + "type": "minecraft:count_on_every_layer", + "count": 1 + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/conditional.json b/src/generated_test/resources/data/data_gen_test/advancements/conditional.json index 90bc1b1c781..158e0e010af 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/conditional.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/conditional.json @@ -1,52 +1,10 @@ { "advancements": [ { - "conditions": [ - { - "values": [ - { - "value": { - "modid": "minecraft", - "type": "forge:mod_loaded" - }, - "type": "forge:not" - }, - { - "item": "minecraft:dirt", - "type": "forge:item_exists" - }, - { - "type": "forge:false" - } - ], - "type": "forge:and" - } - ], "advancement": { "parent": "minecraft:root", - "display": { - "icon": { - "item": "minecraft:diamond_block" - }, - "title": { - "text": "Dirt2Diamonds" - }, - "description": { - "text": "The BEST crafting recipe in the game!" - }, - "frame": "task", - "show_toast": false, - "announce_to_chat": false, - "hidden": false - }, - "rewards": { - "recipes": [ - "data_gen_test:conditional" - ] - }, "criteria": { "has_dirt": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -55,15 +13,57 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": false, + "description": { + "text": "The BEST crafting recipe in the game!" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "minecraft:diamond_block" + }, + "show_toast": false, + "title": { + "text": "Dirt2Diamonds" } }, "requirements": [ [ "has_dirt" ] - ] - } + ], + "rewards": { + "recipes": [ + "data_gen_test:conditional" + ] + } + }, + "conditions": [ + { + "type": "forge:and", + "values": [ + { + "type": "forge:not", + "value": { + "type": "forge:mod_loaded", + "modid": "minecraft" + } + }, + { + "type": "forge:item_exists", + "item": "minecraft:dirt" + }, + { + "type": "forge:false" + } + ] + } + ] } ] } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json b/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json index 0b38993cd72..ada0163bb4e 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json @@ -1,23 +1,6 @@ { - "display": { - "icon": { - "item": "minecraft:dirt" - }, - "title": { - "translate": "block.minecraft.dirt" - }, - "description": { - "translate": "dirt_description" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": true, - "hidden": false, - "background": "minecraft:textures/gui/advancements/backgrounds/stone.png" - }, "criteria": { "has_dirt": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -26,7 +9,24 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": true, + "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", + "description": { + "translate": "dirt_description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "minecraft:dirt" + }, + "show_toast": true, + "title": { + "translate": "block.minecraft.dirt" } }, "requirements": [ diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json index 2055e861be9..125ec85e7fe 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:compound_ingredient_custom_types" - ] - }, "criteria": { "has_planks": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:compound_ingredient_custom_types" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_planks", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:compound_ingredient_custom_types" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json index 5c7c90f706e..5e1c7f59ba3 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:compound_ingredient_only_vanilla" - ] - }, "criteria": { "has_planks": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:compound_ingredient_only_vanilla" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_planks", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:compound_ingredient_only_vanilla" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json index 9e51ddbb93a..2f14c95d4ef 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:intersection_ingredient" - ] - }, "criteria": { "has_planks": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:intersection_ingredient" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_planks", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:intersection_ingredient" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json index 39be9910844..90831028ecf 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json @@ -1,40 +1,10 @@ { "advancements": [ { - "conditions": [ - { - "value": { - "values": [ - { - "value": { - "modid": "minecraft", - "type": "forge:mod_loaded" - }, - "type": "forge:not" - }, - { - "item": "minecraft:dirt", - "type": "forge:item_exists" - }, - { - "type": "forge:false" - } - ], - "type": "forge:and" - }, - "type": "forge:not" - } - ], "advancement": { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "minecraft:diamond_block" - ] - }, "criteria": { "has_dirt": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -43,13 +13,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "minecraft:diamond_block" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -57,8 +28,37 @@ "has_dirt", "has_the_recipe" ] - ] - } + ], + "rewards": { + "recipes": [ + "minecraft:diamond_block" + ] + } + }, + "conditions": [ + { + "type": "forge:not", + "value": { + "type": "forge:and", + "values": [ + { + "type": "forge:not", + "value": { + "type": "forge:mod_loaded", + "modid": "minecraft" + } + }, + { + "type": "forge:item_exists", + "item": "minecraft:dirt" + }, + { + "type": "forge:false" + } + ] + } + } + ] } ] } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json index 800df01860b..3c0ed67750a 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json @@ -1,22 +1,10 @@ { "advancements": [ { - "conditions": [ - { - "tag": "minecraft:planks", - "type": "forge:tag_empty" - } - ], "advancement": { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "minecraft:netherite_block" - ] - }, "criteria": { "has_diamond_block": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -25,13 +13,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "minecraft:netherite_block" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -39,29 +28,25 @@ "has_diamond_block", "has_the_recipe" ] - ] - } - }, - { + ], + "rewards": { + "recipes": [ + "minecraft:netherite_block" + ] + } + }, "conditions": [ { - "value": { - "tag": "minecraft:planks", - "type": "forge:tag_empty" - }, - "type": "forge:not" + "type": "forge:tag_empty", + "tag": "minecraft:planks" } - ], + ] + }, + { "advancement": { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "minecraft:netherite_block" - ] - }, "criteria": { "has_diamond_block": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -70,13 +55,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "minecraft:netherite_block" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -84,8 +70,22 @@ "has_diamond_block", "has_the_recipe" ] - ] - } + ], + "rewards": { + "recipes": [ + "minecraft:netherite_block" + ] + } + }, + "conditions": [ + { + "type": "forge:not", + "value": { + "type": "forge:tag_empty", + "tag": "minecraft:planks" + } + } + ] } ] } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json index ba30ea8fd39..8d5d7cfcc48 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:contains_nbt_ingredient_item_set" - ] - }, "criteria": { "has_pickaxe": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:contains_nbt_ingredient_item_set" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_pickaxe", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:contains_nbt_ingredient_item_set" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json index 3d4b4034804..982b2fbfd92 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:contains_nbt_ingredient_single_item" - ] - }, "criteria": { "has_pickaxe": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:contains_nbt_ingredient_single_item" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_pickaxe", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:contains_nbt_ingredient_single_item" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json index 3fb4661b53f..477d1d6b2f5 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:difference_ingredient" - ] - }, "criteria": { "has_fence": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:difference_ingredient" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_fence", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:difference_ingredient" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json index 8845092d904..096da6df7aa 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json @@ -1,13 +1,7 @@ { "parent": "minecraft:recipes/root", - "rewards": { - "recipes": [ - "data_gen_test:exact_nbt_ingredient" - ] - }, "criteria": { "has_pickaxe": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -16,13 +10,14 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" }, "has_the_recipe": { - "trigger": "minecraft:recipe_unlocked", "conditions": { "recipe": "data_gen_test:exact_nbt_ingredient" - } + }, + "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ @@ -30,5 +25,10 @@ "has_pickaxe", "has_the_recipe" ] - ] + ], + "rewards": { + "recipes": [ + "data_gen_test:exact_nbt_ingredient" + ] + } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json b/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json index ce7425a3b44..68bd401f635 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json @@ -1,15 +1,11 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "#", - "#" - ], "key": { "#": [ { "type": "forge:nbt", - "item": "minecraft:iron_pickaxe", "count": 1, + "item": "minecraft:iron_pickaxe", "nbt": "{Damage:3}" }, [ @@ -22,6 +18,10 @@ ] ] }, + "pattern": [ + "#", + "#" + ], "result": { "item": "minecraft:gold_block" } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json b/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json index 5173707f13e..7d255fd195b 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json @@ -1,9 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - " # " - ], "key": { "#": [ { @@ -17,6 +13,10 @@ } ] }, + "pattern": [ + "###", + " # " + ], "result": { "item": "minecraft:dirt" } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/conditional.json b/src/generated_test/resources/data/data_gen_test/recipes/conditional.json index 4c6c5fc0fc8..866fe43a99e 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/conditional.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/conditional.json @@ -4,40 +4,40 @@ { "conditions": [ { + "type": "forge:and", "values": [ { + "type": "forge:not", "value": { - "modid": "minecraft", - "type": "forge:mod_loaded" - }, - "type": "forge:not" + "type": "forge:mod_loaded", + "modid": "minecraft" + } }, { - "item": "minecraft:dirt", - "type": "forge:item_exists" + "type": "forge:item_exists", + "item": "minecraft:dirt" }, { "type": "forge:false" } - ], - "type": "forge:and" + ] } ], "recipe": { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "XXX", - "XXX" - ], "key": { "X": { "item": "minecraft:dirt" } }, + "pattern": [ + "XXX", + "XXX", + "XXX" + ], "result": { - "item": "minecraft:diamond_block", - "count": 64 + "count": 64, + "item": "minecraft:diamond_block" } } } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/conditional2.json b/src/generated_test/resources/data/data_gen_test/recipes/conditional2.json index 7a49e3baf47..320ce0dc51c 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/conditional2.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/conditional2.json @@ -4,43 +4,43 @@ { "conditions": [ { + "type": "forge:not", "value": { + "type": "forge:and", "values": [ { + "type": "forge:not", "value": { - "modid": "minecraft", - "type": "forge:mod_loaded" - }, - "type": "forge:not" + "type": "forge:mod_loaded", + "modid": "minecraft" + } }, { - "item": "minecraft:dirt", - "type": "forge:item_exists" + "type": "forge:item_exists", + "item": "minecraft:dirt" }, { "type": "forge:false" } - ], - "type": "forge:and" - }, - "type": "forge:not" + ] + } } ], "recipe": { "type": "minecraft:crafting_shaped", - "pattern": [ - "XXX", - "XXX", - "XXX" - ], "key": { "X": { "item": "minecraft:dirt" } }, + "pattern": [ + "XXX", + "XXX", + "XXX" + ], "result": { - "item": "minecraft:diamond_block", - "count": 64 + "count": 64, + "item": "minecraft:diamond_block" } } } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/conditional3.json b/src/generated_test/resources/data/data_gen_test/recipes/conditional3.json index 86727d0774a..945c081ea1a 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/conditional3.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/conditional3.json @@ -4,21 +4,21 @@ { "conditions": [ { - "tag": "minecraft:planks", - "type": "forge:tag_empty" + "type": "forge:tag_empty", + "tag": "minecraft:planks" } ], "recipe": { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "XX" - ], "key": { "X": { "item": "minecraft:diamond_block" } }, + "pattern": [ + "XX", + "XX" + ], "result": { "item": "minecraft:netherite_block" } @@ -27,27 +27,27 @@ { "conditions": [ { + "type": "forge:not", "value": { - "tag": "minecraft:planks", - "type": "forge:tag_empty" - }, - "type": "forge:not" + "type": "forge:tag_empty", + "tag": "minecraft:planks" + } } ], "recipe": { "type": "minecraft:crafting_shaped", - "pattern": [ - "XX", - "XX" - ], "key": { "X": { "item": "minecraft:diamond_block" } }, + "pattern": [ + "XX", + "XX" + ], "result": { - "item": "minecraft:netherite_block", - "count": 9 + "count": 9, + "item": "minecraft:netherite_block" } } } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/contains_nbt_ingredient_item_set.json b/src/generated_test/resources/data/data_gen_test/recipes/contains_nbt_ingredient_item_set.json index e7e6e934319..70f123a0e02 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/contains_nbt_ingredient_item_set.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/contains_nbt_ingredient_item_set.json @@ -8,7 +8,7 @@ "minecraft:stone_pickaxe", "minecraft:wooden_pickaxe" ], - "nbt": "{display:{Name:\u0027{\"text\":\"Diamond Pickaxe\"}\u0027}}" + "nbt": "{display:{Name:'{\"text\":\"Diamond Pickaxe\"}'}}" } ], "result": { diff --git a/src/generated_test/resources/data/data_gen_test/recipes/difference_ingredient.json b/src/generated_test/resources/data/data_gen_test/recipes/difference_ingredient.json index 129b69c57c3..79a2dcbe8b5 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/difference_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/difference_ingredient.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - " # ", - "###", - " # " - ], "key": { "#": { "type": "forge:difference", @@ -16,6 +11,11 @@ } } }, + "pattern": [ + " # ", + "###", + " # " + ], "result": { "item": "minecraft:flint_and_steel" } diff --git a/src/generated_test/resources/data/data_gen_test/recipes/exact_nbt_ingredient.json b/src/generated_test/resources/data/data_gen_test/recipes/exact_nbt_ingredient.json index d2f533c2e36..cd065079f19 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/exact_nbt_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/exact_nbt_ingredient.json @@ -3,8 +3,8 @@ "ingredients": [ { "type": "forge:nbt", - "item": "minecraft:iron_pickaxe", "count": 1, + "item": "minecraft:iron_pickaxe", "nbt": "{Damage:3}" } ], diff --git a/src/generated_test/resources/data/data_gen_test/recipes/intersection_ingredient.json b/src/generated_test/resources/data/data_gen_test/recipes/intersection_ingredient.json index ab8f45fa759..7b122fac04b 100644 --- a/src/generated_test/resources/data/data_gen_test/recipes/intersection_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/recipes/intersection_ingredient.json @@ -1,10 +1,5 @@ { "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "###", - " # " - ], "key": { "#": { "type": "forge:intersection", @@ -18,6 +13,11 @@ ] } }, + "pattern": [ + "###", + "###", + " # " + ], "result": { "item": "minecraft:netherrack" } diff --git a/src/generated_test/resources/data/data_gen_test/tags/blocks/test.json b/src/generated_test/resources/data/data_gen_test/tags/blocks/test.json index 96988a8681f..786e8e8065b 100644 --- a/src/generated_test/resources/data/data_gen_test/tags/blocks/test.json +++ b/src/generated_test/resources/data/data_gen_test/tags/blocks/test.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:diamond_block", "#minecraft:stone_bricks", diff --git a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/one.json b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/one.json index 5f9fcb470f5..dac674da5d4 100644 --- a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/one.json +++ b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/one.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobblestone" ] diff --git a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/three.json b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/three.json index 7fc23b56384..fc0f1e4efc8 100644 --- a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/three.json +++ b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/three.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:andesite" ] diff --git a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/two.json b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/two.json index 4185e1dc41c..9fbd8eaecba 100644 --- a/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/two.json +++ b/src/generated_test/resources/data/data_gen_test/tags/blocks/thing/two.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:diorite" ] diff --git a/src/generated_test/resources/data/data_gen_test/tags/blocks/things.json b/src/generated_test/resources/data/data_gen_test/tags/blocks/things.json index c1ca5f9918e..06e373b4ed3 100644 --- a/src/generated_test/resources/data/data_gen_test/tags/blocks/things.json +++ b/src/generated_test/resources/data/data_gen_test/tags/blocks/things.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "minecraft:cobblestone", "minecraft:diorite", diff --git a/src/generated_test/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/src/generated_test/resources/data/forge/loot_modifiers/global_loot_modifiers.json index d1da71af2cb..d4eaa2c4442 100644 --- a/src/generated_test/resources/data/forge/loot_modifiers/global_loot_modifiers.json +++ b/src/generated_test/resources/data/forge/loot_modifiers/global_loot_modifiers.json @@ -1,8 +1,8 @@ { - "replace": false, "entries": [ "global_loot_test:dungeon_loot", "global_loot_test:wheat_harvest", "global_loot_test:smelting" - ] + ], + "replace": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/global_loot_test/loot_modifiers/dungeon_loot.json b/src/generated_test/resources/data/global_loot_test/loot_modifiers/dungeon_loot.json index 9c9b40faf5a..12af05c13fe 100644 --- a/src/generated_test/resources/data/global_loot_test/loot_modifiers/dungeon_loot.json +++ b/src/generated_test/resources/data/global_loot_test/loot_modifiers/dungeon_loot.json @@ -1,10 +1,10 @@ { + "type": "global_loot_test:dungeon_loot", "conditions": [ { "condition": "forge:loot_table_id", "loot_table_id": "minecraft:chests/simple_dungeon" } ], - "multiplication_factor": 2, - "type": "global_loot_test:dungeon_loot" + "multiplication_factor": 2 } \ No newline at end of file diff --git a/src/generated_test/resources/data/global_loot_test/loot_modifiers/smelting.json b/src/generated_test/resources/data/global_loot_test/loot_modifiers/smelting.json index 60c61211198..09b17fd901f 100644 --- a/src/generated_test/resources/data/global_loot_test/loot_modifiers/smelting.json +++ b/src/generated_test/resources/data/global_loot_test/loot_modifiers/smelting.json @@ -1,4 +1,5 @@ { + "type": "global_loot_test:smelting", "conditions": [ { "condition": "minecraft:match_tool", @@ -13,6 +14,5 @@ ] } } - ], - "type": "global_loot_test:smelting" + ] } \ No newline at end of file diff --git a/src/generated_test/resources/data/global_loot_test/loot_modifiers/wheat_harvest.json b/src/generated_test/resources/data/global_loot_test/loot_modifiers/wheat_harvest.json index 0f76bb2f479..e2cdba2d4d2 100644 --- a/src/generated_test/resources/data/global_loot_test/loot_modifiers/wheat_harvest.json +++ b/src/generated_test/resources/data/global_loot_test/loot_modifiers/wheat_harvest.json @@ -1,4 +1,5 @@ { + "type": "global_loot_test:wheat_harvest", "conditions": [ { "condition": "minecraft:match_tool", @@ -9,12 +10,11 @@ } }, { - "condition": "minecraft:block_state_property", - "block": "minecraft:wheat" + "block": "minecraft:wheat", + "condition": "minecraft:block_state_property" } ], "numSeeds": 3, - "seedItem": "minecraft:wheat_seeds", "replacement": "minecraft:wheat", - "type": "global_loot_test:wheat_harvest" + "seedItem": "minecraft:wheat_seeds" } \ No newline at end of file diff --git a/src/generated_test/resources/data/minecraft/advancements/good_parent.json b/src/generated_test/resources/data/minecraft/advancements/good_parent.json index bbd17591868..6f05501fadc 100644 --- a/src/generated_test/resources/data/minecraft/advancements/good_parent.json +++ b/src/generated_test/resources/data/minecraft/advancements/good_parent.json @@ -1,24 +1,7 @@ { "parent": "forge:dummy_parent", - "display": { - "icon": { - "item": "minecraft:cobblestone" - }, - "title": { - "translate": "block.minecraft.cobblestone" - }, - "description": { - "text": "You got cobblestone" - }, - "frame": "task", - "show_toast": false, - "announce_to_chat": false, - "hidden": false, - "background": "minecraft:textures/gui/advancements/backgrounds/stone.png" - }, "criteria": { "get_cobbleStone": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -27,7 +10,24 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": false, + "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", + "description": { + "text": "You got cobblestone" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "minecraft:cobblestone" + }, + "show_toast": false, + "title": { + "translate": "block.minecraft.cobblestone" } }, "requirements": [ diff --git a/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json b/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json index a9e9a141a96..6f3e4084849 100644 --- a/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json +++ b/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json @@ -1,23 +1,6 @@ { - "display": { - "icon": { - "item": "minecraft:diamond_block" - }, - "title": { - "translate": "block.minecraft.diamond_block" - }, - "description": { - "text": "You obtained a DiamondBlock" - }, - "frame": "challenge", - "show_toast": true, - "announce_to_chat": true, - "hidden": false, - "background": "minecraft:textures/gui/advancements/backgrounds/stone.png" - }, "criteria": { "obtained_diamond_block": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -26,7 +9,24 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": true, + "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", + "description": { + "text": "You obtained a DiamondBlock" + }, + "frame": "challenge", + "hidden": false, + "icon": { + "item": "minecraft:diamond_block" + }, + "show_toast": true, + "title": { + "translate": "block.minecraft.diamond_block" } }, "requirements": [ diff --git a/src/generated_test/resources/data/minecraft/advancements/story/root.json b/src/generated_test/resources/data/minecraft/advancements/story/root.json index 2fa58caf7b0..3a6bc7655c8 100644 --- a/src/generated_test/resources/data/minecraft/advancements/story/root.json +++ b/src/generated_test/resources/data/minecraft/advancements/story/root.json @@ -1,23 +1,6 @@ { - "display": { - "icon": { - "item": "minecraft:grass_block" - }, - "title": { - "translate": "advancements.story.root.title" - }, - "description": { - "text": "Changed Description" - }, - "frame": "task", - "show_toast": false, - "announce_to_chat": false, - "hidden": false, - "background": "minecraft:textures/gui/advancements/backgrounds/stone.png" - }, "criteria": { "crafting_table": { - "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { @@ -26,7 +9,24 @@ ] } ] - } + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": false, + "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", + "description": { + "text": "Changed Description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "minecraft:grass_block" + }, + "show_toast": false, + "title": { + "translate": "advancements.story.root.title" } }, "requirements": [ diff --git a/src/generated_test/resources/data/minecraft/tags/blocks/test_tag.json b/src/generated_test/resources/data/minecraft/tags/blocks/test_tag.json index ed67f1118a5..f72d209df78 100644 --- a/src/generated_test/resources/data/minecraft/tags/blocks/test_tag.json +++ b/src/generated_test/resources/data/minecraft/tags/blocks/test_tag.json @@ -1,15 +1,3 @@ { - "replace": false, - "values": [], - "remove": [ - "minecraft:dirt", - "minecraft:oak_door", - "minecraft:dark_oak_door", - "minecraft:anvil", - "minecraft:basalt", - "minecraft:polished_basalt", - "#minecraft:beehives", - "#minecraft:banners", - "#minecraft:beds" - ] + "values": [] } \ No newline at end of file diff --git a/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json b/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json index d3be5d73ed2..7d1e387c60d 100644 --- a/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json +++ b/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json @@ -2,19 +2,19 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1.0, "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], "entries": [ { "type": "minecraft:item", "name": "tag_based_tool_types:test_stone" } ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ] + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json b/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json index ea937c7be73..df82695e042 100644 --- a/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json +++ b/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "tag_based_tool_types:test_stone" ] diff --git a/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json b/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json index ea937c7be73..df82695e042 100644 --- a/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json +++ b/src/generated_test/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json @@ -1,5 +1,4 @@ { - "replace": false, "values": [ "tag_based_tool_types:test_stone" ] diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index f09476fa9c0..b91fea8ee07 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -14,7 +14,6 @@ import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.RootCommandNode; import net.minecraft.ChatFormatting; -import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.LocalPlayer; @@ -22,12 +21,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.synchronization.SuggestionProviders; -import net.minecraft.network.chat.ClickEvent; -import net.minecraft.network.chat.ComponentUtils; -import net.minecraft.network.chat.HoverEvent; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.*; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.RegisterClientCommandsEvent; import net.minecraftforge.common.MinecraftForge; @@ -79,11 +73,6 @@ public static CommandDispatcher mergeServerCommands(Co CommandDispatcher newServerCommands = new CommandDispatcher<>(); copy(serverCommandsRoot, newServerCommands.getRoot()); - // Copies the server side commands into a temporary server side commands root node to be used later without the client commands - RootCommandNode serverCommandsCopy = new RootCommandNode<>(); - CommandHelper.mergeCommandNode(newServerCommands.getRoot(), serverCommandsCopy, new IdentityHashMap<>(), - Minecraft.getInstance().getConnection().getSuggestionsProvider(), (context) -> 0, (suggestions) -> null); - // Copies the client side commands into the server side commands to be used for suggestions CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (context) -> 0, (suggestions) -> { SuggestionProvider suggestionProvider = SuggestionProviders @@ -105,12 +94,6 @@ public static CommandDispatcher mergeServerCommands(Co return suggestionProvider; }); - // Copies the server side commands into the client side commands so that they can be sent to the server as a chat message - CommandHelper.mergeCommandNode(serverCommandsCopy, commands.getRoot(), new IdentityHashMap<>(), Minecraft.getInstance().getConnection().getSuggestionsProvider(), - (context) -> { - Minecraft.getInstance().player.chat((context.getInput().startsWith("/") ? "" : "/") + context.getInput()); - return 0; - }, (suggestions) -> null); return newServerCommands; } @@ -159,23 +142,17 @@ private static void copy(CommandNode sourceNode, CommandNode resultNod } /** - * Always try to execute the cached parsing of client message as a command. Requires that the execute field of the commands to be set to send to server so that they aren't + * Always try to execute the cached parsing of a typed command as a clientside command. Requires that the execute field of the commands to be set to send to server so that they aren't\ * treated as client command's that do nothing. * * {@link net.minecraft.commands.Commands#performCommand(CommandSourceStack, String)} for reference * - * @param sendMessage - * the chat message - * @return false leaves the message to be sent to the server, true means it should be caught before {@link LocalPlayer#chat(String)} + * @param command the full command to execute, no preceding slash + * @return {@code false} leaves the message to be sent to the server, while {@code true} means it should be caught before LocalPlayer#sendCommand */ - public static boolean sendMessage(String sendMessage) + public static boolean runCommand(String command) { - StringReader reader = new StringReader(sendMessage); - - if (!reader.canRead() || reader.read() != '/') - { - return false; - } + StringReader reader = new StringReader(command); ClientCommandSourceStack source = getSource(); @@ -185,7 +162,7 @@ public static boolean sendMessage(String sendMessage) } catch (CommandRuntimeException execution)// Probably thrown by the command { - Minecraft.getInstance().player.sendMessage(new TextComponent("").append(execution.getComponent()).withStyle(ChatFormatting.RED), Util.NIL_UUID); + Minecraft.getInstance().player.sendSystemMessage(Component.literal("").append(execution.getComponent()).withStyle(ChatFormatting.RED)); } catch (CommandSyntaxException syntax)// Usually thrown by the CommandDispatcher { @@ -194,12 +171,12 @@ public static boolean sendMessage(String sendMessage) // in case of unknown command, let the server try and handle it return false; } - Minecraft.getInstance().player.sendMessage( - new TextComponent("").append(ComponentUtils.fromMessage(syntax.getRawMessage())).withStyle(ChatFormatting.RED), Util.NIL_UUID); + Minecraft.getInstance().player.sendSystemMessage( + Component.literal("").append(ComponentUtils.fromMessage(syntax.getRawMessage())).withStyle(ChatFormatting.RED)); if (syntax.getInput() != null && syntax.getCursor() >= 0) { int position = Math.min(syntax.getInput().length(), syntax.getCursor()); - MutableComponent details = new TextComponent("") + MutableComponent details = Component.literal("") .withStyle(ChatFormatting.GRAY) .withStyle((style) -> style .withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, reader.getString()))); @@ -210,21 +187,20 @@ public static boolean sendMessage(String sendMessage) details.append(syntax.getInput().substring(Math.max(0, position - 10), position)); if (position < syntax.getInput().length()) { - details.append(new TextComponent(syntax.getInput().substring(position)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE)); + details.append(Component.literal(syntax.getInput().substring(position)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE)); } - details.append(new TranslatableComponent("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); - Minecraft.getInstance().player.sendMessage(new TextComponent("").append(details).withStyle(ChatFormatting.RED), Util.NIL_UUID); + details.append(Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); + Minecraft.getInstance().player.sendSystemMessage(Component.literal("").append(details).withStyle(ChatFormatting.RED)); } } catch (Exception generic)// Probably thrown by the command { - TextComponent message = new TextComponent(generic.getMessage() == null ? generic.getClass().getName() : generic.getMessage()); - Minecraft.getInstance().player.sendMessage(new TranslatableComponent("command.failed") + MutableComponent message = Component.literal(generic.getMessage() == null ? generic.getClass().getName() : generic.getMessage()); + Minecraft.getInstance().player.sendSystemMessage(Component.translatable("command.failed") .withStyle(ChatFormatting.RED) .withStyle((style) -> style - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, message))), - Util.NIL_UUID); - LOGGER.error("Error executing client command \"{}\"", sendMessage, generic); + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, message)))); + LOGGER.error("Error executing client command \"{}\"", command, generic); } return true; } diff --git a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java index d3cbfcb0e81..514c4259023 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java @@ -46,7 +46,7 @@ public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotati @Override public void sendSuccess(Component message, boolean sendToAdmins) { - Minecraft.getInstance().player.sendMessage(message, Util.NIL_UUID); + Minecraft.getInstance().player.sendSystemMessage(message); } /** diff --git a/src/main/java/net/minecraftforge/client/FluidContainerColorer.java b/src/main/java/net/minecraftforge/client/FluidContainerColorer.java index e5c6ce9f909..e372f449853 100644 --- a/src/main/java/net/minecraftforge/client/FluidContainerColorer.java +++ b/src/main/java/net/minecraftforge/client/FluidContainerColorer.java @@ -5,16 +5,15 @@ package net.minecraftforge.client; -import javax.annotation.Nonnull; - import net.minecraft.client.color.item.ItemColor; import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidUtil; +import org.jetbrains.annotations.NotNull; public class FluidContainerColorer implements ItemColor { @Override - public int getColor(@Nonnull ItemStack stack, int tintIndex) + public int getColor(@NotNull ItemStack stack, int tintIndex) { if (tintIndex != 1) return 0xFFFFFFFF; return FluidUtil.getFluidContained(stack) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index ba048d0dc1c..b10a4575917 100755 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -12,7 +12,6 @@ import com.mojang.blaze3d.vertex.*; import com.mojang.datafixers.util.Either; import net.minecraft.client.gui.chat.NarratorChatListener; -import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; @@ -30,10 +29,13 @@ import net.minecraft.network.chat.*; import net.minecraft.network.protocol.status.ServerStatus; import net.minecraft.server.WorldStem; +import net.minecraft.server.packs.repository.PackRepository; +import net.minecraft.util.RandomSource; import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import com.mojang.blaze3d.platform.Window; import net.minecraft.client.Minecraft; @@ -43,12 +45,10 @@ import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.screens.worldselection.WorldPreset; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.model.HumanoidModel; @@ -77,6 +77,7 @@ import net.minecraft.client.player.Input; import net.minecraft.resources.ResourceLocation; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.material.FogType; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.PrimaryLevelData; import net.minecraft.world.phys.BlockHitResult; @@ -90,7 +91,6 @@ import net.minecraft.world.level.GameType; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.sound.PlaySoundEvent; @@ -115,8 +115,6 @@ import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -127,7 +125,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.Random; import java.util.Set; import java.util.Stack; import java.util.concurrent.atomic.AtomicBoolean; @@ -143,6 +140,8 @@ import net.minecraft.client.Camera; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.ItemRenderer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ForgeHooksClient { @@ -214,11 +213,11 @@ public static boolean onDrawHighlight(LevelRenderer context, Camera camera, HitR { switch (target.getType()) { case BLOCK: - if (!(target instanceof BlockHitResult)) return false; - return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightBlock(context, camera, target, partialTick, poseStack, bufferSource)); + if (!(target instanceof BlockHitResult blockTarget)) return false; + return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightBlock(context, camera, blockTarget, partialTick, poseStack, bufferSource)); case ENTITY: - if (!(target instanceof EntityHitResult)) return false; - return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightEntity(context, camera, target, partialTick, poseStack, bufferSource)); + if (!(target instanceof EntityHitResult entityTarget)) return false; + return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent.HighlightEntity(context, camera, entityTarget, partialTick, poseStack, bufferSource)); default: return MinecraftForge.EVENT_BUS.post(new DrawSelectionEvent(context, camera, target, partialTick, poseStack, bufferSource)); } @@ -316,7 +315,7 @@ public static float getFieldOfView(Player entity, float fov) { FOVModifierEvent fovModifierEvent = new FOVModifierEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovModifierEvent); - return fovModifierEvent.getNewfov(); + return fovModifierEvent.getNewFov(); } public static double getFieldOfView(GameRenderer renderer, Camera camera, double partialTick, double fov) { @@ -340,9 +339,9 @@ public static void renderMainMenu(TitleScreen gui, PoseStack poseStack, Font fon if (status == BETA || status == BETA_OUTDATED) { // render a warning at the top of the screen, - Component line = new TranslatableComponent("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); + Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha); - line = new TranslatableComponent("forge.update.beta.2"); + line = Component.translatable("forge.update.beta.2"); GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha); } @@ -361,6 +360,7 @@ public static void renderMainMenu(TitleScreen gui, PoseStack poseStack, Font fon } public static String forgeStatusLine; + @Nullable public static SoundInstance playSound(SoundEngine manager, SoundInstance sound) { PlaySoundEvent e = new PlaySoundEvent(manager, sound); @@ -387,23 +387,7 @@ private static void drawScreenInternal(Screen screen, PoseStack poseStack, int m MinecraftForge.EVENT_BUS.post(new ScreenEvent.DrawScreenEvent.Post(screen, poseStack, mouseX, mouseY, partialTick)); } - public static float getFogDensity(FogMode type, Camera camera, float partialTick, float density) - { - EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(type, camera, partialTick, density); - if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity(); - return -1; - } - - /** - * @deprecated to be removed in 1.19, use other onFogRender hook with more params - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static void onFogRender(FogMode type, Camera camera, float partialTick, float distance) - { - MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(type, camera, partialTick, distance)); - } - - public static void onFogRender(FogMode type, Camera camera, float partialTick, float nearDistance, float farDistance, FogShape shape) + public static void onFogRender(FogType type, Camera camera, float partialTick, float nearDistance, float farDistance, FogShape shape) { EntityViewRenderEvent.RenderFogEvent event = new EntityViewRenderEvent.RenderFogEvent(type, camera, partialTick, nearDistance, farDistance, shape); if (MinecraftForge.EVENT_BUS.post(event)) @@ -541,7 +525,7 @@ public static void loadEntityShader(Entity entity, GameRenderer entityRenderer) private static int slotMainHand = 0; - public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot) + public static boolean shouldCauseReequipAnimation(@NotNull ItemStack from, @NotNull ItemStack to, int slot) { boolean fromInvalid = from.isEmpty(); boolean toInvalid = to.isEmpty(); @@ -765,36 +749,11 @@ public static void renderPistonMovedBlocks(BlockPos pos, BlockState state, PoseS { setRenderType(rendertype); VertexConsumer ivertexbuilder = bufferSource.getBuffer(rendertype == RenderType.translucent() ? RenderType.translucentMovingBlock() : rendertype); - blockRenderer.getModelRenderer().tesselateBlock(level, blockRenderer.getBlockModel(state), state, pos, stack, ivertexbuilder, checkSides, new Random(), state.getSeed(pos), packedOverlay); + blockRenderer.getModelRenderer().tesselateBlock(level, blockRenderer.getBlockModel(state), state, pos, stack, ivertexbuilder, checkSides, RandomSource.create(), state.getSeed(pos), packedOverlay); }); setRenderType(null); } - public static void registerForgeWorldPresetScreens() - { - ForgeWorldPresetScreens.registerPresets(); - } - - public static WorldPreset.PresetEditor getPresetEditor(Optional generator, @Nullable WorldPreset.PresetEditor biomegeneratortypescreens$ifactory) - { - return ForgeWorldPresetScreens.getPresetEditor(generator, biomegeneratortypescreens$ifactory); - } - - public static boolean hasPresetEditor(Optional generator) - { - return getPresetEditor(generator, null) != null; - } - - public static Optional getWorldPresetFromGenerator(WorldGenSettings dimensionGeneratorSettings) - { - return WorldPreset.of(dimensionGeneratorSettings); - } - - public static Optional getDefaultWorldPreset() - { - return Optional.of(ForgeWorldPresetScreens.getDefaultPreset()); - } - public static boolean shouldRenderEffect(MobEffectInstance effectInstance) { return RenderProperties.getEffectRenderer(effectInstance).shouldRender(effectInstance); @@ -808,7 +767,7 @@ public static TextureAtlasSprite loadTextureAtlasSprite( int atlasWidth, int atlasHeight, int spriteX, int spriteY, int mipmapLevel, NativeImage image - ) + ) throws IOException { ForgeTextureMetadata metadata = ForgeTextureMetadata.forResource(resource); return metadata.getLoader() == null ? null : metadata.getLoader().load(textureAtlas, resourceManager, textureInfo, resource, atlasWidth, atlasHeight, spriteX, spriteY, mipmapLevel, image); @@ -929,7 +888,7 @@ public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData targe if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) { //this is not the most proper way to do it, //but works best here and has the least maintenance overhead - gui.setToolTip(Arrays.stream(tooltip.split("\n")).map(TextComponent::new).collect(Collectors.toList())); + gui.setToolTip(Arrays.stream(tooltip.split("\n")).map(Component::literal).collect(Collectors.toList())); } } @@ -952,7 +911,7 @@ public static void firePlayerLogin(MultiPlayerGameMode pc, LocalPlayer player, C MinecraftForge.EVENT_BUS.post(new ClientPlayerNetworkEvent.LoggedInEvent(pc, player, networkManager)); } - public static void firePlayerLogout(MultiPlayerGameMode pc, LocalPlayer player) { + public static void firePlayerLogout(@Nullable MultiPlayerGameMode pc, @Nullable LocalPlayer player) { MinecraftForge.EVENT_BUS.post(new ClientPlayerNetworkEvent.LoggedOutEvent(pc, player, player != null ? player.connection != null ? player.connection.getConnection() : null : null)); } @@ -981,7 +940,7 @@ public static void registerShaders(RegisterShadersEvent event) throws IOExceptio } } - public static Font getTooltipFont(@Nullable Font forcedFont, @Nonnull ItemStack stack, Font fallbackFont) + public static Font getTooltipFont(@Nullable Font forcedFont, @NotNull ItemStack stack, Font fallbackFont) { if (forcedFont != null) { @@ -991,14 +950,14 @@ public static Font getTooltipFont(@Nullable Font forcedFont, @Nonnull ItemStack return stackFont == null ? fallbackFont : stackFont; } - public static RenderTooltipEvent.Pre onRenderTooltipPre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull List components, @Nullable Font forcedFont, @Nonnull Font fallbackFont) + public static RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @NotNull List components, @Nullable Font forcedFont, @NotNull Font fallbackFont) { var preEvent = new RenderTooltipEvent.Pre(stack, poseStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components); MinecraftForge.EVENT_BUS.post(preEvent); return preEvent; } - public static RenderTooltipEvent.Color onRenderTooltipColor(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List components) + public static RenderTooltipEvent.Color onRenderTooltipColor(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, @NotNull Font font, @NotNull List components) { var colorEvent = new RenderTooltipEvent.Color(stack, poseStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components); MinecraftForge.EVENT_BUS.post(colorEvent); @@ -1101,47 +1060,48 @@ public static boolean isBlockInSolidLayer(BlockState state) } public static void createWorldConfirmationScreen( - LevelStorageSource save, String worldName, boolean creatingWorld, - Function worldData, - Function, Runnable> runAfter) + String worldName, LevelStorageSource.LevelStorageAccess levelStorageAccess, + PackRepository packRepository, WorldStem worldStem) { - Component title = new TranslatableComponent("selectWorld.backupQuestion.experimental"); - Component msg = new TranslatableComponent("selectWorld.backupWarning.experimental") + Component title = Component.translatable("selectWorld.backupQuestion.experimental"); + Component msg = Component.translatable("selectWorld.backupWarning.experimental") .append("\n\n") - .append(new TranslatableComponent("forge.selectWorld.backupWarning.experimental.additional")); + .append(Component.translatable("forge.selectWorld.backupWarning.experimental.additional")); Screen screen = new ConfirmScreen(confirmed -> { if (confirmed) { - //The WorldData is re-created when re-running the runnable, - // so make sure to be setting the field to true on the right instance. - runAfter.apply(worldData.andThen(wds -> (rm, dpc) -> - wds.get(rm, dpc).mapFirst(wd -> wd instanceof PrimaryLevelData pld ? pld.withConfirmedWarning(true) : wd)) - ).run(); + if (worldStem.worldData() instanceof PrimaryLevelData pld) + { + pld.withConfirmedWarning(true); + } + Minecraft.getInstance().doWorldLoad(worldName, levelStorageAccess, packRepository, worldStem); } else { Minecraft.getInstance().setScreen(null); - - if (creatingWorld) // delete save when cancelling creation. - { - try (LevelStorageSource.LevelStorageAccess levelSave = save.createAccess(worldName)) - { - levelSave.deleteLevel(); - } - catch (IOException e) - { - SystemToast.onWorldDeleteFailure(Minecraft.getInstance(), worldName); - LOGGER.error("Failed to delete world {}", worldName, e); - } - } } }, title, msg, CommonComponents.GUI_PROCEED, CommonComponents.GUI_CANCEL); Minecraft.getInstance().setScreen(screen); } + public static boolean renderFireOverlay(Player player, PoseStack mat) + { + return renderBlockOverlay(player, mat, RenderBlockOverlayEvent.OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition()); + } + + public static boolean renderWaterOverlay(Player player, PoseStack mat) + { + return renderBlockOverlay(player, mat, RenderBlockOverlayEvent.OverlayType.WATER, Blocks.WATER.defaultBlockState(), player.blockPosition()); + } + + public static boolean renderBlockOverlay(Player player, PoseStack mat, RenderBlockOverlayEvent.OverlayType type, BlockState block, BlockPos pos) + { + return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, mat, type, block, pos)); + } + public static int getMaxMipmapLevel(int width, int height) { return Math.min( diff --git a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java index 7035a6aa95f..2cc0f6c7df9 100644 --- a/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java +++ b/src/main/java/net/minecraftforge/client/ForgeRenderTypes.java @@ -6,30 +6,20 @@ package net.minecraftforge.client; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.datafixers.util.Pair; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderStateShard.TextureStateShard; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.ShaderInstance; import net.minecraft.client.renderer.texture.TextureAtlas; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraftforge.client.event.RegisterShadersEvent; import net.minecraftforge.common.util.NonNullLazy; import net.minecraftforge.common.util.NonNullSupplier; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; -import java.io.IOException; -import java.util.List; import java.util.function.BiFunction; -import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; diff --git a/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java b/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java deleted file mode 100644 index 7892f29fd9e..00000000000 --- a/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client; - -import com.google.common.collect.Maps; -import net.minecraft.client.gui.screens.worldselection.WorldPreset; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.Registry; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; -import net.minecraft.world.level.levelgen.WorldGenSettings; -import net.minecraftforge.common.world.ForgeWorldPreset; -import net.minecraftforge.registries.ForgeRegistries; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.Map; -import java.util.Optional; - -public class ForgeWorldPresetScreens -{ - private static final Logger LOGGER = LogManager.getLogger(); - - private static final Map GENERATORS = Maps.newHashMap(); - private static final Map GENERATOR_SCREEN_FACTORIES = Maps.newHashMap(); - - public static synchronized void registerPresetEditor(ForgeWorldPreset type, WorldPreset.PresetEditor factory) - { - if (GENERATOR_SCREEN_FACTORIES.containsKey(type)) - throw new IllegalStateException("Factory has already been registered for: " + type); - - GENERATOR_SCREEN_FACTORIES.put(type, factory); - } - - static WorldPreset getDefaultPreset() - { - ForgeWorldPreset def = ForgeWorldPreset.getDefaultWorldPreset(); - if (def == null) - { - return WorldPreset.NORMAL; - } - - WorldPreset gen = GENERATORS.get(def); - if (gen == null) - { - LOGGER.error("The default world type '{}' has not been added to the GUI. Was it registered too late?", def.getRegistryName()); - return WorldPreset.NORMAL; - } - - return gen; - } - - static WorldPreset.PresetEditor getPresetEditor(Optional generator, @Nullable WorldPreset.PresetEditor biomegeneratortypescreens$ifactory) - { - return generator.filter(gen -> gen instanceof GeneratorPreset) - .map(type -> GENERATOR_SCREEN_FACTORIES.get(((GeneratorPreset)type).getWorldPreset())) - .orElse(biomegeneratortypescreens$ifactory); - } - - static void registerPresets() - { - ForgeRegistries.WORLD_TYPES.get().forEach(wt -> { - GeneratorPreset gen = new GeneratorPreset(wt); - GENERATORS.put(wt, gen); - WorldPreset.registerGenerator(gen); - }); - } - - private static class GeneratorPreset extends WorldPreset - { - private final ForgeWorldPreset worldPreset; - - public GeneratorPreset(ForgeWorldPreset wt) - { - super(wt.getDisplayName()); - worldPreset = wt; - } - - public ForgeWorldPreset getWorldPreset() - { - return worldPreset; - } - - @Nonnull - @Override - public WorldGenSettings create(@Nonnull RegistryAccess dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest) - { - return worldPreset.createSettings(dynamicRegistries, seed, generateStructures, bonusChest, ""); - } - - @Override - protected ChunkGenerator generator(RegistryAccess p_194083_, long p_194084_) { - return worldPreset.createChunkGenerator(p_194083_, p_194084_, ""); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/IItemRenderProperties.java b/src/main/java/net/minecraftforge/client/IItemRenderProperties.java index 6281579e358..19c1574876e 100644 --- a/src/main/java/net/minecraftforge/client/IItemRenderProperties.java +++ b/src/main/java/net/minecraftforge/client/IItemRenderProperties.java @@ -14,9 +14,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface IItemRenderProperties { @@ -43,7 +42,7 @@ default Font getFont(ItemStack stack) * @param itemStack The itemStack to render the model of * @param armorSlot The slot the armor is in * @param _default Original armor model. Will have attributes set. - * @return A HumanoidModel to render instead of the default, will have the relevant properties copied in {@link #getBaseArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel). + * @return A HumanoidModel to render instead of the default, will have the relevant properties copied in {@link #getBaseArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel)}. * Returning null will cause the default to render. * @see #getBaseArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel) */ @@ -65,7 +64,7 @@ default HumanoidModel getArmorModel(LivingEntity entityLiving, ItemStack item * @return A Model to render instead of the default * @see #getArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel) */ - @Nonnull + @NotNull default Model getBaseArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { HumanoidModel replacement = getArmorModel(entityLiving, itemStack, armorSlot, _default); diff --git a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java index f06c0894781..6c501576b8c 100644 --- a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java +++ b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java @@ -7,9 +7,6 @@ import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.collect.Maps; import net.minecraft.client.renderer.ItemModelShaper; @@ -17,17 +14,20 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.core.Holder; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.IRegistryDelegate; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Wrapper around ItemModeMesher that cleans up the internal maps to respect ID remapping. */ public class ItemModelMesherForge extends ItemModelShaper { - final Map, ModelResourceLocation> locations = Maps.newHashMap(); - final Map, BakedModel> models = Maps.newHashMap(); + final Map, ModelResourceLocation> locations = Maps.newHashMap(); + final Map, BakedModel> models = Maps.newHashMap(); public ItemModelMesherForge(ModelManager manager) { @@ -38,13 +38,13 @@ public ItemModelMesherForge(ModelManager manager) @Nullable public BakedModel getItemModel(Item item) { - return models.get(item.delegate); + return models.get(ForgeRegistries.ITEMS.getDelegateOrThrow(item)); } @Override public void register(Item item, ModelResourceLocation location) { - IRegistryDelegate key = item.delegate; + Holder.Reference key = ForgeRegistries.ITEMS.getDelegateOrThrow(item); locations.put(key, location); models.put(key, getModelManager().getModel(location)); } @@ -53,15 +53,15 @@ public void register(Item item, ModelResourceLocation location) public void rebuildCache() { final ModelManager manager = this.getModelManager(); - for (Map.Entry, ModelResourceLocation> e : locations.entrySet()) + for (Map.Entry, ModelResourceLocation> e : locations.entrySet()) { models.put(e.getKey(), manager.getModel(e.getValue())); } } - public ModelResourceLocation getLocation(@Nonnull ItemStack stack) + public ModelResourceLocation getLocation(@NotNull ItemStack stack) { - ModelResourceLocation location = locations.get(stack.getItem().delegate); + ModelResourceLocation location = locations.get(ForgeRegistries.ITEMS.getDelegateOrThrow(stack.getItem())); if (location == null) { diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index 1e032a07058..b678540c50f 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -10,33 +10,22 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.inventory.tooltip.TooltipComponent; -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.chunk.RenderChunkRegion; import com.mojang.blaze3d.platform.NativeImage; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.resources.ResourceLocation; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; import net.minecraftforge.client.textures.ITextureAtlasSpriteLoader; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class MinecraftForgeClient { @@ -107,15 +96,15 @@ public static void registerImageLayerSupplier(ResourceLocation resourceLocation, bufferedImageSuppliers.put(resourceLocation, supplier); } - @Nonnull + @NotNull public static NativeImage getImageLayer(ResourceLocation resourceLocation, ResourceManager resourceManager) throws IOException { Supplier supplier = bufferedImageSuppliers.get(resourceLocation); if (supplier != null) return supplier.get(); - Resource iresource1 = resourceManager.getResource(resourceLocation); - return NativeImage.read(iresource1.getInputStream()); + Resource iresource1 = resourceManager.getResource(resourceLocation).orElseThrow(); + return NativeImage.read(iresource1.open()); } private static final Map textureAtlasSpriteLoaders = new ConcurrentHashMap<>(); diff --git a/src/main/java/net/minecraftforge/client/RecipeBookRegistry.java b/src/main/java/net/minecraftforge/client/RecipeBookRegistry.java index 5b54ec5e9bf..a70a936f56f 100644 --- a/src/main/java/net/minecraftforge/client/RecipeBookRegistry.java +++ b/src/main/java/net/minecraftforge/client/RecipeBookRegistry.java @@ -11,8 +11,8 @@ import net.minecraft.world.inventory.RecipeBookType; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeType; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Function; diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java index f46715ed414..c19d3b32811 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java @@ -6,48 +6,58 @@ package net.minecraftforge.client.event; import com.google.common.base.Strings; -import net.minecraft.client.gui.screens.Screen; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * ClientChatEvent is fired whenever the client is about to send a chat message or command to the server.
- * This event is fired via {@link ForgeEventFactory#onClientSendMessage(String)}, - * which is executed by {@link Screen#sendMessage(String, boolean)}
- *
- * {@link #message} contains the message that will be sent to the server. This can be changed by mods.
- * {@link #originalMessage} contains the original message that was going to be sent to the server. This cannot be changed by mods.
- *
- * This event is {@link Cancelable}.
- * If this event is canceled, the chat message or command is never sent to the server.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + * Fired when the client is about to send a chat message to the server. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the chat message or command will not be sent to the server.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

**/ @Cancelable public class ClientChatEvent extends Event { private String message; private final String originalMessage; + + /** + * @hidden + * @see ForgeEventFactory#onClientSendMessage(String) + */ public ClientChatEvent(String message) { this.setMessage(message); this.originalMessage = Strings.nullToEmpty(message); } + /** + * {@return the message that will be sent to the server, if the event is not cancelled} + */ public String getMessage() { return message; } + /** + * Sets the new message to be sent to the server, if the event is not cancelled. + * + * @param message the new message to be sent + */ public void setMessage(String message) { this.message = Strings.nullToEmpty(message); } + /** + * {@return the original message that was to be sent to the server} + */ public String getOriginalMessage() { return originalMessage; diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index 55427899070..9c033933feb 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -5,56 +5,79 @@ package net.minecraftforge.client.event; +import net.minecraft.network.chat.ChatSender; +import net.minecraft.Util; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nullable; -import java.util.UUID; +import net.minecraftforge.fml.LogicalSide; /** - * Fired on the client when a chat message is received.
- * If this event is cancelled, the message is not displayed in the chat message window.
- * Fired on {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}. + * Fired when a chat message is received on the client. + * This can be used for filtering and detecting messages with specific words or phrases, and suppressing them. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the message is not displayed in the chat message window.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ChatType */ @Cancelable public class ClientChatReceivedEvent extends Event { private Component message; private final ChatType type; - @Nullable - private final UUID senderUUID; + private final ChatSender chatSender; - public ClientChatReceivedEvent(ChatType type, Component message, @Nullable UUID senderUUID) + /** + * @hidden + * @see ForgeEventFactory#onClientChat(ChatType, Component, ChatSender) + */ + public ClientChatReceivedEvent(ChatType type, Component message, ChatSender chatSender) { this.type = type; this.message = message; - this.senderUUID = senderUUID; + this.chatSender = chatSender; } + /** + * {@return the message that will be displayed in the chat message window, if the event is not cancelled} + */ public Component getMessage() { return message; } + /** + * Sets the new message to be displayed in the chat message window, if the event is not cancelled. + * + * @param message the new message to be sent + */ public void setMessage(Component message) { this.message = message; } + /** + * {@return the type of the chat message} + */ public ChatType getType() { return type; } /** - * The UUID of the player or entity that sent this message, or null if not known. - * This will be equal to {@link net.minecraft.Util#NIL_UUID} for system messages. + * {@return the sender of this chat message} This contains the UUID, name, and (optionally) the team name of the + * entity which sent the chat message. For system messages, {@link ChatSender#uuid()} will be equal to + * {@link Util#NIL_UUID}. */ - @Nullable - public UUID getSenderUUID() + public ChatSender getChatSender() { - return senderUUID; + return chatSender; } } diff --git a/src/main/java/net/minecraftforge/client/event/ClientPlayerChangeGameTypeEvent.java b/src/main/java/net/minecraftforge/client/event/ClientPlayerChangeGameTypeEvent.java index b65789710b2..d286011f6cb 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientPlayerChangeGameTypeEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientPlayerChangeGameTypeEvent.java @@ -7,10 +7,19 @@ import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.world.level.GameType; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Fired before the client player is notified of a change in game mode from the server. + * Fired when the client player is notified of a change of {@link GameType} from the server. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public class ClientPlayerChangeGameTypeEvent extends Event { @@ -18,6 +27,10 @@ public class ClientPlayerChangeGameTypeEvent extends Event private final GameType currentGameType; private final GameType newGameType; + /** + * @hidden + * @see ForgeHooksClient#onClientChangeGameType(PlayerInfo, GameType, GameType) + */ public ClientPlayerChangeGameTypeEvent(PlayerInfo info, GameType currentGameType, GameType newGameType) { this.info = info; @@ -25,16 +38,25 @@ public ClientPlayerChangeGameTypeEvent(PlayerInfo info, GameType currentGameType this.newGameType = newGameType; } + /** + * {@return the client player information} + */ public PlayerInfo getInfo() { return info; } + /** + * {@return the current game type of the player} + */ public GameType getCurrentGameType() { return currentGameType; } + /** + * {@return the new game type of the player} + */ public GameType getNewGameType() { return newGameType; diff --git a/src/main/java/net/minecraftforge/client/event/ClientPlayerNetworkEvent.java b/src/main/java/net/minecraftforge/client/event/ClientPlayerNetworkEvent.java index bd8091eb161..2b83186b702 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientPlayerNetworkEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientPlayerNetworkEvent.java @@ -8,42 +8,53 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.multiplayer.MultiPlayerGameMode; import net.minecraft.network.Connection; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nullable; +import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.Nullable; /** - * Client side player connectivity events. - */ + * Fired for different client connectivity events. + * See the various subclasses to listen for specific events. + * + *

These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ClientPlayerNetworkEvent.LoggedInEvent + * @see ClientPlayerNetworkEvent.LoggedOutEvent + * @see ClientPlayerNetworkEvent.RespawnEvent + **/ public class ClientPlayerNetworkEvent extends Event { private final MultiPlayerGameMode multiPlayerGameMode; private final LocalPlayer player; private final Connection connection; /** - * @return the player controller for the client side + * {@return the multiplayer game mode controller for the player} */ - @Nullable public MultiPlayerGameMode getMultiPlayerGameMode() { return multiPlayerGameMode; } /** - * @return the player instance (if present - may be null) + * {@return the player instance} */ - @Nullable public LocalPlayer getPlayer() { return player; } /** - * @return the impl connection (if present - may be null) + * {@return the network connection for the player} */ - @Nullable public Connection getConnection() { return connection; } + /** + * @hidden + */ ClientPlayerNetworkEvent(final MultiPlayerGameMode multiPlayerGameMode, final LocalPlayer player, final Connection connection) { this.multiPlayerGameMode = multiPlayerGameMode; this.player = player; @@ -52,41 +63,121 @@ public Connection getConnection() { /** * Fired when the client player logs in to the server. The player should be initialized. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class LoggedInEvent extends ClientPlayerNetworkEvent { + /** + * @hidden + * @see ForgeHooksClient#firePlayerLogin(MultiPlayerGameMode, LocalPlayer, Connection) + */ public LoggedInEvent(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager) { super(controller, player, networkManager); } } /** - * Fired when the player logs out. Note this might also fire when a new integrated server is being created. + * Fired when the client player logs out. This event may also fire when a new integrated server is being created. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ + @SuppressWarnings("NullableProblems") // Shush IntelliJ, we override non-nullables as nullables in this specific event; see later comment public static class LoggedOutEvent extends ClientPlayerNetworkEvent { - public LoggedOutEvent(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager) { + /** + * @hidden + * @see ForgeHooksClient#firePlayerLogout(MultiPlayerGameMode, LocalPlayer) + */ + public LoggedOutEvent(@Nullable final MultiPlayerGameMode controller, @Nullable final LocalPlayer player, @Nullable final Connection networkManager) { + //noinspection ConstantConditions we know these are nullable, but we don't want to annotate the super as nullable since this is the only event with nullables super(controller, player, networkManager); } + + /** + * {@return the multiplayer game mode controller for the player, may be {@code null}}. This may be {@code null} + * in certain situations such as the creating a new integrated server (singleplayer world) or connecting to + * a multiplayer server. + */ + @Nullable + @Override + public MultiPlayerGameMode getMultiPlayerGameMode() + { + return super.getMultiPlayerGameMode(); + } + + /** + * {@return the player instance, may be {@code null}}. This may be {@code null} + * in certain situations such as the creating a new integrated server (singleplayer world) or connecting to + * a multiplayer server. + */ + @Nullable + @Override + public LocalPlayer getPlayer() + { + return super.getPlayer(); + } + + /** + * {@return the network connection for the player, may be {@code null}}. This may be {@code null} + * in certain situations such as the creating a new integrated server (singleplayer world) or connecting to + * a multiplayer server. + */ + @Nullable + @Override + public Connection getConnection() + { + return super.getConnection(); + } } /** - * Fired when the player object respawns, such as dimension changes. + * Fired when the client player respawns, creating a new player instance to replace the old player instance. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class RespawnEvent extends ClientPlayerNetworkEvent { private final LocalPlayer oldPlayer; + /** + * @hidden + * @see ForgeHooksClient#firePlayerRespawn(MultiPlayerGameMode, LocalPlayer, LocalPlayer, Connection) + */ public RespawnEvent(final MultiPlayerGameMode pc, final LocalPlayer oldPlayer, final LocalPlayer newPlayer, final Connection networkManager) { super(pc, newPlayer, networkManager); this.oldPlayer = oldPlayer; } + /** + * {@return the previous player instance} + */ public LocalPlayer getOldPlayer() { return oldPlayer; } + /** + * {@return the newly created player instance} + */ public LocalPlayer getNewPlayer() { return super.getPlayer(); } + + /** + * {@return the newly created player instance} + * @see #getNewPlayer() + */ + @Override + public LocalPlayer getPlayer() { + return super.getPlayer(); + } } } diff --git a/src/main/java/net/minecraftforge/client/event/ColorHandlerEvent.java b/src/main/java/net/minecraftforge/client/event/ColorHandlerEvent.java index c9206c140b3..fb232fea84e 100644 --- a/src/main/java/net/minecraftforge/client/event/ColorHandlerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ColorHandlerEvent.java @@ -5,48 +5,107 @@ package net.minecraftforge.client.event; +import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.block.BlockColors; +import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColors; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; /** - * Use these events to register block/item - * color handlers at the appropriate time. + * Fired for registering block and item color handlers at the appropriate time. + * See the two subclasses for registering block or item color handlers. + * + *

These events are fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ColorHandlerEvent.Block + * @see ColorHandlerEvent.Item */ public abstract class ColorHandlerEvent extends Event implements IModBusEvent { + /** + * @hidden This should only be invoked by subclasses. + */ + public ColorHandlerEvent() + { + } + + /** + * Fired for registering block color handlers. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class Block extends ColorHandlerEvent { private final BlockColors blockColors; + /** + * @hidden This should only be invoked by the client hook. + * @see ForgeHooksClient#onBlockColorsInit(BlockColors) + */ public Block(BlockColors blockColors) { this.blockColors = blockColors; } + /** + * {@return the block colors registry} + * @see BlockColors#register(BlockColor, net.minecraft.world.level.block.Block...) + */ public BlockColors getBlockColors() { return blockColors; } } + /** + * Fired for registering item color handlers. + * + *

The block colors should only be used for referencing or delegating item colors to their respective block + * colors. Use {@link ColorHandlerEvent.Block} for registering your block color handlers.

+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class Item extends ColorHandlerEvent { private final ItemColors itemColors; private final BlockColors blockColors; + /** + * @hidden + * @see ForgeHooksClient#onItemColorsInit(ItemColors, BlockColors) + */ public Item(ItemColors itemColors, BlockColors blockColors) { this.itemColors = itemColors; this.blockColors = blockColors; } + /** + * {@return the item colors registry} + * @see ItemColors#register(ItemColor, ItemLike...) + */ public ItemColors getItemColors() { return itemColors; } + /** + * {@return the block colors registry} + * This should only be used for referencing or delegating item colors to their respective block colors. + */ public BlockColors getBlockColors() { return blockColors; diff --git a/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java index 05e7234b57e..e1a5b7f1221 100644 --- a/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java @@ -7,31 +7,53 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Event class for handling GuiContainer specific events. + * Fired for hooking into {@link AbstractContainerScreen} rendering. + * See the two subclasses to listen for foreground or background rendering. + * + *

These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ContainerScreenEvent.DrawForeground + * @see ContainerScreenEvent.DrawBackground */ public class ContainerScreenEvent extends Event { private final AbstractContainerScreen containerScreen; + /** + * @hidden + */ public ContainerScreenEvent(AbstractContainerScreen containerScreen) { this.containerScreen = containerScreen; } + /** + * {@return the container screen} + */ public AbstractContainerScreen getContainerScreen() { return containerScreen; } /** - * This event is fired directly after the GuiContainer has draw any foreground elements, - * But before the "dragged" stack, and before any tooltips. - * This is useful for any slot / item specific overlays. - * Things that need to be on top of All GUI elements but bellow tooltips and dragged stacks. + * Fired after the container screen's foreground layer and elements are drawn, but + * before rendering the tooltips and the item stack being dragged by the player. + * + *

This can be used for rendering elements that must be above other screen elements, but + * below tooltips and the dragged stack, such as slot or item stack specific overlays.

+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class DrawForeground extends ContainerScreenEvent { @@ -40,12 +62,7 @@ public static class DrawForeground extends ContainerScreenEvent private final int mouseY; /** - * Called directly after the GuiContainer has drawn any foreground elements. - * - * @param guiContainer The container. - * @param poseStack The pose stack. - * @param mouseX The current X position of the players mouse. - * @param mouseY The current Y position of the players mouse. + * @hidden */ public DrawForeground(AbstractContainerScreen guiContainer, PoseStack poseStack, int mouseX, int mouseY) { @@ -55,25 +72,39 @@ public DrawForeground(AbstractContainerScreen guiContainer, PoseStack poseSta this.mouseY = mouseY; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the X coordinate of the mouse pointer} + */ public int getMouseX() { return mouseX; } + /** + * {@return the Y coordinate of the mouse pointer} + */ public int getMouseY() { return mouseY; } } - + /** - * This event is fired directly after the GuiContainer has draw any background elements, - * This is useful for drawing new background elements. + * Fired after the container screen's background layer and elements are drawn. + * This can be used for rendering new background elements. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class DrawBackground extends ContainerScreenEvent { @@ -82,12 +113,7 @@ public static class DrawBackground extends ContainerScreenEvent private final int mouseY; /** - * Called directly after the GuiContainer has drawn any background elements. - * - * @param guiContainer The container. - * @param poseStack The PoseStack. - * @param mouseX The current X position of the players mouse. - * @param mouseY The current Y position of the players mouse. + * @hidden */ public DrawBackground(AbstractContainerScreen guiContainer, PoseStack poseStack, int mouseX, int mouseY) { @@ -97,16 +123,25 @@ public DrawBackground(AbstractContainerScreen guiContainer, PoseStack poseSta this.mouseY = mouseY; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the X coordinate of the mouse pointer} + */ public int getMouseX() { return mouseX; } + /** + * {@return the Y coordinate of the mouse pointer} + */ public int getMouseY() { return mouseY; diff --git a/src/main/java/net/minecraftforge/client/event/DrawSelectionEvent.java b/src/main/java/net/minecraftforge/client/event/DrawSelectionEvent.java index 574a9d114fe..01d7feccb3c 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawSelectionEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawSelectionEvent.java @@ -9,15 +9,20 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.world.phys.HitResult; import net.minecraft.client.Camera; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraftforge.fml.LogicalSide; /** - * An event called whenever the selection highlight around a block or entity is about to be rendered. - * Canceling this event stops the selection highlight from being rendered. + * Fired before a selection highlight is rendered. + * See the two subclasses to listen for blocks or entities. + * + * @see DrawSelectionEvent.HighlightBlock + * @see DrawSelectionEvent.HighlightEntity */ @Cancelable public class DrawSelectionEvent extends Event @@ -25,38 +30,72 @@ public class DrawSelectionEvent extends Event private final LevelRenderer levelRenderer; private final Camera camera; private final HitResult target; - private final float partialTicks; + private final float partialTick; private final PoseStack poseStack; private final MultiBufferSource multiBufferSource; - public DrawSelectionEvent(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTicks, PoseStack poseStack, MultiBufferSource multiBufferSource) + /** + * @hidden + * @see net.minecraftforge.client.ForgeHooksClient#onDrawHighlight(LevelRenderer, Camera, HitResult, float, PoseStack, MultiBufferSource) + */ + public DrawSelectionEvent(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource) { this.levelRenderer = levelRenderer; this.camera = camera; this.target = target; - this.partialTicks = partialTicks; + this.partialTick = partialTick; this.poseStack = poseStack; this.multiBufferSource = multiBufferSource; } + /** + * {@return the level renderer} + */ public LevelRenderer getLevelRenderer() { return levelRenderer; } + /** + * {@return the camera information} + */ public Camera getCamera() { return camera; } + /** + * {@return the hit result which triggered the selection highlight} + */ public HitResult getTarget() { return target; } - public float getPartialTicks() { return partialTicks; } + /** + * {@return the partial tick} + */ + public float getPartialTick() { return partialTick; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } /** - * A variant of the DrawSelectionEvent only called when a block is highlighted. + * Fired before a block's selection highlight is rendered. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, then the selection highlight will not be rendered.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class HighlightBlock extends DrawSelectionEvent { - public HighlightBlock(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) + /** + * @hidden + */ + public HighlightBlock(LevelRenderer levelRenderer, Camera camera, BlockHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) { super(levelRenderer, camera, target, partialTick, poseStack, bufferSource); } + /** + * {@return the block hit result} + */ @Override public BlockHitResult getTarget() { @@ -65,17 +104,26 @@ public BlockHitResult getTarget() } /** - * A variant of the DrawSelectionEvent only called when an entity is highlighted. - * Canceling this event has no effect. + * Fired before a block's selection highlight is rendered. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ - @Cancelable public static class HighlightEntity extends DrawSelectionEvent { - public HighlightEntity(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) + /** + * @hidden + */ + public HighlightEntity(LevelRenderer levelRenderer, Camera camera, EntityHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) { super(levelRenderer, camera, target, partialTick, poseStack, bufferSource); } + /** + * {@return the entity hit result} + */ @Override public EntityHitResult getTarget() { diff --git a/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java b/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java index a0a06322a64..0cce80ffe54 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityRenderersEvent.java @@ -8,9 +8,11 @@ import com.google.common.collect.ImmutableMap; import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.SkullModel; import net.minecraft.client.model.SkullModelBase; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; @@ -18,6 +20,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -27,24 +30,62 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Map; import java.util.Set; import java.util.function.Supplier; +/** + * Fired for on different events/actions relating to {@linkplain EntityRenderer entity renderers}. + * See the various subclasses for listening to different events. + * + *

These events are fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see EntityRenderersEvent.RegisterLayerDefinitions + * @see EntityRenderersEvent.RegisterRenderers + * @see EntityRenderersEvent.AddLayers + */ public class EntityRenderersEvent extends Event implements IModBusEvent { + /** + * @hidden + */ + public EntityRenderersEvent() + { + } + + /** + * Fired for registering layer definitions at the appropriate time. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class RegisterLayerDefinitions extends EntityRenderersEvent { + /** + * @hidden + */ + public RegisterLayerDefinitions() + { + } + /** * Registers a layer definition supplier with the given {@link ModelLayerLocation}. * These will be inserted into the main layer definition map for entity model layers at the appropriate time. * - * @param layerLocation The model layer location, which should be used in conjunction with {@link EntityRendererProvider.Context#bakeLayer(ModelLayerLocation)} - * @param supplier A supplier to create a {@link LayerDefinition}, generally a static method reference in the entity model class + * @param layerLocation the model layer location, which should be used in conjunction with + * {@link EntityRendererProvider.Context#bakeLayer(ModelLayerLocation)} + * @param supplier a supplier to create a {@link LayerDefinition}, generally a static method reference in + * the entity model class */ public void registerLayerDefinition(ModelLayerLocation layerLocation, Supplier supplier) { @@ -53,15 +94,29 @@ public void registerLayerDefinition(ModelLayerLocation layerLocation, SupplierThis event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class RegisterRenderers extends EntityRenderersEvent { /** - * Registers an entity renderer. + * @hidden + */ + public RegisterRenderers() + { + } + + /** + * Registers an entity renderer for the given entity type. * - * @param entityType The EntityType to register a renderer for - * @param entityRendererProvider The renderer provider, can be a lambda like MyRenderer::new + * @param entityType the entity type to register a renderer for + * @param entityRendererProvider the renderer provider */ public void registerEntityRenderer(EntityType entityType, EntityRendererProvider entityRendererProvider) { @@ -69,10 +124,10 @@ public void registerEntityRenderer(EntityType en } /** - * Registers a block entity renderer. + * Registers a block entity renderer for the given block entity type. * - * @param blockEntityType The BlockEntityType to register a renderer for - * @param blockEntityRendererProvider The renderer provider, can be a lambda like MyRenderer::new + * @param blockEntityType the block entity type to register a renderer for + * @param blockEntityRendererProvider the renderer provider */ public void registerBlockEntityRenderer(BlockEntityType blockEntityType, BlockEntityRendererProvider blockEntityRendererProvider) { @@ -81,7 +136,13 @@ public void registerBlockEntityRenderer(BlockEntityType< } /** - * Provides a safe place to register entity renderer layers. + * Fired for registering entity renderer layers at the appropriate time, after the entity and player renderers maps + * have been created. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class AddLayers extends EntityRenderersEvent { @@ -89,6 +150,9 @@ public static class AddLayers extends EntityRenderersEvent private final Map> skinMap; private final EntityModelSet entityModels = Minecraft.getInstance().getEntityModels(); + /** + * @hidden + */ public AddLayers(Map, EntityRenderer> renderers, Map> playerRenderers) { this.renderers = renderers; @@ -96,7 +160,11 @@ public AddLayers(Map, EntityRenderer> renderers, Map getSkins() { @@ -104,10 +172,12 @@ public Set getSkins() } /** - * Returns a player skin renderer. Vanilla skins are "default" and "slim". - * @param skinName The name of the skin renderer to return - * @param The type of the skin renderer, usually PlayerRenderer - * @return The skin renderer, or null if not found + * Returns a player skin renderer for the given skin name. + * + * @param skinName the name of the skin to get the renderer for + * @param the type of the skin renderer, usually {@link PlayerRenderer} + * @return the skin renderer, or {@code null} if no renderer is registered for that skin name + * @see #getSkins() */ @Nullable @SuppressWarnings("unchecked") @@ -118,10 +188,11 @@ public Set getSkins() /** * Returns an entity renderer for the given entity type. - * @param entityType The entity to return a renderer for - * @param The type of entity the renderer is for - * @param The renderer type - * @return The renderer + * + * @param entityType the entity type to return a renderer for + * @param the type of entity the renderer is for + * @param the type of the renderer + * @return the renderer, or {@code null} if no renderer is registered for that entity type */ @Nullable @SuppressWarnings("unchecked") @@ -129,6 +200,9 @@ public Set getSkins() return (R) renderers.get(entityType); } + /** + * {@return the set of entity models} + */ public EntityModelSet getEntityModels() { return entityModels; @@ -136,19 +210,27 @@ public EntityModelSet getEntityModels() } /** - * Provides a safe place to register models for the skull block + * Fired for registering additional {@linkplain net.minecraft.client.model.SkullModelBase skull models} at the appropriate time. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class CreateSkullModels extends EntityRenderersEvent { - private final ImmutableMap.Builder builder; + private final ImmutableMap.Builder builder; private final EntityModelSet entityModelSet; - public CreateSkullModels(ImmutableMap.Builder builder, EntityModelSet entityModelSet) + public CreateSkullModels(ImmutableMap.Builder builder, EntityModelSet entityModelSet) { this.builder = builder; this.entityModelSet = entityModelSet; } + /** + * {@return the set of entity models} + */ public EntityModelSet getEntityModelSet() { return entityModelSet; @@ -156,10 +238,14 @@ public EntityModelSet getEntityModelSet() /** * Registers the constructor for a skull block with the given {@link SkullBlock.Type}. - * These will be inserted into the maps used by the item, entity, and block model renderers at the appropiate time. + * These will be inserted into the maps used by the item, entity, and block model renderers at the appropriate + * time. * - * @param type Unique skull type. Will cause an exception if multiple mods (including vanilla) register models for the same type - * @param model Model instance. A typical implementation will simply do {@code new SkullModel(entityModelSet.bakeLayer(layerLocation))} + * @param type a unique skull type; an exception will be thrown later if multiple mods (including vanilla) + * register models for the same type + * @param model the skull model instance. A typical implementation will simply bake a model using + * {@link EntityModelSet#bakeLayer(ModelLayerLocation)} and pass it to the constructor for + * {@link SkullModel}. */ public void registerSkullModel(SkullBlock.Type type, SkullModelBase model) { diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index d0a63d1f821..e42a9f1db26 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -7,162 +7,180 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.Camera; -import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.world.level.material.FogType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.FogRenderer; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; import com.mojang.blaze3d.shaders.FogShape; /** - * Event that hooks into GameRenderer, allowing any feature to customize visual attributes - * the player sees. + * Fired for hooking into the entity view rendering in {@link GameRenderer}. + * These can be used for customizing the visual features visible to the player. + * See the various subclasses for listening to different features. + * + *

These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see EntityViewRenderEvent.RenderFogEvent + * @see EntityViewRenderEvent.FogColors + * @see EntityViewRenderEvent.CameraSetup + * @see EntityViewRenderEvent.FieldOfView */ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.api.Event { private final GameRenderer renderer; private final Camera camera; - private final double partialTicks; + private final double partialTick; - public EntityViewRenderEvent(GameRenderer renderer, Camera camera, double partialTicks) + /** + * @hidden + */ + public EntityViewRenderEvent(GameRenderer renderer, Camera camera, double partialTick) { this.renderer = renderer; this.camera = camera; - this.partialTicks = partialTicks; + this.partialTick = partialTick; } + /** + * {@return the game renderer} + */ public GameRenderer getRenderer() { return renderer; } + /** + * {@return the camera information} + */ public Camera getCamera() { return camera; } - public double getPartialTicks() - { - return partialTicks; - } - - @Deprecated(forRemoval = true, since = "1.18.2") - private static class FogEvent extends EntityViewRenderEvent - { - private final FogMode mode; - @SuppressWarnings("resource") - protected FogEvent(FogMode mode, Camera camera, double partialTick) - { - super(Minecraft.getInstance().gameRenderer, camera, partialTick); - this.mode = mode; - } - - public FogMode getMode() { return mode; } - } - /** - * @deprecated Use RenderFogEvent. This event will be removed as the other event has better functionality. - * - * Event that allows any feature to customize the fog density the player sees. - * NOTE: In order to make this event have an effect, you must cancel the event + * {@return the partial tick} */ - @Cancelable - @Deprecated(forRemoval = true, since = "1.18.2") - public static class FogDensity extends FogEvent + public double getPartialTick() { - private float density; - - public FogDensity(FogMode type, Camera camera, float partialTick, float density) - { - super(type, camera, partialTick); - this.setDensity(density); - } - - public float getDensity() - { - return density; - } - - public void setDensity(float density) - { - this.density = density; - } + return partialTick; } /** - * This event allows for customization of parameters related to fog rendering. The plane distances are based on the player's render distance. - * For the event to have an effect, you must cancel it. + * Fired for customizing the rendering of the fog visible to the player. The plane distances are based on + * the player's render distance. * - * The FogMode is NOT customizable. It describes the type of fog being modified. - * A FogMode of FOG_SKY is the skybox's fog. - * A FogMode of FOG_TERRAIN is what the fog induced by render distance uses. This works best for reducing the camera's visibility. + *

This event is {@linkplain Cancelable cancellable}, and {@linkplain HasResult has a result}.
+ * The event must be cancelled for any changes to the plane distances to take effect.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ - @HasResult // TODO: remove in 1.19. Setting a result for this event has no effect. @Cancelable - public static class RenderFogEvent extends FogEvent // TODO: In 1.19, change superclass to EntityViewRenderEvent + public static class RenderFogEvent extends EntityViewRenderEvent { - private final FogMode type; + private final FogType type; private float farPlaneDistance; private float nearPlaneDistance; private FogShape fogShape; /** - * @deprecated Use other constructor with all the params. Will be removed in 1.19 + * @hidden + * @see ForgeHooksClient#onFogRender(FogType, Camera, float, float, float, FogShape) */ - @Deprecated(forRemoval = true, since = "1.18.2") - public RenderFogEvent(FogMode type, Camera camera, float partialTicks, float distance) - { - this(type, camera, partialTicks, -8f, distance, FogShape.SPHERE); - } - - public RenderFogEvent(FogMode type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) + public RenderFogEvent(FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) { - super(type, camera, partialTicks); + super(Minecraft.getInstance().gameRenderer, camera, partialTicks); this.type = type; setFarPlaneDistance(farPlaneDistance); setNearPlaneDistance(nearPlaneDistance); setFogShape(fogShape); } - public FogMode getMode() + /** + * {@return the type of fog being rendered} + */ + public FogType getMode() { return type; } + /** + * {@return the distance to the far plane where the fog ends} + */ public float getFarPlaneDistance() { return farPlaneDistance; } + /** + * {@return the distance to the near plane where the fog starts} + */ public float getNearPlaneDistance() { return nearPlaneDistance; } + /** + * {@return the shape of the fog being rendered} + */ public FogShape getFogShape() { return fogShape; } + /** + * Sets the distance to the far plane of the fog. + * + * @param distance the new distance to the far place + * @see #scaleFarPlaneDistance(float) + */ public void setFarPlaneDistance(float distance) { farPlaneDistance = distance; } + /** + * Sets the distance to the near plane of the fog. + * + * @param distance the new distance to the near plane + * @see #scaleNearPlaneDistance(float) + */ public void setNearPlaneDistance(float distance) { nearPlaneDistance = distance; } + /** + * Sets the new shape of the fog being rendered. The new shape will only take effect if the event is cancelled. + * + * @param shape the new shape of the fog + */ public void setFogShape(FogShape shape) { fogShape = shape; } + /** + * Scales the distance to the far plane of the fog by a given factor. + * + * @param factor the factor to scale the far plane distance by + */ public void scaleFarPlaneDistance(float factor) { farPlaneDistance *= factor; } + /** + * Scales the distance to the near plane of the fog by a given factor. + * + * @param factor the factor to scale the near plane distance by + */ public void scaleNearPlaneDistance(float factor) { nearPlaneDistance *= factor; @@ -170,8 +188,12 @@ public void scaleNearPlaneDistance(float factor) } /** - * 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. + * Fired for customizing the color of the fog visible to the player. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class FogColors extends EntityViewRenderEvent { @@ -179,7 +201,10 @@ public static class FogColors extends EntityViewRenderEvent private float green; private float blue; - @SuppressWarnings("resource") + /** + * @hidden + * @see FogRenderer#setupColor(Camera, float, ClientLevel, int, float) + */ public FogColors(Camera camera, float partialTicks, float red, float green, float blue) { super(Minecraft.getInstance().gameRenderer, camera, partialTicks); @@ -188,16 +213,46 @@ public FogColors(Camera camera, float partialTicks, float red, float green, floa this.setBlue(blue); } + /** + * {@return the red color value of the fog} + */ public float getRed() { return red; } + /** + * Sets the new red color value of the fog. + * + * @param red the new red color value + */ public void setRed(float red) { this.red = red; } + /** + * {@return the green color value of the fog} + */ public float getGreen() { return green; } + /** + * Sets the new green color value of the fog. + * + * @param green the new blue color value + */ public void setGreen(float green) { this.green = green; } + /** + * {@return the blue color value of the fog} + */ public float getBlue() { return blue; } + /** + * Sets the new blue color value of the fog. + * + * @param blue the new blue color value + */ public void setBlue(float blue) { this.blue = blue; } } /** - * Event that allows mods to alter the angles of the player's camera. Mainly useful for applying roll. + * Fired to allow altering the angles of the player's camera. + * This can be used to alter the player's view for different effects, such as applying roll. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class CameraSetup extends EntityViewRenderEvent { @@ -205,6 +260,10 @@ public static class CameraSetup extends EntityViewRenderEvent private float pitch; private float roll; + /** + * @hidden + * @see ForgeHooksClient#onCameraSetup(GameRenderer, Camera, float) + */ public CameraSetup(GameRenderer renderer, Camera camera, double renderPartialTicks, float yaw, float pitch, float roll) { super(renderer, camera, renderPartialTicks); @@ -213,31 +272,74 @@ public CameraSetup(GameRenderer renderer, Camera camera, double renderPartialTic this.setRoll(roll); } + /** + * {@return the yaw of the player's camera} + */ public float getYaw() { return yaw; } + /** + * Sets the yaw of the player's camera. + * + * @param yaw the new yaw + */ public void setYaw(float yaw) { this.yaw = yaw; } + /** + * {@return the pitch of the player's camera} + */ public float getPitch() { return pitch; } + /** + * Sets the pitch of the player's camera. + * + * @param pitch the new pitch + */ public void setPitch(float pitch) { this.pitch = pitch; } + /** + * {@return the roll of the player's camera} + */ public float getRoll() { return roll; } + /** + * Sets the roll of the player's camera. + * + * @param roll the new roll + */ public void setRoll(float roll) { this.roll = roll; } } /** - * Event that allows mods to alter the raw FOV itself. - * This directly affects to the FOV without being modified. - * */ + * Fired for altering the raw field of view (FOV). + * This is after the FOV settings are applied, and before modifiers such as the Nausea effect. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see FOVModifierEvent + */ public static class FieldOfView extends EntityViewRenderEvent { private double fov; + /** + * @hidden + * @see ForgeHooksClient#getFieldOfView(GameRenderer, Camera, double, double) + */ public FieldOfView(GameRenderer renderer, Camera camera, double renderPartialTicks, double fov) { super(renderer, camera, renderPartialTicks); this.setFOV(fov); } + /** + * {@return the raw field of view value} + */ public double getFOV() { return fov; } + /** + * Sets the field of view value. + * + * @param fov the new FOV value + */ public void setFOV(double fov) { this.fov = fov; } diff --git a/src/main/java/net/minecraftforge/client/event/FOVModifierEvent.java b/src/main/java/net/minecraftforge/client/event/FOVModifierEvent.java index c946a880b8c..2e3c1bba3b9 100644 --- a/src/main/java/net/minecraftforge/client/event/FOVModifierEvent.java +++ b/src/main/java/net/minecraftforge/client/event/FOVModifierEvent.java @@ -8,38 +8,71 @@ import net.minecraft.client.Minecraft; import net.minecraft.world.entity.player.Player; import net.minecraft.util.Mth; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired after the field of vision (FOV) modifier for the player is calculated. + * This can be used to modify the FOV before the FOV settings are applied. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see EntityViewRenderEvent.FieldOfView + */ public class FOVModifierEvent extends Event { - private final Player entity; + private final Player player; private final float fov; - private float newfov; + private float newFov; - public FOVModifierEvent(Player entity, float fov) + /** + * @hidden + * @see ForgeHooksClient#getFieldOfView(Player, float) + */ + public FOVModifierEvent(Player player, float fov) { - this.entity = entity; + this.player = player; this.fov = fov; - this.setNewfov(Mth.lerp(Minecraft.getInstance().options.fovEffectScale, 1.0F, fov)); + this.setNewFov((float) Mth.lerp(Minecraft.getInstance().options.fovEffectScale().get(), 1.0F, fov)); } - public Player getEntity() + /** + * {@return the player affected by this event} + */ + public Player getPlayer() { - return entity; + return player; } + /** + * {@return the original field of vision (FOV) of the player, before any modifications or interpolation} + */ public float getFov() { return fov; } - public float getNewfov() + /** + * {@return the current field of vision (FOV) of the player} + */ + public float getNewFov() { - return newfov; + return newFov; } - public void setNewfov(float newfov) + /** + * Sets the new field of vision (FOV) of the player. + * + * @param newFov the new field of vision (FOV) + */ + public void setNewFov(float newFov) { - this.newfov = newfov; + this.newFov = newFov; } } diff --git a/src/main/java/net/minecraftforge/client/event/InputEvent.java b/src/main/java/net/minecraftforge/client/event/InputEvent.java index e196755edb8..6a7e7efbdea 100644 --- a/src/main/java/net/minecraftforge/client/event/InputEvent.java +++ b/src/main/java/net/minecraftforge/client/event/InputEvent.java @@ -7,15 +7,37 @@ import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.client.KeyMapping; +import net.minecraft.client.MouseHandler; import net.minecraft.world.InteractionHand; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import org.lwjgl.glfw.GLFW; +/** + * Fired when an input is detected from the user's input devices. + * See the various subclasses to listen for specific devices and inputs. + * + * @see InputEvent.RawMouseEvent + * @see InputEvent.MouseInputEvent + * @see InputEvent.MouseScrollEvent + * @see InputEvent.KeyInputEvent + * @see InputEvent.ClickInputEvent + */ public class InputEvent extends Event { /** - * A cancellable mouse event fired before key bindings are updated + * Fired when a mouse button is clicked, before being processed by vanilla. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, then the mouse event will not be processed by vanilla (e.g. keymappings and screens)

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see the online GLFW documentation */ @Cancelable public static class RawMouseEvent extends InputEvent @@ -24,6 +46,10 @@ public static class RawMouseEvent extends InputEvent private final int action; private final int modifiers; + /** + * @hidden + * @see ForgeHooksClient#onRawMouseClicked(int, int, int) + */ public RawMouseEvent(int button, int action, int modifiers) { this.button = button; @@ -32,10 +58,11 @@ public RawMouseEvent(int button, int action, int modifiers) } /** - * The mouse button that triggered this event. - * https://www.glfw.org/docs/latest/group__buttons.html + * {@return the mouse button's input code} * - * @see GLFW mouse constants starting with "GLFW_MOUSE_BUTTON_" + * @see InputConstants input constants starting with {@code MOUSE_BUTTON_} + * @see GLFW mouse constants starting with {@code GLFW_MOUSE_BUTTON_} + * @see the online GLFW documentation */ public int getButton() { @@ -43,10 +70,10 @@ public int getButton() } /** - * Integer representing the mouse button's action. + * {@return the mouse button's action} * - * @see GLFW#GLFW_PRESS - * @see GLFW#GLFW_RELEASE + * @see InputConstants#PRESS + * @see InputConstants#RELEASE */ public int getAction() { @@ -54,13 +81,15 @@ public int getAction() } /** - * Bit field representing the modifier keys pressed. - * https://www.glfw.org/docs/latest/group__mods.html + * {@return a bit field representing the active modifier keys} * - * @see GLFW#GLFW_MOD_SHIFT - * @see GLFW#GLFW_MOD_CONTROL - * @see GLFW#GLFW_MOD_ALT - * @see GLFW#GLFW_MOD_SUPER + * @see InputConstants#MOD_CONTROL CTRL modifier key bit + * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit + * @see GLFW#GLFW_MOD_ALT ALT modifier key bit + * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit + * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit + * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit + * @see the online GLFW documentation */ public int getModifiers() { @@ -69,13 +98,25 @@ public int getModifiers() } /** - * This event fires when a mouse input is detected. + * Fired when a mouse button is clicked, after processing. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see the online GLFW documentation */ public static class MouseInputEvent extends InputEvent { private final int button; private final int action; private final int modifiers; + + /** + * @hidden + * @see ForgeHooksClient#onRawMouseClicked(int, int, int) + */ public MouseInputEvent(int button, int action, int modifiers) { this.button = button; @@ -84,10 +125,10 @@ public MouseInputEvent(int button, int action, int modifiers) } /** - * The mouse button that triggered this event. - * https://www.glfw.org/docs/latest/group__buttons.html + * {@return the mouse button's input code} * - * @see GLFW mouse constants starting with "GLFW_MOUSE_BUTTON_" + * @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_' + * @see the online GLFW documentation */ public int getButton() { @@ -95,10 +136,10 @@ public int getButton() } /** - * Integer representing the mouse button's action. + * {@return the mouse button's action} * - * @see GLFW#GLFW_PRESS - * @see GLFW#GLFW_RELEASE + * @see InputConstants#PRESS + * @see InputConstants#RELEASE */ public int getAction() { @@ -106,13 +147,15 @@ public int getAction() } /** - * Bit field representing the modifier keys pressed. - * https://www.glfw.org/docs/latest/group__mods.html + * {@return a bit field representing the active modifier keys} * - * @see GLFW#GLFW_MOD_SHIFT - * @see GLFW#GLFW_MOD_CONTROL - * @see GLFW#GLFW_MOD_ALT - * @see GLFW#GLFW_MOD_SUPER + * @see InputConstants#MOD_CONTROL CTRL modifier key bit + * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit + * @see GLFW#GLFW_MOD_ALT ALT modifier key bit + * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit + * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit + * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit + * @see the online GLFW documentation */ public int getModifiers() { @@ -121,7 +164,16 @@ public int getModifiers() } /** - * This event fires when the mouse scroll wheel is used outside of a gui. + * Fired when a mouse scroll wheel is used outside of a screen and a player is loaded, before being + * processed by vanilla. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, then the mouse scroll event will not be processed further.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see the online GLFW documentation */ @Cancelable public static class MouseScrollEvent extends InputEvent @@ -132,6 +184,11 @@ public static class MouseScrollEvent extends InputEvent private final boolean leftDown; private final boolean middleDown; private final boolean rightDown; + + /** + * @hidden + * @see ForgeHooksClient#onMouseScroll(MouseHandler, double) + */ public MouseScrollEvent(double scrollDelta, boolean leftDown, boolean middleDown, boolean rightDown, double mouseX, double mouseY) { this.scrollDelta = scrollDelta; @@ -142,31 +199,49 @@ public MouseScrollEvent(double scrollDelta, boolean leftDown, boolean middleDown this.mouseY = mouseY; } + /** + * {@return the amount of change / delta of the mouse scroll} + */ public double getScrollDelta() { return this.scrollDelta; } + /** + * {@return {@code true} if the left mouse button is pressed} + */ public boolean isLeftDown() { return this.leftDown; } + /** + * {@return {@code true} if the right mouse button is pressed} + */ public boolean isRightDown() { return this.rightDown; } + /** + * {@return {@code true} if the middle mouse button is pressed} + */ public boolean isMiddleDown() { return this.middleDown; } + /** + * {@return the X position of the mouse cursor} + */ public double getMouseX() { return this.mouseX; } + /** + * {@return the Y position of the mouse cursor} + */ public double getMouseY() { return this.mouseY; @@ -174,7 +249,12 @@ public double getMouseY() } /** - * This event fires when a keyboard input is detected. + * Fired when a keyboard key input occurs, such as pressing, releasing, or repeating a key. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class KeyInputEvent extends InputEvent { @@ -182,6 +262,11 @@ public static class KeyInputEvent extends InputEvent private final int scanCode; private final int action; private final int modifiers; + + /** + * @hidden + * @see ForgeHooksClient#fireKeyInput(int, int, int, int) + */ public KeyInputEvent(int key, int scanCode, int action, int modifiers) { this.key = key; @@ -191,10 +276,11 @@ public KeyInputEvent(int key, int scanCode, int action, int modifiers) } /** - * The keyboard key that triggered this event. - * https://www.glfw.org/docs/latest/group__keys.html + * {@return the {@code GLFW} (platform-agnostic) key code} * - * @see GLFW key constants starting with "GLFW_KEY_" + * @see InputConstants input constants starting with {@code KEY_} + * @see GLFW key constants starting with {@code GLFW_KEY_} + * @see the online GLFW documentation */ public int getKey() { @@ -202,12 +288,13 @@ public int getKey() } /** - * Platform-specific scan code. - * Used for {@link InputConstants#getKey(int, int)} + * {@return the platform-specific scan code} * * The scan code is unique for every key, regardless of whether it has a key code. * Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending * on the platform but they are safe to save to disk as custom key bindings. + * + * @see InputConstants#getKey(int, int) */ public int getScanCode() { @@ -215,11 +302,11 @@ public int getScanCode() } /** - * Integer representing the key's action. + * {@return the mouse button's action} * - * @see GLFW#GLFW_PRESS - * @see GLFW#GLFW_RELEASE - * @see GLFW#GLFW_REPEAT + * @see InputConstants#PRESS + * @see InputConstants#RELEASE + * @see InputConstants#REPEAT */ public int getAction() { @@ -227,13 +314,15 @@ public int getAction() } /** - * Bit field representing the modifier keys pressed. - * https://www.glfw.org/docs/latest/group__mods.html + * {@return a bit field representing the active modifier keys} * - * @see GLFW#GLFW_MOD_SHIFT - * @see GLFW#GLFW_MOD_CONTROL - * @see GLFW#GLFW_MOD_ALT - * @see GLFW#GLFW_MOD_SUPER + * @see InputConstants#MOD_CONTROL CTRL modifier key bit + * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit + * @see GLFW#GLFW_MOD_ALT ALT modifier key bit + * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit + * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit + * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit + * @see the online GLFW documentation */ public int getModifiers() { @@ -242,11 +331,21 @@ public int getModifiers() } /** - * This event fires when one of the keybindings that by default involves clicking the mouse buttons - * is triggered. + * Fired when a keymapping that by default involves clicking the mouse buttons is triggered. + * + *

The key bindings that trigger this event are:

+ *
    + *
  • Use Item - defaults to left mouse click
  • + *
  • Pick Block - defaults to middle mouse click
  • + *
  • Attack - defaults to right mouse click
  • + *
* - * These key bindings are use item, pick block and attack keybindings. (right, middle and left mouse click) - * In the case that these key bindings are re-bound to a keyboard key the event will still be fired as normal. + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung + * according to {@link #shouldSwingHand()}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class ClickInputEvent extends InputEvent @@ -255,6 +354,11 @@ public static class ClickInputEvent extends InputEvent private final KeyMapping keyMapping; private final InteractionHand hand; private boolean handSwing = true; + + /** + * @hidden + * @see ForgeHooksClient#onClickInput(int, KeyMapping, InteractionHand) + */ public ClickInputEvent(int button, KeyMapping keyMapping, InteractionHand hand) { this.button = button; @@ -263,45 +367,62 @@ public ClickInputEvent(int button, KeyMapping keyMapping, InteractionHand hand) } /** - * Set to false to disable the hand swing animation. - * Has no effect if this is a pick block input. + * Sets whether to swing the hand. This takes effect whether or not the event is cancelled. + * + * @param value whether to swing the hand */ public void setSwingHand(boolean value) { handSwing = value; } + /** + * {@return whether to swing the hand; always takes effect, regardless of cancellation} + */ public boolean shouldSwingHand() { return handSwing; } /** - * The hand which is causing the event to get triggered. + * {@return the hand that caused the input} + * * The event will be called for both hands if this is a use item input regardless - * of if either gets canceled. - * Will always be MAIN_HAND if this is an attack or pick block input. + * of both event's cancellation. + * Will always be {@link InteractionHand#MAIN_HAND} if this is an attack or pick block input. */ public InteractionHand getHand() { return hand; } + /** + * {@return {@code true} if the mouse button is the left mouse button} + */ public boolean isAttack() { return button == 0; } + /** + * {@return {@code true} if the mouse button is the right mouse button} + */ public boolean isUseItem() { return button == 1; } + /** + * {@return {@code true} if the mouse button is the middle mouse button} + */ public boolean isPickBlock() { return button == 2; } + /** + * {@return the key mapping which triggered this event} + */ public KeyMapping getKeyMapping() { return keyMapping; diff --git a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java index 042f4328f68..52d747a9f1f 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java @@ -10,13 +10,22 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.ForgeModelBakery; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; /** * Fired when the ModelManager is notified of the resource manager reloading. * Called after model registry is setup, but before it's passed to BlockModelShapes. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

These events are fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ // TODO: try to merge with ICustomModelLoader public class ModelBakeEvent extends Event implements IModBusEvent @@ -25,6 +34,10 @@ public class ModelBakeEvent extends Event implements IModBusEvent private final Map modelRegistry; private final ForgeModelBakery modelLoader; + /** + * @hidden + * @see ForgeHooksClient#onModelBake(ModelManager, Map, ForgeModelBakery) + */ public ModelBakeEvent(ModelManager modelManager, Map modelRegistry, ForgeModelBakery modelLoader) { this.modelManager = modelManager; @@ -32,16 +45,25 @@ public ModelBakeEvent(ModelManager modelManager, Map getModelRegistry() { return modelRegistry; } + /** + * {@return the model loader} + */ public ForgeModelBakery getModelLoader() { return modelLoader; diff --git a/src/main/java/net/minecraftforge/client/event/ModelRegistryEvent.java b/src/main/java/net/minecraftforge/client/event/ModelRegistryEvent.java index 386102dac78..fe90c537375 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelRegistryEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelRegistryEvent.java @@ -8,14 +8,29 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.model.IModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; /** - * Fired when the {@link ModelLoaderRegistry} is ready to register model loaders + * Fired when the {@link ModelLoaderRegistry} is ready for model loader registrations. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

* * @see ModelLoaderRegistry#registerLoader(ResourceLocation, IModelLoader) */ public class ModelRegistryEvent extends Event implements IModBusEvent { + /** + * @hidden + * @see ModelLoaderRegistry#onModelLoadingStart() + */ + public ModelRegistryEvent() + { + } } diff --git a/src/main/java/net/minecraftforge/client/event/MovementInputUpdateEvent.java b/src/main/java/net/minecraftforge/client/event/MovementInputUpdateEvent.java index 9ec40e17a2f..7ae53c391b4 100644 --- a/src/main/java/net/minecraftforge/client/event/MovementInputUpdateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/MovementInputUpdateEvent.java @@ -7,22 +7,37 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.client.player.Input; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; /** - * This event is fired after player movement inputs are updated.
- * Handlers can freely manipulate {@link Input} to cancel movement.
+ *

Fired after the player's movement inputs are updated.

+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public class MovementInputUpdateEvent extends PlayerEvent { private final Input input; + /** + * @hidden + * @see ForgeHooksClient#onMovementInputUpdate(Player, Input) + */ public MovementInputUpdateEvent(Player player, Input input) { super(player); this.input = input; } + /** + * {@return the player's movement inputs} + */ public Input getInput() { return input; diff --git a/src/main/java/net/minecraftforge/client/event/ParticleFactoryRegisterEvent.java b/src/main/java/net/minecraftforge/client/event/ParticleFactoryRegisterEvent.java index 2f3e94ca86f..db5c8bf8b04 100644 --- a/src/main/java/net/minecraftforge/client/event/ParticleFactoryRegisterEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ParticleFactoryRegisterEvent.java @@ -8,12 +8,31 @@ import net.minecraft.client.particle.ParticleEngine; import net.minecraft.client.particle.ParticleProvider; import net.minecraft.core.particles.ParticleType; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.RegisterEvent; /** - * Fired when you should call {@link ParticleEngine#register(ParticleType, ParticleProvider)}. - * Note that your {@code ParticleType}s should still be registered during the usual registry events, this - * is only for the factories. + * Fired for registering particle providers at the appropriate time. + * + *

{@link ParticleType}s must be registered during {@link RegisterEvent} as usual; + * this event is only for the {@link ParticleProvider}s.

+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ParticleEngine#register(ParticleType, ParticleProvider) */ -public class ParticleFactoryRegisterEvent extends Event implements IModBusEvent {} +public class ParticleFactoryRegisterEvent extends Event implements IModBusEvent { + /** + * @hidden + */ + public ParticleFactoryRegisterEvent() + { + } +} diff --git a/src/main/java/net/minecraftforge/client/event/RecipesUpdatedEvent.java b/src/main/java/net/minecraftforge/client/event/RecipesUpdatedEvent.java index c67ed6a3600..5b0b29ee72c 100644 --- a/src/main/java/net/minecraftforge/client/event/RecipesUpdatedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RecipesUpdatedEvent.java @@ -6,24 +6,36 @@ package net.minecraftforge.client.event; import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Fired on {@link Dist#CLIENT} when {@link RecipeManager} has all of its recipes synced from the server to the client (just after a client has connected), + * Fired when the {@link RecipeManager} has received and synced the recipes from the server to the client. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public class RecipesUpdatedEvent extends Event { - + private final RecipeManager mgr; - + + /** + * @hidden + * @see ForgeHooksClient#onRecipesUpdated(RecipeManager) + */ public RecipesUpdatedEvent(RecipeManager mgr) { this.mgr = mgr; } /** - * @return The newly-updated recipe manager that now contains all the recipes that were just received. + * {@return the recipe manager} */ public RecipeManager getRecipeManager() { diff --git a/src/main/java/net/minecraftforge/client/event/RegisterClientCommandsEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterClientCommandsEvent.java index 03383fe66b9..85508845397 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterClientCommandsEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterClientCommandsEvent.java @@ -9,29 +9,45 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.arguments.ObjectiveArgument; import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Register commands to be executed on the client using this event. - * - * Some arguments behave differently: + * Fired to allow mods to register client commands. + * + *

Some command arguments behave differently for the client commands dispatcher:

*
    - *
  • {@link ResourceLocationArgument#getAdvancement(com.mojang.brigadier.context.CommandContext, String)} only returns advancements that are shown on the advancements screen - *
  • {@link ObjectiveArgument#getObjective(com.mojang.brigadier.context.CommandContext, String)} only returns objectives that are set to display + *
  • {@link ResourceLocationArgument#getAdvancement(com.mojang.brigadier.context.CommandContext, String)} only returns + * advancements that are shown on the advancements screen. + *
  • {@link ObjectiveArgument#getObjective(com.mojang.brigadier.context.CommandContext, String)} only returns + * objectives that are displayed to the player. *
+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see net.minecraftforge.event.RegisterCommandsEvent */ public class RegisterClientCommandsEvent extends Event { private final CommandDispatcher dispatcher; + /** + * @hidden + * @see net.minecraftforge.client.ClientCommandHandler#mergeServerCommands(CommandDispatcher) + */ public RegisterClientCommandsEvent(CommandDispatcher dispatcher) { this.dispatcher = dispatcher; } /** - * @return The command dispatcher for registering commands to be executed on the client + * {@return the command dispatcher for registering commands to be executed on the client} */ public CommandDispatcher getDispatcher() { diff --git a/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java index eaa4c8a5af8..2324cfba690 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterClientReloadListenersEvent.java @@ -5,20 +5,44 @@ package net.minecraftforge.client.event; +import net.minecraft.client.Minecraft; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ReloadableResourceManager; +import net.minecraftforge.event.AddReloadListenerEvent; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +/** + * Fired to allow mods to register their reload listeners on the client-side resource manager. + * This event is fired once during the construction of the {@link Minecraft} instance. + * + *

For registering reload listeners on the server-side resource manager, see {@link AddReloadListenerEvent}.

+ * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public class RegisterClientReloadListenersEvent extends Event implements IModBusEvent { private final ReloadableResourceManager resourceManager; + /** + * @hidden + */ public RegisterClientReloadListenersEvent(ReloadableResourceManager resourceManager) { this.resourceManager = resourceManager; } + /** + * Registers the given reload listener to the client-side resource manager. + * + * @param reloadListener the reload listener + */ public void registerReloadListener(PreparableReloadListener reloadListener) { resourceManager.registerReloadListener(reloadListener); diff --git a/src/main/java/net/minecraftforge/client/event/RegisterShadersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterShadersEvent.java index 80101893a65..9c97904d70a 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterShadersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterShadersEvent.java @@ -8,28 +8,58 @@ import com.mojang.datafixers.util.Pair; import net.minecraft.client.renderer.ShaderInstance; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import java.util.List; import java.util.function.Consumer; +/** + * Fired to allow mods to register custom {@linkplain ShaderInstance shaders}. + * This event is fired after the default Minecraft shaders have been registered. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public class RegisterShadersEvent extends Event implements IModBusEvent { private final ResourceManager resourceManager; private final List>> shaderList; + /** + * @hidden + */ public RegisterShadersEvent(ResourceManager resourceManager, List>> shaderList) { this.resourceManager = resourceManager; this.shaderList = shaderList; } + /** + * {@return the client-side resource manager} + */ public ResourceManager getResourceManager() { return resourceManager; } + /** + * Registers a shader, and a callback for when the shader is loaded. + * + *

When creating a {@link ShaderInstance}, pass in the {@linkplain #getResourceManager() + * client-side resource manager} as the resource provider.

+ * + *

Mods should not store the shader instance passed into this method. Instead, mods should store the shader + * passed into the registered load callback.

+ * + * @param shaderInstance a shader + * @param onLoaded a callback for when the shader is loaded + */ public void registerShader(ShaderInstance shaderInstance, Consumer onLoaded) { shaderList.add(Pair.of(shaderInstance, onLoaded)); diff --git a/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java b/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java index 69646ee9bfd..247fb56fd84 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderArmEvent.java @@ -7,19 +7,24 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.entity.HumanoidArm; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * This is a more targeted version of {@link RenderHandEvent} event that is fired specifically when - * a player's arm is being rendered in first person, and should be used instead if the desired - * outcome is just to replace the rendering of the arm, such as to make armor render on it or - * instead of it. + * Fired before the player's arm is rendered in first person. This is a more targeted version of {@link RenderHandEvent}, + * and can be used to replace the rendering of the player's arm, such as for rendering armor on the arm or outright + * replacing the arm with armor. * - * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS} - * Canceling the event causes the arm to not render. + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the arm will not be rendered.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public class RenderArmEvent extends Event @@ -30,6 +35,10 @@ public class RenderArmEvent extends Event private final AbstractClientPlayer player; private final HumanoidArm arm; + /** + * @hidden + * @see net.minecraftforge.client.ForgeHooksClient#renderSpecificFirstPersonArm(PoseStack, MultiBufferSource, int, AbstractClientPlayer, HumanoidArm) + */ public RenderArmEvent(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, AbstractClientPlayer player, HumanoidArm arm) { this.poseStack = poseStack; @@ -40,30 +49,42 @@ public RenderArmEvent(PoseStack poseStack, MultiBufferSource multiBufferSource, } /** - * @return The arm being rendered. + * {@return the arm being rendered} */ public HumanoidArm getArm() { return arm; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } + /** + * {@return the amount of packed (sky and block) light for rendering} + * + * @see LightTexture + */ public int getPackedLight() { return packedLight; } /** - * @return the client player that is having their arm rendered. In general this will be the same as {@link net.minecraft.client.Minecraft#player}. + * {@return the client player that is having their arm rendered} In general, this will be the same as + * {@link net.minecraft.client.Minecraft#player}. */ public AbstractClientPlayer getPlayer() { diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index 0d8d49b244e..352ec7fddde 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -10,26 +10,54 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Called when a block's texture is going to be overlaid on the player's HUD. Cancel this event to prevent the overlay. + * Fired before a block texture will be overlaid on the player's view. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the overlay will not be rendered.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public class RenderBlockOverlayEvent extends Event { - public static enum OverlayType { - FIRE, BLOCK, WATER + /** + * The type of the block overlay to be rendered. + * + * @see RenderBlockOverlayEvent + */ + public enum OverlayType { + /** + * The type of the overlay when the player is burning / on fire. + */ + FIRE, + /** + * The type of overlay when the player is suffocating inside a solid block. + */ + BLOCK, + /** + * The type of overlay when the player is underwater. + */ + WATER } - + private final Player player; private final PoseStack poseStack; private final OverlayType overlayType; private final BlockState blockState; private final BlockPos blockPos; - + + /** + * @hidden + */ public RenderBlockOverlayEvent(Player player, PoseStack poseStack, OverlayType type, BlockState block, BlockPos blockPos) { this.player = player; @@ -37,21 +65,27 @@ public RenderBlockOverlayEvent(Player player, PoseStack poseStack, OverlayType t this.overlayType = type; this.blockState = block; this.blockPos = blockPos; - + } /** - * The player which the overlay will apply to + * {@return the player which the overlay will apply to} */ public Player getPlayer() { return player; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } /** - * The type of overlay to occur + * {@return the type of the overlay} */ public OverlayType getOverlayType() { return overlayType; } /** - * If the overlay type is BLOCK, then this is the block which the overlay is getting it's icon from + * {@return the block which the overlay is gotten from} */ public BlockState getBlockState() { return blockState; } + /** + * {@return the position of the block which the overlay is gotten from} + */ public BlockPos getBlockPos() { return blockPos; } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index 43bdc9747d7..2f52c177513 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -8,122 +8,273 @@ import java.util.ArrayList; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.IIngameOverlay; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import com.mojang.blaze3d.platform.Window; import net.minecraft.client.gui.components.LerpingBossEvent; - +import net.minecraftforge.fml.LogicalSide; + +/** + * Fired when an overlay element is rendered to the game window. + * See the two subclasses for listening to before and after rendering. + * + *

An overlay that is not normally active cannot be forced to render, and this event will not fire.

+ * + * @see RenderGameOverlayEvent.Pre + * @see RenderGameOverlayEvent.Post + * @see ForgeIngameGui + */ @Cancelable public class RenderGameOverlayEvent extends Event { - public PoseStack getMatrixStack() + /** + * {@return the pose stack used for rendering} + */ + public PoseStack getPoseStack() { - return mStack; + return poseStack; } - public float getPartialTicks() + /** + * {@return the partial tick} + */ + public float getPartialTick() { - return partialTicks; + return partialTick; } - + + /** + * {@return the game window} + */ public Window getWindow() { return window; } + /** + * {@return the type of the overlay element being rendered} + */ public ElementType getType() { return type; } - public static enum ElementType + /** + * The types of the different overlay elements that can be rendered + */ + public enum ElementType { + /** + * Represents all of the overlay elements; cancelling the {@link RenderGameOverlayEvent.Pre} with this type + * will suppress rendering of all overlay elements. + */ ALL, + /** + * An in-game overlay layer. + * + * @see IIngameOverlay + * @see RenderGameOverlayEvent.PreLayer + * @see RenderGameOverlayEvent.PostLayer + */ LAYER, - BOSSINFO, // Individual boss bar + /** + * An individual boss event bar. + * + * @see RenderGameOverlayEvent.BossInfo + */ + BOSSINFO, + /** + * For adding text to be rendered on the screen (after the debug screen text, if visible). + * + * @see RenderGameOverlayEvent.Text + */ TEXT, + /** + * The chat message window overlay. + * + * @see RenderGameOverlayEvent.Chat + */ CHAT, + /** + * The player list overlay, shown when the TAB key (or other keybind) is pressed. + * + * See {@code ForgeIngameGui#renderPlayerList} + */ PLAYER_LIST, + /** + * The debug overlay. + * + * See {@code ForgeIngameGui#renderHUDText.} + */ DEBUG } - private final PoseStack mStack; - private final float partialTicks; + private final PoseStack poseStack; + private final float partialTick; private final Window window; private final ElementType type; - public RenderGameOverlayEvent(PoseStack mStack, float partialTicks, Window window) + /** + * @hidden + */ + public RenderGameOverlayEvent(PoseStack poseStack, float partialTick, Window window) { - this.mStack = mStack; - this.partialTicks = partialTicks; + this.poseStack = poseStack; + this.partialTick = partialTick; this.window = window; this.type = null; } - private RenderGameOverlayEvent(PoseStack mStack, RenderGameOverlayEvent parent, ElementType type) + /** + * @hidden + */ + private RenderGameOverlayEvent(PoseStack poseStack, RenderGameOverlayEvent parent, ElementType type) { - this.mStack = mStack; - this.partialTicks = parent.getPartialTicks(); + this.poseStack = poseStack; + this.partialTick = parent.getPartialTick(); this.window = parent.getWindow(); this.type = type; } + /** + * Fired before an active overlay element is rendered to the screen. + * See the three sub-classes for specific special overlay elements. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the overlay corresponding to this event will not be rendered, and the + * corresponding {@link RenderGameOverlayEvent.Post} event is not fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see RenderGameOverlayEvent.PreLayer + * @see RenderGameOverlayEvent.BossInfo + * @see RenderGameOverlayEvent.Text + * @see RenderGameOverlayEvent.Chat + */ public static class Pre extends RenderGameOverlayEvent { - public Pre(PoseStack mStack, RenderGameOverlayEvent parent, ElementType type) + /** + * @hidden + */ + public Pre(PoseStack poseStack, RenderGameOverlayEvent parent, ElementType type) { - super(mStack, parent, type); + super(poseStack, parent, type); } } + /** + * Fired after an active overlay element is rendered to the screen, if the corresponding + * {@link RenderGameOverlayEvent.Pre} is not cancelled. + * See the specialized {@link RenderGameOverlayEvent.PostLayer} for individual overlay layer. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class Post extends RenderGameOverlayEvent { - public Post(PoseStack mStack, RenderGameOverlayEvent parent, ElementType type) + /** + * @hidden + */ + public Post(PoseStack poseStack, RenderGameOverlayEvent parent, ElementType type) { - super(mStack, parent, type); + super(poseStack, parent, type); } @Override public boolean isCancelable(){ return false; } } + /** + * Fired before an in-game overlay layer is rendered to the screen. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the overlay layer in this event will not be rendered, and the + * corresponding {@link RenderGameOverlayEvent.PostLayer} event is not fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see RenderGameOverlayEvent.PostLayer + */ public static class PreLayer extends Pre { private final IIngameOverlay overlay; + /** + * @hidden + */ public PreLayer(PoseStack mStack, RenderGameOverlayEvent parent, IIngameOverlay overlay) { super(mStack, parent, ElementType.LAYER); this.overlay = overlay; } + /** + * {@return the in-game overlay layer being rendered} + */ public IIngameOverlay getOverlay() { return overlay; } } + /** + * Fired after an in-game overlay layer is rendered to the screen, if the corresponding + * {@link RenderGameOverlayEvent.PreLayer} is not cancelled. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class PostLayer extends Post { private final IIngameOverlay overlay; + /** + * @hidden + */ public PostLayer(PoseStack mStack, RenderGameOverlayEvent parent, IIngameOverlay overlay) { super(mStack, parent, ElementType.LAYER); this.overlay = overlay; } + /** + * {@return the in-game overlay layer being rendered} + */ public IIngameOverlay getOverlay() { return overlay; } } + /** + * Fired before a boss health bar is rendered to the screen. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the boss health bar corresponding to this event will not be rendered, and the + * corresponding {@link RenderGameOverlayEvent.Post} is not fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ElementType#BOSSINFO + */ public static class BossInfo extends Pre { private final LerpingBossEvent bossEvent; private final int x; private final int y; private int increment; + + /** + * @hidden + */ public BossInfo(PoseStack mStack, RenderGameOverlayEvent parent, ElementType type, LerpingBossEvent bossEvent, int x, int y, int increment) { super(mStack, parent, type); @@ -134,7 +285,7 @@ public BossInfo(PoseStack mStack, RenderGameOverlayEvent parent, ElementType typ } /** - * @return The {@link LerpingBossEvent} currently being rendered + * {@return the boss health bar currently being rendered} */ public LerpingBossEvent getBossEvent() { @@ -142,7 +293,7 @@ public LerpingBossEvent getBossEvent() } /** - * @return The current x position we are rendering at + * {@return the X position of the boss health bar} */ public int getX() { @@ -150,7 +301,7 @@ public int getX() } /** - * @return The current y position we are rendering at + * {@return the Y position of the boss health bar} */ public int getY() { @@ -158,7 +309,7 @@ public int getY() } /** - * @return How much to move down before rendering the next bar + * {@return the Y position increment before rendering the next boss health bar} */ public int getIncrement() { @@ -166,8 +317,9 @@ public int getIncrement() } /** - * Sets the amount to move down before rendering the next bar - * @param increment The increment to set + * Sets the Y position increment before rendering the next boss health bar. + * + * @param increment the new Y position increment */ public void setIncrement(int increment) { @@ -175,10 +327,26 @@ public void setIncrement(int increment) } } + /** + * Fired before textual information is rendered to the debug screen. + * This can be used to add or remove text information. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the text will not be rendered; this includes the debug overlay text.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ElementType#TEXT + */ public static class Text extends Pre { private final ArrayList left; private final ArrayList right; + + /** + * @hidden + */ public Text(PoseStack mStack, RenderGameOverlayEvent parent, ArrayList left, ArrayList right) { super(mStack, parent, ElementType.TEXT); @@ -186,22 +354,42 @@ public Text(PoseStack mStack, RenderGameOverlayEvent parent, ArrayList l this.right = right; } + /** + * {@return the modifiable list of text to render on the left side} + */ public ArrayList getLeft() { return left; } + /** + * {@return the modifiable list of text to render on the right side} + */ public ArrayList getRight() { return right; } } + /** + * Fired before the chat messages overlay is rendered to the screen. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the chat messages overlay will not be rendered.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ElementType#CHAT + */ public static class Chat extends Pre { private int posX; private int posY; + /** + * @hidden + */ public Chat(PoseStack mStack, RenderGameOverlayEvent parent, int posX, int posY) { super(mStack, parent, ElementType.CHAT); @@ -209,21 +397,37 @@ public Chat(PoseStack mStack, RenderGameOverlayEvent parent, int posX, int posY) this.setPosY(posY); } + /** + * {@return the X position of the chat messages overlay} + */ public int getPosX() { return posX; } + /** + * Sets the new X position for rendering the chat messages overlay + * + * @param posX the new X position + */ public void setPosX(int posX) { this.posX = posX; } + /** + * {@return the Y position of the chat messages overlay} + */ public int getPosY() { return posY; } + /** + * Sets the new Y position for rendering the chat messages overlay + * + * @param posY the new y position + */ public void setPosY(int posY) { this.posY = posY; diff --git a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java index 41cd2a44679..235316eb8fe 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java @@ -5,20 +5,27 @@ package net.minecraftforge.client.event; -import javax.annotation.Nonnull; - import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS} - * whenever a hand is rendered in first person. - * Canceling the event causes the hand to not render. + * Fired before a hand is rendered in the first person view. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the hand will not be rendered.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see RenderArmEvent */ @Cancelable public class RenderHandEvent extends Event @@ -27,53 +34,73 @@ public class RenderHandEvent extends Event private final PoseStack poseStack; private final MultiBufferSource multiBufferSource; private final int packedLight; - private final float partialTicks; + private final float partialTick; private final float interpolatedPitch; private final float swingProgress; private final float equipProgress; - @Nonnull private final ItemStack stack; + /** + * @hidden + * @see net.minecraftforge.client.ForgeHooksClient#renderSpecificFirstPersonHand(InteractionHand, PoseStack, MultiBufferSource, int, float, float, float, float, ItemStack) + */ public RenderHandEvent(InteractionHand hand, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, - float partialTicks, float interpolatedPitch, - float swingProgress, float equipProgress, @Nonnull ItemStack stack) + float partialTick, float interpolatedPitch, + float swingProgress, float equipProgress, ItemStack stack) { this.hand = hand; this.poseStack = poseStack; this.multiBufferSource = multiBufferSource; this.packedLight = packedLight; - this.partialTicks = partialTicks; + this.partialTick = partialTick; this.interpolatedPitch = interpolatedPitch; this.swingProgress = swingProgress; this.equipProgress = equipProgress; this.stack = stack; } + /** + * {@return the hand being rendered} + */ public InteractionHand getHand() { return hand; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } + /** + * {@return the amount of packed (sky and block) light for rendering} + * + * @see LightTexture + */ public int getPackedLight() { return packedLight; } - public float getPartialTicks() + /** + * {@return the partial tick} + */ + public float getPartialTick() { - return partialTicks; + return partialTick; } /** - * @return The interpolated pitch of the player entity + * {@return the interpolated pitch of the player entity} */ public float getInterpolatedPitch() { @@ -81,7 +108,7 @@ public float getInterpolatedPitch() } /** - * @return The swing progress of the hand being rendered + * {@return the swing progress of the hand being rendered} */ public float getSwingProgress() { @@ -89,7 +116,7 @@ public float getSwingProgress() } /** - * @return The progress of the equip animation. 1.0 is fully equipped. + * {@return the progress of the equip animation, from {@code 0.0} to {@code 1.0}} */ public float getEquipProgress() { @@ -97,9 +124,8 @@ public float getEquipProgress() } /** - * @return The ItemStack to be rendered + * {@return the item stack to be rendered} */ - @Nonnull public ItemStack getItemStack() { return stack; diff --git a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java index 3eb05bc209b..e09bf39709c 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java @@ -6,31 +6,43 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.ItemFrameRenderer; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nonnull; +import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.NotNull; /** - * This event is called when an item is rendered in an item frame. + * Fired before an item stack is rendered in an item frame. + * This can be used to prevent normal rendering or add custom rendering. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, then the item stack will not be rendered

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

* - * You can set canceled to do no further vanilla processing. + * @see ItemFrameRenderer */ @Cancelable public class RenderItemInFrameEvent extends Event { private final ItemStack itemStack; private final ItemFrame itemFrameEntity; - private final ItemFrameRenderer renderer; + private final ItemFrameRenderer renderer; private final PoseStack poseStack; private final MultiBufferSource multiBufferSource; private final int packedLight; - public RenderItemInFrameEvent(ItemFrame itemFrame, ItemFrameRenderer renderItemFrame, PoseStack poseStack, + /** + * @hidden + */ + public RenderItemInFrameEvent(ItemFrame itemFrame, ItemFrameRenderer renderItemFrame, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { itemStack = itemFrame.getItem(); @@ -41,30 +53,49 @@ public RenderItemInFrameEvent(ItemFrame itemFrame, ItemFrameRenderer renderItemF this.packedLight = packedLight; } - @Nonnull + /** + * {@return the item stack being rendered} + */ public ItemStack getItemStack() { return itemStack; } + /** + * {@return the item frame entity} + */ public ItemFrame getItemFrameEntity() { return itemFrameEntity; } - public ItemFrameRenderer getRenderer() + /** + * {@return the renderer for the item frame entity} + */ + public ItemFrameRenderer getRenderer() { return renderer; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } + /** + * {@return the amount of packed (sky and block) light for rendering} + * + * @see LightTexture + */ public int getPackedLight() { return packedLight; } diff --git a/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java index 7ac43201329..f9a7ac680d8 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java @@ -7,9 +7,26 @@ import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; import com.mojang.math.Matrix4f; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired after all level rendering. + * This can be used for custom rendering outside of e.g. a block entity or entity renderer. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see GameRenderer + * @see LevelRenderer + */ public class RenderLevelLastEvent extends net.minecraftforge.eventbus.api.Event { private final LevelRenderer levelRenderer; @@ -18,6 +35,10 @@ public class RenderLevelLastEvent extends net.minecraftforge.eventbus.api.Event private final Matrix4f projectionMatrix; private final long startNanos; + /** + * @hidden + * @see ForgeHooksClient#dispatchRenderLast(LevelRenderer, PoseStack, float, Matrix4f, long) + */ public RenderLevelLastEvent(LevelRenderer levelRenderer, PoseStack poseStack, float partialTick, Matrix4f projectionMatrix, long startNanos) { this.levelRenderer = levelRenderer; @@ -27,26 +48,41 @@ public RenderLevelLastEvent(LevelRenderer levelRenderer, PoseStack poseStack, fl this.startNanos = startNanos; } + /** + * {@return the level renderer} + */ public LevelRenderer getLevelRenderer() { return levelRenderer; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the partial tick} + */ public float getPartialTick() { return partialTick; } + /** + * {@return the projection matrix} + */ public Matrix4f getProjectionMatrix() { return projectionMatrix; } + /** + * {@return the time when rendering started, in nanoseconds} + */ public long getStartNanos() { return startNanos; diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index c4f81180b19..a4feb85f0ba 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -6,13 +6,31 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.model.EntityModel; import net.minecraft.world.entity.LivingEntity; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired when a {@link LivingEntity} is rendered. + * See the two subclasses to listen for before and after rendering. + * + *

Despite this event's use of generic type parameters, this is not a {@link net.minecraftforge.eventbus.api.GenericEvent}, + * and should not be treated as such (such as using generic-specific listeners, which may cause a {@link ClassCastException}).

+ * + * @param the living entity that is being rendered + * @param the model for the living entity + * + * @see RenderLivingEvent.Pre + * @see RenderLivingEvent.Post + * @see RenderPlayerEvent + * @see LivingEntityRenderer + */ public abstract class RenderLivingEvent> extends Event { @@ -23,6 +41,9 @@ public abstract class RenderLivingEvent renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { @@ -34,23 +55,74 @@ public RenderLivingEvent(LivingEntity entity, LivingEntityRenderer rendere this.packedLight = packedLight; } + /** + * @return the living entity being rendered + */ public LivingEntity getEntity() { return entity; } + /** + * @return the renderer for the living entity + */ public LivingEntityRenderer getRenderer() { return renderer; } + /** + * {@return the partial tick} + */ public float getPartialTick() { return partialTick; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } + /** + * {@return the amount of packed (sky and block) light for rendering} + * + * @see LightTexture + */ public int getPackedLight() { return packedLight; } + /** + * Fired before an entity is rendered. + * This can be used to render additional effects or suppress rendering. + * + *

This event is {@linkplain Cancelable cancelable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the entity will not be rendered and the corresponding + * {@link RenderLivingEvent.Post} will not be fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @param the living entity that is being rendered + * @param the model for the living entity + */ @Cancelable public static class Pre> extends RenderLivingEvent { + /** + * @hidden + */ public Pre(LivingEntity entity, LivingEntityRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight); } } + /** + * Fired after an entity is rendered, if the corresponding {@link RenderLivingEvent.Post} is not cancelled. + * + *

This event is not {@linkplain Cancelable cancelable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @param the living entity that was rendered + * @param the model for the living entity + */ public static class Post> extends RenderLivingEvent { + /** + * @hidden + */ public Post(LivingEntity entity, LivingEntityRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(entity, renderer, partialTick, poseStack, multiBufferSource, packedLight); } diff --git a/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java b/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java index b62a6ea2537..6ef07b3216d 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderNameplateEvent.java @@ -12,29 +12,25 @@ import net.minecraft.network.chat.Component; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * RenderNameplateEvent is fired whenever the entity renderer attempts to render a name plate/tag of an entity. - *
- * {@link #nameplateContent} contains the content being rendered on the name plate/tag. This can be changed by mods.
- * {@link #originalContent} contains the original content being rendered on the name plate/tag. This cannot be - * changed by mods.
- * {@link #entityRenderer} contains the entity renderer instance that renders the name plate/tag. This cannot be - * changed by mods.
- * {@link #poseStack} contains the matrix stack instance involved in rendering the name plate/tag. This cannot - * be changed by mods.
- * {@link #multiBufferSource} contains the render type buffer instance involved in rendering the name plate/tag. - * This cannot be changed by mods.
- * {@link #packedLight} contains the sky and block light values used in rendering the name plate/tag.
- * {@link #partialTick} contains the partial ticks used in rendering the name plate/tag. This cannot be changed by mods.
- *
- * This event has a result. {@link HasResult}.
- * ALLOW will force-render name plate/tag, DEFAULT will ignore the hook and continue using the vanilla check - * and DENY will prevent name plate/tag from rendering
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. - **/ + * Fired before an entity renderer renders the nameplate of an entity. + * + *

This event is not {@linkplain Cancelable cancellable}, and {@linkplain HasResult has a result}.

+ *
    + *
  • {@link Result#ALLOW} - the nameplate will be forcibly rendered.
  • + *
  • {@link Result#DEFAULT} - the vanilla logic will be used.
  • + *
  • {@link Result#DENY} - the nameplate will not be rendered.
  • + *
+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see EntityRenderer + */ @Event.HasResult public class RenderNameplateEvent extends EntityEvent { @@ -46,7 +42,10 @@ public class RenderNameplateEvent extends EntityEvent private final MultiBufferSource multiBufferSource; private final int packedLight; private final float partialTick; - + + /** + * @hidden + */ public RenderNameplateEvent(Entity entity, Component content, EntityRenderer entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick) { super(entity); @@ -60,7 +59,9 @@ public RenderNameplateEvent(Entity entity, Component content, EntityRenderer } /** - * Sets the content that is to be rendered on the name plate/tag + * Sets the new text on the nameplate. + * + * @param contents the new text */ public void setContent(Component contents) { @@ -68,7 +69,7 @@ public void setContent(Component contents) } /** - * The content being rendered on the name plate/tag + * {@return the text on the nameplate that will be rendered, if the event is not {@link Result#DENY DENIED}} */ public Component getContent() { @@ -76,7 +77,7 @@ public Component getContent() } /** - * The original content being rendered on the name plate/tag + * {@return the original text on the nameplate} */ public Component getOriginalContent() { @@ -84,7 +85,7 @@ public Component getOriginalContent() } /** - * The entity renderer that renders the name plate/tag, if it was provided + * {@return the entity renderer rendering the nameplate} */ public EntityRenderer getEntityRenderer() { @@ -92,7 +93,7 @@ public EntityRenderer getEntityRenderer() } /** - * The matrix stack used during the rendering of the name plate/tag + * {@return the pose stack used for rendering} */ public PoseStack getPoseStack() { @@ -100,7 +101,7 @@ public PoseStack getPoseStack() } /** - * The render type buffer used during the rendering of the name plate/tag + * {@return the source of rendering buffers} */ public MultiBufferSource getMultiBufferSource() { @@ -108,15 +109,17 @@ public MultiBufferSource getMultiBufferSource() } /** - * The packed values of sky and block light used during the rendering of the name plate/tag + * {@return the amount of packed (sky and block) light for rendering} + * + * @see net.minecraft.client.renderer.LightTexture */ public int getPackedLight() { return this.packedLight; } - + /** - * The partial ticks used during the rendering of the name plate/tag + * {@return the partial tick} */ public float getPartialTick() { diff --git a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java index cf258667a2a..25268034241 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java @@ -6,12 +6,23 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.world.entity.player.Player; import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired when a player is being rendered. + * See the two subclasses for listening for before and after rendering. + * + * @see RenderPlayerEvent.Pre + * @see RenderPlayerEvent.Post + * @see PlayerRenderer + */ public abstract class RenderPlayerEvent extends PlayerEvent { private final PlayerRenderer renderer; @@ -20,6 +31,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent private final MultiBufferSource multiBufferSource; private final int packedLight; + /** + * @hidden + */ public RenderPlayerEvent(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(player); @@ -30,22 +44,64 @@ public RenderPlayerEvent(Player player, PlayerRenderer renderer, float partialTi this.packedLight = packedLight; } + /** + * {@return the player entity renderer} + */ public PlayerRenderer getRenderer() { return renderer; } + /** + * {@return the partial tick} + */ public float getPartialTick() { return partialTick; } + /** + * {@return the pose stack used for rendering} + */ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the source of rendering buffers} + */ public MultiBufferSource getMultiBufferSource() { return multiBufferSource; } + /** + * {@return the amount of packed (sky and block) light for rendering} + * + * @see LightTexture + */ public int getPackedLight() { return packedLight; } + /** + * Fired before the player is rendered. + * This can be used for rendering additional effects or suppressing rendering. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the player will not be rendered and the corresponding + * {@link RenderPlayerEvent.Post} will not be fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ @Cancelable public static class Pre extends RenderPlayerEvent { + /** + * @hidden + */ public Pre(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight); } } + /** + * Fired after the player is rendered, if the corresponding {@link RenderPlayerEvent.Pre} is not cancelled. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ public static class Post extends RenderPlayerEvent { + /** + * @hidden + */ public Post(Player player, PlayerRenderer renderer, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) { super(player, renderer, partialTick, poseStack, multiBufferSource, packedLight); } diff --git a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java index b830626c828..e4a8e357d36 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java @@ -8,8 +8,6 @@ import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Either; import net.minecraft.client.gui.Font; @@ -17,24 +15,24 @@ import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.FormattedText; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.NotNull; /** - * A set of events which are fired at various points during tooltip rendering. - *

- * Can be used to change the rendering parameters, draw something extra, etc. - *

- * Do not use this event directly, use one of the subclasses: - *

    - *
  • {@link RenderTooltipEvent.Pre}
  • - *
  • {@link RenderTooltipEvent.GatherComponents}
  • - *
  • {@link RenderTooltipEvent.Color}
  • - *
+ * Fired during tooltip rendering. + * See the various subclasses for listening to specific events. + * + * @see RenderTooltipEvent.GatherComponents + * @see RenderTooltipEvent.Pre + * @see RenderTooltipEvent.Color */ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api.Event { - @Nonnull + @NotNull protected final ItemStack itemStack; protected final PoseStack poseStack; protected int x; @@ -43,7 +41,10 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api protected final List components; - public RenderTooltipEvent(@Nonnull ItemStack itemStack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List components) + /** + * @hidden + */ + public RenderTooltipEvent(@NotNull ItemStack itemStack, PoseStack poseStack, int x, int y, @NotNull Font font, @NotNull List components) { this.itemStack = itemStack; this.poseStack = poseStack; @@ -54,9 +55,10 @@ public RenderTooltipEvent(@Nonnull ItemStack itemStack, PoseStack poseStack, int } /** - * @return The stack which the tooltip is being rendered for. As tooltips can be drawn without itemstacks, this stack may be empty. + * {@return the item stack which the tooltip is being rendered for, or an {@linkplain ItemStack#isEmpty() empty + * item stack} if there is no associated item stack} */ - @Nonnull + @NotNull public ItemStack getItemStack() { return itemStack; @@ -64,23 +66,23 @@ public ItemStack getItemStack() /** - * @return The PoseStack rendering context. + * {@return the pose stack used for rendering} */ public PoseStack getPoseStack() { return poseStack; } /** - * The components to be drawn. - * To modify this list use {@link GatherComponents}. - * @return an unmodifiable list of tooltip components to be drawn. + * {@return the unmodifiable list of tooltip components} + * + *

Use {@link ItemTooltipEvent} or {@link GatherComponents} to modify tooltip contents or components.

*/ - @Nonnull + @NotNull public List getComponents() { return components; } /** - * @return The X position of the tooltip box. By default, the mouse X position. + *{@return the X position of the tooltip box} By default, this is the mouse X position. */ public int getX() { @@ -88,27 +90,32 @@ public int getX() } /** - * @return The Y position of the tooltip box. By default, the mouse Y position. + * {@return the Y position of the tooltip box} By default, this is the mouse Y position. */ public int getY() { return y; } - + /** - * @return The {@link Font} instance the current render is using. + * {@return The font used to render the text} */ - @Nonnull + @NotNull public Font getFont() { return font; } /** - * Fires when a tooltip gathers the {@link TooltipComponent}s to render. This event fires before any text wrapping - * or text processing. - * This event allows modifying the components to be rendered as well as specifying a maximum width for the tooltip. - * The maximum width will cause any text components to be wrapped. + * Fired when a tooltip gathers the {@link TooltipComponent}s to be rendered, before any text wrapping or processing. + * The list of components and the maximum width of the tooltip can be modified through this event. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the list of components will be empty, causing the tooltip to not be rendered and + * the corresponding {@link RenderTooltipEvent.Pre} and {@link RenderTooltipEvent.Color} to not be fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class GatherComponents extends Event @@ -119,6 +126,9 @@ public static class GatherComponents extends Event private final List> tooltipElements; private int maxWidth; + /** + * @hidden + */ public GatherComponents(ItemStack itemStack, int screenWidth, int screenHeight, List> tooltipElements, int maxWidth) { this.itemStack = itemStack; @@ -129,7 +139,8 @@ public GatherComponents(ItemStack itemStack, int screenWidth, int screenHeight, } /** - * @return the ItemStack whose tooltip is being rendered or an empty stack if this tooltip is not for a stack + * {@return the item stack which the tooltip is being rendered for, or an {@linkplain ItemStack#isEmpty() empty + * item stack} if there is no associated item stack} */ public ItemStack getItemStack() { @@ -137,7 +148,9 @@ public ItemStack getItemStack() } /** - * @return the width of the screen + * {@return the width of the screen}. + * The lines of text within the tooltip are wrapped to be within the screen width, and the tooltip box itself + * is moved to be within the screen width. */ public int getScreenWidth() { @@ -145,7 +158,8 @@ public int getScreenWidth() } /** - * @return the height of the screen + * {@return the height of the screen} + * The tooltip box is moved to be within the screen height. */ public int getScreenHeight() { @@ -153,8 +167,8 @@ public int getScreenHeight() } /** - * The elements to be rendered. These can be either formatted text or custom tooltip components. - * This list is modifiable. + * {@return the modifiable list of elements to be rendered on the tooltip} These elements can be either + * formatted text or custom tooltip components. */ public List> getTooltipElements() { @@ -162,7 +176,10 @@ public List> getTooltipElements() } /** - * @return the current maximum width for the text components of the tooltip (or -1 for no maximum width) + * {@return the maximum width of the tooltip when being rendered} + * + *

A value of {@code -1} means an unlimited maximum width. However, an unlimited maximum width will still + * be wrapped to be within the screen bounds.

*/ public int getMaxWidth() { @@ -170,7 +187,9 @@ public int getMaxWidth() } /** - * Set the maximum width for the text components of the tooltip (or -1 for no maximum width) + * Sets the maximum width of the tooltip. Use {@code -1} for unlimited maximum width. + * + * @param maxWidth the new maximum width */ public void setMaxWidth(int maxWidth) { @@ -179,43 +198,65 @@ public void setMaxWidth(int maxWidth) } /** - * This event is fired before any tooltip calculations are done. It provides setters for all aspects of the tooltip, so the final render can be modified. - *

- * This event is {@link Cancelable}. + * Fired before the tooltip is rendered. + * This can be used to modify the positioning and font of the tooltip. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the tooltip will not be rendered and the corresponding + * {@link RenderTooltipEvent.Color} will not be fired.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class Pre extends RenderTooltipEvent { - private int screenWidth; - private int screenHeight; + private final int screenWidth; + private final int screenHeight; - public Pre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull Font font, @Nonnull List components) + /** + * @hidden + */ + public Pre(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @NotNull Font font, @NotNull List components) { super(stack, poseStack, x, y, font, components); this.screenWidth = screenWidth; this.screenHeight = screenHeight; } + /** + * {@return the width of the screen}. + * The lines of text within the tooltip are wrapped to be within the screen width, and the tooltip box itself + * is moved to be within the screen width. + */ public int getScreenWidth() { return screenWidth; } + /** + * {@return the height of the screen} + * The tooltip box is moved to be within the screen height. + */ public int getScreenHeight() { return screenHeight; } /** - * Sets the {@link Font} to be used to render text. + * Sets the font to be used to render text. + * + * @param fr the new font */ - public void setFont(@Nonnull Font fr) + public void setFont(@NotNull Font fr) { this.font = fr; } /** - * Set the X origin of the tooltip. + * Sets the X origin of the tooltip. + * + * @param x the new X origin */ public void setX(int x) { @@ -223,7 +264,9 @@ public void setX(int x) } /** - * Set the Y origin of the tooltip. + * Sets the Y origin of the tooltip. + * + * @param y the new Y origin */ public void setY(int y) { @@ -232,7 +275,13 @@ public void setY(int y) } /** - * This event is fired when the colours for the tooltip background are determined. + * Fired when the colours for the tooltip background are determined. + * This can be used to modify the background color and the border's gradient colors. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class Color extends RenderTooltipEvent { @@ -244,7 +293,10 @@ public static class Color extends RenderTooltipEvent private int borderStart; private int borderEnd; - public Color(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font fr, int background, int borderStart, int borderEnd, @Nonnull List components) + /** + * @hidden + */ + public Color(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, @NotNull Font fr, int background, int borderStart, int borderEnd, @NotNull List components) { super(stack, poseStack, x, y, fr, components); this.originalBackground = background; @@ -256,67 +308,118 @@ public Color(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnu this.borderEnd = borderEnd; } + /** + * {@return the gradient start color for the tooltip background} + */ public int getBackgroundStart() { return backgroundStart; } + /** + * {@return the gradient end color for the tooltip background} + */ public int getBackgroundEnd() { return backgroundEnd; } + + /** + * Sets the new color for the tooltip background. This sets both the gradient start and end color for the + * background to this color. + * + * @param background the new color for the tooltip background + */ public void setBackground(int background) { this.backgroundStart = background; this.backgroundEnd = background; } + /** + * Sets the new start color for the gradient of the tooltip background. + * + * @param backgroundStart the new start color for the tooltip background + */ public void setBackgroundStart(int backgroundStart) { this.backgroundStart = backgroundStart; } + /** + * Sets the new end color for the gradient of the tooltip background. + * + * @param backgroundEnd the new end color for the tooltip background + */ public void setBackgroundEnd(int backgroundEnd) { this.backgroundEnd = backgroundEnd; } + /** + * {@return the gradient start color for the tooltip border} + */ public int getBorderStart() { return borderStart; } + /** + * Sets the new start color for the gradient of the tooltip border. + * + * @param borderStart the new start color for the tooltip border + */ public void setBorderStart(int borderStart) { this.borderStart = borderStart; } + /** + * {@return the gradient end color for the tooltip border} + */ public int getBorderEnd() { return borderEnd; } + /** + * Sets the new end color for the gradient of the tooltip border. + * + * @param borderEnd the new end color for the tooltip border + */ public void setBorderEnd(int borderEnd) { this.borderEnd = borderEnd; } + /** + * {@return the original tooltip background's gradient start color} + */ public int getOriginalBackgroundStart() { return originalBackground; } + /** + * {@return the original tooltip background's gradient end color} + */ public int getOriginalBackgroundEnd() { return originalBackground; } + /** + * {@return the original tooltip border's gradient start color} + */ public int getOriginalBorderStart() { return originalBorderStart; } + /** + * {@return the original tooltip border's gradient end color} + */ public int getOriginalBorderEnd() { return originalBorderEnd; diff --git a/src/main/java/net/minecraftforge/client/event/ScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenEvent.java index 6e6ccffc507..d6b7c55910b 100644 --- a/src/main/java/net/minecraftforge/client/event/ScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ScreenEvent.java @@ -10,14 +10,16 @@ import java.util.Objects; import java.util.function.Consumer; +import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.Minecraft; +import net.minecraft.client.MouseHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraft.client.gui.screens.Screen; +import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; @@ -25,35 +27,60 @@ import org.lwjgl.glfw.GLFW; /** - * Event classes for GuiScreen events. + * Fired on different events/actions when a {@link Screen} is active and visible. + * See the various subclasses for listening to different events. * - * @author bspkrs + *

These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see ScreenEvent.InitScreenEvent + * @see ScreenEvent.DrawScreenEvent + * @see ScreenEvent.BackgroundDrawnEvent + * @see ScreenEvent.MouseInputEvent + * @see ScreenEvent.KeyboardKeyEvent */ @OnlyIn(Dist.CLIENT) public class ScreenEvent extends Event { private final Screen screen; + /** + * @hidden + */ public ScreenEvent(Screen screen) { this.screen = Objects.requireNonNull(screen); } /** - * The GuiScreen object generating this event. + * {@return the screen that caused this event} */ public Screen getScreen() { return screen; } + /** + * Fired when a screen is being initialized. + * See the two subclasses for listening before and after the initialization. + * + *

Listeners added through this event may also be marked as renderable or narratable, if they inherit from + * {@link net.minecraft.client.gui.components.Widget} and {@link net.minecraft.client.gui.narration.NarratableEntry} + * respectively.

+ * + * @see InitScreenEvent.Pre + * @see InitScreenEvent.Post + */ public static class InitScreenEvent extends ScreenEvent { - private Consumer add; - private Consumer remove; + private final Consumer add; + private final Consumer remove; - private List listenerList; + private final List listenerList; + /** + * @hidden + */ public InitScreenEvent(Screen screen, List listenerList, Consumer add, Consumer remove) { super(screen); @@ -61,37 +88,50 @@ public InitScreenEvent(Screen screen, List listenerList, Consu this.add = add; this.remove = remove; } - /** - * Unmodifiable reference to the list of buttons on the {@link #screen}. + * {@return unmodifiable view of list of event listeners on the screen} */ public List getListenersList() { return listenerList; } - public void addListener(GuiEventListener button) + /** + * Adds the given {@link GuiEventListener} to the screen. + * + * @param listener the listener to add + */ + public void addListener(GuiEventListener listener) { - add.accept(button); + add.accept(listener); } - public void removeListener(GuiEventListener button) + /** + * Removes the given {@link GuiEventListener} from the screen. + * + * @param listener the listener to remove + */ + public void removeListener(GuiEventListener listener) { - remove.accept(button); + remove.accept(listener); } /** - * This event fires just after initializing the {@link Minecraft}, font renderer, width, - * and height fields.

+ * Fired before the screen's overridable initialization method is fired. * - * If canceled the following lines are skipped in {@link Screen#init(Minecraft, int, int)}:
- * {@code this.buttonList.clear();}
- * {@code this.children.clear();}
- * {@code this.initGui();}
+ *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the initialization method will not be called, and the widgets and children lists + * will not be cleared.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class Pre extends InitScreenEvent { + /** + * @hidden + */ public Pre(Screen screen, List list, Consumer add, Consumer remove) { super(screen, list, add, remove); @@ -99,11 +139,18 @@ public Pre(Screen screen, List list, Consumerafter the screen's overridable initialization method is called. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class Post extends InitScreenEvent { + /** + * @hidden + */ public Post(Screen screen, List list, Consumer add, Consumer remove) { super(screen, list, add, remove); @@ -111,24 +158,35 @@ public Post(Screen screen, List list, Consumerbefore the screen is drawn. + * + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen will not be drawn.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ @Cancelable public static class Pre extends DrawScreenEvent { + /** + * @hidden + */ public Pre(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) { super(screen, poseStack, mouseX, mouseY, partialTick); @@ -173,10 +239,18 @@ public Pre(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float par } /** - * This event fires just after {@link Screen#render(PoseStack, int, int, float)} is called. + * Fired after the screen is drawn. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class Post extends DrawScreenEvent { + /** + * @hidden + */ public Post(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) { super(screen, poseStack, mouseX, mouseY, partialTick); @@ -185,13 +259,21 @@ public Post(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float pa } /** - * This event fires at the end of {@link Screen#renderBackground(PoseStack, int)} and before the rest of the Gui draws. - * This allows drawing next to Guis, above the background but below any tooltips. + * Fired directly after the background of the screen is drawn. + * Can be used for drawing above the background but below the tooltips. + * + *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

*/ public static class BackgroundDrawnEvent extends ScreenEvent { private final PoseStack poseStack; + /** + * @hidden + */ public BackgroundDrawnEvent(Screen screen, PoseStack poseStack) { super(screen); @@ -199,7 +281,7 @@ public BackgroundDrawnEvent(Screen screen, PoseStack poseStack) } /** - * The PoseStack to render with. + * {@return the pose stack used for rendering} */ public PoseStack getPoseStack() { @@ -207,30 +289,11 @@ public PoseStack getPoseStack() } } - /** - * This event fires in {@link EffectRenderingInventoryScreen} in the - * {@code checkEffectRendering} method when potion effects are active and the gui wants to move over. - * Cancel this event to prevent the Gui from being moved. - * - * @deprecated This event was made redundant by the removal of the screen shifting due to potion indicators in the - * inventory screen (along with being moved to the right hand side). This has been changed to have no effect, and - * will be removed in 1.19. See {@link PotionSizeEvent} as a possible alternative instead. - */ - @Deprecated(forRemoval = true, since = "1.18.1") - @Cancelable - public static class PotionShiftEvent extends ScreenEvent - { - public PotionShiftEvent(Screen screen) - { - super(screen); - } - } - /** * Fired to determine whether to render the potion indicators in the {@link EffectRenderingInventoryScreen inventory * screen} in compact or classic mode. * - *

This event is not {@linkplain Cancelable cancelable} and {@linkplain HasResult has a result}.

+ *

This event is not {@linkplain Cancelable cancellable} and {@linkplain HasResult has a result}.

*
    *
  • {@link Result#ALLOW} - forcibly renders the potion indicators in compact mode.
  • *
  • {@link Result#DEFAULT} - defaults to vanilla behavior to using compact mode if the the screen width is too @@ -253,11 +316,23 @@ public PotionSizeEvent(Screen screen) } } + /** + * Fired whenever an action is performed by the mouse. + * See the various subclasses to listen for different actions. + * + * @see ScreenEvent.MouseClickedEvent + * @see ScreenEvent.MouseReleasedEvent + * @see ScreenEvent.MouseDragEvent + * @see ScreenEvent.MouseScrollEvent + */ public static abstract class MouseInputEvent extends ScreenEvent { private final double mouseX; private final double mouseY; + /** + * @hidden + */ public MouseInputEvent(Screen screen, double mouseX, double mouseY) { super(screen); @@ -265,39 +340,71 @@ public MouseInputEvent(Screen screen, double mouseX, double mouseY) this.mouseY = mouseY; } + /** + * {@return the X position of the mouse cursor, relative to the screen} + */ public double getMouseX() { return mouseX; } + /** + * {@return the Y position of the mouse cursor, relative to the screen} + */ public double getMouseY() { return mouseY; } } + /** + * Fired when a mouse button is clicked. + * See the two subclasses for listening before and after the normal handling. + * + * @see MouseClickedEvent.Pre + * @see MouseClickedEvent.Post + */ public static abstract class MouseClickedEvent extends MouseInputEvent { private final int button; + /** + * @hidden + */ public MouseClickedEvent(Screen screen, double mouseX, double mouseY, int button) { super(screen, mouseX, mouseY); this.button = button; } + /** + * {@return the mouse button's input code} + * + * @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_' + * @see the online GLFW documentation + */ public int getButton() { return button; } /** - * This event fires when a mouse click is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#mouseClicked(double, double, int)}. + * Fired before the mouse click is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's mouse click handler will be bypassed + * and the corresponding {@link MouseClickedEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends MouseClickedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseClickedPre(Screen, double, double, int) + */ public Pre(Screen screen, double mouseX, double mouseY, int button) { super(screen, mouseX, mouseY, button); @@ -305,24 +412,29 @@ public Pre(Screen screen, double mouseX, double mouseY, int button) } /** - * This event fires after {@link GuiEventListener#mouseClicked(double, double, int)}. + * Fired after the mouse click is handled, if the corresponding {@link MouseClickedEvent.Pre} was not + * cancelled. * - *

    This event {@linkplain HasResult has a result}.
    + *

    This event is not {@linkplain Cancelable cancellable}, {@linkplain HasResult has a result}.

    *
      - *
    • {@link Result#ALLOW} - to force set the mouse click as handled
    • - *
    • {@link Result#DEFAULT} - to use the default value of {@link #handled}
    • - *
    • {@link Result#DENY} - to force set the mouse click as not handled
    • + *
    • {@link Result#ALLOW} - forcibly sets the mouse click as handled
    • + *
    • {@link Result#DEFAULT} - defaults to the return value of + * {@link Screen#mouseClicked(double, double, int)} from the screen (see {@link #wasHandled()}.
    • + *
    • {@link Result#DENY} - forcibly sets the mouse click as not handled.
    • *
    - *

    * - *

    Note that this event is currently pre-cancelled if {@link Screen#mouseClicked} returns {@code true} - * to retain old behavior. This will be changed in 1.18 when the event is made non-cancellable.

    + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @HasResult public static class Post extends MouseClickedEvent { private final boolean handled; + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseClickedPost(Screen, double, double, int, boolean) + */ public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) { super(screen, mouseX, mouseY, button); @@ -330,7 +442,7 @@ public Post(Screen screen, double mouseX, double mouseY, int button, boolean han } /** - * @return {@code true} if the mouse click was already handled by its screen + * {@return {@code true} if the mouse click was already handled by its screen} */ public boolean wasHandled() { @@ -339,28 +451,54 @@ public boolean wasHandled() } } + /** + * Fired when a mouse button is released. + * See the two subclasses for listening before and after the normal handling. + * + * @see MouseReleasedEvent.Pre + * @see MouseReleasedEvent.Post + */ public static abstract class MouseReleasedEvent extends MouseInputEvent { private final int button; + /** + * @hidden + */ public MouseReleasedEvent(Screen screen, double mouseX, double mouseY, int button) { super(screen, mouseX, mouseY); this.button = button; } + /** + * {@return the mouse button's input code} + * + * @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_' + * @see the online GLFW documentation + */ public int getButton() { return button; } /** - * This event fires when a mouse release is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#mouseReleased(double, double, int)}. + * Fired before the mouse release is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's mouse release handler will be bypassed + * and the corresponding {@link MouseReleasedEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends MouseReleasedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseReleasedPre(Screen, double, double, int) + */ public Pre(Screen screen, double mouseX, double mouseY, int button) { super(screen, mouseX, mouseY, button); @@ -368,22 +506,29 @@ public Pre(Screen screen, double mouseX, double mouseY, int button) } /** - * This event fires after {@link GuiEventListener#mouseReleased(double, double, int)}. + * Fired after the mouse release is handled, if the corresponding {@link MouseReleasedEvent.Pre} was + * not cancelled. * - *

    This event {@linkplain HasResult has a result}.
    + *

    This event is not {@linkplain Cancelable cancellable}, {@linkplain HasResult has a result}.

    *
      - *
    • {@link Result#ALLOW} - to force set the mouse release as handled
    • - *
    • {@link Result#DEFAULT} - to use the default value of {@link #handled}
    • - *
    • {@link Result#DENY} - to force set the mouse release as not handled
    • + *
    • {@link Result#ALLOW} - forcibly sets the mouse release as handled
    • + *
    • {@link Result#DEFAULT} - defaults to the return value of + * {@link Screen#mouseReleased(double, double, int)} from the screen (see {@link #wasHandled()}.
    • + *
    • {@link Result#DENY} - forcibly sets the mouse release as not handled.
    • *
    - *

    * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @HasResult public static class Post extends MouseReleasedEvent { private final boolean handled; + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseReleasedPost(Screen, double, double, int, boolean) + */ public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) { super(screen, mouseX, mouseY, button); @@ -400,12 +545,22 @@ public boolean wasHandled() } } + /** + * Fired when the mouse was dragged while a button is being held down. + * See the two subclasses for listening before and after the normal handling. + * + * @see MouseDragEvent.Pre + * @see MouseDragEvent.Post + */ public static abstract class MouseDragEvent extends MouseInputEvent { private final int mouseButton; private final double dragX; private final double dragY; + /** + * @hidden + */ public MouseDragEvent(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) { super(screen, mouseX, mouseY); @@ -414,28 +569,50 @@ public MouseDragEvent(Screen screen, double mouseX, double mouseY, int mouseButt this.dragY = dragY; } + /** + * {@return the mouse button's input code} + * + * @see GLFW mouse constants starting with 'GLFW_MOUSE_BUTTON_' + * @see the online GLFW documentation + */ public int getMouseButton() { return mouseButton; } + /** + * {@return amount of mouse drag along the X axis} + */ public double getDragX() { return dragX; } + /** + * {@return amount of mouse drag along the Y axis} + */ public double getDragY() { return dragY; } /** - * This event fires when a mouse drag is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#mouseDragged(double, double, int, double, double)}. + * Fired before the mouse drag is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's mouse drag handler will be bypassed + * and the corresponding {@link MouseDragEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends MouseDragEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseDragPre(Screen, double, double, int, double, double) + */ public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) { super(screen, mouseX, mouseY, mouseButton, dragX, dragY); @@ -443,12 +620,22 @@ public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double } /** - * This event fires after {@link GuiEventListener#mouseDragged(double, double, int, double, double)} if the drag was not already handled. - * Cancel this event when you successfully use the mouse drag, to prevent other handlers from using the same input. + * Fired after the mouse drag is handled, if not handled by the screen + * and the corresponding {@link MouseDragEvent.Pre} is not cancelled. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the mouse drag will be set as handled.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Post extends MouseDragEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseDragPost(Screen, double, double, int, double, double) + */ public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) { super(screen, mouseX, mouseY, mouseButton, dragX, dragY); @@ -456,28 +643,51 @@ public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double } } + /** + * Fired when the mouse was dragged while a button is being held down. + * See the two subclasses for listening before and after the normal handling. + * + * @see MouseScrollEvent.Pre + * @see MouseScrollEvent.Post + */ public static abstract class MouseScrollEvent extends MouseInputEvent { private final double scrollDelta; + /** + * @hidden + */ public MouseScrollEvent(Screen screen, double mouseX, double mouseY, double scrollDelta) { super(screen, mouseX, mouseY); this.scrollDelta = scrollDelta; } + /** + * {@return the amount of change / delta of the mouse scroll} + */ public double getScrollDelta() { return scrollDelta; } /** - * This event fires when a mouse scroll is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#mouseScrolled(double, double, double)}. + * Fired before the mouse scroll is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's mouse scroll handler will be bypassed + * and the corresponding {@link MouseScrollEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends MouseScrollEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseScrollPre(MouseHandler, Screen, double) + */ public Pre(Screen screen, double mouseX, double mouseY, double scrollDelta) { super(screen, mouseX, mouseY, scrollDelta); @@ -485,12 +695,22 @@ public Pre(Screen screen, double mouseX, double mouseY, double scrollDelta) } /** - * This event fires after {@link GuiEventListener#mouseScrolled(double, double, double)} if the scroll was not already handled. - * Cancel this event when you successfully use the mouse scroll, to prevent other handlers from using the same input. + * Fired after the mouse scroll is handled, if not handled by the screen + * and the corresponding {@link MouseScrollEvent.Pre} is not cancelled. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the mouse scroll will be set as handled.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Post extends MouseScrollEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenMouseScrollPost(MouseHandler, Screen, double) + */ public Post(Screen screen, double mouseX, double mouseY, double scrollDelta) { super(screen, mouseX, mouseY, scrollDelta); @@ -498,12 +718,24 @@ public Post(Screen screen, double mouseX, double mouseY, double scrollDelta) } } + /** + *

    Fired whenever a keyboard key is pressed or released. + * See the various subclasses to listen for key pressing or releasing.

    + * + * @see ScreenEvent.KeyboardKeyPressedEvent + * @see ScreenEvent.KeyboardKeyReleasedEvent + * @see InputConstants + * @see the online GLFW documentation + */ public static abstract class KeyboardKeyEvent extends ScreenEvent { private final int keyCode; private final int scanCode; private final int modifiers; + /** + * @hidden + */ public KeyboardKeyEvent(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen); @@ -513,10 +745,11 @@ public KeyboardKeyEvent(Screen screen, int keyCode, int scanCode, int modifiers) } /** - * The keyboard key that was pressed or released - * https://www.glfw.org/docs/latest/group__keys.html + * {@return the {@code GLFW} (platform-agnostic) key code} * - * @see GLFW key constants starting with "GLFW_KEY_" + * @see InputConstants input constants starting with {@code KEY_} + * @see GLFW key constants starting with {@code GLFW_KEY_} + * @see the online GLFW documentation */ public int getKeyCode() { @@ -524,12 +757,13 @@ public int getKeyCode() } /** - * Platform-specific scan code. - * Used for {@link com.mojang.blaze3d.platform.InputConstants#getKey(int, int)} + * {@return the platform-specific scan code} * * The scan code is unique for every key, regardless of whether it has a key code. * Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending * on the platform but they are safe to save to disk as custom key bindings. + * + * @see InputConstants#getKey(int, int) */ public int getScanCode() { @@ -537,13 +771,15 @@ public int getScanCode() } /** - * Bit field representing the modifier keys pressed. - * https://www.glfw.org/docs/latest/group__mods.html + * {@return a bit field representing the active modifier keys} * - * @see GLFW#GLFW_MOD_SHIFT - * @see GLFW#GLFW_MOD_CONTROL - * @see GLFW#GLFW_MOD_ALT - * @see GLFW#GLFW_MOD_SUPER + * @see InputConstants#MOD_CONTROL CTRL modifier key bit + * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit + * @see GLFW#GLFW_MOD_ALT ALT modifier key bit + * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit + * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit + * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit + * @see the online GLFW documentation */ public int getModifiers() { @@ -551,20 +787,40 @@ public int getModifiers() } } + /** + * Fired when a keyboard key is pressed. + * See the two subclasses for listening before and after the normal handling. + * + * @see KeyboardKeyPressedEvent.Pre + * @see KeyboardKeyPressedEvent.Post + */ public static abstract class KeyboardKeyPressedEvent extends KeyboardKeyEvent { + /** + * @hidden + */ public KeyboardKeyPressedEvent(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); } /** - * This event fires when keyboard input is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#keyPressed(int, int, int)}. + * Fired before the key press is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable} and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's key press handler will be bypassed + * and the corresponding {@link KeyboardKeyPressedEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends KeyboardKeyPressedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenKeyPressedPre(Screen, int, int, int) + */ public Pre(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); @@ -572,12 +828,22 @@ public Pre(Screen screen, int keyCode, int scanCode, int modifiers) } /** - * This event fires after {@link GuiEventListener#keyPressed(int, int, int)} if the key was not already handled. - * Cancel this event when you successfully use the keyboard input to prevent other handlers from using the same input. + * Fired after the key press is handled, if not handled by the screen + * and the corresponding {@link KeyboardKeyPressedEvent.Pre} is not cancelled. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the key press will be set as handled.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Post extends KeyboardKeyPressedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenKeyPressedPost(Screen, int, int, int) + */ public Post(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); @@ -585,20 +851,40 @@ public Post(Screen screen, int keyCode, int scanCode, int modifiers) } } + /** + * Fired when a keyboard key is released. + * See the two subclasses for listening before and after the normal handling. + * + * @see KeyboardKeyReleasedEvent.Pre + * @see KeyboardKeyReleasedEvent.Post + */ public static abstract class KeyboardKeyReleasedEvent extends KeyboardKeyEvent { + /** + * @hidden + */ public KeyboardKeyReleasedEvent(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); } /** - * This event fires when keyboard input is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#keyReleased(int, int, int)}. + * Fired before the key release is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's key release handler will be bypassed + * and the corresponding {@link KeyboardKeyReleasedEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends KeyboardKeyReleasedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenKeyReleasedPre(Screen, int, int, int) + */ public Pre(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); @@ -606,12 +892,22 @@ public Pre(Screen screen, int keyCode, int scanCode, int modifiers) } /** - * This event fires after {@link GuiEventListener#keyReleased(int, int, int)} if the key was not already handled. - * Cancel this event when you successfully use the keyboard input to prevent other handlers from using the same input. + * Fired after the key release is handled, if not handled by the screen + * and the corresponding {@link KeyboardKeyReleasedEvent.Pre} is not cancelled. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the key release will be set as handled.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Post extends KeyboardKeyReleasedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenKeyReleasedPost(Screen, int, int, int) + */ public Post(Screen screen, int keyCode, int scanCode, int modifiers) { super(screen, keyCode, scanCode, modifiers); @@ -619,11 +915,22 @@ public Post(Screen screen, int keyCode, int scanCode, int modifiers) } } + /** + * Fired when a keyboard key corresponding to a character is typed. + * See the two subclasses for listening before and after the normal handling. + * + * @see KeyboardCharTypedEvent.Pre + * @see KeyboardCharTypedEvent.Post + * @see the online GLFW documentation + */ public static class KeyboardCharTypedEvent extends ScreenEvent { private final char codePoint; private final int modifiers; + /** + * @hidden + */ public KeyboardCharTypedEvent(Screen screen, char codePoint, int modifiers) { super(screen); @@ -632,7 +939,7 @@ public KeyboardCharTypedEvent(Screen screen, char codePoint, int modifiers) } /** - * The code point typed, used for text entry. + * {@return the character code point} */ public char getCodePoint() { @@ -640,12 +947,15 @@ public char getCodePoint() } /** - * Bit field representing the modifier keys pressed. + * {@return a bit field representing the active modifier keys} * - * @see GLFW#GLFW_MOD_SHIFT - * @see GLFW#GLFW_MOD_CONTROL - * @see GLFW#GLFW_MOD_ALT - * @see GLFW#GLFW_MOD_SUPER + * @see InputConstants#MOD_CONTROL CTRL modifier key bit + * @see GLFW#GLFW_MOD_SHIFT SHIFT modifier key bit + * @see GLFW#GLFW_MOD_ALT ALT modifier key bit + * @see GLFW#GLFW_MOD_SUPER SUPER modifier key bit + * @see GLFW#GLFW_KEY_CAPS_LOCK CAPS LOCK modifier key bit + * @see GLFW#GLFW_KEY_NUM_LOCK NUM LOCK modifier key bit + * @see the online GLFW documentation */ public int getModifiers() { @@ -653,12 +963,22 @@ public int getModifiers() } /** - * This event fires when keyboard character input is detected for a GuiScreen, before it is handled. - * Cancel this event to bypass {@link GuiEventListener#charTyped(char, int)}. + * Fired before the character input is handled by the screen. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the screen's character input handler will be bypassed + * and the corresponding {@link KeyboardCharTypedEvent.Post} will not be fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Pre extends KeyboardCharTypedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenCharTypedPre(Screen, char, int) + */ public Pre(Screen screen, char codePoint, int modifiers) { super(screen, codePoint, modifiers); @@ -666,12 +986,22 @@ public Pre(Screen screen, char codePoint, int modifiers) } /** - * This event fires after {@link GuiEventListener#charTyped(char, int)} if the character was not already handled. - * Cancel this event when you successfully use the keyboard input to prevent other handlers from using the same input. + * Fired after the character input is handled, if not handled by the screen + * and the corresponding {@link KeyboardCharTypedEvent.Pre} is not cancelled. + * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the character input will be set as handled.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public static class Post extends KeyboardCharTypedEvent { + /** + * @hidden + * @see ForgeHooksClient#onScreenCharTypedPost(Screen, char, int) + */ public Post(Screen screen, char codePoint, int modifiers) { super(screen, codePoint, modifiers); diff --git a/src/main/java/net/minecraftforge/client/event/ScreenOpenEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenOpenEvent.java index b308a484b71..b24f7ef52b9 100644 --- a/src/main/java/net/minecraftforge/client/event/ScreenOpenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ScreenOpenEvent.java @@ -5,30 +5,50 @@ package net.minecraftforge.client.event; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.client.gui.screens.Screen; +import net.minecraftforge.fml.LogicalSide; /** - * This event is called before any Screen will open. - * If you don't want this to happen, cancel the event. - * If you want to override this Screen, simply set the screen variable to your own Screen. + * Fired before any {@link Screen} will be opened, to allow changing or preventing it from being opened. All screen + * layers on the screen are closed before this event is fired. * + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the {@code Screen} shall be prevented from opening and any previous screen + * will remain open. However, cancelling this event will not prevent the closing of screen layers which happened before + * this event fired.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ @Cancelable public class ScreenOpenEvent extends Event { private Screen screen; + + /** + * @hidden + */ public ScreenOpenEvent(Screen screen) { this.setScreen(screen); } + /** + * {@return the screen that will be opened, if the event is not cancelled} + */ public Screen getScreen() { return screen; } + /** + * Sets the new screen to be opened, if the event is not cancelled. + * + * @param screen the new screen + */ public void setScreen(Screen screen) { this.screen = screen; diff --git a/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java index b57031adce5..49c83a06447 100644 --- a/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ScreenshotEvent.java @@ -6,68 +6,105 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.platform.NativeImage; +import net.minecraft.client.Screenshot; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; import java.io.File; import java.io.IOException; /** - * This event is fired before and after a screenshot is taken - * This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS} - * This event is {@link Cancelable} + * Fired when a screenshot is taken, but before it is written to disk. * - * {@link #screenshotFile} contains the file the screenshot will be/was saved to - * {@link #image} contains the {@link NativeImage} that will be saved - * {@link #resultMessage} contains the {@link Component} to be returned. If {@code null}, the default vanilla message will be used instead + *

    This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the screenshot is not written to disk, and the message in the event will be posted + * to the player's chat.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see Screenshot */ @Cancelable public class ScreenshotEvent extends Event { - public static final Component DEFAULT_CANCEL_REASON = new TextComponent("Screenshot canceled"); + public static final Component DEFAULT_CANCEL_REASON = Component.literal("Screenshot canceled"); - private NativeImage image; + private final NativeImage image; private File screenshotFile; private Component resultMessage = null; + /** + * @hidden + * @see net.minecraftforge.client.ForgeHooksClient#onScreenshot(NativeImage, File) + */ public ScreenshotEvent(NativeImage image, File screenshotFile) { this.image = image; this.screenshotFile = screenshotFile; try { this.screenshotFile = screenshotFile.getCanonicalFile(); // FORGE: Fix errors on Windows with paths that include \.\ - } catch (IOException e) {} + } catch (IOException ignored) {} } + /** + * {@return the in-memory image of the screenshot} + */ public NativeImage getImage() { return image; } + /** + * @return the file where the screenshot will be saved to + */ public File getScreenshotFile() { return screenshotFile; } + /** + * Sets the new file where the screenshot will be saved to. + * + * @param screenshotFile the new filepath + */ public void setScreenshotFile(File screenshotFile) { this.screenshotFile = screenshotFile; } + /** + * {@return the custom cancellation message, or {@code null} if no custom message is set} + */ public Component getResultMessage() { return resultMessage; } + /** + * Sets the new custom cancellation message used to inform the player. + * It may be {@code null}, in which case the {@linkplain #DEFAULT_CANCEL_REASON default cancel reason} will be used. + * + * @param resultMessage the new result message + */ public void setResultMessage(Component resultMessage) { this.resultMessage = resultMessage; } + /** + * Returns the cancellation message to be used in informing the player. + * + *

    If there is no custom message given ({@link #getResultMessage()} returns {@code null}), then + * the message will be the {@linkplain #DEFAULT_CANCEL_REASON default cancel reason message}.

    + * + * @return the cancel message for the player + */ public Component getCancelMessage() { return getResultMessage() != null ? getResultMessage() : DEFAULT_CANCEL_REASON; diff --git a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java index 2f0c7369f79..09832d42b5e 100644 --- a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java +++ b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java @@ -6,35 +6,62 @@ package net.minecraftforge.client.event; import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import java.util.Set; +/** + * Fired before and after a texture atlas stitched together. + * See the two subclasses to listen for before and after stitching. + * + * @see TextureStitchEvent.Pre + * @see TextureStitchEvent.Post + * @see TextureAtlas + */ public class TextureStitchEvent extends Event implements IModBusEvent { private final TextureAtlas atlas; + /** + * @hidden + */ public TextureStitchEvent(TextureAtlas atlas) { this.atlas = atlas; } + /** + * {@return the texture atlas} + */ public TextureAtlas getAtlas() { return atlas; } /** - * Fired when the TextureMap is told to refresh it's stitched texture. - * Called before the {@link net.minecraft.client.renderer.texture.TextureAtlasSprite} are loaded. + *

    Fired before a texture atlas is stitched together. + * This can be used to add custom sprites to be stitched into the atlas.

    + * + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ public static class Pre extends TextureStitchEvent { private final Set sprites; + /** + * @hidden + * @see ForgeHooksClient#onTextureStitchedPre(TextureAtlas, Set) + */ public Pre(TextureAtlas map, Set sprites) { super(map); @@ -42,7 +69,12 @@ public Pre(TextureAtlas map, Set sprites) } /** - * Add a sprite to be stitched into the Texture Atlas. + * Adds a sprite to be stitched into the texture atlas. + * + *

    Callers should check that the atlas which the event is fired for is the atlas they wish to stitch the + * sprite into, as otherwise they would be stitching the sprite into all atlases.

    + * + * @param sprite the location of the sprite */ public boolean addSprite(ResourceLocation sprite) { return this.sprites.add(sprite); @@ -50,12 +82,19 @@ public boolean addSprite(ResourceLocation sprite) { } /** - * This event is fired once the texture map has loaded all textures and - * stitched them together. All Icons should have there locations defined - * by the time this is fired. + * Fired after a texture atlas is stitched together and all textures therein has been loaded. + * + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    */ public static class Post extends TextureStitchEvent { + /** + * @hidden + * @see ForgeHooksClient#onTextureStitchedPost(TextureAtlas) + */ public Post(TextureAtlas map){ super(map); } } } diff --git a/src/main/java/net/minecraftforge/client/event/package-info.java b/src/main/java/net/minecraftforge/client/event/package-info.java new file mode 100644 index 00000000000..3cd3aed976b --- /dev/null +++ b/src/main/java/net/minecraftforge/client/event/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +/** + * Events fired only on the client-side, chiefly related to rendering and user interfaces (screens and input). + */ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.minecraftforge.client.event; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java index 7472a85aa5c..f70c9024b6e 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java @@ -7,19 +7,35 @@ import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.Nullable; -/*** - * Raised when the SoundManager tries to play a normal sound. +/** + * Fired when a sound is about to be played by the sound engine. This fires before the sound is played and before any + * checks on the sound (such as a zeroed volume, an empty {@link net.minecraft.client.resources.sounds.Sound}, and + * others). This can be used to change or prevent (by passing {@code null)} a sound from being played through + * {@link #setSound(SoundInstance)}). * - * If you return null from this function it will prevent the sound from being played, - * you can return a different entry if you want to change the sound being played. + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see PlaySoundSourceEvent + * @see PlayStreamingSourceEvent */ public class PlaySoundEvent extends SoundEvent { private final String name; private final SoundInstance originalSound; + @Nullable private SoundInstance sound; + /** + * @hidden + */ public PlaySoundEvent(SoundEngine manager, SoundInstance sound) { super(manager); @@ -28,23 +44,38 @@ public PlaySoundEvent(SoundEngine manager, SoundInstance sound) this.setSound(sound); } + /** + * {@return the name of the original sound} This is equivalent to the path of the location of the original sound. + */ public String getName() { return name; } + /** + * {@return the original sound that was to be played} + */ public SoundInstance getOriginalSound() { return originalSound; } + /** + * {@return the sound to be played, or {@code null} if no sound will be played} + */ + @Nullable public SoundInstance getSound() { return sound; } - public void setSound(SoundInstance result) + /** + * Sets the sound to be played, which may be {@code null} to prevent any sound from being played. + * + * @param newSound the new sound to be played, or {@code null} for no sound + */ + public void setSound(@Nullable SoundInstance newSound) { - this.sound = result; + this.sound = newSound; } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java index 27d2f99f8fb..8feedcc49ea 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java @@ -9,11 +9,29 @@ import net.minecraft.client.sounds.SoundEngine; import com.mojang.blaze3d.audio.Channel; import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired when a non-streaming sound is being played. A non-streaming sound is loaded fully into memory + * in a buffer before being played, and used for most sounds of short length such as sound effects for clicking + * buttons. + * + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see PlayStreamingSourceEvent + */ public class PlaySoundSourceEvent extends SoundSourceEvent { - public PlaySoundSourceEvent(SoundEngine manager, SoundInstance sound, Channel source) + /** + * @hidden + */ + public PlaySoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) { - super(manager, sound, source); + super(engine, sound, channel); } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java index 68d9b87c4f2..7de226f8a22 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java @@ -9,11 +9,29 @@ import net.minecraft.client.sounds.SoundEngine; import com.mojang.blaze3d.audio.Channel; import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; +/** + * Fired when a streaming sound is being played. A streaming sound is streamed directly from its source + * (such as a file), and used for sounds of long length which are unsuitable to keep fully loaded in-memory in a buffer + * (as is done for regular non-streaming sounds), such as background music or music discs. + * + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see PlayStreamingSourceEvent + */ public class PlayStreamingSourceEvent extends SoundSourceEvent { - public PlayStreamingSourceEvent(SoundEngine manager, SoundInstance sound, Channel source) + /** + * @hidden + */ + public PlayStreamingSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) { - super(manager, sound, source); + super(engine, sound, channel); } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java new file mode 100644 index 00000000000..94259c28729 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEngineLoadEvent.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.client.event.sound; + +import net.minecraft.client.sounds.SoundEngine; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +/** + * Fired when the {@link SoundEngine} is constructed or (re)loaded, such as during game initialization or when the sound + * output device is changed. + * + *

    This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

    + * + *

    This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + */ +public class SoundEngineLoadEvent extends SoundEvent implements IModBusEvent +{ + /** + * @hidden + */ + public SoundEngineLoadEvent(SoundEngine manager) + { + super(manager); + } +} diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index 4ad873f3838..e5a522d0a67 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -8,44 +8,85 @@ import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.SoundEngine; import com.mojang.blaze3d.audio.Channel; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; -public class SoundEvent extends net.minecraftforge.eventbus.api.Event +/** + * Superclass for sound related events. + * + *

    These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see SoundSourceEvent + * @see PlaySoundEvent + * @see SoundEngineLoadEvent + */ +public class SoundEvent extends Event { private final SoundEngine engine; + + /** + * @hidden + */ public SoundEvent(SoundEngine engine) { this.engine = engine; } + /** + * {@return the sound engine} + */ public SoundEngine getEngine() { return engine; } + /** + * Superclass for when a sound has started to play on an audio channel. + * + *

    These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

    + * + * @see PlaySoundSourceEvent + * @see PlayStreamingSourceEvent + */ public static class SoundSourceEvent extends SoundEvent { private final SoundInstance sound; private final Channel channel; private final String name; - public SoundSourceEvent(SoundEngine manager, SoundInstance sound, Channel channel) + /** + * @hidden + */ + public SoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) { - super(manager); + super(engine); this.name = sound.getLocation().getPath(); this.sound = sound; this.channel = channel; } + /** + * {@return the sound being played} + */ public SoundInstance getSound() { return sound; } + /** + * {@return the audio channel on which the sound is playing on} + */ public Channel getChannel() { return channel; } + /** + * {@return the name of the sound being played} This is equivalent to the path of the location of the original sound. + */ public String getName() { return name; diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java deleted file mode 100644 index 9ab86240663..00000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundLoadEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.sounds.SoundEngine; -import net.minecraftforge.fml.event.IModBusEvent; - -/** - * Raised by the SoundManager.loadSoundSettings, this would be a good place for - * adding your custom sounds to the SoundPool. - */ -public class SoundLoadEvent extends SoundEvent implements IModBusEvent -{ - public SoundLoadEvent(SoundEngine manager) - { - super(manager); - } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java deleted file mode 100644 index ee0c3588a77..00000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundSetupEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.sounds.SoundEngine; - -/** - * This event is raised by the SoundManager when it does its first setup of the - * SoundSystemConfig's codecs, use this function to add your own codecs. - */ -public class SoundSetupEvent extends SoundEvent -{ - public SoundSetupEvent(SoundEngine manager) - { - super(manager); - } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/package-info.java b/src/main/java/net/minecraftforge/client/event/sound/package-info.java new file mode 100644 index 00000000000..64e886a2c53 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/event/sound/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +/** + * Client-only events relating to sounds. + */ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.minecraftforge.client.event.sound; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java index ec2ab0834e0..d08b6b533cc 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeBakedModel.java @@ -7,14 +7,11 @@ import java.util.Collections; import java.util.List; -import java.util.Random; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ItemBlockRenderTypes; @@ -27,7 +24,12 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.client.model.data.IModelData; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +/** + * Extension interface for {@link IForgeBakedModel}. + */ public interface IForgeBakedModel { private BakedModel self() @@ -35,8 +37,8 @@ private BakedModel self() return (BakedModel) this; } - @Nonnull - default List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + @NotNull + default List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) { return self().getQuads(state, side, rand); } @@ -57,12 +59,12 @@ default BakedModel handlePerspective(ItemTransforms.TransformType cameraTransfor return net.minecraftforge.client.ForgeHooksClient.handlePerspective(self(), cameraTransformType, poseStack); } - default @Nonnull IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData) + default @NotNull IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData modelData) { return modelData; } - default TextureAtlasSprite getParticleIcon(@Nonnull IModelData data) + default TextureAtlasSprite getParticleIcon(@NotNull IModelData data) { return self().getParticleIcon(); } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeKeyMapping.java b/src/main/java/net/minecraftforge/client/extensions/IForgeKeyMapping.java index e968b7bec39..898a681adf9 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeKeyMapping.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeKeyMapping.java @@ -5,18 +5,23 @@ package net.minecraftforge.client.extensions; -import javax.annotation.Nonnull; - import net.minecraft.client.KeyMapping; import com.mojang.blaze3d.platform.InputConstants; import net.minecraftforge.client.settings.IKeyConflictContext; import net.minecraftforge.client.settings.KeyModifier; +import org.jetbrains.annotations.NotNull; +/** + * Extension interface for {@link KeyMapping}. + */ public interface IForgeKeyMapping { - private KeyMapping self() { return (KeyMapping) this; } - - @Nonnull InputConstants.Key getKey(); + private KeyMapping self() + { + return (KeyMapping) this; + } + + @NotNull InputConstants.Key getKey(); /** * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding. @@ -25,7 +30,7 @@ default boolean isActiveAndMatches(InputConstants.Key keyCode) { return keyCode != InputConstants.UNKNOWN && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext()); } - + default void setToDefault() { setKeyModifierAndCode(getDefaultKeyModifier(), self().getDefaultKey()); diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java index 8da4a2e272f..9436086de9f 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeMinecraft.java @@ -9,15 +9,29 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraftforge.client.ForgeHooksClient; +/** + * Extension interface for {@link IForgeMinecraft}. + */ public interface IForgeMinecraft { - private Minecraft self() { return (Minecraft)this; } + private Minecraft self() + { + return (Minecraft) this; + } + /** + * Pushes a screen as a new GUI layer. + * + * @param screen the new GUI layer + */ default void pushGuiLayer(Screen screen) { ForgeHooksClient.pushGuiLayer(self(), screen); } + /** + * Pops a GUI layer from the screen. + */ default void popGuiLayer() { ForgeHooksClient.popGuiLayer(self()); diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeModelState.java b/src/main/java/net/minecraftforge/client/extensions/IForgeModelState.java index 1728db2aaee..d0fe103b3e3 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeModelState.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeModelState.java @@ -6,18 +6,27 @@ package net.minecraftforge.client.extensions; import com.mojang.math.Transformation; +import net.minecraft.client.resources.model.ModelState; /** - * 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. + * Extension interface for {@link ModelState}. An {@code ModelState} 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 IForgeModelState { + private ModelState self() + { + return (ModelState) this; + } + /** - * @param part Part of the model we are wanting to transform. An empty optional means + * {@return A transformation to apply to the part} This may be an {@linkplain Transformation#isIdentity() identity + * transformation} if there is no transformation to be applied. The coordinate system of the transform is determined + * by the part type. + * + * @param part part of the model we are wanting to transform. An empty optional means * we want a transform for the entire model. - * @return A transformation to apply to the part, if any. The coordinate system of the transform - * is determined by the part type. */ default Transformation getPartTransformation(Object part) { diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java index 7497c25aaa1..aa84e094800 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java @@ -13,18 +13,32 @@ import com.mojang.math.Vector3f; import com.mojang.math.Vector4f; +/** + * Extension interface for {@link Transformation}. + */ public interface IForgeTransformation { private Transformation self() { - return (Transformation)this; + return (Transformation) this; } + /** + * {@return whether this transformation is the identity transformation} + * + * @see Transformation#identity() + */ default boolean isIdentity() { return self().equals(Transformation.identity()); } + /** + * Pushes and applies this transformation to the pose stack. The effects of this method can be reversed by a + * corresponding {@link PoseStack#popPose()}. + * + * @param stack the pose stack to modify + */ default void push(PoseStack stack) { stack.pushPose(); @@ -41,24 +55,45 @@ default void push(PoseStack stack) } + /** + * Transforms the position according to this transformation. + * + * @param position the position to transform + */ default void transformPosition(Vector4f position) { position.transform(self().getMatrix()); } + /** + * Transforms the normal according to this transformation and normalizes it. + * + * @param normal the normal to transform + */ default void transformNormal(Vector3f normal) { normal.transform(self().getNormalMatrix()); normal.normalize(); } + /** + * Rotates the direction according to this transformation and returns the nearest {@code Direction} to the + * resulting direction. + * + * @param facing the direction to transform + * @return the {@code Direction} value nearest to the resulting transformed direction + * @see Direction#rotate(Matrix4f, Direction) + */ default Direction rotateTransform(Direction facing) { return Direction.rotate(self().getMatrix(), facing); } /** - * convert transformation from assuming center-block system to opposing-corner-block system + * Converts and returns a new transformation based on this transformation from assuming a center-block system to an + * opposing-corner-block system. + * + * @return a new transformation using the opposing-corner-block system */ default Transformation blockCenterToCorner() { @@ -66,7 +101,10 @@ default Transformation blockCenterToCorner() } /** - * convert transformation from assuming opposing-corner-block system to center-block system + * Converts and returns a new transformation based on this transformation from assuming an opposing-corner-block + * system to a center-block system. + * + * @return a new transformation using the center-block system */ default Transformation blockCornerToCenter() { @@ -74,11 +112,14 @@ default Transformation blockCornerToCenter() } /** - * Apply this transformation to a different origin. - * Can be used for switching between coordinate systems. - * Parameter is relative to the current origin. + * Returns a new transformation with a changed origin by applying the given parameter (which is relative to the + * current origin). This can be used for switching between coordinate systems. + * + * @param origin the new origin as relative to the current origin + * @return a new transformation with a changed origin */ - default Transformation applyOrigin(Vector3f origin) { + default Transformation applyOrigin(Vector3f origin) + { Transformation transform = self(); if (transform.isIdentity()) return Transformation.identity(); diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java index a7adcc507ae..d4edd6039f4 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeVertexConsumer.java @@ -24,8 +24,16 @@ import com.mojang.math.Vector4f; import net.minecraft.core.Vec3i; +/** + * Extension interface for {@link VertexConsumer}. + */ public interface IForgeVertexConsumer { + private VertexConsumer self() + { + return (VertexConsumer) this; + } + // Copy of putBulkData, but enables tinting and per-vertex alpha default void putBulkData(PoseStack.Pose poseStack, BakedQuad bakedQuad, float red, float green, float blue, int packedLight, int packedOverlay, boolean readExistingColor) { putBulkData(poseStack, bakedQuad, red, green, blue, 1.0f, packedLight, packedOverlay, readExistingColor); @@ -87,7 +95,7 @@ default void putBulkData(PoseStack.Pose pose, BakedQuad bakedQuad, float[] baseB Vector4f pos = new Vector4f(f, f1, f2, 1.0F); pos.transform(matrix4f); applyBakedNormals(normal, bytebuffer, pose.normal()); - ((VertexConsumer)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, packedOverlay, lightmapCoord, normal.x(), normal.y(), normal.z()); + self().vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, packedOverlay, lightmapCoord, normal.x(), normal.y(), normal.z()); } } } diff --git a/src/main/java/net/minecraftforge/client/extensions/package-info.java b/src/main/java/net/minecraftforge/client/extensions/package-info.java new file mode 100644 index 00000000000..ebc0593df4c --- /dev/null +++ b/src/main/java/net/minecraftforge/client/extensions/package-info.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +/** + * Extension interfaces for {@link net.minecraftforge.api.distmarker.Dist#CLIENT client}-only classes. + * + *

    Extension interfaces allow the convenient addition of methods to the target class, as the target class is patched + * to implement the interface. Because of this, these interfaces must only be implemented by the target classes, and must + * not be implemented manually by mods.

    + * + *

    These interfaces hold at least one method: the {@code self()} method which casts the object into the type of the + * targeted class, to allow methods in the extension interface to reference methods from the target class. Additional + * methods are usually {@code default} with an implementation in the interface itself, but methods may be implemented + * in the target class instead if it requires access to (patched-in or original) fields in the instance.

    + */ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.minecraftforge.client.extensions; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java index 2ec453139a8..6273348e924 100644 --- a/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java +++ b/src/main/java/net/minecraftforge/client/gui/ForgeIngameGui.java @@ -45,12 +45,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; -import javax.annotation.Nullable; - public class ForgeIngameGui extends Gui { private static final Logger LOGGER = LogManager.getLogger(); @@ -319,7 +318,7 @@ public void setupOverlayRenderState(boolean blend, boolean depthTest, @Nullable public ForgeIngameGui(Minecraft mc) { - super(mc); + super(mc, mc.getItemRenderer()); debugOverlay = new ForgeDebugScreenOverlay(mc); } diff --git a/src/main/java/net/minecraftforge/client/gui/GuiUtils.java b/src/main/java/net/minecraftforge/client/gui/GuiUtils.java index 48b24f54392..aac29daa210 100644 --- a/src/main/java/net/minecraftforge/client/gui/GuiUtils.java +++ b/src/main/java/net/minecraftforge/client/gui/GuiUtils.java @@ -25,7 +25,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java index 15dfe76fe88..a4d8e4b1241 100644 --- a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java @@ -11,11 +11,9 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.screens.ErrorScreen; import net.minecraft.client.gui.components.ObjectSelectionList; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.util.FormattedCharSequence; import net.minecraft.Util; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.ChatFormatting; import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.fml.LoadingFailedException; @@ -46,7 +44,7 @@ public class LoadingErrorScreen extends ErrorScreen { public LoadingErrorScreen(LoadingFailedException loadingException, List warnings, final File dumpedLocation) { - super(new TextComponent("Loading Error"), null); + super(Component.literal("Loading Error"), null); this.modLoadWarnings = warnings; this.modLoadErrors = loadingException == null ? Collections.emptyList() : loadingException.getErrors(); this.modsDir = FMLPaths.MODSDIR.get(); @@ -60,18 +58,18 @@ public void init() super.init(); this.clearWidgets(); - this.errorHeader = new TextComponent(ChatFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + ChatFormatting.RESET); - this.warningHeader = new TextComponent(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + ChatFormatting.RESET); + this.errorHeader = Component.literal(ChatFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + ChatFormatting.RESET); + this.warningHeader = Component.literal(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + ChatFormatting.RESET); int yOffset = 46; - this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getPlatform().openFile(modsDir.toFile()))); - this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getPlatform().openFile(logFile.toFile()))); + this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getPlatform().openFile(modsDir.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getPlatform().openFile(logFile.toFile()))); if (this.modLoadErrors.isEmpty()) { - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> { + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> { this.minecraft.setScreen(null); })); } else { - this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getPlatform().openFile(dumpedLocation.toFile()))); + this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getPlatform().openFile(dumpedLocation.toFile()))); } this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings); @@ -100,13 +98,13 @@ public static class LoadingEntryList extends ObjectSelectionListaddEntry(new LoadingMessageEntry(new TextComponent(e.formatToString())))); + errors.forEach(e->addEntry(new LoadingMessageEntry(Component.literal(e.formatToString())))); if (both) { int maxChars = (this.width - 10) / parent.minecraft.font.width("-"); - addEntry(new LoadingMessageEntry(new TextComponent("\n" + Strings.repeat("-", maxChars) + "\n"))); + addEntry(new LoadingMessageEntry(Component.literal("\n" + Strings.repeat("-", maxChars) + "\n"))); addEntry(new LoadingMessageEntry(parent.warningHeader, true)); } - warnings.forEach(w->addEntry(new LoadingMessageEntry(new TextComponent(w.formatToString())))); + warnings.forEach(w->addEntry(new LoadingMessageEntry(Component.literal(w.formatToString())))); } @Override @@ -136,7 +134,7 @@ public class LoadingMessageEntry extends ObjectSelectionList.Entry ModListScreen.this.onClose()); - openModsFolderButton = new Button(6, y, this.listWidth, 20, new TranslatableComponent("fml.menu.mods.openmodsfolder"), b -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())); + doneButton = new Button(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, 20, Component.translatable("gui.done"), b -> ModListScreen.this.onClose()); + openModsFolderButton = new Button(6, y, this.listWidth, 20, Component.translatable("fml.menu.mods.openmodsfolder"), b -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile())); y -= 20 + PADDING; - configButton = new Button(6, y, this.listWidth, 20, new TranslatableComponent("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig()); + configButton = new Button(6, y, this.listWidth, 20, Component.translatable("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig()); y -= 14 + PADDING; - search = new EditBox(getFontRenderer(), PADDING + 1, y, listWidth - 2, 14, new TranslatableComponent("fml.menu.mods.search")); + search = new EditBox(getFontRenderer(), PADDING + 1, y, listWidth - 2, 14, Component.translatable("fml.menu.mods.search")); this.modList = new ModListWidget(this, listWidth, fullButtonHeight, search.y - getFontRenderer().lineHeight - PADDING); this.modList.setLeftPos(6); @@ -366,7 +365,7 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic if (this.modInfo != null) this.modInfo.render(poseStack, mouseX, mouseY, partialTick); - Component text = new TranslatableComponent("fml.menu.mods.search"); + Component text = Component.translatable("fml.menu.mods.search"); int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().width(text) / 2); this.search.render(poseStack, mouseX , mouseY, partialTick); super.render(poseStack, mouseX, mouseY, partialTick); diff --git a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java index 1bade1b79da..15b65ae43cb 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java @@ -47,8 +47,6 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; import net.minecraftforge.common.ForgeI18n; @@ -105,9 +103,9 @@ protected void init() this.addRenderableWidget(new MismatchInfoPanel(minecraft, listWidth, listHeight, (this.height - this.listHeight) / 2, listLeft)); int buttonWidth = Math.min(210, this.width / 2 - 20); - this.addRenderableWidget(new Button(Math.max(this.width / 4 - buttonWidth / 2, listLeft), upperButtonHeight, buttonWidth, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), button -> Util.getPlatform().openFile(logFile.toFile()))); - this.addRenderableWidget(new Button(Math.min(this.width * 3 / 4 - buttonWidth / 2, listLeft + listWidth - buttonWidth), upperButtonHeight, buttonWidth, 20, new TextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), button -> Util.getPlatform().openFile(modsDir.toFile()))); - this.addRenderableWidget(new Button((this.width - buttonWidth) / 2, lowerButtonHeight, buttonWidth, 20, new TranslatableComponent("gui.toMenu"), button -> this.minecraft.setScreen(this.parent))); + this.addRenderableWidget(new Button(Math.max(this.width / 4 - buttonWidth / 2, listLeft), upperButtonHeight, buttonWidth, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), button -> Util.getPlatform().openFile(logFile.toFile()))); + this.addRenderableWidget(new Button(Math.min(this.width * 3 / 4 - buttonWidth / 2, listLeft + listWidth - buttonWidth), upperButtonHeight, buttonWidth, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), button -> Util.getPlatform().openFile(modsDir.toFile()))); + this.addRenderableWidget(new Button((this.width - buttonWidth) / 2, lowerButtonHeight, buttonWidth, 20, Component.translatable("gui.toMenu"), button -> this.minecraft.setScreen(this.parent))); } @Override @@ -138,36 +136,36 @@ public MismatchInfoPanel(Minecraft client, int width, int height, int top, int l if (!missingModData.isEmpty()) { //The header of the section, colored in gray - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.missingmods.server" : "fml.modmismatchscreen.missingmods.client")).withStyle(ChatFormatting.GRAY), null)); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.missingmods.server" : "fml.modmismatchscreen.missingmods.client")).withStyle(ChatFormatting.GRAY), null)); //This table section contains the mod name and mod version of each mod that has a missing remote counterpart (if the mod is missing on the server, the client mod version is displayed, and vice versa) - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage("fml.modmismatchscreen.table.modname")).withStyle(ChatFormatting.UNDERLINE), Pair.of("", ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.youhave" : "fml.modmismatchscreen.table.youneed")))); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage("fml.modmismatchscreen.table.modname")).withStyle(ChatFormatting.UNDERLINE), Pair.of("", ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.youhave" : "fml.modmismatchscreen.table.youneed")))); int i = 0; for (ResourceLocation mod : missingModData) { rawTable.add(Pair.of(toModNameComponent(mod, presentModData.get(mod).getLeft(), i), Pair.of("", presentModData.getOrDefault(mod, Pair.of("", "")).getRight()))); if (++i >= 10) { //If too many missing mod entries are present, append a line referencing how to see the full list and stop rendering any more entries - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage("fml.modmismatchscreen.additional", missingModData.size() - i)).withStyle(ChatFormatting.ITALIC), Pair.of("", ""))); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage("fml.modmismatchscreen.additional", missingModData.size() - i)).withStyle(ChatFormatting.ITALIC), Pair.of("", ""))); break; } } - rawTable.add(Pair.of(new TextComponent(" "), null)); //padding + rawTable.add(Pair.of(Component.literal(" "), null)); //padding } if (!mismatchedModData.isEmpty()) { //The header of the table section, colored in gray - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage("fml.modmismatchscreen.mismatchedmods")).withStyle(ChatFormatting.GRAY), null)); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage("fml.modmismatchscreen.mismatchedmods")).withStyle(ChatFormatting.GRAY), null)); //This table section contains the mod name and both mod versions of each mod that has a mismatching client and server version - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage("fml.modmismatchscreen.table.modname")).withStyle(ChatFormatting.UNDERLINE), Pair.of(ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.youhave" : "fml.modmismatchscreen.table.serverhas"), ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.serverhas" : "fml.modmismatchscreen.table.youhave")))); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage("fml.modmismatchscreen.table.modname")).withStyle(ChatFormatting.UNDERLINE), Pair.of(ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.youhave" : "fml.modmismatchscreen.table.serverhas"), ForgeI18n.parseMessage(mismatchedDataFromServer ? "fml.modmismatchscreen.table.serverhas" : "fml.modmismatchscreen.table.youhave")))); int i = 0; for (Map.Entry modData : mismatchedModData.entrySet()) { rawTable.add(Pair.of(toModNameComponent(modData.getKey(), presentModData.get(modData.getKey()).getLeft(), i), Pair.of(presentModData.getOrDefault(modData.getKey(), Pair.of("", "")).getRight(), modData.getValue()))); if (++i >= 10) { //If too many mismatched mod entries are present, append a line referencing how to see the full list and stop rendering any more entries - rawTable.add(Pair.of(new TextComponent(ForgeI18n.parseMessage("fml.modmismatchscreen.additional", mismatchedModData.size() - i)).withStyle(ChatFormatting.ITALIC), Pair.of("", ""))); + rawTable.add(Pair.of(Component.literal(ForgeI18n.parseMessage("fml.modmismatchscreen.additional", mismatchedModData.size() - i)).withStyle(ChatFormatting.ITALIC), Pair.of("", ""))); break; } } - rawTable.add(Pair.of(new TextComponent(" "), null)); //padding + rawTable.add(Pair.of(Component.literal(" "), null)); //padding } this.lineTable = rawTable.stream().flatMap(p -> splitLineToWidth(p.getKey(), p.getValue()).stream()).collect(Collectors.toList()); @@ -187,8 +185,8 @@ private List nameLines = font.split(name, adaptedNameWidth); - List clientVersionLines = font.split(new TextComponent(versions != null ? versions.getLeft() : "").setStyle(style), versionWidth - 4); - List serverVersionLines = font.split(new TextComponent(versions != null ? versions.getRight() : "").setStyle(style), versionWidth - 4); + List clientVersionLines = font.split(Component.literal(versions != null ? versions.getLeft() : "").setStyle(style), versionWidth - 4); + List serverVersionLines = font.split(Component.literal(versions != null ? versions.getRight() : "").setStyle(style), versionWidth - 4); List>> splitLines = new ArrayList<>(); int rowsOccupied = Math.max(nameLines.size(), Math.max(clientVersionLines.size(), serverVersionLines.size())); for (int i = 0; i < rowsOccupied; i++) { @@ -209,8 +207,8 @@ private MutableComponent toModNameComponent(ResourceLocation id, String modName, { String modId = id.getNamespace(); String tooltipId = id.getPath().isEmpty() ? id.getNamespace() : id.toString(); - return new TextComponent(modName).withStyle(color % 2 == 0 ? ChatFormatting.GOLD : ChatFormatting.YELLOW) - .withStyle(s -> s.withHoverEvent(new HoverEvent(Action.SHOW_TEXT, new TextComponent(tooltipId + (!presentModUrls.getOrDefault(modId, "").isEmpty() ? "\n" + ForgeI18n.parseMessage("fml.modmismatchscreen.homepage") : ""))))) + return Component.literal(modName).withStyle(color % 2 == 0 ? ChatFormatting.GOLD : ChatFormatting.YELLOW) + .withStyle(s -> s.withHoverEvent(new HoverEvent(Action.SHOW_TEXT, Component.literal(tooltipId + (!presentModUrls.getOrDefault(modId, "").isEmpty() ? "\n" + ForgeI18n.parseMessage("fml.modmismatchscreen.homepage") : ""))))) .withStyle(s -> s.withClickEvent(!presentModUrls.getOrDefault(modId, "").isEmpty() ? new ClickEvent(ClickEvent.Action.OPEN_URL, presentModUrls.get(modId)) : null)); } diff --git a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java index e9bdbf3fd04..86f8dcac49c 100644 --- a/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/NotificationModUpdateScreen.java @@ -11,8 +11,8 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.loading.FMLConfig; import net.minecraftforge.versions.forge.ForgeVersion; @@ -32,7 +32,7 @@ public class NotificationModUpdateScreen extends Screen public NotificationModUpdateScreen(Button modButton) { - super(new TranslatableComponent("forge.menu.updatescreen.title")); + super(Component.translatable("forge.menu.updatescreen.title")); this.modButton = modButton; } diff --git a/src/main/java/net/minecraftforge/client/gui/OverlayRegistry.java b/src/main/java/net/minecraftforge/client/gui/OverlayRegistry.java index 11f1086c9f9..1c7790a8a59 100644 --- a/src/main/java/net/minecraftforge/client/gui/OverlayRegistry.java +++ b/src/main/java/net/minecraftforge/client/gui/OverlayRegistry.java @@ -7,9 +7,9 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.Map; @@ -23,7 +23,7 @@ public class OverlayRegistry * @param overlay An instance, lambda or method reference for the logic used in rendering the overlay. * @return The same object passed into the {@code overlay} parameter. */ - public static synchronized IIngameOverlay registerOverlayBottom(@Nonnull String displayName, @Nonnull IIngameOverlay overlay) + public static synchronized IIngameOverlay registerOverlayBottom(@NotNull String displayName, @NotNull IIngameOverlay overlay) { return registerOverlay(-1, null, displayName, overlay); } @@ -36,7 +36,7 @@ public static synchronized IIngameOverlay registerOverlayBottom(@Nonnull String * @param overlay An instance, lambda or method reference for the logic used in rendering the overlay. * @return The same object passed into the {@code overlay} parameter. */ - public static synchronized IIngameOverlay registerOverlayBelow(@Nonnull IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) + public static synchronized IIngameOverlay registerOverlayBelow(@NotNull IIngameOverlay other, @NotNull String displayName, @NotNull IIngameOverlay overlay) { return registerOverlay(-1, other, displayName, overlay); } @@ -49,7 +49,7 @@ public static synchronized IIngameOverlay registerOverlayBelow(@Nonnull IIngameO * @param overlay An instance, lambda or method reference for the logic used in rendering the overlay. * @return The same object passed into the {@code overlay} parameter. */ - public static synchronized IIngameOverlay registerOverlayAbove(@Nonnull IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) + public static synchronized IIngameOverlay registerOverlayAbove(@NotNull IIngameOverlay other, @NotNull String displayName, @NotNull IIngameOverlay overlay) { return registerOverlay(1, other, displayName, overlay); } @@ -61,12 +61,12 @@ public static synchronized IIngameOverlay registerOverlayAbove(@Nonnull IIngameO * @param overlay An instance, lambda or method reference for the logic used in rendering the overlay. * @return The same object passed into the {@code overlay} parameter. */ - public static synchronized IIngameOverlay registerOverlayTop(@Nonnull String displayName, @Nonnull IIngameOverlay overlay) + public static synchronized IIngameOverlay registerOverlayTop(@NotNull String displayName, @NotNull IIngameOverlay overlay) { return registerOverlay(1, null, displayName, overlay); } - private static IIngameOverlay registerOverlay(int sort, @Nullable IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) + private static IIngameOverlay registerOverlay(int sort, @Nullable IIngameOverlay other, @NotNull String displayName, @NotNull IIngameOverlay overlay) { OverlayEntry entry = overlays.get(overlay); @@ -108,7 +108,7 @@ private static IIngameOverlay registerOverlay(int sort, @Nullable IIngameOverlay * @param overlay The overlay object to enable or disable * @param enable The new state */ - public static synchronized void enableOverlay(@Nonnull IIngameOverlay overlay, boolean enable) + public static synchronized void enableOverlay(@NotNull IIngameOverlay overlay, boolean enable) { OverlayEntry entry = overlays.get(overlay); if (entry != null) @@ -123,7 +123,7 @@ public static synchronized void enableOverlay(@Nonnull IIngameOverlay overlay, b * @return The registration entry for this overlay. */ @Nullable - public static synchronized OverlayEntry getEntry(@Nonnull IIngameOverlay overlay) + public static synchronized OverlayEntry getEntry(@NotNull IIngameOverlay overlay) { return overlays.get(overlay); } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java b/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java index a453580b1b0..7ece01d69dd 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.client.gui.GuiUtils; /** @@ -46,7 +45,7 @@ public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float part if (strWidth > width - 6 && strWidth > ellipsisWidth) //TODO, srg names make it hard to figure out how to append to an ITextProperties from this trim operation, wraping this in StringTextComponent is kinda dirty. - buttonText = new TextComponent(mc.font.substrByWidth(buttonText, width - 6 - ellipsisWidth).getString() + "..."); + buttonText = Component.literal(mc.font.substrByWidth(buttonText, width - 6 - ellipsisWidth).getString() + "..."); drawCenteredString(poseStack, mc.font, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, getFGColor()); } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java b/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java index e5c64c957b8..0c66fd03564 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.util.Mth; import org.lwjgl.glfw.GLFW; @@ -47,7 +46,7 @@ public class ForgeSlider extends AbstractSliderButton */ public ForgeSlider(int x, int y, int width, int height, Component prefix, Component suffix, double minValue, double maxValue, double currentValue, double stepSize, int precision, boolean drawString) { - super(x, y, width, height, TextComponent.EMPTY, 0D); + super(x, y, width, height, Component.empty(), 0D); this.prefix = prefix; this.suffix = suffix; this.minValue = minValue; @@ -207,11 +206,11 @@ protected void updateMessage() { if (this.drawString) { - this.setMessage(new TextComponent("").append(prefix).append(this.getValueString()).append(suffix)); + this.setMessage(Component.literal("").append(prefix).append(this.getValueString()).append(suffix)); } else { - this.setMessage(TextComponent.EMPTY); + this.setMessage(Component.empty()); } } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java b/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java index a167d6f586f..ea0d952de53 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java @@ -9,12 +9,10 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.ObjectSelectionList; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.locale.Language; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.client.gui.ModListScreen; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.common.util.MavenVersionStringHelper; @@ -73,14 +71,14 @@ public class ModEntry extends ObjectSelectionList.Entry { @Override public Component getNarration() { - return new TranslatableComponent("narrator.select", modInfo.getDisplayName()); + return Component.translatable("narrator.select", modInfo.getDisplayName()); } @Override public void render(PoseStack poseStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTick) { - Component name = new TextComponent(stripControlCodes(modInfo.getDisplayName())); - Component version = new TextComponent(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); + Component name = Component.literal(stripControlCodes(modInfo.getDisplayName())); + Component version = Component.literal(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo); Font font = this.parent.getFontRenderer(); font.draw(poseStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth))), left + 3, top + 2, 0xFFFFFF); diff --git a/src/main/java/net/minecraftforge/client/gui/widget/Slider.java b/src/main/java/net/minecraftforge/client/gui/widget/Slider.java deleted file mode 100644 index 9400fd009ed..00000000000 --- a/src/main/java/net/minecraftforge/client/gui/widget/Slider.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.gui.widget; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraftforge.client.gui.GuiUtils; - -import javax.annotation.Nullable; - -/** - * This class is blatantly stolen from iChunUtils with permission. - * - * @deprecated This class has a few issues, - * mainly MinecraftForge/MinecraftForge#8485. - * Use {@link ForgeSlider} instead. - * - * @author iChun - */ -@Deprecated(since = "1.18.2", forRemoval = true) -public class Slider extends ExtendedButton -{ - /** The value of this slider control. */ - public double sliderValue = 1.0F; - - public Component dispString; - - /** Is this slider control being dragged. */ - public boolean dragging = false; - public boolean showDecimal = true; - - public double minValue = 0.0D; - public double maxValue = 5.0D; - public int precision = 1; - - @Nullable - public ISlider parent = null; - - public Component suffix; - - public boolean drawString = true; - - public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, OnPress handler) - { - this(xPos, yPos, width, height, prefix, suf, minVal, maxVal, currentVal, showDec, drawStr, handler, null); - } - - public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, OnPress handler, @Nullable ISlider par) - { - super(xPos, yPos, width, height, prefix, handler); - minValue = minVal; - maxValue = maxVal; - sliderValue = (currentVal - minValue) / (maxValue - minValue); - dispString = prefix; - parent = par; - suffix = suf; - showDecimal = showDec; - String val; - - if (showDecimal) - { - val = Double.toString(sliderValue * (maxValue - minValue) + minValue); - precision = Math.min(val.substring(val.indexOf(".") + 1).length(), 4); - } - else - { - val = Integer.toString((int)Math.round(sliderValue * (maxValue - minValue) + minValue)); - precision = 0; - } - - setMessage(new TextComponent("").append(dispString).append(val).append(suffix)); - - drawString = drawStr; - if(!drawString) - setMessage(new TextComponent("")); - } - - public Slider(int xPos, int yPos, Component displayStr, double minVal, double maxVal, double currentVal, OnPress handler, ISlider par) - { - this(xPos, yPos, 150, 20, displayStr, new TextComponent(""), minVal, maxVal, currentVal, true, true, handler, par); - } - - /** - * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over - * this button. - */ - @Override - public int getYImage(boolean par1) - { - return 0; - } - - /** - * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). - */ - @Override - protected void renderBg(PoseStack poseStack, Minecraft minecraft, int par2, int par3) - { - if (this.visible) - { - if (this.dragging) - { - this.sliderValue = (par2 - (this.x + 4)) / (float)(this.width - 8); - updateSlider(); - } - - GuiUtils.drawContinuousTexturedBox(poseStack, 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()); - } - } - - /** - * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent - * e). - */ - @Override - public void onClick(double mouseX, double mouseY) - { - this.sliderValue = (mouseX - (this.x + 4)) / (this.width - 8); - updateSlider(); - this.dragging = true; - } - - public void updateSlider() - { - if (this.sliderValue < 0.0F) - { - this.sliderValue = 0.0F; - } - - if (this.sliderValue > 1.0F) - { - this.sliderValue = 1.0F; - } - - String val; - - if (showDecimal) - { - val = Double.toString(sliderValue * (maxValue - minValue) + minValue); - - if (val.substring(val.indexOf(".") + 1).length() > precision) - { - val = val.substring(0, val.indexOf(".") + precision + 1); - - if (val.endsWith(".")) - { - val = val.substring(0, val.indexOf(".") + precision); - } - } - else - { - while (val.substring(val.indexOf(".") + 1).length() < precision) - { - val = val + "0"; - } - } - } - else - { - val = Integer.toString((int)Math.round(sliderValue * (maxValue - minValue) + minValue)); - } - - if(drawString) - { - setMessage(new TextComponent("").append(dispString).append(val).append(suffix)); - } - - if (parent != null) - { - parent.onChangeSliderValue(this); - } - } - - /** - * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). - */ - @Override - public void onRelease(double mouseX, double mouseY) - { - this.dragging = false; - } - - public int getValueInt() - { - return (int)Math.round(sliderValue * (maxValue - minValue) + minValue); - } - - public double getValue() - { - return sliderValue * (maxValue - minValue) + minValue; - } - - public void setValue(double d) - { - this.sliderValue = (d - minValue) / (maxValue - minValue); - } - - public static interface ISlider - { - void onChangeSliderValue(Slider slider); - } -} diff --git a/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java b/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java index 0cf57b69fed..e58e7fd4808 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.client.gui.GuiUtils; /** @@ -47,14 +46,14 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic int totalWidth = strWidth + glyphWidth; if (totalWidth > width - 6 && totalWidth > ellipsisWidth) - buttonText = new TextComponent(mc.font.substrByWidth(buttonText, width - 6 - ellipsisWidth).getString().trim() + "...") ; + buttonText = Component.literal(mc.font.substrByWidth(buttonText, width - 6 - ellipsisWidth).getString().trim() + "...") ; strWidth = mc.font.width(buttonText); totalWidth = glyphWidth + strWidth; poseStack.pushPose(); poseStack.scale(glyphScale, glyphScale, 1.0F); - this.drawCenteredString(poseStack, mc.font, new TextComponent(glyph), + this.drawCenteredString(poseStack, mc.font, Component.literal(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()); poseStack.popPose(); diff --git a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java index 4544e018acd..949a16c58c5 100644 --- a/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/client/loading/ClientModLoader.java @@ -14,6 +14,7 @@ import java.util.concurrent.*; import java.util.function.Consumer; +import net.minecraft.network.chat.Component; import net.minecraft.server.packs.repository.RepositorySource; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.repository.PackSource; @@ -40,7 +41,6 @@ import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.ModelLoaderRegistry; @@ -209,7 +209,7 @@ private static void clientPackFinder(Map m } } final Pack packInfo = Pack.create("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", - new PackMetadataSection(new TranslatableComponent("fml.resources.modresources", hiddenPacks.size()), PackType.CLIENT_RESOURCES.getVersion(SharedConstants.getCurrentVersion())), + new PackMetadataSection(Component.translatable("fml.resources.modresources", hiddenPacks.size()), PackType.CLIENT_RESOURCES.getVersion(SharedConstants.getCurrentVersion())), hiddenPacks), factory, Pack.Position.BOTTOM, PackSource.DEFAULT); consumer.accept(packInfo); } diff --git a/src/main/java/net/minecraftforge/client/loading/EarlyLoaderGUI.java b/src/main/java/net/minecraftforge/client/loading/EarlyLoaderGUI.java index 7a3cf3b7839..b63ca31f3d6 100644 --- a/src/main/java/net/minecraftforge/client/loading/EarlyLoaderGUI.java +++ b/src/main/java/net/minecraftforge/client/loading/EarlyLoaderGUI.java @@ -67,7 +67,7 @@ void renderTick() { private void renderBackground() { GL11.glBegin(GL11.GL_QUADS); - boolean isDarkBackground = minecraft.options.darkMojangStudiosBackground; + boolean isDarkBackground = minecraft.options.darkMojangStudiosBackground().get(); GL11.glColor4f(isDarkBackground ? 0 : (239F / 255F), isDarkBackground ? 0 : (50F / 255F), isDarkBackground ? 0 : (61F / 255F), 1); //Color from LoadingOverlay GL11.glVertex3f(0, 0, -10); GL11.glVertex3f(0, window.getGuiScaledHeight(), -10); diff --git a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java index 67d2ba9de45..5d808dde17f 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedItemModel.java +++ b/src/main/java/net/minecraftforge/client/model/BakedItemModel.java @@ -5,14 +5,12 @@ package net.minecraftforge.client.model; -import javax.annotation.Nullable; - import java.util.List; -import java.util.Random; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import com.mojang.math.Transformation; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -21,6 +19,7 @@ import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; +import org.jetbrains.annotations.Nullable; public class BakedItemModel implements BakedModel { @@ -55,7 +54,7 @@ private static boolean hasGuiIdentity(ImmutableMap getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand) { if (side == null) { @@ -93,7 +92,7 @@ public BakedGuiItemModel(T originalModel) } @Override - public List getQuads (@Nullable BlockState state, @Nullable Direction side, Random rand) + public List getQuads (@Nullable BlockState state, @Nullable Direction side, RandomSource rand) { if(side == null) { diff --git a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java index 1826b529d88..27ae84a0e6a 100644 --- a/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/BakedModelWrapper.java @@ -5,12 +5,10 @@ package net.minecraftforge.client.model; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; -import java.util.Random; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; @@ -21,6 +19,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.client.model.data.IModelData; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public abstract class BakedModelWrapper implements BakedModel { @@ -32,7 +32,7 @@ public BakedModelWrapper(T originalModel) } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand) { return originalModel.getQuads(state, side, rand); } @@ -98,21 +98,21 @@ public BakedModel handlePerspective(ItemTransforms.TransformType cameraTransform } @Override - public TextureAtlasSprite getParticleIcon(@Nonnull IModelData data) + public TextureAtlasSprite getParticleIcon(@NotNull IModelData data) { return originalModel.getParticleIcon(data); } - @Nonnull + @NotNull @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) { return originalModel.getQuads(state, side, rand, extraData); } - @Nonnull + @NotNull @Override - public IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData) + public IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData modelData) { return originalModel.getModelData(level, pos, state, modelData); } diff --git a/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java index 5042233ae67..9e56877491e 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java +++ b/src/main/java/net/minecraftforge/client/model/BlockModelConfiguration.java @@ -11,7 +11,6 @@ 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; @@ -23,6 +22,7 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; public class BlockModelConfiguration implements IModelConfiguration { diff --git a/src/main/java/net/minecraftforge/client/model/CompositeModel.java b/src/main/java/net/minecraftforge/client/model/CompositeModel.java index 40b7c07622b..483c05a442e 100644 --- a/src/main/java/net/minecraftforge/client/model/CompositeModel.java +++ b/src/main/java/net/minecraftforge/client/model/CompositeModel.java @@ -11,6 +11,7 @@ import com.google.gson.JsonObject; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.server.packs.resources.ResourceManager; @@ -22,8 +23,6 @@ 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; @@ -36,6 +35,8 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class CompositeModel implements IDynamicBakedModel { @@ -58,9 +59,9 @@ public CompositeModel(boolean isGui3d, boolean isSideLit, boolean isAmbientOcclu this.transforms = combinedTransform; } - @Nonnull + @NotNull @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(); for(Map.Entry entry : bakedParts.entrySet()) @@ -70,9 +71,9 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction return quads; } - @Nonnull + @NotNull @Override - public IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData) + public IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData modelData) { CompositeModelData composite = new CompositeModelData(); for(Map.Entry entry : bakedParts.entrySet()) diff --git a/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java b/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java index 5dff006e3ce..8896554b6aa 100644 --- a/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java +++ b/src/main/java/net/minecraftforge/client/model/DynamicBucketModel.java @@ -28,8 +28,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Function; @@ -40,6 +38,8 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public final class DynamicBucketModel implements IModelGeometry { @@ -51,7 +51,7 @@ public final class DynamicBucketModel implements IModelGeometry { Fluid fluid = fluidStack.getFluid(); - String name = fluid.getRegistryName().toString(); + String name = ForgeRegistries.FLUIDS.getKey(fluid).toString(); if (!cache.containsKey(name)) { diff --git a/src/main/java/net/minecraftforge/client/model/FluidModel.java b/src/main/java/net/minecraftforge/client/model/FluidModel.java index 2539f6cdcd1..c62c722dd6a 100644 --- a/src/main/java/net/minecraftforge/client/model/FluidModel.java +++ b/src/main/java/net/minecraftforge/client/model/FluidModel.java @@ -11,12 +11,10 @@ import java.util.EnumMap; import java.util.List; import java.util.Optional; -import java.util.Random; import java.util.Set; -import javax.annotation.Nullable; - import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import com.mojang.math.Transformation; import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; @@ -51,6 +49,7 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; public final class FluidModel implements IModelGeometry { @@ -186,7 +185,7 @@ private static boolean[] getOverlay(Optional stateOption) } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, IModelData modelData) { if (side != null) { @@ -450,7 +449,7 @@ public TextureAtlasSprite getParticleIcon() } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand) { return side == null ? ImmutableList.of() : faceQuads.get(side); } diff --git a/src/main/java/net/minecraftforge/client/model/ForgeModelBakery.java b/src/main/java/net/minecraftforge/client/model/ForgeModelBakery.java index a3177bafd3e..e3d30af692c 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeModelBakery.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeModelBakery.java @@ -23,8 +23,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nullable; - import static net.minecraftforge.fml.Logging.MODELLOADING; import net.minecraft.client.resources.model.BakedModel; @@ -32,6 +30,7 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; public final class ForgeModelBakery extends ModelBakery { diff --git a/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java index e1d5f07cb41..491a75c386b 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java +++ b/src/main/java/net/minecraftforge/client/model/IModelConfiguration.java @@ -10,8 +10,7 @@ import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.Material; import net.minecraftforge.client.model.geometry.IModelGeometryPart; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /* * Interface that provides generic access to the data within BlockModel, diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 7dc82851170..7958f2ae1ef 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -26,7 +26,6 @@ import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.TRSRTransformer; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Function; @@ -38,6 +37,7 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; /** * Forge reimplementation of vanilla {@link ItemModelGenerator}, i.e. builtin/generated models, diff --git a/src/main/java/net/minecraftforge/client/model/ItemMultiLayerBakedModel.java b/src/main/java/net/minecraftforge/client/model/ItemMultiLayerBakedModel.java index a29894f9ae8..3d954794f99 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemMultiLayerBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemMultiLayerBakedModel.java @@ -10,6 +10,7 @@ import com.google.common.collect.Lists; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -22,12 +23,11 @@ import com.mojang.math.Transformation; import net.minecraftforge.client.model.data.IDynamicBakedModel; import net.minecraftforge.client.model.data.IModelData; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Random; public class ItemMultiLayerBakedModel implements IDynamicBakedModel { @@ -54,7 +54,7 @@ public ItemMultiLayerBakedModel(boolean smoothLighting, boolean shadedInGui, boo } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, IModelData modelData) { List quads = Lists.newArrayList(); layerModels.forEach(lm -> quads.addAll(lm.getFirst().getQuads(state, side, rand, modelData))); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java index bd393a1a362..bf06509adb0 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java @@ -12,8 +12,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import javax.annotation.Nullable; - import com.google.common.base.Preconditions; import net.minecraft.client.Minecraft; @@ -27,14 +25,15 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; +import org.jetbrains.annotations.Nullable; @EventBusSubscriber(modid = "forge", bus = Bus.FORGE, value = Dist.CLIENT) public class ModelDataManager { private static WeakReference currentLevel = new WeakReference<>(null); - + private static final Map> needModelDataRefresh = new ConcurrentHashMap<>(); - + private static final Map> modelDataCache = new ConcurrentHashMap<>(); private static void cleanCaches(Level level) @@ -48,7 +47,7 @@ private static void cleanCaches(Level level) modelDataCache.clear(); } } - + public static void requestModelDataRefresh(BlockEntity te) { Preconditions.checkNotNull(te, "Tile entity must not be null"); @@ -58,9 +57,9 @@ public static void requestModelDataRefresh(BlockEntity te) needModelDataRefresh.computeIfAbsent(new ChunkPos(te.getBlockPos()), $ -> Collections.synchronizedSet(new HashSet<>())) .add(te.getBlockPos()); } - + private static void refreshModelData(Level level, ChunkPos chunk) - { + { cleanCaches(level); Set needUpdate = needModelDataRefresh.remove(chunk); @@ -81,22 +80,22 @@ private static void refreshModelData(Level level, ChunkPos chunk) } } } - + @SubscribeEvent public static void onChunkUnload(ChunkEvent.Unload event) { if (!event.getChunk().getWorldForge().isClientSide()) return; - + ChunkPos chunk = event.getChunk().getPos(); needModelDataRefresh.remove(chunk); modelDataCache.remove(chunk); } - + public static @Nullable IModelData getModelData(Level level, BlockPos pos) { return getModelData(level, new ChunkPos(pos)).get(pos); } - + public static Map getModelData(Level level, ChunkPos pos) { Preconditions.checkArgument(level.isClientSide, "Cannot request model data for server level"); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index bba686bffdb..dd4edf45124 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -28,7 +28,6 @@ import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.common.model.TransformationHelper; -import javax.annotation.Nullable; import java.lang.reflect.Type; import java.util.*; import java.util.function.Function; @@ -49,6 +48,7 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; import net.minecraftforge.common.util.Lazy; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 6234f64d6dc..de1b3cc7e45 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -7,14 +7,12 @@ import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.collect.*; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.RenderType; import com.mojang.math.Transformation; @@ -45,6 +43,8 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A model that can be rendered in multiple {@link RenderType}. @@ -132,9 +132,9 @@ public MultiLayerBakedModel( }).collect(Collectors.toList()); } - @Nonnull + @NotNull @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) { RenderType layer = MinecraftForgeClient.getRenderType(); if (layer == null) diff --git a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java index 250b466d36c..5ee4ad393f6 100644 --- a/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java +++ b/src/main/java/net/minecraftforge/client/model/PerspectiveMapWrapper.java @@ -6,11 +6,11 @@ package net.minecraftforge.client.model; import java.util.EnumMap; -import java.util.Random; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.multiplayer.ClientLevel; @@ -22,15 +22,14 @@ import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.common.model.TransformationHelper; -import javax.annotation.Nullable; import java.util.List; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverride; import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.ModelState; +import org.jetbrains.annotations.Nullable; public class PerspectiveMapWrapper implements IDynamicBakedModel { @@ -124,7 +123,7 @@ public static BakedModel handlePerspective(BakedModel model, ModelState state, I @Override public TextureAtlasSprite getParticleIcon() { return parent.getParticleIcon(); } @SuppressWarnings("deprecation") @Override public ItemTransforms getTransforms() { return parent.getTransforms(); } - @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData) + @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, IModelData extraData) { return parent.getQuads(state, side, rand, extraData); } diff --git a/src/main/java/net/minecraftforge/client/model/SeparatePerspectiveModel.java b/src/main/java/net/minecraftforge/client/model/SeparatePerspectiveModel.java index 468ac419cde..263940a1b79 100644 --- a/src/main/java/net/minecraftforge/client/model/SeparatePerspectiveModel.java +++ b/src/main/java/net/minecraftforge/client/model/SeparatePerspectiveModel.java @@ -13,7 +13,7 @@ import com.google.gson.JsonObject; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; -import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.server.packs.resources.ResourceManager; @@ -22,21 +22,18 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.model.geometry.IModelGeometry; -import javax.annotation.Nullable; import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; import java.util.function.Function; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; -import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.Nullable; public class SeparatePerspectiveModel implements IModelGeometry { @@ -94,7 +91,7 @@ public BakedModel(boolean isAmbientOcclusion, boolean isGui3d, boolean isSideLit } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand) { return Collections.emptyList(); } diff --git a/src/main/java/net/minecraftforge/client/model/StandaloneModelConfiguration.java b/src/main/java/net/minecraftforge/client/model/StandaloneModelConfiguration.java index 65c3c1946b0..ee78654b2d6 100644 --- a/src/main/java/net/minecraftforge/client/model/StandaloneModelConfiguration.java +++ b/src/main/java/net/minecraftforge/client/model/StandaloneModelConfiguration.java @@ -12,8 +12,8 @@ import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.textures.UnitSprite; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Map; /** diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java deleted file mode 100644 index ddd36885ea1..00000000000 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.model.b3d; - -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.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexFormatElement; -import com.mojang.math.Matrix4f; -import com.mojang.math.Transformation; -import com.mojang.math.Vector3f; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemOverrides; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; -import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureAtlas; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.*; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.Mth; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.CompositeModelState; -import net.minecraftforge.client.model.ForgeModelBakery; -import net.minecraftforge.client.model.ModelLoadingException; -import net.minecraftforge.client.model.PerspectiveMapWrapper; -import net.minecraftforge.client.model.b3d.B3DModel.*; -import net.minecraftforge.client.model.data.IDynamicBakedModel; -import net.minecraftforge.client.model.data.IModelData; -import net.minecraftforge.client.model.pipeline.BakedQuadBuilder; -import net.minecraftforge.client.model.pipeline.IVertexConsumer; -import net.minecraftforge.common.model.TransformationHelper; -import net.minecraftforge.common.property.Properties; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.tuple.Triple; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.stream.Collectors; - -/* - * Loader for Blitz3D models. - */ -@Deprecated(forRemoval = true, since = "1.18") -public enum B3DLoader -{ - INSTANCE; - - private static final Logger LOGGER = LogManager.getLogger(); - - private ResourceManager manager; - - private final Set enabledDomains = new HashSet<>(); - private final Map cache = new HashMap<>(); - - public UnbakedModel loadModel(ResourceLocation modelLocation) throws Exception - { - ResourceLocation file = new ResourceLocation(modelLocation.getNamespace(), modelLocation.getPath()); - if(!cache.containsKey(file)) - { - Resource resource = null; - 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; - } - B3DModel.Parser parser = new B3DModel.Parser(resource.getInputStream()); - B3DModel model = parser.parse(); - cache.put(file, model); - } - catch(IOException e) - { - cache.put(file, null); - throw e; - } - finally - { - IOUtils.closeQuietly(resource); - } - } - B3DModel model = cache.get(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, true, 1); - } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, true, 1); - } - - public static final class B3DState implements ModelState - { - @Nullable - private final Animation animation; - private final int frame; - private final int nextFrame; - private final float progress; - @Nullable - private final ModelState parent; - - public B3DState(@Nullable Animation animation, int frame) - { - this(animation, frame, frame, 0); - } - - public B3DState(@Nullable Animation animation, int frame, ModelState parent) - { - this(animation, frame, frame, 0, parent); - } - - public B3DState(@Nullable Animation animation, int frame, int nextFrame, float progress) - { - this(animation, frame, nextFrame, progress, null); - } - - public B3DState(@Nullable Animation animation, int frame, int nextFrame, float progress, @Nullable ModelState parent) - { - this.animation = animation; - this.frame = frame; - this.nextFrame = nextFrame; - this.progress = Mth.clamp(progress, 0, 1); - this.parent = getParent(parent); - } - - @Nullable - private ModelState getParent(@Nullable ModelState parent) - { - if (parent == null) return null; - else if (parent instanceof B3DState) return ((B3DState)parent).parent; - return parent; - } - - @Nullable - public Animation getAnimation() - { - return animation; - } - - public int getFrame() - { - return frame; - } - - public int getNextFrame() - { - return nextFrame; - } - - public float getProgress() - { - return progress; - } - - @Nullable - public ModelState getParent() - { - return parent; - } - - - @Override - public Transformation getRotation() - { - if(parent != null) - { - return parent.getRotation(); - } - return Transformation.identity(); - } - - @Override - public Transformation getPartTransformation(Object part) - { - // TODO make more use of Optional - - if(!(part instanceof NodeJoint)) - { - return Transformation.identity(); - } - Node node = ((NodeJoint)part).getNode(); - Transformation nodeTransform; - if(progress < 1e-5 || frame == nextFrame) - { - nodeTransform = getNodeMatrix(node, frame); - } - else if(progress > 1 - 1e-5) - { - nodeTransform = getNodeMatrix(node, nextFrame); - } - else - { - nodeTransform = getNodeMatrix(node, frame); - nodeTransform = TransformationHelper.slerp(nodeTransform,getNodeMatrix(node, nextFrame), progress); - } - if(parent != null && node.getParent() == null) - { - return parent.getPartTransformation(part).compose(nodeTransform); - } - return nodeTransform; - } - - private static LoadingCache, Integer>, Transformation> cache = CacheBuilder.newBuilder() - .maximumSize(16384) - .expireAfterAccess(2, TimeUnit.MINUTES) - .build(new CacheLoader, Integer>, Transformation>() - { - @Override - public Transformation load(Triple, Integer> key) throws Exception - { - return getNodeMatrix(key.getLeft(), key.getMiddle(), key.getRight()); - } - }); - - public Transformation getNodeMatrix(Node node) - { - return getNodeMatrix(node, frame); - } - - public Transformation getNodeMatrix(Node node, int frame) - { - return cache.getUnchecked(Triple.of(animation, node, frame)); - } - - public static Transformation getNodeMatrix(@Nullable Animation animation, Node node, int frame) - { - Transformation ret = Transformation.identity(); - Key key = null; - if(animation != null) key = animation.getKeys().get(frame, node); - else if(node.getAnimation() != null) key = node.getAnimation().getKeys().get(frame, node); - if(key != null) - { - Node parent = node.getParent(); - if(parent != null) - { - // parent model-global current pose - Transformation pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); - ret = ret.compose(pm); - // joint offset in the parent coords - ret = ret.compose(new Transformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); - } - // current node local pose - ret = ret.compose(new Transformation(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(); - rm.invert(); - ret = ret.compose(new TRSRTransformation(rm)); - if(parent != null) - { - // inverse bind of the parent - rm = new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null).getMatrix(); - rm.invert(); - ret = ret.compose(new TRSRTransformation(rm)); - }*/ - // TODO cache - Transformation invBind = new NodeJoint(node).getInvBindPose(); - ret = ret.compose(invBind); - } - else - { - Node parent = node.getParent(); - if(parent != null) - { - // parent model-global current pose - Transformation pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame)); - ret = ret.compose(pm); - // joint offset in the parent coords - ret = ret.compose(new Transformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); - } - ret = ret.compose(new Transformation(node.getPos(), node.getRot(), node.getScale(), null)); - // TODO cache - Transformation invBind = new NodeJoint(node).getInvBindPose(); - ret = ret.compose(invBind); - } - return ret; - } - } - - static final class NodeJoint - { - private final Node node; - - public NodeJoint(Node node) - { - this.node = node; - } - - public Transformation getInvBindPose() - { - Matrix4f m = new Transformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); - m.invert(); - Transformation pose = new Transformation(m); - - if(node.getParent() != null) - { - Transformation parent = new NodeJoint(node.getParent()).getInvBindPose(); - pose = pose.compose(parent); - } - return pose; - } - - public Optional getParent() - { - // FIXME cache? - if(node.getParent() == null) return Optional.empty(); - return Optional.of(new NodeJoint(node.getParent())); - } - - public Node getNode() - { - return node; - } - - public int hashCode() - { - return node.hashCode(); - } - - public boolean equals(Object obj) - { - if (this == obj) return true; - if (!super.equals(obj)) return false; - if (getClass() != obj.getClass()) return false; - NodeJoint other = (NodeJoint) obj; - return Objects.equal(node, other.node); - } - } - - private static final class ModelWrapper implements UnbakedModel - { - private final ResourceLocation modelLocation; - private final B3DModel model; - private final ImmutableSet meshes; - private final ImmutableMap textures; - private final boolean smooth; - private final boolean gui3d; - private final boolean isSideLit; - private final int defaultKey; - - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, boolean isSideLit, int defaultKey) - { - this(modelLocation, model, meshes, smooth, gui3d, isSideLit, defaultKey, buildTextures(model.getTextures())); - } - - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, boolean isSideLit, int defaultKey, ImmutableMap textures) - { - this.modelLocation = modelLocation; - this.model = model; - this.meshes = meshes; - this.isSideLit = isSideLit; - this.textures = textures; - this.smooth = smooth; - this.gui3d = gui3d; - this.defaultKey = defaultKey; - } - - private static ImmutableMap buildTextures(List textures) - { - 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, location); - } - return builder.build(); - } - - private static String getLocation(String path) - { - if(path.endsWith(".png")) path = path.substring(0, path.length() - ".png".length()); - return path; - } - - @SuppressWarnings("deprecation") - @Override - public Collection getMaterials(Function modelGetter, Set> missingTextureErrors) - { - return textures.values().stream().filter(loc -> !loc.startsWith("#")) - .map(t -> new Material(TextureAtlas.LOCATION_BLOCKS, new ResourceLocation(t))) - .collect(Collectors.toList()); - } - - @Override - public Collection getDependencies() - { - return Collections.emptyList(); - } - - @SuppressWarnings("deprecation") - @Nullable - @Override - public BakedModel bake(ModelBakery bakery, Function spriteGetter, ModelState modelTransform, ResourceLocation modelLocation) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - TextureAtlasSprite missing = spriteGetter.apply(new Material(TextureAtlas.LOCATION_BLOCKS, MissingTextureAtlasSprite.getLocation())); - for(Map.Entry e : textures.entrySet()) - { - if(e.getValue().startsWith("#")) - { - LOGGER.fatal("unresolved texture '{}' for b3d model '{}'", e.getValue(), this.modelLocation); - builder.put(e.getKey(), missing); - } - else - { - builder.put(e.getKey(), spriteGetter.apply(new Material(TextureAtlas.LOCATION_BLOCKS, new ResourceLocation(e.getValue())))); - } - } - builder.put("missingno", missing); - return new BakedWrapper(model.getRoot(), modelTransform, smooth, gui3d, isSideLit, meshes, builder.build()); - } - - public ModelWrapper retexture(ImmutableMap textures) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(Map.Entry e : this.textures.entrySet()) - { - String path = e.getKey(); - String loc = getLocation(path); - // 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 = textures.get(alt); - if(newLoc == null) newLoc = path.substring(1); - builder.put(e.getKey(), newLoc); - } - else - { - builder.put(e); - } - } - return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, isSideLit, defaultKey, builder.build()); - } - - public ModelWrapper process(ImmutableMap data) - { - ImmutableSet newMeshes = this.meshes; - int newDefaultKey = this.defaultKey; - boolean hasChanged = false; - if(data.containsKey("mesh")) - { - JsonElement e = new JsonParser().parse(data.get("mesh")); - if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) - { - return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), smooth, gui3d, isSideLit, defaultKey, textures); - } - else if (e.isJsonArray()) - { - ImmutableSet.Builder builder = ImmutableSet.builder(); - for(JsonElement s : e.getAsJsonArray()) - { - if(s.isJsonPrimitive() && s.getAsJsonPrimitive().isString()) - { - builder.add(s.getAsString()); - } - else - { - LOGGER.fatal("unknown mesh definition '{}' in array for b3d model '{}'", s.toString(), modelLocation); - return this; - } - } - newMeshes = builder.build(); - hasChanged = true; - } - else - { - LOGGER.fatal("unknown mesh definition '{}' for b3d model '{}'", e.toString(), modelLocation); - return this; - } - } - if(data.containsKey("key")) - { - JsonElement e = new JsonParser().parse(data.get("key")); - if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) - { - newDefaultKey = e.getAsNumber().intValue(); - hasChanged = true; - } - else - { - LOGGER.fatal("unknown keyframe definition '{}' for b3d model '{}'", e.toString(), modelLocation); - return this; - } - } - return hasChanged ? new ModelWrapper(modelLocation, model, newMeshes, smooth, gui3d, isSideLit, newDefaultKey, textures) : this; - } - - public ModelState getDefaultState() - { - return new B3DState(model.getRoot().getAnimation(), defaultKey, defaultKey, 0); - } - - public ModelWrapper smoothLighting(boolean value) - { - if(value == smooth) - { - return this; - } - return new ModelWrapper(modelLocation, model, meshes, value, gui3d, isSideLit, defaultKey, textures); - } - - public ModelWrapper gui3d(boolean value) - { - if(value == gui3d) - { - return this; - } - return new ModelWrapper(modelLocation, model, meshes, smooth, value, isSideLit, defaultKey, textures); - } - } - - private static final class BakedWrapper implements IDynamicBakedModel - { - private final Node node; - private final ModelState state; - private final boolean smooth; - private final boolean gui3d; - private final boolean isSideLit; - private final ImmutableSet meshes; - private final ImmutableMap textures; - private final LoadingCache cache; - - private ImmutableList quads; - - public record HiddenModelPart(ImmutableList path) { } - - public BakedWrapper(final Node node, final ModelState state, final boolean smooth, final boolean gui3d, boolean isSideLit, final ImmutableSet meshes, final ImmutableMap textures) - { - this(node, state, smooth, gui3d, isSideLit, meshes, textures, CacheBuilder.newBuilder() - .maximumSize(128) - .expireAfterAccess(2, TimeUnit.MINUTES) - .build(new CacheLoader() - { - @Override - public B3DState load(Integer frame) throws Exception - { - ModelState parent = state; - Animation newAnimation = node.getAnimation(); - if(parent instanceof B3DState) - { - B3DState ps = (B3DState)parent; - parent = ps.getParent(); - } - return new B3DState(newAnimation, frame, frame, 0, parent); - } - })); - } - - public BakedWrapper(Node node, ModelState state, boolean smooth, boolean gui3d, boolean isSideLit, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) - { - this.node = node; - this.state = state; - this.smooth = smooth; - this.gui3d = gui3d; - this.isSideLit = isSideLit; - this.meshes = meshes; - this.textures = textures; - this.cache = cache; - } - - @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData data) - { - if(side != null) return ImmutableList.of(); - ModelState modelState = this.state; - ModelState newState = data.getData(Properties.AnimationProperty); - if(newState != null) - { - // FIXME: should animation state handle the parent state, or should it remain here? - ModelState parent = this.state; - if(parent instanceof B3DState) - { - B3DState ps = (B3DState)parent; - parent = ps.getParent(); - } - if (parent == null) - { - modelState = newState; - } - else - { - modelState = new CompositeModelState(parent, newState); - } - } - if(quads == null) - { - ImmutableList.Builder builder = ImmutableList.builder(); - generateQuads(builder, node, this.state, ImmutableList.of()); - quads = builder.build(); - } - // TODO: caching? - if(this.state != modelState) - { - ImmutableList.Builder builder = ImmutableList.builder(); - generateQuads(builder, node, modelState, ImmutableList.of()); - return builder.build(); - } - return quads; - } - - private void generateQuads(ImmutableList.Builder builder, Node node, final ModelState state, ImmutableList path) - { - ImmutableList.Builder pathBuilder = ImmutableList.builder(); - pathBuilder.addAll(path); - pathBuilder.add(node.getName()); - ImmutableList newPath = pathBuilder.build(); - for(Node child : node.getNodes().values()) - { - generateQuads(builder, child, state, newPath); - } - if(node.getKind() instanceof Mesh && meshes.contains(node.getName()) && state.getPartTransformation(new HiddenModelPart(newPath)).isIdentity()) - { - Mesh mesh = (Mesh)node.getKind(); - Collection faces = mesh.bake(new Function, Matrix4f>() - { - private final Transformation global = state.getRotation(); - private final LoadingCache, Transformation> localCache = CacheBuilder.newBuilder() - .maximumSize(32) - .build(new CacheLoader, Transformation>() - { - @Override - public Transformation load(Node node) throws Exception - { - return state.getPartTransformation(new NodeJoint(node)); - } - }); - - @Override - public Matrix4f apply(Node node) - { - return global.compose(localCache.getUnchecked(node)).getMatrix(); - } - }); - for(Face f : faces) - { - List textures = null; - 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 = ForgeModelBakery.White.instance(); - else sprite = this.textures.get(textures.get(0).getPath()); - BakedQuadBuilder quadBuilder = new BakedQuadBuilder(sprite); - quadBuilder.setContractUVs(true); - quadBuilder.setQuadOrientation(Direction.getNearest(f.getNormal().x(), f.getNormal().y(), f.getNormal().z())); - putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - builder.add(quadBuilder.build()); - } - } - } - - private final void putVertexData(IVertexConsumer consumer, Vertex v, Vector3f faceNormal, TextureAtlasSprite sprite) - { - // TODO handle everything not handled (texture transformations, bones, transformations, normals, e.t.c) - ImmutableList vertexFormatElements = consumer.getVertexFormat().getElements(); - for(int e = 0; e < vertexFormatElements.size(); e++) - { - switch(vertexFormatElements.get(e).getUsage()) - { - case POSITION: - consumer.put(e, v.getPos().x(), v.getPos().y(), v.getPos().z(), 1); - break; - case COLOR: - if(v.getColor() != null) - { - consumer.put(e, v.getColor().x(), v.getColor().y(), v.getColor().z(), v.getColor().w()); - } - else - { - consumer.put(e, 1, 1, 1, 1); - } - break; - case UV: - // TODO handle more brushes - if(vertexFormatElements.get(e).getIndex() < v.getTexCoords().length) - { - consumer.put(e, - sprite.getU(v.getTexCoords()[0].x() * 16), - sprite.getV(v.getTexCoords()[0].y() * 16), - 0, - 1 - ); - } - else - { - consumer.put(e, 0, 0, 0, 1); - } - break; - case NORMAL: - if(v.getNormal() != null) - { - consumer.put(e, v.getNormal().x(), v.getNormal().y(), v.getNormal().z(), 0); - } - else - { - consumer.put(e, faceNormal.x(), faceNormal.y(), faceNormal.z(), 0); - } - break; - default: - consumer.put(e); - } - } - } - - @Override - public boolean useAmbientOcclusion() - { - return smooth; - } - - @Override - public boolean isGui3d() - { - return gui3d; - } - - @Override - public boolean usesBlockLight() - { - return isSideLit; - } - - @Override - public boolean isCustomRenderer() - { - return false; - } - - @Override - public TextureAtlasSprite getParticleIcon() - { - // FIXME somehow specify particle texture in the model - return textures.values().asList().get(0); - } - - @Override - public boolean doesHandlePerspectives() - { - return true; - } - - @Override - public BakedModel handlePerspective(TransformType cameraTransformType, PoseStack poseStack) - { - return PerspectiveMapWrapper.handlePerspective(this, state, cameraTransformType, poseStack); - } - - @Override - public ItemOverrides getOverrides() - { - // TODO handle items - return ItemOverrides.EMPTY; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java deleted file mode 100644 index 429f3ee3be3..00000000000 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ /dev/null @@ -1,1140 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.model.b3d; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.channels.FileChannel; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import javax.annotation.Nullable; - -import net.minecraftforge.versions.forge.ForgeVersion; -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; - -import java.util.function.Function; -import com.google.common.base.Joiner; -import java.util.Optional; -import com.google.common.collect.HashBasedTable; -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.ImmutableTable; -import com.google.common.collect.Table; - -import com.mojang.math.Matrix4f; -import com.mojang.math.Quaternion; -import com.mojang.math.Transformation; -import com.mojang.math.Vector3f; -import com.mojang.math.Vector4f; -import net.minecraft.world.phys.Vec2; - -@Deprecated(forRemoval = true, since = "1.18") -public class B3DModel -{ - static final Logger logger = LogManager.getLogger(ForgeVersion.MOD_ID + ".B3DModel"); - private static final boolean printLoadedModels = "true".equals(System.getProperty("b3dloader.printLoadedModels")); - private final List textures; - private final List brushes; - private final Node root; - private final ImmutableMap> meshes; - - public B3DModel(List textures, List brushes, Node root, ImmutableMap> meshes) - { - this.textures = textures; - this.brushes = brushes; - this.root = root; - this.meshes = meshes; - } - - public static class Parser - { - private static final int version = 1; - private final ByteBuffer buf; - - private byte[] tag = new byte[4]; - private int length; - public Parser(InputStream in) throws IOException - { - if(in instanceof FileInputStream) - { - // fast shorthand for normal files - FileChannel channel = ((FileInputStream)in).getChannel(); - buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()).order(ByteOrder.LITTLE_ENDIAN); - } - else - { - // slower default for others - IOUtils.readFully(in, tag); - byte[] tmp = new byte[4]; - IOUtils.readFully(in, tmp); - int l = ByteBuffer.wrap(tmp).order(ByteOrder.LITTLE_ENDIAN).getInt(); - if(l < 0 || l + 8 < 0) throw new IOException("File is too large"); - buf = ByteBuffer.allocate(l + 8).order(ByteOrder.LITTLE_ENDIAN); - ((Buffer)buf).clear(); - buf.put(tag); - buf.put(tmp); - buf.put(IOUtils.toByteArray(in, l)); - ((Buffer)buf).flip(); - } - } - - private String dump = ""; - private void dump(String str) - { - if(printLoadedModels) - { - dump += str + "\n"; - } - } - - private B3DModel res; - - public B3DModel parse() throws IOException - { - if(res != null) return res; - dump = "\n"; - readHeader(); - res = bb3d(); - if(printLoadedModels) - { - logger.info(dump); - } - return res; - } - - private final List textures = new ArrayList<>(); - - private Texture getTexture(int texture) - { - if(texture > textures.size()) - { - logger.error("texture {} is out of range", texture); - return null; - } - else if(texture == -1) return Texture.White; - return textures.get(texture); - } - - private final List brushes = new ArrayList<>(); - - private @Nullable Brush getBrush(int brush) throws IOException - { - if(brush > brushes.size()) - { - throw new IOException(String.format(Locale.ENGLISH, "brush %s is out of range", brush)); - } - else if(brush == -1) return null; - return brushes.get(brush); - } - - private final List vertices = new ArrayList<>(); - - private Vertex getVertex(int vertex) throws IOException - { - if(vertex > vertices.size()) - { - throw new IOException(String.format(Locale.ENGLISH, "vertex %s is out of range", vertex)); - } - return vertices.get(vertex); - } - - private final ImmutableMap.Builder> meshes = ImmutableMap.builder(); - - private void readHeader() throws IOException - { - buf.get(tag); - length = buf.getInt(); - } - - private boolean isChunk(String tag) throws IOException - { - return Arrays.equals(this.tag, tag.getBytes("US-ASCII")); - } - - private void chunk(String tag) throws IOException - { - if(!isChunk(tag)) throw new IOException("Expected chunk " + tag + ", got " + new String(this.tag, "US-ASCII")); - pushLimit(); - } - - private String readString() throws IOException - { - int start = buf.position(); - while(buf.get() != 0); - int end = buf.position(); - byte[] tmp = new byte[end - start - 1]; - ((Buffer)buf).position(start); - buf.get(tmp); - buf.get(); - return new String(tmp, "UTF8"); - } - - private Deque limitStack = new ArrayDeque<>(); - - private void pushLimit() - { - limitStack.push(buf.limit()); - ((Buffer)buf).limit(buf.position() + length); - } - - private void popLimit() - { - ((Buffer)buf).limit(limitStack.pop()); - } - - private B3DModel bb3d() throws IOException - { - chunk("BB3D"); - int version = buf.getInt(); - if(version / 100 > Parser.version / 100) - throw new IOException("Unsupported major model version: " + ((float)version / 100)); - if(version % 100 > Parser.version % 100) - logger.warn(String.format(Locale.ENGLISH, "Minor version difference in model: %s", ((float)version / 100))); - List textures = Collections.emptyList(); - List brushes = Collections.emptyList(); - Node root = null; - dump("BB3D(version = " + version + ") {"); - while(buf.hasRemaining()) - { - readHeader(); - if (isChunk("TEXS")) textures = texs(); - else if(isChunk("BRUS")) brushes = brus(); - else if(isChunk("NODE")) root = node(); - else skip(); - } - dump("}"); - popLimit(); - if (root == null) { - throw new IOException("not found the root node in the model"); - } - return new B3DModel(textures, brushes, root, meshes.build()); - } - - private List texs() throws IOException - { - chunk("TEXS"); - List ret = new ArrayList<>(); - while(buf.hasRemaining()) - { - String path = readString(); - int flags = buf.getInt(); - int blend = buf.getInt(); - Vec2 pos = new Vec2(buf.getFloat(), buf.getFloat()); - Vec2 scale = new Vec2(buf.getFloat(), buf.getFloat()); - float rot = buf.getFloat(); - ret.add(new Texture(path, flags, blend, pos, scale, rot)); - } - dump("TEXS([" + Joiner.on(", ").join(ret) + "])"); - popLimit(); - this.textures.addAll(ret); - return ret; - } - - private List brus() throws IOException - { - chunk("BRUS"); - List ret = new ArrayList<>(); - int n_texs = buf.getInt(); - while(buf.hasRemaining()) - { - String name = readString(); - Vector4f color = new Vector4f(buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat()); - float shininess = buf.getFloat(); - int blend = buf.getInt(); - int fx = buf.getInt(); - List textures = new ArrayList<>(); - for(int i = 0; i < n_texs; i++) textures.add(getTexture(buf.getInt())); - ret.add(new Brush(name, color, shininess, blend, fx, textures)); - } - dump("BRUS([" + Joiner.on(", ").join(ret) + "])"); - popLimit(); - this.brushes.addAll(ret); - return ret; - } - - private List vrts() throws IOException - { - chunk("VRTS"); - List ret = new ArrayList<>(); - int flags = buf.getInt(); - int tex_coord_sets = buf.getInt(); - int tex_coord_set_size = buf.getInt(); - while(buf.hasRemaining()) - { - Vector3f v = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()), n = null; - Vector4f color = null; - if((flags & 1) != 0) - { - n = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()); - } - if((flags & 2) != 0) - { - color = new Vector4f(buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat()); - } - Vector4f[] tex_coords = new Vector4f[tex_coord_sets]; - for(int i = 0; i < tex_coord_sets; i++) - { - switch(tex_coord_set_size) - { - case 1: - tex_coords[i] = new Vector4f(buf.getFloat(), 0, 0, 1); - break; - case 2: - tex_coords[i] = new Vector4f(buf.getFloat(), buf.getFloat(), 0, 1); - break; - case 3: - tex_coords[i] = new Vector4f(buf.getFloat(), buf.getFloat(), buf.getFloat(), 1); - break; - case 4: - tex_coords[i] = new Vector4f(buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat()); - break; - default: - logger.error(String.format(Locale.ENGLISH, "Unsupported number of texture coords: %s", tex_coord_set_size)); - tex_coords[i] = new Vector4f(0, 0, 0, 1); - } - } - ret.add(new Vertex(v, n, color, tex_coords)); - } - dump("VRTS([" + Joiner.on(", ").join(ret) + "])"); - popLimit(); - this.vertices.clear(); - this.vertices.addAll(ret); - return ret; - } - - private List tris() throws IOException - { - chunk("TRIS"); - List ret = new ArrayList<>(); - int brush_id = buf.getInt(); - while(buf.hasRemaining()) - { - ret.add(new Face(getVertex(buf.getInt()), getVertex(buf.getInt()), getVertex(buf.getInt()), getBrush(brush_id))); - } - dump("TRIS([" + Joiner.on(", ").join(ret) + "])"); - popLimit(); - return ret; - } - - private Pair> mesh() throws IOException - { - chunk("MESH"); - int brush_id = buf.getInt(); - readHeader(); - dump("MESH(brush = " + brush_id + ") {"); - vrts(); - List ret = new ArrayList<>(); - while(buf.hasRemaining()) - { - readHeader(); - ret.addAll(tris()); - } - dump("}"); - popLimit(); - return Pair.of(getBrush(brush_id), ret); - } - - private List> bone() throws IOException - { - chunk("BONE"); - List> ret = new ArrayList<>(); - while(buf.hasRemaining()) - { - ret.add(Pair.of(getVertex(buf.getInt()), buf.getFloat())); - } - dump("BONE(...)"); - popLimit(); - return ret; - } - - private final Deque>, Key>> animations = new ArrayDeque<>(); - - private Map keys() throws IOException - { - chunk("KEYS"); - Map ret = new HashMap<>(); - int flags = buf.getInt(); - Vector3f pos = null, scale = null; - Quaternion rot = null; - while(buf.hasRemaining()) - { - int frame = buf.getInt(); - if((flags & 1) != 0) - { - pos = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()); - } - if((flags & 2) != 0) - { - scale = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()); - } - if((flags & 4) != 0) - { - rot = readQuat(); - } - Key key = new Key(pos, scale, rot); - Key oldKey = animations.peek().get(frame, null); - if(oldKey != null) - { - if(pos != null) - { - if(oldKey.getPos() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key); - else key = new Key(oldKey.getPos(), key.getScale(), key.getRot()); - } - if(scale != null) - { - if(oldKey.getScale() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key); - else key = new Key(key.getPos(), oldKey.getScale(), key.getRot()); - } - if(rot != null) - { - if(oldKey.getRot() != null) logger.error("Duplicate keys: {} and {} (ignored)", oldKey, key); - else key = new Key(key.getPos(), key.getScale(), oldKey.getRot()); - } - } - animations.peek().put(frame, Optional.empty(), key); - ret.put(frame, key); - } - dump("KEYS([(" + Joiner.on("), (").withKeyValueSeparator(" -> ").join(ret) + ")])"); - popLimit(); - return ret; - } - - private Triple anim() throws IOException - { - chunk("ANIM"); - int flags = buf.getInt(); - int frames = buf.getInt(); - float fps = buf.getFloat(); - dump("ANIM(" + flags + ", " + frames + ", " + fps + ")"); - popLimit(); - return Triple.of(flags, frames, fps); - } - - private Node node() throws IOException - { - chunk("NODE"); - animations.push(HashBasedTable.create()); - Triple animData = null; - Pair> mesh = null; - List> bone = null; - Map keys = new HashMap<>(); - List> nodes = new ArrayList<>(); - String name = readString(); - Vector3f pos = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()); - Vector3f scale = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat()); - Quaternion rot = readQuat(); - dump("NODE(" + name + ", " + pos + ", " + scale + ", " + rot + ") {"); - while(buf.hasRemaining()) - { - readHeader(); - if (isChunk("MESH")) mesh = mesh(); - else if(isChunk("BONE")) bone = bone(); - else if(isChunk("KEYS")) keys.putAll(keys()); - else if(isChunk("NODE")) nodes.add(node()); - else if(isChunk("ANIM")) animData = anim(); - else skip(); - } - dump("}"); - popLimit(); - Table>, Key> keyData = animations.pop(); - Node node; - if(mesh != null) - { - Node mNode = Node.create(name, pos, scale, rot, nodes, new Mesh(mesh)); - meshes.put(name, mNode); - node = mNode; - } - else if(bone != null) node = Node.create(name, pos, scale, rot, nodes, new Bone(bone)); - else node = Node.create(name, pos, scale, rot, nodes, new Pivot()); - if(animData == null) - { - for(Table.Cell>, Key> key : keyData.cellSet()) - { - animations.peek().put(key.getRowKey(), Optional.of(key.getColumnKey().orElse(node)), key.getValue()); - } - } - else - { - node.setAnimation(animData, keyData); - } - return node; - } - - private Quaternion readQuat() - { - float w = buf.getFloat(); - float x = buf.getFloat(); - float y = buf.getFloat(); - float z = buf.getFloat(); - return new Quaternion(x, y, z, w); - } - - private void skip() - { - ((Buffer)buf).position(buf.position() + length); - } - } - - // boilerplate below - - public List getTextures() - { - return textures; - } - - public List getBrushes() - { - return brushes; - } - - public Node getRoot() - { - return root; - } - - public ImmutableMap> getMeshes() - { - return meshes; - } - - public static class Texture - { - public static final Texture White = new Texture("builtin/white", 0, 0, new Vec2(0, 0), new Vec2(1, 1), 0); - private final String path; - private final int flags; - private final int blend; - private final Vec2 pos; - private final Vec2 scale; - private final float rot; - - public Texture(String path, int flags, int blend, Vec2 pos, Vec2 scale, float rot) - { - this.path = path; - this.flags = flags; - this.blend = blend; - this.pos = pos; - this.scale = scale; - this.rot = rot; - } - - public String getPath() - { - return path; - } - - public int getFlags() - { - return flags; - } - - public int getBlend() - { - return blend; - } - - public Vec2 getPos() - { - return pos; - } - - public Vec2 getScale() - { - return scale; - } - - public float getRot() - { - return rot; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Texture [path=%s, flags=%s, blend=%s, pos=%s, scale=%s, rot=%s]", path, flags, blend, pos, scale, rot); - } - } - - public static class Brush - { - private final String name; - private final Vector4f color; - private final float shininess; - private final int blend; - private final int fx; - private final List textures; - - public Brush(String name, Vector4f color, float shininess, int blend, int fx, List textures) - { - this.name = name; - this.color = color; - this.shininess = shininess; - this.blend = blend; - this.fx = fx; - this.textures = textures; - } - - public String getName() - { - return name; - } - - public Vector4f getColor() - { - return color; - } - - public float getShininess() - { - return shininess; - } - - public int getBlend() - { - return blend; - } - - public int getFx() - { - return fx; - } - - public List getTextures() - { - return textures; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Brush [name=%s, color=%s, shininess=%s, blend=%s, fx=%s, textures=%s]", name, color, shininess, blend, fx, textures); - } - } - - public static class Vertex - { - private final Vector3f pos; - @Nullable - private final Vector3f normal; - @Nullable - private final Vector4f color; - private final Vector4f[] texCoords; - public Vertex(Vector3f pos, @Nullable Vector3f normal, @Nullable Vector4f color, Vector4f[] texCoords) - { - this.pos = pos; - this.normal = normal; - this.color = color; - this.texCoords = texCoords; - } - - public Vertex bake(Mesh mesh, Function, Matrix4f> animator) - { - // geometry - Float totalWeight = 0f; - Matrix4f t = new Matrix4f(); - if(mesh.getWeightMap().get(this).isEmpty()) - { - t.setIdentity(); - } - else - { - for(Pair> bone : mesh.getWeightMap().get(this)) - { - totalWeight += bone.getLeft(); - Matrix4f bm = animator.apply(bone.getRight()); - bm.multiply(bone.getLeft()); - t.add(bm); - } - if(Math.abs(totalWeight) > 1e-4) t.multiply(1f / totalWeight); - else t.setIdentity(); - } - - Transformation trsr = new Transformation(t); - - // pos - Vector4f pos = new Vector4f(this.pos); - pos.setW(1); - trsr.transformPosition(pos); - pos.normalize(); - Vector3f rPos = new Vector3f(pos.x(), pos.y(), pos.z()); - - // normal - Vector3f rNormal = null; - - if(this.normal != null) - { - rNormal = this.normal.copy(); - trsr.transformNormal(rNormal); - } - - // texCoords TODO - return new Vertex(rPos, rNormal, color, texCoords); - } - - public Vector3f getPos() - { - return pos; - } - - @Nullable - public Vector3f getNormal() - { - return normal; - } - - @Nullable - public Vector4f getColor() - { - return color; - } - - public Vector4f[] getTexCoords() - { - return texCoords; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Vertex [pos=%s, normal=%s, color=%s, texCoords=%s]", pos, normal, color, java.util.Arrays.toString(texCoords)); - } - } - - public static class Face - { - private final Vertex v1, v2, v3; - @Nullable - private final Brush brush; - private final Vector3f normal; - - public Face(Vertex v1, Vertex v2, Vertex v3, @Nullable Brush brush) - { - this(v1, v2, v3, brush, getNormal(v1, v2, v3)); - } - - public Face(Vertex v1, Vertex v2, Vertex v3, @Nullable Brush brush, Vector3f normal) - { - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - this.brush = brush; - this.normal = normal; - } - - public Vertex getV1() - { - return v1; - } - - public Vertex getV2() - { - return v2; - } - - public Vertex getV3() - { - return v3; - } - - @Nullable - public Brush getBrush() - { - return brush; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Face [v1=%s, v2=%s, v3=%s]", v1, v2, v3); - } - - public Vector3f getNormal() - { - return normal; - } - - public static Vector3f getNormal(Vertex v1, Vertex v2, Vertex v3) - { - Vector3f a = v2.getPos().copy(); - a.sub(v1.getPos()); - Vector3f b = v3.getPos().copy(); - b.sub(v1.getPos()); - Vector3f c = a.copy(); - c.cross(b); - c.normalize(); - return c; - } - } - - public static class Key - { - @Nullable - private final Vector3f pos; - @Nullable - private final Vector3f scale; - @Nullable - private final Quaternion rot; - - public Key(@Nullable Vector3f pos, @Nullable Vector3f scale, @Nullable Quaternion rot) - { - this.pos = pos; - this.scale = scale; - this.rot = rot; - } - - @Nullable - public Vector3f getPos() - { - return pos; - } - - @Nullable - public Vector3f getScale() - { - return scale; - } - - @Nullable - public Quaternion getRot() - { - return rot; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Key [pos=%s, scale=%s, rot=%s]", pos, scale, rot); - } - } - - public static class Animation - { - private final int flags; - private final int frames; - private final float fps; - private final ImmutableTable, Key> keys; - - public Animation(int flags, int frames, float fps, ImmutableTable, Key> keys) - { - this.flags = flags; - this.frames = frames; - this.fps = fps; - this.keys = keys; - } - - public int getFlags() - { - return flags; - } - - public int getFrames() - { - return frames; - } - - public float getFps() - { - return fps; - } - - public ImmutableTable, Key> getKeys() - { - return keys; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Animation [flags=%s, frames=%s, fps=%s, keys=...]", flags, frames, fps); - } - } - - public static interface IKind> - { - void setParent(Node parent); - Node getParent(); - } - - public static class Node> - { - private final String name; - private final Vector3f pos; - private final Vector3f scale; - private final Quaternion rot; - private final ImmutableMap> nodes; - @Nullable - private Animation animation; - private final K kind; - @Nullable - private Node> parent; - - public static > Node create(String name, Vector3f pos, Vector3f scale, Quaternion rot, List> nodes, K kind) - { - return new Node<>(name, pos, scale, rot, nodes, kind); - } - - public Node(String name, Vector3f pos, Vector3f scale, Quaternion rot, List> nodes, K kind) - { - this.name = name; - this.pos = pos; - this.scale = scale; - this.rot = rot; - this.nodes = buildNodeMap(nodes); - this.kind = kind; - kind.setParent(this); - for(Node child : this.nodes.values()) - { - child.setParent(this); - } - } - - public void setAnimation(Animation animation) - { - this.animation = animation; - Deque> q = new ArrayDeque<>(nodes.values()); - - while(!q.isEmpty()) - { - Node node = q.pop(); - if(node.getAnimation() != null) continue; - node.setAnimation(animation); - q.addAll(node.getNodes().values()); - } - } - - public void setAnimation(Triple animData, Table>, Key> keyData) - { - ImmutableTable.Builder, Key> builder = ImmutableTable.builder(); - for(Table.Cell>, Key> key : keyData.cellSet()) - { - builder.put(key.getRowKey(), key.getColumnKey().orElse(this), key.getValue()); - } - setAnimation(new Animation(animData.getLeft(), animData.getMiddle(), animData.getRight(), builder.build())); - } - - private ImmutableMap> buildNodeMap(List> nodes) - { - ImmutableMap.Builder> builder = ImmutableMap.builder(); - for(Node node : nodes) - { - builder.put(node.getName(), node); - } - return builder.build(); - } - - public String getName() - { - return name; - } - - public K getKind() - { - return kind; - } - - public Vector3f getPos() - { - return pos; - } - - public Vector3f getScale() - { - return scale; - } - - public Quaternion getRot() - { - return rot; - } - - public ImmutableMap> getNodes() - { - return nodes; - } - - @Nullable - public Animation getAnimation() - { - return animation; - } - - @Nullable - public Node> getParent() - { - return parent; - } - - public void setParent(Node> parent) - { - this.parent = parent; - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Node [name=%s, kind=%s, pos=%s, scale=%s, rot=%s, keys=..., nodes=..., animation=%s]", name, kind, pos, scale, rot, animation); - } - } - - public static class Pivot implements IKind - { - private Node parent; - - @Override - public void setParent(Node parent) - { - this.parent = parent; - } - - @Override - public Node getParent() - { - return parent; - } - } - - public static class Mesh implements IKind - { - private Node parent; - private final Brush brush; - private final ImmutableList faces; - //private final ImmutableList bones; - - private Set> bones = new HashSet<>(); - - private ImmutableMultimap>> weightMap = ImmutableMultimap.of(); - - public Mesh(Pair> data) - { - this.brush = data.getLeft(); - this.faces = ImmutableList.copyOf(data.getRight()); - } - - public ImmutableMultimap>> getWeightMap() - { - return weightMap; - } - - public ImmutableList bake(Function, Matrix4f> animator) - { - ImmutableList.Builder builder = ImmutableList.builder(); - for(Face f : getFaces()) - { - Vertex v1 = f.getV1().bake(this, animator); - Vertex v2 = f.getV2().bake(this, animator); - Vertex v3 = f.getV3().bake(this, animator); - builder.add(new Face(v1, v2, v3, f.getBrush())); - } - return builder.build(); - } - - public Brush getBrush() - { - return brush; - } - - public ImmutableList getFaces() - { - return faces; - } - - public ImmutableSet> getBones() - { - return ImmutableSet.copyOf(bones); - } - - @Override - public String toString() - { - return String.format(Locale.ENGLISH, "Mesh [pivot=%s, brush=%s, data=...]", super.toString(), brush); - } - - @Override - @SuppressWarnings("unchecked") - public void setParent(Node parent) - { - this.parent = parent; - Deque> queue = new ArrayDeque<>(parent.getNodes().values()); - while(!queue.isEmpty()) - { - Node node = queue.pop(); - if(node.getKind() instanceof Bone) - { - bones.add((Node)node); - queue.addAll(node.getNodes().values()); - } - } - ImmutableMultimap.Builder>> builder = ImmutableMultimap.builder(); - for(Node bone : getBones()) - { - for(Pair b : bone.getKind().getData()) - { - builder.put(b.getLeft(), Pair.of(b.getRight(), bone)); - } - } - weightMap = builder.build(); - } - - @Override - public Node getParent() - { - return parent; - } - } - - public static class Bone implements IKind - { - private Node parent; - private final List> data; - - public Bone(List> data) - { - this.data = data; - } - - public List> getData() - { - return data; - } - - /*@Override - public String toString() - { - return String.format("Bone [data=%s]", data); - }*/ - - @Override - public void setParent(Node parent) - { - this.parent = parent; - } - - @Override - public Node getParent() - { - return parent; - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/data/IDynamicBakedModel.java b/src/main/java/net/minecraftforge/client/model/data/IDynamicBakedModel.java index d2bd7f4d061..2bc6a5ae3b3 100644 --- a/src/main/java/net/minecraftforge/client/model/data/IDynamicBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/data/IDynamicBakedModel.java @@ -6,29 +6,28 @@ package net.minecraftforge.client.model.data; import java.util.List; -import java.util.Random; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** - * Convenience interface with default implementation of {@link BakedModel#getQuads(BlockState, Direction, Random, IModelData)}. + * Convenience interface with default implementation of {@link BakedModel#getQuads(BlockState, Direction, RandomSource, IModelData)}. */ public interface IDynamicBakedModel extends BakedModel { @Override - default @Nonnull List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) + default @NotNull List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand) { return getQuads(state, side, rand, EmptyModelData.INSTANCE); } - + // Force this to be overriden otherwise this introduces a default cycle between the two overloads. @Override - @Nonnull - List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData); + @NotNull + List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData); } diff --git a/src/main/java/net/minecraftforge/client/model/data/IModelData.java b/src/main/java/net/minecraftforge/client/model/data/IModelData.java index 45cb42c5583..6eba11b5afa 100644 --- a/src/main/java/net/minecraftforge/client/model/data/IModelData.java +++ b/src/main/java/net/minecraftforge/client/model/data/IModelData.java @@ -5,7 +5,7 @@ package net.minecraftforge.client.model.data; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public interface IModelData { @@ -16,7 +16,7 @@ public interface IModelData *

    * IMPORTANT: {@link #getData(ModelProperty)} can return {@code null} * even if this method returns {@code true}. - * + * * @param prop The property to check for inclusion in this model data * @return {@code true} if this data has the given property, even if no value is present */ @@ -24,7 +24,7 @@ public interface IModelData @Nullable T getData(ModelProperty prop); - + @Nullable T setData(ModelProperty prop, T data); } diff --git a/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java b/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java index 404819f3802..e8b8756b19f 100644 --- a/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java +++ b/src/main/java/net/minecraftforge/client/model/data/MultipartModelData.java @@ -10,8 +10,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; 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 f368f5099a5..65caf69a399 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java @@ -5,10 +5,9 @@ package net.minecraftforge.client.model.generators; -import javax.annotation.Nonnull; - import net.minecraft.data.DataGenerator; import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.NotNull; /** * Stub class to extend for block model data providers, eliminates some @@ -20,7 +19,7 @@ public BlockModelProvider(DataGenerator generator, String modid, ExistingFileHel super(generator, modid, BLOCK_FOLDER, BlockModelBuilder::new, existingFileHelper); } - @Nonnull + @NotNull @Override public String getName() { return "Block Models: " + modid; diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java index 924b920dd97..edd93b82419 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java @@ -13,12 +13,12 @@ import java.util.Map; import java.util.function.Function; -import javax.annotation.Nonnull; - +import net.minecraft.data.CachedOutput; import net.minecraft.world.level.block.ButtonBlock; import net.minecraft.world.level.block.PressurePlateBlock; import net.minecraft.world.level.block.StandingSignBlock; import net.minecraft.world.level.block.WallSignBlock; +import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -47,7 +47,6 @@ import net.minecraft.world.level.block.WallBlock; import net.minecraft.world.level.block.state.properties.WallSide; import net.minecraft.data.DataGenerator; -import net.minecraft.data.HashCache; import net.minecraft.data.DataProvider; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.AttachFace; @@ -61,6 +60,7 @@ import net.minecraft.core.Direction.Axis; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; /** * Data provider for blockstate files. Extends {@link BlockModelProvider} so that @@ -83,15 +83,19 @@ public BlockStateProvider(DataGenerator gen, String modid, ExistingFileHelper ex this.generator = gen; this.modid = modid; this.blockModels = new BlockModelProvider(gen, modid, exFileHelper) { + @Override public void run(CachedOutput p_236071_) throws IOException {} + @Override protected void registerModels() {} }; this.itemModels = new ItemModelProvider(gen, modid, this.blockModels.existingFileHelper) { @Override protected void registerModels() {} + + @Override public void run(CachedOutput p_236071_) throws IOException {} }; } @Override - public void run(HashCache cache) throws IOException { + public void run(CachedOutput cache) throws IOException { models().clear(); itemModels().clear(); registeredBlocks.clear(); @@ -145,12 +149,16 @@ public ResourceLocation mcLoc(String name) { return new ResourceLocation(name); } + private ResourceLocation key(Block block) { + return ForgeRegistries.BLOCKS.getKey(block); + } + private String name(Block block) { - return block.getRegistryName().getPath(); + return key(block).getPath(); } public ResourceLocation blockTexture(Block block) { - ResourceLocation name = block.getRegistryName(); + ResourceLocation name = key(block); return new ResourceLocation(name.getNamespace(), ModelProvider.BLOCK_FOLDER + "/" + name.getPath()); } @@ -175,7 +183,7 @@ public void simpleBlock(Block block, ModelFile model) { } public void simpleBlockItem(Block block, ModelFile model) { - itemModels().getBuilder(block.getRegistryName().getPath()).parent(model); + itemModels().getBuilder(key(block).getPath()).parent(model); } public void simpleBlock(Block block, ConfiguredModel... models) { @@ -291,7 +299,7 @@ public void stairsBlock(StairBlock block, String name, ResourceLocation texture) } public void stairsBlock(StairBlock block, ResourceLocation side, ResourceLocation bottom, ResourceLocation top) { - stairsBlockInternal(block, block.getRegistryName().toString(), side, bottom, top); + stairsBlockInternal(block, key(block).toString(), side, bottom, top); } public void stairsBlock(StairBlock block, String name, ResourceLocation side, ResourceLocation bottom, ResourceLocation top) { @@ -404,7 +412,7 @@ public void fourWayMultipart(MultiPartBlockStateBuilder builder, ModelFile side) } public void fenceBlock(FenceBlock block, ResourceLocation texture) { - String baseName = block.getRegistryName().toString(); + String baseName = key(block).toString(); fourWayBlock(block, models().fencePost(baseName + "_post", texture), models().fenceSide(baseName + "_side", texture)); } @@ -413,7 +421,7 @@ public void fenceBlock(FenceBlock block, String name, ResourceLocation texture) } public void fenceGateBlock(FenceGateBlock block, ResourceLocation texture) { - fenceGateBlockInternal(block, block.getRegistryName().toString(), texture); + fenceGateBlockInternal(block, key(block).toString(), texture); } public void fenceGateBlock(FenceGateBlock block, String name, ResourceLocation texture) { @@ -446,7 +454,7 @@ public void fenceGateBlock(FenceGateBlock block, ModelFile gate, ModelFile gateO } public void wallBlock(WallBlock block, ResourceLocation texture) { - wallBlockInternal(block, block.getRegistryName().toString(), texture); + wallBlockInternal(block, key(block).toString(), texture); } public void wallBlock(WallBlock block, String name, ResourceLocation texture) { @@ -456,7 +464,7 @@ public void wallBlock(WallBlock block, String name, ResourceLocation texture) { private void wallBlockInternal(WallBlock block, String baseName, ResourceLocation texture) { wallBlock(block, models().wallPost(baseName + "_post", texture), models().wallSide(baseName + "_side", texture), models().wallSideTall(baseName + "_side_tall", texture)); } - + public static final ImmutableMap> WALL_PROPS = ImmutableMap.>builder() .put(Direction.EAST, BlockStateProperties.EAST_WALL) .put(Direction.NORTH, BlockStateProperties.NORTH_WALL) @@ -475,7 +483,7 @@ public void wallBlock(WallBlock block, ModelFile post, ModelFile side, ModelFile wallSidePart(builder, sideTall, e, WallSide.TALL); }); } - + private void wallSidePart(MultiPartBlockStateBuilder builder, ModelFile model, Map.Entry> entry, WallSide height) { builder.part() .modelFile(model) @@ -486,7 +494,7 @@ private void wallSidePart(MultiPartBlockStateBuilder builder, ModelFile model, M } public void paneBlock(IronBarsBlock block, ResourceLocation pane, ResourceLocation edge) { - paneBlockInternal(block, block.getRegistryName().toString(), pane, edge); + paneBlockInternal(block, key(block).toString(), pane, edge); } public void paneBlock(IronBarsBlock block, String name, ResourceLocation pane, ResourceLocation edge) { @@ -518,7 +526,7 @@ public void paneBlock(IronBarsBlock block, ModelFile post, ModelFile side, Model } public void doorBlock(DoorBlock block, ResourceLocation bottom, ResourceLocation top) { - doorBlockInternal(block, block.getRegistryName().toString(), bottom, top); + doorBlockInternal(block, key(block).toString(), bottom, top); } public void doorBlock(DoorBlock block, String name, ResourceLocation bottom, ResourceLocation top) { @@ -553,7 +561,7 @@ public void doorBlock(DoorBlock block, ModelFile bottomLeft, ModelFile bottomRig } public void trapdoorBlock(TrapDoorBlock block, ResourceLocation texture, boolean orientable) { - trapdoorBlockInternal(block, block.getRegistryName().toString(), texture, orientable); + trapdoorBlockInternal(block, key(block).toString(), texture, orientable); } public void trapdoorBlock(TrapDoorBlock block, String name, ResourceLocation texture, boolean orientable) { @@ -587,19 +595,19 @@ public void trapdoorBlock(TrapDoorBlock block, ModelFile bottom, ModelFile top, }, TrapDoorBlock.POWERED, TrapDoorBlock.WATERLOGGED); } - private void saveBlockState(HashCache cache, JsonObject stateJson, Block owner) { - ResourceLocation blockName = Preconditions.checkNotNull(owner.getRegistryName()); + private void saveBlockState(CachedOutput cache, JsonObject stateJson, Block owner) { + ResourceLocation blockName = Preconditions.checkNotNull(key(owner)); Path mainOutput = generator.getOutputFolder(); String pathSuffix = "assets/" + blockName.getNamespace() + "/blockstates/" + blockName.getPath() + ".json"; Path outputPath = mainOutput.resolve(pathSuffix); try { - DataProvider.save(GSON, cache, stateJson, outputPath); + DataProvider.saveStable(cache, stateJson, outputPath); } catch (IOException e) { LOGGER.error("Couldn't save blockstate to {}", outputPath, e); } } - @Nonnull + @NotNull @Override public String getName() { return "Block States: " + modid; 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 dc1fb82e460..ea9911f9eed 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ConfiguredModel.java @@ -10,7 +10,6 @@ import java.util.function.Function; import java.util.stream.IntStream; -import javax.annotation.Nullable; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -20,6 +19,7 @@ import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder.PartBuilder; import net.minecraftforge.client.model.generators.VariantBlockStateBuilder.PartialBlockstate; +import org.jetbrains.annotations.Nullable; /** * Represents a model with blockstate configurations, e.g. rotation, uvlock, and @@ -70,13 +70,13 @@ public static ConfiguredModel[] allRotations(ModelFile model, boolean uvlock, in /** * Construct a new {@link ConfiguredModel}. - * + * * @param model the underlying model * @param rotationX x-rotation to apply to the model * @param rotationY y-rotation to apply to the model * @param uvLock if uvlock should be enabled * @param weight the random weight of the model - * + * * @throws NullPointerException if {@code model} is {@code null} * @throws IllegalArgumentException if x and/or y rotation are not valid (see * {@link BlockModelRotation}) @@ -96,12 +96,12 @@ public ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uv /** * Construct a new {@link ConfiguredModel} with the {@link #DEFAULT_WEIGHT * default random weight}. - * + * * @param model the underlying model * @param rotationX x-rotation to apply to the model * @param rotationY y-rotation to apply to the model * @param uvLock if uvlock should be enabled - * + * * @throws NullPointerException if {@code model} is {@code null} * @throws IllegalArgumentException if x and/or y rotation are not valid (see * {@link BlockModelRotation}) @@ -113,7 +113,7 @@ public ConfiguredModel(ModelFile model, int rotationX, int rotationY, boolean uv /** * Construct a new {@link ConfiguredModel} with the default rotation (0, 0), * uvlock (false), and {@link #DEFAULT_WEIGHT default random weight}. - * + * * @throws NullPointerException if {@code model} is {@code null} */ public ConfiguredModel(ModelFile model) { @@ -144,7 +144,7 @@ JsonObject toJSON(boolean includeWeight) { /** * Create a new unowned {@link Builder}. - * + * * @return the builder * @see Builder */ @@ -197,7 +197,7 @@ public static class Builder { /** * Set the underlying model object for this configured model. - * + * * @param model the model * @return this builder * @throws NullPointerException if {@code model} is {@code null} @@ -210,7 +210,7 @@ public Builder modelFile(ModelFile model) { /** * Set the x-rotation for this model. - * + * * @param value the x-rotation value * @return this builder * @throws IllegalArgumentException if {@code value} is not a valid x-rotation @@ -224,7 +224,7 @@ public Builder rotationX(int value) { /** * Set the y-rotation for this model. - * + * * @param value the y-rotation value * @return this builder * @throws IllegalArgumentException if {@code value} is not a valid y-rotation @@ -243,7 +243,7 @@ public Builder uvLock(boolean value) { /** * Set the random weight for this model. - * + * * @param value the weight value * @return this builder * @throws IllegalArgumentException if {@code value} is less than or equal to @@ -258,7 +258,7 @@ public Builder weight(int value) { /** * Build the most recent model, as if {@link #nextModel()} was never called. * Useful for single-model builders. - * + * * @return the most recently configured model */ public ConfiguredModel buildLast() { @@ -267,7 +267,7 @@ public ConfiguredModel buildLast() { /** * Build all configured models and return them as an array. - * + * * @return the array of built models. */ public ConfiguredModel[] build() { @@ -284,7 +284,7 @@ public ConfiguredModel[] build() { *

  • {@link PartialBlockstate#modelForState()}
  • *
  • {@link MultiPartBlockStateBuilder#part()}
  • *
- * + * * @return the owning builder object * @throws NullPointerException if there is no owning builder (and thus no callback) */ @@ -296,7 +296,7 @@ public T addModel() { /** * Complete the current model and return a new builder instance with the same * callback, and storing all previously built models. - * + * * @return a new builder for configuring the next model */ public Builder nextModel() { 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 3fb16fc2758..0787fb83323 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java @@ -5,12 +5,14 @@ package net.minecraftforge.client.model.generators; -import javax.annotation.Nonnull; - import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; /** * Stub class to extend for item model data providers, eliminates some @@ -24,7 +26,7 @@ public ItemModelProvider(DataGenerator generator, String modid, ExistingFileHelp public ItemModelBuilder basicItem(Item item) { - return basicItem(item.getRegistryName()); + return basicItem(Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(item))); } public ItemModelBuilder basicItem(ResourceLocation item) @@ -34,7 +36,7 @@ public ItemModelBuilder basicItem(ResourceLocation item) .texture("layer0", new ResourceLocation(item.getNamespace(), "item/" + item.getPath())); } - @Nonnull + @NotNull @Override public String getName() { return "Item Models: " + modid; diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java index cee87694012..11d62c3ee22 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java @@ -15,8 +15,6 @@ import java.util.function.BiFunction; import java.util.stream.Collectors; -import javax.annotation.Nullable; - import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.gson.Gson; @@ -28,7 +26,6 @@ import net.minecraft.client.renderer.block.model.BlockElement; import net.minecraft.client.renderer.block.model.BlockElementFace; import net.minecraft.client.renderer.block.model.BlockElementRotation; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.block.model.ItemTransform; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; @@ -37,6 +34,7 @@ import net.minecraft.util.Mth; import com.mojang.math.Vector3f; import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.Nullable; /** * General purpose model builder, contains all the commonalities between item diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java index 5438f38855d..3d5394fbd57 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java @@ -17,6 +17,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import net.minecraft.data.CachedOutput; import net.minecraft.data.DataGenerator; import net.minecraft.data.HashCache; import net.minecraft.data.DataProvider; @@ -373,17 +374,17 @@ protected void clear() { } @Override - public void run(HashCache cache) throws IOException { + public void run(CachedOutput cache) throws IOException { clear(); registerModels(); generateAll(cache); } - protected void generateAll(HashCache cache) { + protected void generateAll(CachedOutput cache) { for (T model : generatedModels.values()) { Path target = getPath(model); try { - DataProvider.save(GSON, cache, model.toJson(), target); + DataProvider.saveStable(cache, model.toJson(), target); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java index 11deb7b2f6a..729da576bd6 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/VariantBlockStateBuilder.java @@ -20,8 +20,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.Nullable; - import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -32,6 +30,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredModelList; +import org.jetbrains.annotations.Nullable; /** * Builder for variant-type blockstates, i.e. non-multipart blockstates. Should @@ -49,7 +48,7 @@ * {@link #forAllStatesExcept(Function, Property...)} for cases where the model * for each variant can be decided dynamically based on the state's property * values. - * + * * @see BlockStateProvider */ public class VariantBlockStateBuilder implements IGeneratedBlockstate { @@ -86,7 +85,7 @@ public JsonObject toJson() { /** * Assign some models to a given {@link PartialBlockstate partial state}. - * + * * @param state The {@link PartialBlockstate partial state} for which to add * the models * @param models A set of models to add to this state @@ -120,7 +119,7 @@ public VariantBlockStateBuilder addModels(PartialBlockstate state, ConfiguredMod * Assign some models to a given {@link PartialBlockstate partial state}, * throwing an exception if the state has already been configured. Otherwise, * simply calls {@link #addModels(PartialBlockstate, ConfiguredModel...)}. - * + * * @param state The {@link PartialBlockstate partial state} for which to set * the models * @param model A set of models to assign to this state @@ -199,7 +198,7 @@ private void checkValidOwner() { * Creates a builder for models to assign to this state, which when completed * via {@link ConfiguredModel.Builder#addModel()} will assign the resultant set * of models to this state. - * + * * @return the model builder * @see ConfiguredModel.Builder */ @@ -212,7 +211,7 @@ public ConfiguredModel.Builder modelForState() { * Add models to the current state's variant. For use when it is more convenient * to add multiple sets of models, as a replacement for * {@link #setModels(ConfiguredModel...)}. - * + * * @param models The models to add. * @return {@code this} * @throws NullPointerException If the parent builder is {@code null} @@ -225,7 +224,7 @@ public PartialBlockstate addModels(ConfiguredModel... models) { /** * Set this variant's models, and return the parent builder. - * + * * @param models The models to set * @return The parent builder instance * @throws NullPointerException If the parent builder is {@code null} @@ -239,7 +238,7 @@ public VariantBlockStateBuilder setModels(ConfiguredModel... models) { * Complete this state without adding any new models, and return a new partial * state via the parent builder. For use after calling * {@link #addModels(ConfiguredModel...)}. - * + * * @return A fresh partial state as specified by * {@link VariantBlockStateBuilder#partialState()}. * @throws NullPointerException If the parent builder is {@code null} diff --git a/src/main/java/net/minecraftforge/client/model/generators/loaders/DynamicBucketModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/loaders/DynamicBucketModelBuilder.java index f77a5b88b24..f52f7a1a570 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/loaders/DynamicBucketModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/loaders/DynamicBucketModelBuilder.java @@ -12,6 +12,7 @@ import net.minecraftforge.client.model.generators.CustomLoaderBuilder; import net.minecraftforge.client.model.generators.ModelBuilder; import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.registries.ForgeRegistries; public class DynamicBucketModelBuilder> extends CustomLoaderBuilder { @@ -34,7 +35,7 @@ protected DynamicBucketModelBuilder(T parent, ExistingFileHelper existingFileHel public DynamicBucketModelBuilder fluid(Fluid fluid) { Preconditions.checkNotNull(fluid, "fluid must not be null"); - this.fluid = fluid.getRegistryName(); + this.fluid = ForgeRegistries.FLUIDS.getKey(fluid); return this; } diff --git a/src/main/java/net/minecraftforge/client/model/obj/LineReader.java b/src/main/java/net/minecraftforge/client/model/obj/LineReader.java index e78fe14bcfd..26831fe8a32 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/LineReader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/LineReader.java @@ -8,8 +8,8 @@ import com.google.common.base.Charsets; import joptsimple.internal.Strings; import net.minecraft.server.packs.resources.Resource; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -22,9 +22,8 @@ public class LineReader implements AutoCloseable InputStreamReader lineStream; BufferedReader lineReader; - public LineReader(Resource resource) - { - this.lineStream = new InputStreamReader(resource.getInputStream(), Charsets.UTF_8); + public LineReader(Resource resource) throws IOException { + this.lineStream = new InputStreamReader(resource.open(), Charsets.UTF_8); this.lineReader = new BufferedReader(lineStream); } 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 b6c251d1ae6..fcc2b695213 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -14,8 +14,8 @@ import net.minecraft.util.GsonHelper; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.model.IModelLoader; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.FileNotFoundException; import java.util.*; @@ -57,9 +57,8 @@ public OBJModel read(JsonDeserializationContext deserializationContext, JsonObje public OBJModel loadModel(OBJModel.ModelSettings settings) { return modelCache.computeIfAbsent(settings, (data) -> { - - try(Resource resource = manager.getResource(settings.modelLocation()); - LineReader rdr = new LineReader(resource)) + Resource resource = manager.getResource(settings.modelLocation()).orElseThrow(); + try(LineReader rdr = new LineReader(resource)) { return new OBJModel(rdr, settings); } @@ -77,8 +76,8 @@ public OBJModel loadModel(OBJModel.ModelSettings settings) public MaterialLibrary loadMaterialLibrary(ResourceLocation materialLocation) { return materialCache.computeIfAbsent(materialLocation, (location) -> { - try(Resource resource = manager.getResource(location); - LineReader rdr = new LineReader(resource)) + Resource resource = manager.getResource(location).orElseThrow(); + try(LineReader rdr = new LineReader(resource)) { return new MaterialLibrary(rdr); } 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 4a49f1653d7..b31d2214bcd 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -28,8 +28,6 @@ import net.minecraftforge.client.textures.UnitSprite; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.*; import java.util.function.Function; @@ -41,6 +39,8 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelState; import net.minecraft.client.resources.model.UnbakedModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class OBJModel implements IMultipartModelGeometry { @@ -660,7 +660,7 @@ public void bake(SimpleRenderable.PartBuilder builder, IModelConfiguration co } } - public record ModelSettings(@Nonnull ResourceLocation modelLocation, + public record ModelSettings(@NotNull ResourceLocation modelLocation, boolean detectCullableFaces, boolean diffuseLighting, boolean flipV, boolean ambientToFullbright, @Nullable String materialLibraryOverrideLocation) {} 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 b9b0dc5ff7e..2bec77eabc0 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -10,6 +10,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.renderer.block.ModelBlockRenderer; @@ -37,7 +38,7 @@ public ForgeBlockModelRenderer(BlockColors colors) } @Override - public boolean tesselateWithoutAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int packedOverlay, IModelData modelData) + public void tesselateWithoutAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, RandomSource rand, long seed, int packedOverlay, IModelData modelData) { if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get()) { @@ -48,16 +49,16 @@ public boolean tesselateWithoutAO(BlockAndTintGetter level, BakedModel model, Bl lighter.setParent(consumer); lighter.setTransform(poseStack.last()); - return render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData); + render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData); } else { - return super.tesselateWithoutAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData); + super.tesselateWithoutAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData); } } @Override - public boolean tesselateWithAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int packedOverlay, IModelData modelData) + public void tesselateWithAO(BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, VertexConsumer buffer, boolean checkSides, RandomSource rand, long seed, int packedOverlay, IModelData modelData) { if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get()) { @@ -68,15 +69,15 @@ public boolean tesselateWithAO(BlockAndTintGetter level, BakedModel model, Block lighter.setParent(consumer); lighter.setTransform(poseStack.last()); - return render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData); + render(lighter, level, model, state, pos, poseStack, checkSides, rand, seed, modelData); } else { - return super.tesselateWithAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData); + super.tesselateWithAO(level, model, state, pos, poseStack, buffer, checkSides, rand, seed, packedOverlay, modelData); } } - public static boolean render(VertexLighterFlat lighter, BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, boolean checkSides, Random rand, long seed, IModelData modelData) + public static boolean render(VertexLighterFlat lighter, BlockAndTintGetter level, BakedModel model, BlockState state, BlockPos pos, PoseStack poseStack, boolean checkSides, RandomSource rand, long seed, IModelData modelData) { lighter.setWorld(level); lighter.setState(state); diff --git a/src/main/java/net/minecraftforge/client/model/renderable/BakedRenderable.java b/src/main/java/net/minecraftforge/client/model/renderable/BakedRenderable.java index be287fc2711..3de4be80fd5 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/BakedRenderable.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/BakedRenderable.java @@ -14,6 +14,7 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.RandomSource; import net.minecraft.world.inventory.InventoryMenu; import net.minecraftforge.client.model.data.IModelData; @@ -47,7 +48,7 @@ public static BakedRenderable of(BakedModel model) return new BakedRenderable(model); } - private final Random rand = new Random(); + private final RandomSource rand = RandomSource.create(); private final BakedModel model; private BakedRenderable(BakedModel model) diff --git a/src/main/java/net/minecraftforge/client/model/renderable/IMultipartRenderValues.java b/src/main/java/net/minecraftforge/client/model/renderable/IMultipartRenderValues.java index 2001e0be9a7..be2a626a698 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/IMultipartRenderValues.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/IMultipartRenderValues.java @@ -5,7 +5,7 @@ package net.minecraftforge.client.model.renderable; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * A standard interface for renderable context values that support providing different values for parts of the model. diff --git a/src/main/java/net/minecraftforge/client/model/renderable/MultipartTransforms.java b/src/main/java/net/minecraftforge/client/model/renderable/MultipartTransforms.java index 18fc9070f9e..3e6ea6a3947 100644 --- a/src/main/java/net/minecraftforge/client/model/renderable/MultipartTransforms.java +++ b/src/main/java/net/minecraftforge/client/model/renderable/MultipartTransforms.java @@ -7,8 +7,7 @@ import com.google.common.collect.ImmutableMap; import com.mojang.math.Matrix4f; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * A context value that provides {@link Matrix4f} transforms for certain parts of the model. diff --git a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java index dd141c1aee0..a17c57541ae 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyBindingMap.java @@ -7,8 +7,8 @@ import net.minecraft.client.KeyMapping; import com.mojang.blaze3d.platform.InputConstants; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.EnumMap; diff --git a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java index 4182ba1a393..c98d538d1aa 100644 --- a/src/main/java/net/minecraftforge/client/settings/KeyModifier.java +++ b/src/main/java/net/minecraftforge/client/settings/KeyModifier.java @@ -7,14 +7,12 @@ import java.util.function.Supplier; -import javax.annotation.Nullable; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; +import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; public enum KeyModifier { @@ -43,7 +41,7 @@ public boolean isActive(@Nullable IKeyConflictContext conflictContext) public Component getCombinedName(InputConstants.Key key, Supplier defaultLogic) { String localizationFormatKey = Minecraft.ON_OSX ? "forge.controlsgui.control.mac" : "forge.controlsgui.control"; - return new TranslatableComponent(localizationFormatKey, defaultLogic.get()); + return Component.translatable(localizationFormatKey, defaultLogic.get()); } }, SHIFT { @@ -62,7 +60,7 @@ public boolean isActive(@Nullable IKeyConflictContext conflictContext) @Override public Component getCombinedName(InputConstants.Key key, Supplier defaultLogic) { - return new TranslatableComponent("forge.controlsgui.shift", defaultLogic.get()); + return Component.translatable("forge.controlsgui.shift", defaultLogic.get()); } }, ALT { @@ -81,7 +79,7 @@ public boolean isActive(@Nullable IKeyConflictContext conflictContext) @Override public Component getCombinedName(InputConstants.Key keyCode, Supplier defaultLogic) { - return new TranslatableComponent("forge.controlsgui.alt", defaultLogic.get()); + return Component.translatable("forge.controlsgui.alt", defaultLogic.get()); } }, NONE { diff --git a/src/main/java/net/minecraftforge/client/textures/ForgeTextureMetadata.java b/src/main/java/net/minecraftforge/client/textures/ForgeTextureMetadata.java index 77627fc8060..717cfa74fdd 100644 --- a/src/main/java/net/minecraftforge/client/textures/ForgeTextureMetadata.java +++ b/src/main/java/net/minecraftforge/client/textures/ForgeTextureMetadata.java @@ -5,9 +5,6 @@ package net.minecraftforge.client.textures; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.resources.Resource; @@ -16,6 +13,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.util.Optional; /** * The "forge" section of texture metadata files (.mcmeta). Currently used only to specify custom @@ -28,10 +30,9 @@ public final class ForgeTextureMetadata public static final ForgeTextureMetadata EMPTY = new ForgeTextureMetadata(null); public static final MetadataSectionSerializer SERIALIZER = new Serializer(); - public static ForgeTextureMetadata forResource(Resource resource) - { - ForgeTextureMetadata metadata = resource.getMetadata(SERIALIZER); - return metadata == null ? EMPTY : metadata; + public static ForgeTextureMetadata forResource(Resource resource) throws IOException { + Optional metadata = resource.metadata().getSection(SERIALIZER); + return metadata.isEmpty() ? EMPTY : metadata.get(); } @Nullable @@ -52,14 +53,14 @@ private static final class Serializer implements MetadataSectionSerializer @@ -32,7 +31,7 @@ public interface ITextureAtlasSpriteLoader /** * Load a TextureAtlasSprite for the given resource. */ - @Nonnull + @NotNull TextureAtlasSprite load( TextureAtlas atlas, ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo, diff --git a/src/main/java/net/minecraftforge/common/BasicItemListing.java b/src/main/java/net/minecraftforge/common/BasicItemListing.java index 12a0ad4e7ed..b506185c46d 100644 --- a/src/main/java/net/minecraftforge/common/BasicItemListing.java +++ b/src/main/java/net/minecraftforge/common/BasicItemListing.java @@ -5,10 +5,7 @@ package net.minecraftforge.common; -import java.util.Random; - -import javax.annotation.Nullable; - +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.npc.VillagerTrades.ItemListing; import net.minecraft.world.item.ItemStack; @@ -54,11 +51,9 @@ public BasicItemListing(int emeralds, ItemStack forSale, int maxTrades, int xp) this(new ItemStack(Items.EMERALD, emeralds), forSale, maxTrades, xp, 1); } + @org.jetbrains.annotations.Nullable @Override - @Nullable - public MerchantOffer getOffer(Entity merchant, Random rand) - { + public MerchantOffer getOffer(Entity p_219693_, RandomSource p_219694_) { return new MerchantOffer(price, price2, forSale, maxTrades, xp, priceMult); } - } diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java deleted file mode 100644 index df547aa7062..00000000000 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraftforge.event.world.BiomeLoadingEvent; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import net.minecraft.world.level.biome.Biomes; -import net.minecraft.resources.ResourceKey; -import net.minecraft.core.Registry; -import static net.minecraftforge.common.BiomeDictionary.Type.*; -import net.minecraftforge.registries.ForgeRegistries; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.world.level.biome.Biome; - -/** - * Use {@link Tags.Biomes} when possible. - * Note that tags are not usable yet during {@link BiomeLoadingEvent} so BiomeDictionary are still necessary there - */ -@Deprecated -public class BiomeDictionary -{ - private static final boolean DEBUG = false; - private static final Logger LOGGER = LogManager.getLogger(); - - public static final class Type - { - private static final Map byName = new ConcurrentHashMap<>(); - private static Collection allTypes = Collections.unmodifiableCollection(byName.values()); - - /*Temperature-based tags. Specifying neither implies a biome is temperate*/ - public static final Type HOT = getType("HOT"); - public static final Type COLD = getType("COLD"); - - //Tags specifying the amount of vegetation a biome has. Specifying neither implies a biome to have moderate amounts*/ - public static final Type SPARSE = getType("SPARSE"); - public static final Type DENSE = getType("DENSE"); - - //Tags specifying how moist a biome is. Specifying neither implies the biome as having moderate humidity*/ - public static final Type WET = getType("WET"); - public static final Type DRY = getType("DRY"); - - /*Tree-based tags, SAVANNA refers to dry, desert-like trees (Such as Acacia), CONIFEROUS refers to snowy trees (Such as Spruce) and JUNGLE refers to jungle trees. - * Specifying no tag implies a biome has temperate trees (Such as Oak)*/ - public static final Type SAVANNA = getType("SAVANNA"); - public static final Type CONIFEROUS = getType("CONIFEROUS"); - public static final Type JUNGLE = getType("JUNGLE"); - - /*Tags specifying the nature of a biome*/ - public static final Type SPOOKY = getType("SPOOKY"); - public static final Type DEAD = getType("DEAD"); - public static final Type LUSH = getType("LUSH"); - public static final Type MUSHROOM = getType("MUSHROOM"); - public static final Type MAGICAL = getType("MAGICAL"); - public static final Type RARE = getType("RARE"); - public static final Type PLATEAU = getType("PLATEAU"); - public static final Type MODIFIED = getType("MODIFIED"); - - public static final Type OCEAN = getType("OCEAN"); - public static final Type RIVER = getType("RIVER"); - /** - * A general tag for all water-based biomes. Shown as present if OCEAN or RIVER are. - **/ - public static final Type WATER = getType("WATER", OCEAN, RIVER); - - /*Generic types which a biome can be*/ - public static final Type MESA = getType("MESA"); - public static final Type FOREST = getType("FOREST"); - public static final Type PLAINS = getType("PLAINS"); - public static final Type HILLS = getType("HILLS"); - public static final Type SWAMP = getType("SWAMP"); - public static final Type SANDY = getType("SANDY"); - public static final Type SNOWY = getType("SNOWY"); - public static final Type WASTELAND = getType("WASTELAND"); - public static final Type BEACH = getType("BEACH"); - public static final Type VOID = getType("VOID"); - public static final Type UNDERGROUND = getType("UNDERGROUND"); - - /*Mountain related tags*/ - public static final Type PEAK = getType("PEAK"); - public static final Type SLOPE = getType("SLOPE"); - public static final Type MOUNTAIN = getType("MOUNTAIN", PEAK, SLOPE); - - /*Tags specifying the dimension a biome generates in. Specifying none implies a biome that generates in a modded dimension*/ - public static final Type OVERWORLD = getType("OVERWORLD"); - public static final Type NETHER = getType("NETHER"); - public static final Type END = getType("END"); - - private final String name; - private final List subTypes; - private final Set> biomes = ConcurrentHashMap.newKeySet(); - private final Set> biomesUn = Collections.unmodifiableSet(biomes); - - private Type(String name, Type... subTypes) - { - this.name = name; - this.subTypes = ImmutableList.copyOf(subTypes); - } - - /** - * Gets the name for this type. - */ - public String getName() - { - return name; - } - - public String toString() - { - return name; - } - - /** - * Retrieves a Type instance by name, - * if one does not exist already it creates one. - * This can be used as intermediate measure for modders to - * add their own Biome types. - *

- * There are no naming conventions besides: - *

  • Must be all upper case (enforced by name.toUpper())
  • - *
  • No Special characters. {Unenforced, just don't be a pain, if it becomes a issue I WILL - * make this RTE with no worry about backwards compatibility}
- *

- * Note: For performance sake, the return value of this function SHOULD be cached. - * Two calls with the same name SHOULD return the same value. - * - * @param name The name of this Type - * @return An instance of Type for this name. - */ - public synchronized static Type getType(String name, Type... subTypes) - { - return byName.computeIfAbsent(name.toUpperCase(Locale.ENGLISH), n -> new Type(n, subTypes)); - } - - /** - * Checks if a type instance exists for a given name. Does not have any side effects if a type does not already exist. - * This can be used for checking if a user-defined type is valid, for example, in a codec which accepts biome dictionary names. - * @param name The name. - * @return {@code true} if a type exists with this name. - * - * @see #getType(String, Type...) #getType for type naming conventions. - */ - public static boolean hasType(String name) - { - return byName.containsKey(name.toUpperCase(Locale.ENGLISH)); - } - - /** - * @return An unmodifiable collection of all current biome types. - */ - public static Collection getAll() - { - return allTypes; - } - - @Nullable - public static Type fromVanilla(Biome.BiomeCategory category) - { - if (category == Biome.BiomeCategory.NONE) - return null; - if (category == Biome.BiomeCategory.THEEND) - return VOID; - return getType(category.name()); - } - } - - private static final Map, BiomeInfo> biomeInfoMap = new HashMap<>(); - - private static class BiomeInfo - { - private final Set types = new HashSet(); - private final Set typesUn = Collections.unmodifiableSet(this.types); - } - - public static void init() {} - static - { - registerVanillaBiomes(); - } - - /** - * Adds the given types to the biome. - * - */ - public static void addTypes(ResourceKey biome, Type... types) - { - Collection supertypes = listSupertypes(types); - Collections.addAll(supertypes, types); - - for (Type type : supertypes) - { - type.biomes.add(biome); - } - - BiomeInfo biomeInfo = getBiomeInfo(biome); - Collections.addAll(biomeInfo.types, types); - biomeInfo.types.addAll(supertypes); - } - - /** - * Gets the set of biomes that have the given type. - * - */ - @Nonnull - public static Set> getBiomes(Type type) - { - return type.biomesUn; - } - - /** - * Gets the set of types that have been added to the given biome. - * - */ - @Nonnull - public static Set getTypes(ResourceKey biome) - { - return getBiomeInfo(biome).typesUn; - } - - /** - * Checks if the two given biomes have types in common. - * - * @return returns true if a common type is found, false otherwise - */ - public static boolean areSimilar(ResourceKey biomeA, ResourceKey biomeB) - { - Set typesA = getTypes(biomeA); - Set typesB = getTypes(biomeB); - return typesA.stream().anyMatch(typesB::contains); - } - - /** - * Checks if the given type has been added to the given biome. - * - */ - public static boolean hasType(ResourceKey biome, Type type) - { - return getTypes(biome).contains(type); - } - - /** - * Checks if any type has been added to the given biome. - * - */ - public static boolean hasAnyType(ResourceKey biome) - { - return !getBiomeInfo(biome).types.isEmpty(); - } - - //Internal implementation - private static BiomeInfo getBiomeInfo(ResourceKey biome) - { - return biomeInfoMap.computeIfAbsent(biome, k -> new BiomeInfo()); - } - - private static Collection listSupertypes(Type... types) - { - Set supertypes = new HashSet(); - Deque next = new ArrayDeque(); - Collections.addAll(next, types); - - while (!next.isEmpty()) - { - Type type = next.remove(); - - for (Type sType : Type.byName.values()) - { - if (sType.subTypes.contains(type) && supertypes.add(sType)) - next.add(sType); - } - } - - return supertypes; - } - - private static void registerVanillaBiomes() - { - addTypes(Biomes.OCEAN, OCEAN, OVERWORLD); - addTypes(Biomes.PLAINS, PLAINS, OVERWORLD); - addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD); - addTypes(Biomes.WINDSWEPT_HILLS, HILLS, OVERWORLD); - addTypes(Biomes.FOREST, FOREST, OVERWORLD); - addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD); - addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD); - addTypes(Biomes.RIVER, RIVER, OVERWORLD); - addTypes(Biomes.NETHER_WASTES, HOT, DRY, NETHER); - addTypes(Biomes.THE_END, COLD, DRY, END); - addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD); - addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD); - addTypes(Biomes.SNOWY_PLAINS, COLD, SNOWY, WASTELAND, OVERWORLD); - addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD); - addTypes(Biomes.BEACH, BEACH, OVERWORLD); - addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD); - addTypes(Biomes.SPARSE_JUNGLE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD); - addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD); - addTypes(Biomes.STONY_SHORE, BEACH, OVERWORLD); - addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD); - addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD); - addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD); - addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD); - addTypes(Biomes.OLD_GROWTH_PINE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD); - addTypes(Biomes.WINDSWEPT_FOREST, HILLS, FOREST, SPARSE, OVERWORLD); - addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD); - addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, SLOPE, PLATEAU); - addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD); - addTypes(Biomes.WOODED_BADLANDS, MESA, SANDY, DRY, SPARSE, OVERWORLD, SLOPE, PLATEAU); - addTypes(Biomes.MEADOW, PLAINS, PLATEAU, SLOPE, OVERWORLD); - addTypes(Biomes.GROVE, COLD, CONIFEROUS, FOREST, SNOWY, SLOPE, OVERWORLD); - addTypes(Biomes.SNOWY_SLOPES, COLD, SPARSE, SNOWY, SLOPE, OVERWORLD); - addTypes(Biomes.JAGGED_PEAKS, COLD, SPARSE, SNOWY, PEAK, OVERWORLD); - addTypes(Biomes.FROZEN_PEAKS, COLD, SPARSE, SNOWY, PEAK, OVERWORLD); - addTypes(Biomes.STONY_PEAKS, HOT, PEAK, OVERWORLD); - addTypes(Biomes.SMALL_END_ISLANDS, END); - addTypes(Biomes.END_MIDLANDS, END); - addTypes(Biomes.END_HIGHLANDS, END); - addTypes(Biomes.END_BARRENS, END); - addTypes(Biomes.WARM_OCEAN, OCEAN, HOT, OVERWORLD); - addTypes(Biomes.LUKEWARM_OCEAN, OCEAN, OVERWORLD); - addTypes(Biomes.COLD_OCEAN, OCEAN, COLD, OVERWORLD); - addTypes(Biomes.DEEP_LUKEWARM_OCEAN, OCEAN, OVERWORLD); - addTypes(Biomes.DEEP_COLD_OCEAN, OCEAN, COLD, OVERWORLD); - addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD); - addTypes(Biomes.THE_VOID, VOID); - addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD); - addTypes(Biomes.WINDSWEPT_GRAVELLY_HILLS, HILLS, SPARSE, RARE, OVERWORLD); - addTypes(Biomes.FLOWER_FOREST, FOREST, RARE, OVERWORLD); - addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, RARE, OVERWORLD); - addTypes(Biomes.OLD_GROWTH_BIRCH_FOREST, FOREST, DENSE, RARE, OVERWORLD); - addTypes(Biomes.OLD_GROWTH_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD); - addTypes(Biomes.WINDSWEPT_SAVANNA, HOT, DRY, SPARSE, SAVANNA, HILLS, RARE, OVERWORLD); - addTypes(Biomes.ERODED_BADLANDS, MESA, HOT, DRY, SPARSE, RARE, OVERWORLD); - addTypes(Biomes.BAMBOO_JUNGLE, HOT, WET, RARE, JUNGLE, OVERWORLD); - addTypes(Biomes.LUSH_CAVES, UNDERGROUND, LUSH, WET, OVERWORLD); - addTypes(Biomes.DRIPSTONE_CAVES, UNDERGROUND, SPARSE, OVERWORLD); - addTypes(Biomes.SOUL_SAND_VALLEY, HOT, DRY, NETHER); - addTypes(Biomes.CRIMSON_FOREST, HOT, DRY, NETHER, FOREST); - addTypes(Biomes.WARPED_FOREST, HOT, DRY, NETHER, FOREST); - addTypes(Biomes.BASALT_DELTAS, HOT, DRY, NETHER); - - if (DEBUG) - { - StringBuilder buf = new StringBuilder(); - buf.append("BiomeDictionary:\n"); - - Type.getAll().stream() - .sorted((l,r) -> l.getName().compareTo(r.getName())) - .forEach(type -> - buf.append(" ").append(type.name).append(": ") - .append(type.biomes.stream() - .map(ResourceKey::location) - .sorted((a,b) -> a.compareNamespaced(b)) - .map(Object::toString) - .collect(Collectors.joining(", ")) - ) - .append('\n') - ); - - boolean missing = false; - List> all = StreamSupport.stream(ForgeRegistries.BIOMES.spliterator(), false) - .map(b -> ResourceKey.create(Registry.BIOME_REGISTRY, b.getRegistryName())) - .sorted().collect(Collectors.toList()); - - for (ResourceKey key : all) { - if (!biomeInfoMap.containsKey(key)) { - if (!missing) { - buf.append("Missing:\n"); - missing = true; - } - buf.append(" ").append(key.location()).append('\n'); - } - } - LOGGER.debug(buf.toString()); - } - } -} diff --git a/src/main/java/net/minecraftforge/common/DungeonHooks.java b/src/main/java/net/minecraftforge/common/DungeonHooks.java index 5b0fcedbc79..755f9ab60bc 100644 --- a/src/main/java/net/minecraftforge/common/DungeonHooks.java +++ b/src/main/java/net/minecraftforge/common/DungeonHooks.java @@ -9,6 +9,7 @@ import java.util.Iterator; import java.util.Random; +import net.minecraft.util.RandomSource; import net.minecraft.util.random.WeightedEntry; import net.minecraft.util.random.WeightedRandom; import net.minecraft.world.entity.EntityType; @@ -78,7 +79,7 @@ public static int removeDungeonMob(EntityType name) * @param rand World generation random number generator * @return The mob name */ - public static EntityType getRandomDungeonMob(Random rand) + public static EntityType getRandomDungeonMob(RandomSource rand) { DungeonMob mob = WeightedRandom.getRandomItem(rand, dungeonMobs).orElseThrow(); return mob.type; diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index a68676b6374..37450f7fc75 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -26,9 +26,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraftforge.fml.config.IConfigSpec; import net.minecraftforge.fml.loading.FMLEnvironment; import org.apache.commons.lang3.tuple.Pair; @@ -48,6 +45,8 @@ import com.google.common.base.Splitter; import com.google.common.collect.Lists; import com.google.common.collect.ObjectArrays; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /* * Like {@link com.electronwill.nightconfig.core.ConfigSpec} except in builder format, and extended to accept comments, language keys, @@ -647,7 +646,7 @@ public interface BuilderConsumer { private static class BuilderContext { - private @Nonnull String[] comment = new String[0]; + private @NotNull String[] comment = new String[0]; private String langKey; private Range range; private boolean worldRestart = false; diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 8cda2ed5fe4..389aa92cdeb 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -7,19 +7,7 @@ import java.net.URI; import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import java.util.Objects; -import java.util.Set; -import java.util.Map.Entry; +import java.util.*; import java.util.function.Function; import java.util.function.Supplier; import java.util.regex.Matcher; @@ -36,21 +24,19 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import com.mojang.datafixers.kinds.App; import com.mojang.serialization.Codec; import com.mojang.serialization.Lifecycle; import com.mojang.serialization.codecs.RecordCodecBuilder; -import com.mojang.serialization.codecs.RecordCodecBuilder.Mu; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import it.unimi.dsi.fastutil.longs.LongSet; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.ResourceLocationException; +import net.minecraft.Util; import net.minecraft.advancements.Advancement; import net.minecraft.core.*; +import net.minecraft.network.chat.*; import net.minecraft.server.packs.PackType; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.TagEntry; import net.minecraft.tags.TagKey; import net.minecraft.util.datafix.fixes.StructuresBecomeConfiguredFix; import net.minecraft.world.effect.MobEffect; @@ -64,14 +50,11 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.storage.WorldData; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTables; -import net.minecraft.tags.Tag; import net.minecraft.util.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.Minecraft; @@ -91,7 +74,6 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; -import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.network.protocol.Packet; import net.minecraft.network.syncher.EntityDataSerializer; import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket; @@ -100,8 +82,6 @@ import net.minecraft.stats.Stats; import net.minecraft.world.phys.Vec3; import net.minecraft.world.*; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.level.block.entity.FurnaceBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; @@ -110,7 +90,6 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.network.chat.ClickEvent; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.BiomeGenerationSettings; @@ -157,7 +136,6 @@ import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.living.LivingGetProjectileEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.NoteBlockEvent; import net.minecraftforge.eventbus.api.Event.Result; @@ -166,23 +144,18 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.resource.ResourcePackLoader; -import net.minecraftforge.registries.DataSerializerEntry; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.GameData; -import net.minecraftforge.registries.IRegistryDelegate; import net.minecraftforge.registries.RegistryManager; +import net.minecraftforge.server.ServerLifecycleHooks; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.TextColor; -import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.damagesource.DamageSource; @@ -195,6 +168,8 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.LavaFluid; import net.minecraft.world.level.material.WaterFluid; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ForgeHooks { @@ -203,7 +178,7 @@ public class ForgeHooks private static final Marker FORGEHOOKS = MarkerManager.getMarker("FORGEHOOKS"); private static final Marker WORLDPERSISTENCE = MarkerManager.getMarker("WP"); - public static boolean canContinueUsing(@Nonnull ItemStack from, @Nonnull ItemStack to) + public static boolean canContinueUsing(@NotNull ItemStack from, @NotNull ItemStack to) { if (!from.isEmpty() && !to.isEmpty()) { @@ -212,7 +187,7 @@ public static boolean canContinueUsing(@Nonnull ItemStack from, @Nonnull ItemSta return false; } - public static boolean isCorrectToolForDrops(@Nonnull BlockState state, @Nonnull Player player) + public static boolean isCorrectToolForDrops(@NotNull BlockState state, @NotNull Player player) { if (!state.requiresCorrectToolForDrops()) return ForgeEventFactory.doPlayerHarvestCheck(player, state, true); @@ -244,7 +219,7 @@ public static boolean onPickBlock(HitResult target, Player player, Level level) result = state.getCloneItemStack(target, level, pos, player); if (result.isEmpty()) - LOGGER.warn("Picking on: [{}] {} gave null item", target.getType(), state.getBlock().getRegistryName()); + LOGGER.warn("Picking on: [{}] {} gave null item", target.getType(), ForgeRegistries.BLOCKS.getKey(state.getBlock())); } else if (target.getType() == HitResult.Type.ENTITY) { @@ -252,7 +227,7 @@ else if (target.getType() == HitResult.Type.ENTITY) result = entity.getPickedResult(target); if (result.isEmpty()) - LOGGER.warn("Picking on: [{}] {} gave null item", target.getType(), entity.getType().getRegistryName()); + LOGGER.warn("Picking on: [{}] {} gave null item", target.getType(), ForgeRegistries.ENTITIES.getKey(entity.getType())); } if (result.isEmpty()) @@ -366,7 +341,7 @@ public static double getEntityVisibilityMultiplier(LivingEntity entity, Entity l return Math.max(0,event.getVisibilityModifier()); } - public static Optional isLivingOnLadder(@Nonnull BlockState state, @Nonnull Level level, @Nonnull BlockPos pos, @Nonnull LivingEntity entity) + public static Optional isLivingOnLadder(@NotNull BlockState state, @NotNull Level level, @NotNull BlockPos pos, @NotNull LivingEntity entity) { boolean isSpectator = (entity instanceof Player && entity.isSpectator()); if (isSpectator) return Optional.empty(); @@ -405,7 +380,7 @@ public static void onLivingJump(LivingEntity entity) } @Nullable - public static ItemEntity onPlayerTossEvent(@Nonnull Player player, @Nonnull ItemStack item, boolean includeName) + public static ItemEntity onPlayerTossEvent(@NotNull Player player, @NotNull ItemStack item, boolean includeName) { player.captureDrops(Lists.newArrayList()); ItemEntity ret = player.drop(item, false, includeName); @@ -423,15 +398,15 @@ public static ItemEntity onPlayerTossEvent(@Nonnull Player player, @Nonnull Item return event.getEntityItem(); } - public static boolean onVanillaGameEvent(Level level, @Nullable Entity cause, GameEvent vanillaEvent, BlockPos position) + public static boolean onVanillaGameEvent(Level level, GameEvent vanillaEvent, Vec3 pos, GameEvent.Context context) { - return !MinecraftForge.EVENT_BUS.post(new VanillaGameEvent(level, cause, vanillaEvent, position)); + return !MinecraftForge.EVENT_BUS.post(new VanillaGameEvent(level, vanillaEvent, pos, context)); } @Nullable - public static Component onServerChatEvent(ServerGamePacketListenerImpl net, String raw, Component comp) + public static Component onServerChatEvent(@Nullable ServerPlayer player, String raw, Component comp) { - ServerChatEvent event = new ServerChatEvent(net.player, raw, comp); + ServerChatEvent event = new ServerChatEvent(player, raw, comp); if (MinecraftForge.EVENT_BUS.post(event)) { return null; @@ -467,13 +442,13 @@ public static Component newChatWithLinks(String string, boolean allowMissingHead if (part.length() > 0) { if (ichat == null) - ichat = new TextComponent(part); + ichat = Component.literal(part); else ichat.append(part); } lastEnd = end; String url = string.substring(start, end); - MutableComponent link = new TextComponent(url); + MutableComponent link = Component.literal(url); try { @@ -483,7 +458,7 @@ public static Component newChatWithLinks(String string, boolean allowMissingHead if (!allowMissingHeader) { if (ichat == null) - ichat = new TextComponent(url); + ichat = Component.literal(url); else ichat.append(url); continue; @@ -494,25 +469,25 @@ public static Component newChatWithLinks(String string, boolean allowMissingHead catch (URISyntaxException e) { // Bad syntax bail out! - if (ichat == null) ichat = new TextComponent(url); + if (ichat == null) ichat = Component.literal(url); else ichat.append(url); continue; } // Set the click event and append the link. ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url); - link.setStyle(link.getStyle().withClickEvent(click).setUnderlined(true).withColor(TextColor.fromLegacyFormat(ChatFormatting.BLUE))); + link.setStyle(link.getStyle().withClickEvent(click).withUnderlined(true).withColor(TextColor.fromLegacyFormat(ChatFormatting.BLUE))); if (ichat == null) - ichat = new TextComponent(""); + ichat = Component.literal(""); ichat.append(link); } // Append the rest of the message. String end = string.substring(lastEnd); if (ichat == null) - ichat = new TextComponent(end); + ichat = Component.literal(end); else if (end.length() > 0) - ichat.append(new TextComponent(string.substring(lastEnd))); + ichat.append(Component.literal(string.substring(lastEnd))); return ichat; } @@ -570,7 +545,7 @@ public static int onBlockBreakEvent(Level level, GameType gameType, ServerPlayer return event.isCanceled() ? -1 : event.getExpToDrop(); } - public static InteractionResult onPlaceItemIntoWorld(@Nonnull UseOnContext context) + public static InteractionResult onPlaceItemIntoWorld(@NotNull UseOnContext context) { ItemStack itemstack = context.getItemInHand(); Level level = context.getLevel(); @@ -660,7 +635,7 @@ else if (blockSnapshots.size() == 1) return ret; } - public static boolean onAnvilChange(AnvilMenu container, @Nonnull ItemStack left, @Nonnull ItemStack right, Container outputSlot, String name, int baseCost, Player player) + public static boolean onAnvilChange(AnvilMenu container, @NotNull ItemStack left, @NotNull ItemStack right, Container outputSlot, String name, int baseCost, Player player) { AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost, player); if (MinecraftForge.EVENT_BUS.post(e)) return false; @@ -672,7 +647,7 @@ public static boolean onAnvilChange(AnvilMenu container, @Nonnull ItemStack left return false; } - public static float onAnvilRepair(Player player, @Nonnull ItemStack output, @Nonnull ItemStack left, @Nonnull ItemStack right) + public static float onAnvilRepair(Player player, @NotNull ItemStack output, @NotNull ItemStack left, @NotNull ItemStack right) { AnvilRepairEvent e = new AnvilRepairEvent(player, left, right, output); MinecraftForge.EVENT_BUS.post(e); @@ -688,8 +663,8 @@ public static Player getCraftingPlayer() { return craftingPlayer.get(); } - @Nonnull - public static ItemStack getContainerItem(@Nonnull ItemStack stack) + @NotNull + public static ItemStack getContainerItem(@NotNull ItemStack stack) { if (stack.getItem().hasContainerItem(stack)) { @@ -769,12 +744,6 @@ public static void onEmptyLeftClick(Player player) MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.LeftClickEmpty(player)); } - @Deprecated(forRemoval = true, since = "1.18") - public static boolean onChangeGameMode(Player player, GameType currentGameMode, GameType newGameMode) - { - return onChangeGameType(player, currentGameMode, newGameMode) != null; - } - /** * @return null if game type should not be changed, desired new GameType otherwise */ @@ -864,7 +833,7 @@ public static String getDefaultWorldPreset() { ForgeWorldPreset def = ForgeWorldPreset.getDefaultWorldPreset(); if (def != null) - return def.getRegistryName().toString(); + return ForgeRegistries.WORLD_TYPES.get().getKey(def).toString(); return "default"; } @@ -884,16 +853,7 @@ public static TagKey getTagFromVanillaTier(Tiers tier) @FunctionalInterface public interface BiomeCallbackFunction { - Biome apply(final Biome.ClimateSettings climate, final Biome.BiomeCategory category, final BiomeSpecialEffects effects, final BiomeGenerationSettings gen, final MobSpawnSettings spawns); - } - - public static Biome enhanceBiome(@Nullable final ResourceLocation name, final Biome.ClimateSettings climate, final Biome.BiomeCategory category, final BiomeSpecialEffects effects, final BiomeGenerationSettings gen, final MobSpawnSettings spawns, final RecordCodecBuilder.Instance codec, final BiomeCallbackFunction callback) - { - BiomeGenerationSettingsBuilder genBuilder = new BiomeGenerationSettingsBuilder(gen); - MobSpawnSettingsBuilder spawnBuilder = new MobSpawnSettingsBuilder(spawns); - BiomeLoadingEvent event = new BiomeLoadingEvent(name, climate, category, effects, genBuilder, spawnBuilder); - MinecraftForge.EVENT_BUS.post(event); - return callback.apply(event.getClimate(), event.getCategory(), event.getEffects(), event.getGeneration().build(), event.getSpawns().build()).setRegistryName(name); + Biome apply(final Biome.ClimateSettings climate, final BiomeSpecialEffects effects, final BiomeGenerationSettings gen, final MobSpawnSettings spawns); } private static class LootTableContext @@ -1034,10 +994,10 @@ public static ItemStack getProjectile(LivingEntity entity, ItemStack projectileW * Used as the default implementation of {@link Item#getCreatorModId}. Call that method instead. */ @Nullable - public static String getDefaultCreatorModId(@Nonnull ItemStack itemStack) + public static String getDefaultCreatorModId(@NotNull ItemStack itemStack) { Item item = itemStack.getItem(); - ResourceLocation registryName = item.getRegistryName(); + ResourceLocation registryName = ForgeRegistries.ITEMS.getKey(item); String modId = registryName == null ? null : registryName.getNamespace(); if ("minecraft".equals(modId)) { @@ -1065,7 +1025,7 @@ else if (item instanceof PotionItem || item instanceof TippedArrowItem) } else if (item instanceof SpawnEggItem) { - ResourceLocation resourceLocation = ((SpawnEggItem)item).getType(null).getRegistryName(); + ResourceLocation resourceLocation = ForgeRegistries.ENTITIES.getKey(((SpawnEggItem) item).getType(null)); if (resourceLocation != null) { return resourceLocation.getNamespace(); @@ -1106,40 +1066,38 @@ public static boolean hasNoElements(Ingredient ingredient) { //If we potentially added a barrier due to the ingredient being an empty tag, try and check if it is the stack we added ItemStack item = items[0]; - return item.getItem() == Items.BARRIER && item.getHoverName() instanceof TextComponent hoverName && hoverName.getText().startsWith("Empty Tag: "); + return item.getItem() == Items.BARRIER && item.getHoverName() instanceof MutableComponent hoverName && hoverName.getString().startsWith("Empty Tag: "); } return false; } - public static void deserializeTagAdditions(List list, JsonObject json, List allList) + public static void deserializeTagAdditions(List list, JsonObject json, List allList) { if (json.has("remove")) { for (JsonElement entry : GsonHelper.getAsJsonArray(json, "remove")) { String s = GsonHelper.convertToString(entry, "value"); - Tag.Entry dummy; + TagEntry dummy; if (!s.startsWith("#")) - dummy = new Tag.OptionalElementEntry(new ResourceLocation(s)); + dummy = TagEntry.optionalElement(new ResourceLocation(s)); else - dummy = new Tag.TagEntry(new ResourceLocation(s.substring(1))); - allList.removeIf(e -> e.entry().equals(dummy)); + dummy = TagEntry.tag(new ResourceLocation(s.substring(1))); + allList.removeIf(e -> e.equals(dummy)); } } } - private static Map, DataSerializerEntry> serializerEntries = GameData.getSerializerMap(); - //private static final ForgeRegistry serializerRegistry = (ForgeRegistry) ForgeRegistries.DATA_SERIALIZERS; - // Do not reimplement this ^ it introduces a chicken-egg scenario by classloading registries during bootstrap - @Nullable public static EntityDataSerializer getSerializer(int id, CrudeIncrementalIntIdentityHashBiMap> vanilla) { EntityDataSerializer serializer = vanilla.byId(id); if (serializer == null) { - DataSerializerEntry entry = ((ForgeRegistry)ForgeRegistries.DATA_SERIALIZERS.get()).getValue(id); - if (entry != null) serializer = entry.getSerializer(); + // ForgeRegistries.DATA_SERIALIZERS is a deferred register now, so if this method is called too early, the registry will be null + ForgeRegistry> registry = (ForgeRegistry>) ForgeRegistries.DATA_SERIALIZERS.get(); + if (registry != null) + serializer = registry.getValue(id); } return serializer; } @@ -1149,16 +1107,11 @@ public static int getSerializerId(EntityDataSerializer serializer, CrudeIncre int id = vanilla.getId(serializer); if (id < 0) { - // ForgeRegistries.DATA_SERIALIZERS is a deferred register now, so if this method is called too early, the serializer map will be null - // This should keep checking until it's not null - if (serializerEntries == null) - serializerEntries = GameData.getSerializerMap(); - if (serializerEntries != null) - { - DataSerializerEntry entry = serializerEntries.get(serializer); - if (entry != null) - id = ((ForgeRegistry) ForgeRegistries.DATA_SERIALIZERS.get()).getID(entry); - } + id = ((ForgeRegistry>) ForgeRegistries.DATA_SERIALIZERS).getID(serializer); + // ForgeRegistries.DATA_SERIALIZERS is a deferred register now, so if this method is called too early, the registry will be null + ForgeRegistry> registry = (ForgeRegistry>) ForgeRegistries.DATA_SERIALIZERS.get(); + if (registry != null) + id = registry.getID(serializer); } return id; } @@ -1171,7 +1124,7 @@ public static boolean canEntityDestroy(Level level, BlockPos pos, LivingEntity e return ForgeEventFactory.getMobGriefingEvent(level, entity) && state.canEntityDestroy(level, pos, entity) && ForgeEventFactory.onEntityDestroyBlock(entity, pos, state); } - private static final Map, Integer> VANILLA_BURNS = new HashMap<>(); + private static final Map, Integer> VANILLA_BURNS = new HashMap<>(); /** * Gets the burn time of this itemstack. @@ -1186,7 +1139,7 @@ public static int getBurnTime(ItemStack stack, @Nullable RecipeType recipeTyp { Item item = stack.getItem(); int ret = stack.getBurnTime(recipeType); - return ForgeEventFactory.getItemBurnTime(stack, ret == -1 ? VANILLA_BURNS.getOrDefault(item.delegate, 0) : ret, recipeType); + return ForgeEventFactory.getItemBurnTime(stack, ret == -1 ? VANILLA_BURNS.getOrDefault(ForgeRegistries.ITEMS.getDelegateOrThrow(item), 0) : ret, recipeType); } } @@ -1194,7 +1147,7 @@ public static int getBurnTime(ItemStack stack, @Nullable RecipeType recipeTyp public static synchronized void updateBurns() { VANILLA_BURNS.clear(); - FurnaceBlockEntity.getFuel().entrySet().forEach(e -> VANILLA_BURNS.put(e.getKey().delegate, e.getValue())); + FurnaceBlockEntity.getFuel().entrySet().forEach(e -> VANILLA_BURNS.put(ForgeRegistries.ITEMS.getDelegateOrThrow(e.getKey()), e.getValue())); } /** @@ -1205,14 +1158,14 @@ public static synchronized void updateBurns() * @param context The loot context that generated that loot * @return The modified list * - * @deprecated Use {@link #modifyLoot(ResourceLocation, List, LootContext)} instead. + * @deprecated Use {@link #modifyLoot(ResourceLocation, ObjectArrayList, LootContext)} instead. * * @implNote This method will use the {@linkplain LootTableIdCondition#UNKNOWN_LOOT_TABLE * unknown loot table marker} when redirecting. */ @Deprecated public static List modifyLoot(List list, LootContext context) { - return modifyLoot(LootTableIdCondition.UNKNOWN_LOOT_TABLE, list, context); + return modifyLoot(LootTableIdCondition.UNKNOWN_LOOT_TABLE, ObjectArrayList.wrap((ItemStack[]) list.toArray()), context); } /** @@ -1229,7 +1182,7 @@ public static List modifyLoot(List list, LootContext conte * @apiNote The given context will be modified by this method to also store the ID of the * loot table being queried. */ - public static List modifyLoot(ResourceLocation lootTableId, List generatedLoot, LootContext context) { + public static ObjectArrayList modifyLoot(ResourceLocation lootTableId, ObjectArrayList generatedLoot, LootContext context) { context.setQueriedLootTableId(lootTableId); // In case the ID was set via copy constructor, this will be ignored: intended LootModifierManager man = ForgeInternalHandler.getLootModifierManager(); for (IGlobalLootModifier mod : man.getAllLootMods()) { @@ -1253,20 +1206,6 @@ public static List getModPacksWithVanilla() return modpacks; } - /** - * Fixes MC-194811 - * When a structure mod is removed, this map may contain null keys. This will make the world unable to save if this persists. - * If we remove a structure from the save data in this way, we then mark the chunk for saving - */ - public static void fixNullStructureReferences(ChunkAccess chunk, Map, LongSet> structureReferences) - { - if (structureReferences.remove(null) != null) - { - chunk.setUnsaved(true); - } - chunk.setAllReferences(structureReferences); - } - private static final Set VANILLA_DIMS = Sets.newHashSet("minecraft:overworld", "minecraft:the_nether", "minecraft:the_end"); private static final String DIMENSIONS_KEY = "dimensions"; private static final String SEED_KEY = "seed"; @@ -1310,50 +1249,6 @@ public static ShieldBlockEvent onShieldBlock(LivingEntity blocker, DamageSource return e; } - /** - * Called when dimension jsons are parsed. - * Creates a copy of the worldgen settings and its dimension registry, - * where dimensions that specify that they should use the server seed will use the server seed - * instead of the seed that mojang requires be specified in the json. - **/ - public static WorldGenSettings loadDimensionsWithServerSeed(WorldGenSettings wgs) - { - // get the original worldgen settings' settings - long seed = wgs.seed(); - boolean generateFeatures = wgs.generateFeatures(); - boolean generateBonusChest = wgs.generateBonusChest(); - Registry originalRegistry = wgs.dimensions(); - Optional legacyCustomOptions = wgs.legacyCustomOptions; - - // make a copy of the dimension registry; for dimensions that specify that they should use the server seed instead - // of the hardcoded json seed, recreate them with the correct seed - MappedRegistry seededRegistry = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental(), (Function>)null); - for (Entry, LevelStem> entry : originalRegistry.entrySet()) - { - ResourceKey key = entry.getKey(); - LevelStem dimension = entry.getValue(); - if (dimension.useServerSeed()) - { - seededRegistry.register(key, new LevelStem(dimension.typeHolder(), dimension.generator().withSeed(seed), true), originalRegistry.lifecycle(entry.getValue())); - } - else - { - seededRegistry.register(key, dimension, originalRegistry.lifecycle(dimension)); - } - } - - return new WorldGenSettings(seed, generateFeatures, generateBonusChest, seededRegistry, legacyCustomOptions); - } - - /** Called in the LevelStem codec builder to add extra fields to dimension jsons **/ - public static App, LevelStem> expandLevelStemCodec(RecordCodecBuilder.Instance builder, Supplier, LevelStem>> vanillaFieldsSupplier) - { - App, LevelStem> vanillaFields = vanillaFieldsSupplier.get(); - return builder.group(vanillaFields).and( - Codec.BOOL.optionalFieldOf("forge:use_server_seed", false).stable().forGetter(levelStem -> levelStem.useServerSeed())) - .apply(builder, builder.stable((stem, useServerSeed) -> new LevelStem(stem.typeHolder(), stem.generator(), useServerSeed))); - } - public static void writeAdditionalLevelSaveData(WorldData worldData, CompoundTag levelTag) { CompoundTag fmlData = new CompoundTag(); @@ -1460,7 +1355,7 @@ public static Lifecycle parseLifecycle(String lifecycle) public static void saveMobEffect(CompoundTag nbt, String key, MobEffect effect) { - var registryName = effect.getRegistryName(); + var registryName = ForgeRegistries.MOB_EFFECTS.getKey(effect); if (registryName != null) { nbt.putString(key, registryName.toString()); @@ -1484,37 +1379,7 @@ public static MobEffect loadMobEffect(CompoundTag nbt, String key, @Nullable Mob return fallback; } } - - private static BannerPattern[] nonPatternItems; - private static int totalPatternRows; - - static - { - refreshBannerPatternData(); - } - public static void refreshBannerPatternData() - { - nonPatternItems = Arrays.stream(BannerPattern.values()) - .filter(p -> !p.hasPatternItem) - .toArray(BannerPattern[]::new); - totalPatternRows = (nonPatternItems.length + 2) / 4; - } - - public static int getTotalPatternRows() - { - return totalPatternRows; - } - public static int getNonPatternItemCount() - { - return nonPatternItems.length; - } - - public static int getActualPatternIndex(int index) - { - return nonPatternItems[index].ordinal(); - } - public static boolean shouldSuppressEnderManAnger(EnderMan enderMan, Player player, ItemStack mask) { return mask.isEnderMask(player, enderMan) || MinecraftForge.EVENT_BUS.post(new EnderManAngerEvent(enderMan, player)); diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 4908845f06f..71f552ab2a2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -5,9 +5,11 @@ package net.minecraftforge.common; -import net.minecraft.commands.synchronization.EmptyArgumentSerializer; -import net.minecraft.commands.synchronization.ArgumentTypes; -import net.minecraft.commands.synchronization.ArgumentSerializer; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; +import net.minecraft.commands.synchronization.SingletonArgumentInfo; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.RangedAttribute; import net.minecraft.world.item.crafting.Ingredient; @@ -16,7 +18,6 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.core.Registry; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.common.crafting.PartialNBTIngredient; @@ -28,20 +29,20 @@ import net.minecraftforge.common.extensions.IForgeEntity; import net.minecraftforge.common.extensions.IForgePlayer; import net.minecraftforge.common.loot.CanToolPerformAction; -import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.LootTableIdCondition; +import net.minecraftforge.common.world.BiomeModifier; +import net.minecraftforge.common.world.NoneBiomeModifier; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.*; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.*; +import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.registries.*; import net.minecraftforge.network.NetworkConstants; import net.minecraftforge.event.server.ServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; import net.minecraftforge.network.filters.VanillaPacketSplitter; import net.minecraftforge.server.command.EnumArgument; @@ -53,8 +54,6 @@ import org.apache.logging.log4j.Logger; import net.minecraft.data.DataGenerator; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.crafting.CompoundIngredient; import net.minecraftforge.common.crafting.ConditionalRecipe; @@ -74,13 +73,14 @@ import net.minecraftforge.common.data.ForgeLootTableProvider; import net.minecraftforge.common.data.ForgeRecipeProvider; import net.minecraftforge.energy.CapabilityEnergy; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; +import com.mojang.serialization.Codec; + import java.util.*; @Mod("forge") @@ -91,6 +91,15 @@ public class ForgeMod private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD"); private static final DeferredRegister ATTRIBUTES = DeferredRegister.create(ForgeRegistries.Keys.ATTRIBUTES, "forge"); + private static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, "forge"); + private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "forge"); + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static final RegistryObject ENUM_COMMAND_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES.register("enum", () -> + ArgumentTypeInfos.registerByClass(EnumArgument.class, new EnumArgument.Info())); + private static final RegistryObject> MODID_COMMAND_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES.register("modid", () -> + ArgumentTypeInfos.registerByClass(ModIdArgument.class, + SingletonArgumentInfo.contextFree(ModIdArgument::modIdArgument))); public static final RegistryObject SWIM_SPEED = ATTRIBUTES.register("swim_speed", () -> new RangedAttribute("forge.swimSpeed", 1.0D, 0.0D, 1024.0D).setSyncable(true)); public static final RegistryObject NAMETAG_DISTANCE = ATTRIBUTES.register("nametag_distance", () -> new RangedAttribute("forge.nameTagDistance", 64.0D, 0.0D, 64.0).setSyncable(true)); @@ -117,6 +126,11 @@ public class ForgeMod */ public static final RegistryObject STEP_HEIGHT_ADDITION = ATTRIBUTES.register("step_height_addition", () -> new RangedAttribute("forge.stepHeight", 0.0D, -512.0D, 512.0D).setSyncable(true)); + /** + * Noop biome modifier. Can be used in a biome modifier json with "type": "forge:none". + */ + public static final RegistryObject> NONE_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("none", () -> Codec.unit(NoneBiomeModifier.INSTANCE)); + private static boolean enableMilkFluid = false; public static final RegistryObject MILK = RegistryObject.create(new ResourceLocation("milk"), ForgeRegistries.FLUIDS); @@ -156,11 +170,15 @@ public ForgeMod() modEventBus.addListener(this::preInit); modEventBus.addListener(this::gatherData); modEventBus.addListener(this::loadComplete); - modEventBus.addGenericListener(Fluid.class, this::registerFluids); + modEventBus.addListener(this::registerFluids); + modEventBus.addListener(this::registerRecipeSerializers); + modEventBus.addListener(this::registerLootData); modEventBus.register(this); ATTRIBUTES.register(modEventBus); + COMMAND_ARGUMENT_TYPES.register(modEventBus); + BIOME_MODIFIER_SERIALIZERS.register(modEventBus); MinecraftForge.EVENT_BUS.addListener(this::serverStopping); - MinecraftForge.EVENT_BUS.addGenericListener(SoundEvent.class, this::missingSoundMapping); + MinecraftForge.EVENT_BUS.addListener(this::missingSoundMapping); ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ForgeConfig.clientSpec); ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ForgeConfig.serverSpec); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ForgeConfig.commonSpec); @@ -173,9 +191,8 @@ public ForgeMod() MinecraftForge.EVENT_BUS.addListener(VillagerTradingManager::loadTrades); MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER); MinecraftForge.EVENT_BUS.addListener(this::mappingChanged); - BiomeDictionary.init(); - ForgeRegistries.ITEMS.tags().addOptionalTagDefaults(Tags.Items.ENCHANTING_FUELS, Set.of(Items.LAPIS_LAZULI.delegate)); + ForgeRegistries.ITEMS.tags().addOptionalTagDefaults(Tags.Items.ENCHANTING_FUELS, Set.of(ForgeRegistries.ITEMS.getDelegateOrThrow(Items.LAPIS_LAZULI))); if (FMLEnvironment.dist == Dist.CLIENT) { @@ -193,22 +210,11 @@ public void registerCapabilities(RegisterCapabilitiesEvent event) public void preInit(FMLCommonSetupEvent evt) { VersionChecker.startVersionCheck(); - - registerArgumentTypes(); VanillaPacketSplitter.register(); } - @SuppressWarnings({"unchecked", "rawtypes"}) - private void registerArgumentTypes() - { - ArgumentTypes.register("forge:enum", EnumArgument.class, (ArgumentSerializer) new EnumArgument.Serializer()); - ArgumentTypes.register("forge:modid", ModIdArgument.class, new EmptyArgumentSerializer<>(ModIdArgument::modIdArgument)); - } - public void loadComplete(FMLLoadCompleteEvent event) { - if (FMLEnvironment.dist == Dist.CLIENT) - ForgeHooksClient.registerForgeWorldPresetScreens(); } public void serverStopping(ServerStoppingEvent evt) @@ -216,7 +222,7 @@ public void serverStopping(ServerStoppingEvent evt) WorldWorkerManager.clear(); } - public void mappingChanged(RegistryEvent.IdMappingEvent evt) + public void mappingChanged(IdMappingEvent evt) { Ingredient.invalidateAll(); } @@ -225,26 +231,26 @@ public void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if (event.includeServer()) - { - ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); - ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen, existingFileHelper); - gen.addProvider(blockTags); - gen.addProvider(new ForgeItemTagsProvider(gen, blockTags, existingFileHelper)); - gen.addProvider(new ForgeFluidTagsProvider(gen, existingFileHelper)); - gen.addProvider(new ForgeRecipeProvider(gen)); - gen.addProvider(new ForgeLootTableProvider(gen)); - gen.addProvider(new ForgeBiomeTagsProvider(gen, existingFileHelper)); - } + ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); + ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen, existingFileHelper); + gen.addProvider(event.includeServer(), blockTags); + gen.addProvider(event.includeServer(), new ForgeItemTagsProvider(gen, blockTags, existingFileHelper)); + gen.addProvider(event.includeServer(), new ForgeFluidTagsProvider(gen, existingFileHelper)); + gen.addProvider(event.includeServer(), new ForgeRecipeProvider(gen)); + gen.addProvider(event.includeServer(), new ForgeLootTableProvider(gen)); + gen.addProvider(event.includeServer(), new ForgeBiomeTagsProvider(gen, existingFileHelper)); } - public void missingSoundMapping(RegistryEvent.MissingMappings event) + public void missingSoundMapping(MissingMappingsEvent event) { + if (event.getKey() != ForgeRegistries.Keys.SOUND_EVENTS) + return; + //Removed in 1.15, see https://minecraft.gamepedia.com/Parrot#History List removedSounds = Arrays.asList("entity.parrot.imitate.panda", "entity.parrot.imitate.zombie_pigman", "entity.parrot.imitate.enderman", "entity.parrot.imitate.polar_bear", "entity.parrot.imitate.wolf"); - for (RegistryEvent.MissingMappings.Mapping mapping : event.getAllMappings()) + for (MissingMappingsEvent.Mapping mapping : event.getAllMappings(ForgeRegistries.Keys.SOUND_EVENTS)) { - ResourceLocation regName = mapping.key; + ResourceLocation regName = mapping.getKey(); if (regName != null && regName.getNamespace().equals("minecraft")) { String path = regName.getPath(); @@ -258,48 +264,49 @@ public void missingSoundMapping(RegistryEvent.MissingMappings event) } // done in an event instead of deferred to only enable if a mod requests it - public void registerFluids(RegistryEvent.Register event) + public void registerFluids(RegisterEvent event) { - if (enableMilkFluid) + if (enableMilkFluid && event.getRegistryKey().equals(ForgeRegistries.Keys.FLUIDS)) { // set up attributes FluidAttributes.Builder attributesBuilder = FluidAttributes.builder(new ResourceLocation("forge", "block/milk_still"), new ResourceLocation("forge", "block/milk_flowing")).density(1024).viscosity(1024); ForgeFlowingFluid.Properties properties = new ForgeFlowingFluid.Properties(MILK, FLOWING_MILK, attributesBuilder).bucket(() -> Items.MILK_BUCKET); // register fluids - event.getRegistry().register(new ForgeFlowingFluid.Source(properties).setRegistryName(MILK.getId())); - event.getRegistry().register(new ForgeFlowingFluid.Flowing(properties).setRegistryName(FLOWING_MILK.getId())); + event.register(ForgeRegistries.Keys.FLUIDS, MILK.getId(), () -> new ForgeFlowingFluid.Source(properties)); + event.register(ForgeRegistries.Keys.FLUIDS, FLOWING_MILK.getId(), () -> new ForgeFlowingFluid.Flowing(properties)); } } - @SubscribeEvent //ModBus, can't use addListener due to nested genetics. - public void registerRecipeSerialziers(RegistryEvent.Register> event) + public void registerRecipeSerializers(RegisterEvent event) { - CraftingHelper.register(AndCondition.Serializer.INSTANCE); - CraftingHelper.register(FalseCondition.Serializer.INSTANCE); - CraftingHelper.register(ItemExistsCondition.Serializer.INSTANCE); - CraftingHelper.register(ModLoadedCondition.Serializer.INSTANCE); - CraftingHelper.register(NotCondition.Serializer.INSTANCE); - CraftingHelper.register(OrCondition.Serializer.INSTANCE); - CraftingHelper.register(TrueCondition.Serializer.INSTANCE); - CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE); - - CraftingHelper.register(new ResourceLocation("forge", "compound"), CompoundIngredient.Serializer.INSTANCE); - CraftingHelper.register(new ResourceLocation("forge", "nbt"), NBTIngredient.Serializer.INSTANCE); - CraftingHelper.register(new ResourceLocation("forge", "partial_nbt"), PartialNBTIngredient.Serializer.INSTANCE); - CraftingHelper.register(new ResourceLocation("forge", "difference"), DifferenceIngredient.Serializer.INSTANCE); - CraftingHelper.register(new ResourceLocation("forge", "intersection"), IntersectionIngredient.Serializer.INSTANCE); - CraftingHelper.register(new ResourceLocation("minecraft", "item"), VanillaIngredientSerializer.INSTANCE); - - event.getRegistry().register(new ConditionalRecipe.Serializer>().setRegistryName(new ResourceLocation("forge", "conditional"))); - + if (event.getRegistryKey().equals(ForgeRegistries.Keys.RECIPE_SERIALIZERS)) + { + CraftingHelper.register(AndCondition.Serializer.INSTANCE); + CraftingHelper.register(FalseCondition.Serializer.INSTANCE); + CraftingHelper.register(ItemExistsCondition.Serializer.INSTANCE); + CraftingHelper.register(ModLoadedCondition.Serializer.INSTANCE); + CraftingHelper.register(NotCondition.Serializer.INSTANCE); + CraftingHelper.register(OrCondition.Serializer.INSTANCE); + CraftingHelper.register(TrueCondition.Serializer.INSTANCE); + CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE); + + CraftingHelper.register(new ResourceLocation("forge", "compound"), CompoundIngredient.Serializer.INSTANCE); + CraftingHelper.register(new ResourceLocation("forge", "nbt"), NBTIngredient.Serializer.INSTANCE); + CraftingHelper.register(new ResourceLocation("forge", "partial_nbt"), PartialNBTIngredient.Serializer.INSTANCE); + CraftingHelper.register(new ResourceLocation("forge", "difference"), DifferenceIngredient.Serializer.INSTANCE); + CraftingHelper.register(new ResourceLocation("forge", "intersection"), IntersectionIngredient.Serializer.INSTANCE); + CraftingHelper.register(new ResourceLocation("minecraft", "item"), VanillaIngredientSerializer.INSTANCE); + + event.register(ForgeRegistries.Keys.RECIPE_SERIALIZERS, new ResourceLocation("forge", "conditional"), ConditionalRecipe.Serializer::new); + } } - @SubscribeEvent //ModBus - @SuppressWarnings("unused") // automatically called by Forge - public void registerLootData(RegistryEvent.Register> event) + public void registerLootData(RegisterEvent event) { - // Ignore the event itself: this is done only not to statically initialize our custom LootConditionType - Registry.register(Registry.LOOT_CONDITION_TYPE, new ResourceLocation("forge:loot_table_id"), LootTableIdCondition.LOOT_TABLE_ID); - Registry.register(Registry.LOOT_CONDITION_TYPE, new ResourceLocation("forge:can_tool_perform_action"), CanToolPerformAction.LOOT_CONDITION_TYPE); + if (!event.getRegistryKey().equals(Registry.LOOT_ITEM_REGISTRY)) + return; + + event.register(Registry.LOOT_ITEM_REGISTRY, new ResourceLocation("forge:loot_table_id"), () -> LootTableIdCondition.LOOT_TABLE_ID); + event.register(Registry.LOOT_ITEM_REGISTRY, new ResourceLocation("forge:can_tool_perform_action"), () -> CanToolPerformAction.LOOT_CONDITION_TYPE); } } diff --git a/src/main/java/net/minecraftforge/common/ForgeSpawnEggItem.java b/src/main/java/net/minecraftforge/common/ForgeSpawnEggItem.java index ab618574626..efc0093194f 100644 --- a/src/main/java/net/minecraftforge/common/ForgeSpawnEggItem.java +++ b/src/main/java/net/minecraftforge/common/ForgeSpawnEggItem.java @@ -21,8 +21,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.IdentityHashMap; import java.util.List; @@ -81,7 +81,7 @@ public static SpawnEggItem fromEntityType(@Nullable EntityType type) } stack.shrink(1); - source.getLevel().gameEvent(GameEvent.ENTITY_PLACE, source.getPos()); + source.getLevel().gameEvent(GameEvent.ENTITY_PLACE, source.getPos(), GameEvent.Context.of(source.getBlockState())); return stack; }; diff --git a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java index 7c351c9b253..fb7ac091c22 100644 --- a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java +++ b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java @@ -5,57 +5,30 @@ package net.minecraftforge.common; +import java.util.List; import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fml.*; -import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.IModLoadingState; +import net.minecraftforge.fml.IModStateProvider; +import net.minecraftforge.fml.ModLoadingPhase; +import net.minecraftforge.fml.ModLoadingState; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.ObjectHolderRegistry; import net.minecraftforge.registries.RegistryManager; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Stream; +public class ForgeStatesProvider implements IModStateProvider +{ + final ModLoadingState CREATE_REGISTRIES = ModLoadingState.withInline("CREATE_REGISTRIES", "CONSTRUCT", ModLoadingPhase.GATHER, ml -> RegistryManager.postNewRegistryEvent()); + final ModLoadingState OBJECT_HOLDERS = ModLoadingState.withInline("OBJECT_HOLDERS", "CREATE_REGISTRIES", ModLoadingPhase.GATHER, ml -> ObjectHolderRegistry.findObjectHolders()); + final ModLoadingState INJECT_CAPABILITIES = ModLoadingState.withInline("INJECT_CAPABILITIES", "OBJECT_HOLDERS", ModLoadingPhase.GATHER, ml -> CapabilityManager.INSTANCE.injectCapabilities(ml.getAllScanData())); + final ModLoadingState UNFREEZE = ModLoadingState.withInline("UNFREEZE_DATA", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml -> GameData.unfreezeData()); + final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withInline("LOAD_REGISTRIES", "UNFREEZE_DATA", ModLoadingPhase.GATHER, ml -> GameData.postRegisterEvents()); + final ModLoadingState FREEZE = ModLoadingState.withInline("FREEZE_DATA", "COMPLETE", ModLoadingPhase.COMPLETE, ml -> GameData.freezeData()); + final ModLoadingState NETLOCK = ModLoadingState.withInline("NETWORK_LOCK", "FREEZE_DATA", ModLoadingPhase.COMPLETE, ml -> NetworkRegistry.lock()); -public class ForgeStatesProvider implements IModStateProvider { - final ModLoadingState CREATE_REGISTRIES = ModLoadingState.withTransition("CREATE_REGISTRIES", "CONSTRUCT", ModLoadingPhase.GATHER, new SerialTransition<>(() -> Stream.of(IModStateTransition.EventGenerator.fromFunction(RegistryManager.newRegistryEventGenerator())), RegistryManager::preNewRegistryEvent, RegistryManager::postNewRegistryEvent, (e, prev) -> prev.thenApplyAsync(Function.identity(), e))); - final ModLoadingState OBJECT_HOLDERS = ModLoadingState.withInline("OBJECT_HOLDERS", "CREATE_REGISTRIES", ModLoadingPhase.GATHER, ml-> ObjectHolderRegistry.findObjectHolders()); - final ModLoadingState INJECT_CAPABILITIES = ModLoadingState.withInline("INJECT_CAPABILITIES", "OBJECT_HOLDERS", ModLoadingPhase.GATHER, ml-> CapabilityManager.INSTANCE.injectCapabilities(ml.getAllScanData())); - final ModLoadingState UNFREEZE = ModLoadingState.withInline("UNFREEZE_DATA", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml->GameData.unfreezeData()); - final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withTransition("LOAD_REGISTRIES", "UNFREEZE_DATA", ModLoadingPhase.GATHER, new SerialTransition>(GameData::generateRegistryEvents, GameData::preRegistryEventDispatch, GameData::postRegistryEventDispatch, GameData::checkForRevertToVanilla)); - final ModLoadingState FREEZE = ModLoadingState.withInline("FREEZE_DATA", "COMPLETE", ModLoadingPhase.COMPLETE, ml->GameData.freezeData()); - final ModLoadingState NETLOCK = ModLoadingState.withInline("NETWORK_LOCK", "FREEZE_DATA", ModLoadingPhase.COMPLETE, ml-> NetworkRegistry.lock()); @Override - public List getAllStates() { + public List getAllStates() + { return List.of(CREATE_REGISTRIES, OBJECT_HOLDERS, INJECT_CAPABILITIES, UNFREEZE, LOAD_REGISTRIES, FREEZE, NETLOCK); } - - // TODO 1.19: Pass the event instances to the pre and post hooks rather than the event generators - static record SerialTransition(Supplier>> eventStream, BiFunction, CompletableFuture>> preDispatchHook, BiFunction, CompletableFuture>> postDispatchHook, BiFunction>, CompletableFuture>> finalActivityGenerator) implements IModStateTransition { - public static SerialTransition of(Supplier>> eventStream) { - return new SerialTransition(eventStream, (t, f)->CompletableFuture.completedFuture(Collections.emptyList()), (t, f)->CompletableFuture.completedFuture(Collections.emptyList()), (e, prev) ->prev.thenApplyAsync(Function.identity(), e)); - } - @Override - public Supplier>> eventFunctionStream() { - return eventStream; - } - - @Override - public ThreadSelector threadSelector() { - return ThreadSelector.SYNC; - } - - // These never progress the ModLoadingStage.. - @Override - public BiFunction nextModLoadingStage() { - return ModLoadingStage::currentState; - } - } } diff --git a/src/main/java/net/minecraftforge/common/ForgeTier.java b/src/main/java/net/minecraftforge/common/ForgeTier.java index 1e832f416cf..f0ddc720afb 100644 --- a/src/main/java/net/minecraftforge/common/ForgeTier.java +++ b/src/main/java/net/minecraftforge/common/ForgeTier.java @@ -9,9 +9,8 @@ import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.Objects; import java.util.function.Supplier; /** @@ -25,13 +24,13 @@ public final class ForgeTier implements Tier private final float speed; private final float attackDamageBonus; private final int enchantmentValue; - @Nonnull + @NotNull private final TagKey tag; - @Nonnull + @NotNull private final Supplier repairIngredient; public ForgeTier(int level, int uses, float speed, float attackDamageBonus, int enchantmentValue, - @Nonnull TagKey tag, @Nonnull Supplier repairIngredient) + @NotNull TagKey tag, @NotNull Supplier repairIngredient) { this.level = level; this.uses = uses; @@ -72,13 +71,13 @@ public int getEnchantmentValue() return this.enchantmentValue; } - @Nonnull + @NotNull public TagKey getTag() { return this.tag; } - @Nonnull + @NotNull @Override public Ingredient getRepairIngredient() { diff --git a/src/main/java/net/minecraftforge/common/IExtensibleEnum.java b/src/main/java/net/minecraftforge/common/IExtensibleEnum.java index 0ecbfa299d4..ff7501ce201 100644 --- a/src/main/java/net/minecraftforge/common/IExtensibleEnum.java +++ b/src/main/java/net/minecraftforge/common/IExtensibleEnum.java @@ -22,14 +22,14 @@ *

* For example, an enum with the constructor {@code MyEnum(Object foo)} would * require the method: - * + * *

  * public static MyEnum create(String name, Object foo)
  * {
  *     throw new IllegalStateException("Enum not extended");
  * }
  * 
- * + * * The method contents will be replaced with ASM at runtime. Multiple * {@code create} methods can be defined as long as each * matches a constructor. @@ -44,7 +44,7 @@ public interface IExtensibleEnum default void init() {} /** - * Use this instead of {@link StringRepresentable#fromEnum(Supplier, Function)} for extensible enums because this not cache the enum values on construction + * Use this instead of {@link StringRepresentable#fromEnum(Supplier)} for extensible enums because this not cache the enum values on construction */ static & StringRepresentable> Codec createCodecForExtensibleEnum(Supplier valuesSupplier, Function enumValueFromNameFunction) { return Codec.either(Codec.STRING, Codec.INT).comapFlatMap( diff --git a/src/main/java/net/minecraftforge/common/IForgeShearable.java b/src/main/java/net/minecraftforge/common/IForgeShearable.java index 3ef41b7ab5f..5e7e34021a2 100644 --- a/src/main/java/net/minecraftforge/common/IForgeShearable.java +++ b/src/main/java/net/minecraftforge/common/IForgeShearable.java @@ -12,9 +12,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @@ -35,7 +34,7 @@ public interface IForgeShearable * @param pos Block's position in level. * @return If this is shearable, and onSheared should be called. */ - default boolean isShearable(@Nonnull ItemStack item, Level level, BlockPos pos) + default boolean isShearable(@NotNull ItemStack item, Level level, BlockPos pos) { return true; } @@ -58,8 +57,8 @@ default boolean isShearable(@Nonnull ItemStack item, Level level, BlockPos pos) * @param fortune The fortune level of the shears being used. * @return A List containing all items from this shearing. May be empty. */ - @Nonnull - default List onSheared(@Nullable Player player, @Nonnull ItemStack item, Level level, BlockPos pos, int fortune) + @NotNull + default List onSheared(@Nullable Player player, @NotNull ItemStack item, Level level, BlockPos pos, int fortune) { return Collections.emptyList(); } diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index 722f82a13e1..18a57fef282 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -19,10 +19,6 @@ import net.minecraft.world.level.material.Fluid; import net.minecraftforge.registries.ForgeRegistries; -import javax.annotation.Nullable; -import java.util.Set; -import java.util.function.Supplier; - public class Tags { public static void init () diff --git a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java index 5198341b4fa..09dfe53c01c 100644 --- a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java +++ b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java @@ -41,11 +41,10 @@ import net.minecraftforge.server.ServerLifecycleHooks; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.*; -import java.nio.charset.StandardCharsets; import java.util.*; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -246,14 +245,15 @@ static PreparableReloadListener getReloadListener() { final Gson gson = (new GsonBuilder()).create(); - @Nonnull + @NotNull @Override - protected JsonObject prepare(@Nonnull ResourceManager resourceManager, ProfilerFiller p) + protected JsonObject prepare(@NotNull ResourceManager resourceManager, ProfilerFiller p) { - if (!resourceManager.hasResource(ITEM_TIER_ORDERING_JSON)) + Optional res = resourceManager.getResource(ITEM_TIER_ORDERING_JSON); + if (res.isEmpty()) return new JsonObject(); - try (Resource r = resourceManager.getResource(ITEM_TIER_ORDERING_JSON); InputStream stream = r.getInputStream(); Reader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) + try (Reader reader = res.get().openAsReader()) { return gson.fromJson(reader, JsonObject.class); } @@ -265,7 +265,7 @@ protected JsonObject prepare(@Nonnull ResourceManager resourceManager, ProfilerF } @Override - protected void apply(@Nonnull JsonObject data, @Nonnull ResourceManager resourceManager, ProfilerFiller p) + protected void apply(@NotNull JsonObject data, @NotNull ResourceManager resourceManager, ProfilerFiller p) { try { diff --git a/src/main/java/net/minecraftforge/common/UsernameCache.java b/src/main/java/net/minecraftforge/common/UsernameCache.java index 2e1d8af1a9c..41a42199767 100644 --- a/src/main/java/net/minecraftforge/common/UsernameCache.java +++ b/src/main/java/net/minecraftforge/common/UsernameCache.java @@ -16,8 +16,6 @@ import java.util.Objects; import java.util.UUID; -import javax.annotation.Nullable; - import com.google.common.base.Charsets; import net.minecraftforge.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; @@ -30,6 +28,7 @@ import com.google.gson.JsonSyntaxException; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; +import org.jetbrains.annotations.Nullable; /** * Caches player's last known usernames diff --git a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java index 2cfac299f38..ccb8d3f9aed 100644 --- a/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/BrewingRecipe.java @@ -7,14 +7,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BrewingRecipe implements IBrewingRecipe { - @Nonnull private final Ingredient input; - @Nonnull private final Ingredient ingredient; - @Nonnull private final ItemStack output; + @NotNull private final Ingredient input; + @NotNull private final Ingredient ingredient; + @NotNull private final ItemStack output; public BrewingRecipe(Ingredient input, Ingredient ingredient, ItemStack output) { @@ -24,7 +23,7 @@ public BrewingRecipe(Ingredient input, Ingredient ingredient, ItemStack output) } @Override - public boolean isInput(@Nonnull ItemStack stack) + public boolean isInput(@NotNull ItemStack stack) { return this.input.test(stack); } diff --git a/src/main/java/net/minecraftforge/common/capabilities/Capability.java b/src/main/java/net/minecraftforge/common/capabilities/Capability.java index 666c5cb36df..3078f034473 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/Capability.java +++ b/src/main/java/net/minecraftforge/common/capabilities/Capability.java @@ -6,13 +6,12 @@ package net.minecraftforge.common.capabilities; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; - /** * This is the core holder object Capabilities. * Each capability will have ONE instance of this class, @@ -28,7 +27,7 @@ public class Capability */ public String getName() { return name; } - public @Nonnull LazyOptional orEmpty(Capability toCheck, LazyOptional inst) + public @NotNull LazyOptional orEmpty(Capability toCheck, LazyOptional inst) { return this == toCheck ? inst.cast() : LazyOptional.empty(); } diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityDispatcher.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityDispatcher.java index 16e6a345b81..5587ed365e8 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityDispatcher.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityDispatcher.java @@ -5,7 +5,6 @@ package net.minecraftforge.common.capabilities; -import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; @@ -21,6 +20,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.Nullable; /** * A high-speed implementation of a capability delegator. diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java index 3a7b43642eb..adc734c53fc 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java @@ -5,8 +5,6 @@ package net.minecraftforge.common.capabilities; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import com.google.common.annotations.VisibleForTesting; @@ -17,6 +15,7 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.ForgeEventFactory; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; @@ -27,7 +26,7 @@ public abstract class CapabilityProvider> i @VisibleForTesting static boolean SUPPORTS_LAZY_CAPABILITIES = true; - private final @Nonnull Class baseClass; + private final @NotNull Class baseClass; private @Nullable CapabilityDispatcher capabilities; private boolean valid = true; @@ -176,8 +175,8 @@ public void reviveCaps() } @Override - @Nonnull - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) + @NotNull + public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { final CapabilityDispatcher disp = getCapabilities(); return !valid || disp == null ? LazyOptional.empty() : disp.getCapability(cap, side); diff --git a/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProvider.java b/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProvider.java index 845d96e6960..f1e4499c18c 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProvider.java +++ b/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProvider.java @@ -5,11 +5,10 @@ package net.minecraftforge.common.capabilities; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.core.Direction; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface ICapabilityProvider { @@ -24,13 +23,13 @@ public interface ICapabilityProvider * CAN BE NULL. Null is defined to represent 'internal' or 'self' * @return The requested an optional holding the requested capability. */ - @Nonnull LazyOptional getCapability(@Nonnull final Capability cap, final @Nullable Direction side); + @NotNull LazyOptional getCapability(@NotNull final Capability cap, final @Nullable Direction side); /* * Purely added as a bouncer to sided version, to make modders stop complaining about calling with a null value. * This should never be OVERRIDDEN, modders should only ever implement the sided version. */ - @Nonnull default LazyOptional getCapability(@Nonnull final Capability cap) { + @NotNull default LazyOptional getCapability(@NotNull final Capability cap) { return getCapability(cap, null); } } diff --git a/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProviderImpl.java b/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProviderImpl.java index f92e07387f4..ffbd3d6cc17 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProviderImpl.java +++ b/src/main/java/net/minecraftforge/common/capabilities/ICapabilityProviderImpl.java @@ -5,7 +5,7 @@ package net.minecraftforge.common.capabilities; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public interface ICapabilityProviderImpl> extends ICapabilityProvider { diff --git a/src/main/java/net/minecraftforge/common/crafting/AbstractIngredient.java b/src/main/java/net/minecraftforge/common/crafting/AbstractIngredient.java index 0ea5d92b86a..735ff9948ba 100644 --- a/src/main/java/net/minecraftforge/common/crafting/AbstractIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/AbstractIngredient.java @@ -12,8 +12,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.stream.Stream; /** diff --git a/src/main/java/net/minecraftforge/common/crafting/CompoundIngredient.java b/src/main/java/net/minecraftforge/common/crafting/CompoundIngredient.java index 09204f9e589..8ac505fe096 100644 --- a/src/main/java/net/minecraftforge/common/crafting/CompoundIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/CompoundIngredient.java @@ -12,10 +12,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -28,6 +24,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.network.FriendlyByteBuf; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** Ingredient that matches if any of the child ingredients match */ public class CompoundIngredient extends AbstractIngredient @@ -69,7 +67,7 @@ public static Ingredient of(Ingredient... children) } @Override - @Nonnull + @NotNull public ItemStack[] getItems() { if (stacks == null) @@ -84,7 +82,7 @@ public ItemStack[] getItems() } @Override - @Nonnull + @NotNull public IntList getStackingIds() { boolean childrenNeedInvalidation = false; @@ -132,7 +130,7 @@ public IIngredientSerializer getSerializer() return Serializer.INSTANCE; } - @Nonnull + @NotNull public Collection getChildren() { return this.children; diff --git a/src/main/java/net/minecraftforge/common/crafting/ConditionalAdvancement.java b/src/main/java/net/minecraftforge/common/crafting/ConditionalAdvancement.java index 43b79e13ffc..eb61e0ef8e0 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ConditionalAdvancement.java +++ b/src/main/java/net/minecraftforge/common/crafting/ConditionalAdvancement.java @@ -19,8 +19,7 @@ import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.util.GsonHelper; import net.minecraftforge.common.crafting.conditions.ICondition; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class ConditionalAdvancement { @@ -29,15 +28,6 @@ public static Builder builder() return new Builder(); } - /** - * @deprecated Please use {@linkplain #processConditional(JsonObject, ICondition.IContext) the more general overload}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - @Nullable - public static JsonObject processConditional(JsonObject json) { - return processConditional(json, ICondition.IContext.EMPTY); - } - /** * Processes the conditional advancement during loading. * @param json The incoming json from the advancement file. diff --git a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java index 25f69b9e422..948232c35ca 100644 --- a/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java +++ b/src/main/java/net/minecraftforge/common/crafting/ConditionalRecipe.java @@ -23,12 +23,11 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.registries.ObjectHolder; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class ConditionalRecipe { - @ObjectHolder("forge:conditional") + @ObjectHolder(registryName = "recipe_serializer", value = "forge:conditional") public static final RecipeSerializer> SERIALZIER = null; public static Builder builder() @@ -38,33 +37,6 @@ public static Builder builder() public static class Serializer> implements RecipeSerializer { - private ResourceLocation name; - - @Override - public RecipeSerializer setRegistryName(ResourceLocation name) - { - this.name = name; - return this; - } - - @Override - public ResourceLocation getRegistryName() - { - return name; - } - - @Override - public Class> getRegistryType() - { - return Serializer.>castClass(RecipeSerializer.class); - } - - @SuppressWarnings("unchecked") // Need this wrapper, because generics - private static Class castClass(Class cls) - { - return (Class)cls; - } - @Override public T fromJson(ResourceLocation recipeId, JsonObject json) { diff --git a/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java b/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java index 6db8c97e255..393ddcfdcbf 100644 --- a/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java +++ b/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java @@ -10,8 +10,6 @@ import java.util.Map; import java.util.Objects; -import javax.annotation.Nullable; - import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Lists; @@ -40,6 +38,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; +import org.jetbrains.annotations.Nullable; public class CraftingHelper { @@ -199,29 +198,11 @@ public static ItemStack getItemStack(JsonObject json, boolean readNBT, boolean d return new ItemStack(item, GsonHelper.getAsInt(json, "count", 1)); } - /** - * @deprecated Please use the {@linkplain #processConditions(JsonObject, String, ICondition.IContext) other more general overload}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static boolean processConditions(JsonObject json, String memberName) - { - return processConditions(json, memberName, ICondition.IContext.EMPTY); - } - public static boolean processConditions(JsonObject json, String memberName, ICondition.IContext context) { return !json.has(memberName) || processConditions(GsonHelper.getAsJsonArray(json, memberName), context); } - /** - * @deprecated Please use the {@linkplain #processConditions(JsonArray, ICondition.IContext) other more general overload}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static boolean processConditions(JsonArray conditions) - { - return processConditions(conditions, ICondition.IContext.EMPTY); - } - public static boolean processConditions(JsonArray conditions, ICondition.IContext context) { for (int x = 0; x < conditions.size(); x++) diff --git a/src/main/java/net/minecraftforge/common/crafting/DifferenceIngredient.java b/src/main/java/net/minecraftforge/common/crafting/DifferenceIngredient.java index 765940b79c4..b1e6d74ba21 100644 --- a/src/main/java/net/minecraftforge/common/crafting/DifferenceIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/DifferenceIngredient.java @@ -14,8 +14,8 @@ import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Arrays; /** Ingredient that matches everything from the first ingredient that is not included in the second ingredient */ diff --git a/src/main/java/net/minecraftforge/common/crafting/IntersectionIngredient.java b/src/main/java/net/minecraftforge/common/crafting/IntersectionIngredient.java index 51a1bb119dd..3eb8326c442 100644 --- a/src/main/java/net/minecraftforge/common/crafting/IntersectionIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/IntersectionIngredient.java @@ -17,8 +17,8 @@ import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/src/main/java/net/minecraftforge/common/crafting/MultiItemValue.java b/src/main/java/net/minecraftforge/common/crafting/MultiItemValue.java index 70080e43150..c0fb22707ea 100644 --- a/src/main/java/net/minecraftforge/common/crafting/MultiItemValue.java +++ b/src/main/java/net/minecraftforge/common/crafting/MultiItemValue.java @@ -13,6 +13,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient.Value; +import net.minecraftforge.registries.ForgeRegistries; public class MultiItemValue implements Value { @@ -44,7 +45,7 @@ public JsonObject serialize() private JsonObject toJson(ItemStack stack) { JsonObject ret = new JsonObject(); - ret.addProperty("item", stack.getItem().getRegistryName().toString()); + ret.addProperty("item", ForgeRegistries.ITEMS.getKey(stack.getItem()).toString()); if (stack.getCount() != 1) ret.addProperty("count", stack.getCount()); if (stack.getTag() != null) diff --git a/src/main/java/net/minecraftforge/common/crafting/NBTIngredient.java b/src/main/java/net/minecraftforge/common/crafting/NBTIngredient.java index 43fbd8de685..3e970e82bab 100644 --- a/src/main/java/net/minecraftforge/common/crafting/NBTIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/NBTIngredient.java @@ -7,14 +7,14 @@ import java.util.stream.Stream; -import javax.annotation.Nullable; - import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; /** Ingredient that matches the given stack, performing an exact NBT match. Use {@link PartialNBTIngredient} if you need partial match. */ public class NBTIngredient extends AbstractIngredient @@ -58,7 +58,7 @@ public JsonElement toJson() { JsonObject json = new JsonObject(); json.addProperty("type", CraftingHelper.getID(Serializer.INSTANCE).toString()); - json.addProperty("item", stack.getItem().getRegistryName().toString()); + json.addProperty("item", ForgeRegistries.ITEMS.getKey(stack.getItem()).toString()); json.addProperty("count", stack.getCount()); if (stack.hasTag()) json.addProperty("nbt", stack.getTag().toString()); diff --git a/src/main/java/net/minecraftforge/common/crafting/PartialNBTIngredient.java b/src/main/java/net/minecraftforge/common/crafting/PartialNBTIngredient.java index 1c632844d2c..3f791bd8356 100644 --- a/src/main/java/net/minecraftforge/common/crafting/PartialNBTIngredient.java +++ b/src/main/java/net/minecraftforge/common/crafting/PartialNBTIngredient.java @@ -92,13 +92,13 @@ public JsonElement toJson() json.addProperty("type", CraftingHelper.getID(Serializer.INSTANCE).toString()); if (items.size() == 1) { - json.addProperty("item", items.iterator().next().getRegistryName().toString()); + json.addProperty("item", ForgeRegistries.ITEMS.getKey(items.iterator().next()).toString()); } else { JsonArray items = new JsonArray(); // ensure the order of items in the set is deterministic when saved to JSON - this.items.stream().map(Item::getRegistryName).sorted().forEach(name -> items.add(name.toString())); + this.items.stream().map(ForgeRegistries.ITEMS::getKey).sorted().forEach(name -> items.add(name.toString())); json.add("items", items); } json.addProperty("nbt", nbt.toString()); diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/AndCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/AndCondition.java index c1a81beb789..adf0ff9400a 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/AndCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/AndCondition.java @@ -43,12 +43,6 @@ public ResourceLocation getID() return NAME; } - @Override - public boolean test() - { - return test(IContext.EMPTY); - } - @Override public boolean test(IContext context) { diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionContext.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionContext.java index 5cc3e013650..7cfe212368f 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionContext.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ConditionContext.java @@ -6,12 +6,13 @@ package net.minecraftforge.common.crafting.conditions; import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagManager; +import java.util.Collection; import java.util.Collections; import java.util.IdentityHashMap; import java.util.Map; @@ -19,15 +20,16 @@ public class ConditionContext implements ICondition.IContext { private final TagManager tagManager; - private Map, Map>>> loadedTags = null; + private Map, Map>>> loadedTags = null; public ConditionContext(TagManager tagManager) { this.tagManager = tagManager; } - @Override - public Map>> getAllTags(ResourceKey> registry) + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public Map>> getAllTags(ResourceKey> registry) { if (loadedTags == null) { @@ -37,7 +39,8 @@ public Map>> getAllTags(ResourceKey(); for (var loadResult : tags) { - loadedTags.put(loadResult.key(), (Map) Collections.unmodifiableMap(loadResult.tags())); + Map>> map = Collections.unmodifiableMap(loadResult.tags()); + loadedTags.put(loadResult.key(), (Map) map); } } return (Map) loadedTags.getOrDefault(registry, Collections.emptyMap()); diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/FalseCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/FalseCondition.java index 5a17ed276af..2277af5c27f 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/FalseCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/FalseCondition.java @@ -22,7 +22,7 @@ public ResourceLocation getID() } @Override - public boolean test() + public boolean test(IContext condition) { return false; } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ICondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ICondition.java index ddcd6b0f01c..d3f3f11b50c 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ICondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ICondition.java @@ -9,33 +9,25 @@ import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey; +import java.util.Collection; import java.util.Collections; import java.util.Map; +import java.util.Set; public interface ICondition { ResourceLocation getID(); - default boolean test(IContext context) - { - return test(); - } - - /** - * @deprecated Use {@linkplain #test(IContext) the other more general overload}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - boolean test(); + boolean test(IContext context); interface IContext { IContext EMPTY = new IContext() { @Override - public Map>> getAllTags(ResourceKey> registry) + public Map>> getAllTags(ResourceKey> registry) { return Collections.emptyMap(); } @@ -44,15 +36,15 @@ public Map>> getAllTags(ResourceKey Tag> getTag(TagKey key) + default Collection> getTag(TagKey key) { - return getAllTags(key.registry()).getOrDefault(key.location(), Tag.empty()); + return getAllTags(key.registry()).getOrDefault(key.location(), Set.of()); } /** * Return all the loaded tags for the passed registry, or an empty map if none is available. * Note that the map and the tags are unmodifiable. */ - Map>> getAllTags(ResourceKey> registry); + Map>> getAllTags(ResourceKey> registry); } } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ItemExistsCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ItemExistsCondition.java index fe98ca24270..445a5c5928d 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ItemExistsCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ItemExistsCondition.java @@ -38,7 +38,7 @@ public ResourceLocation getID() } @Override - public boolean test() + public boolean test(IContext context) { return ForgeRegistries.ITEMS.containsKey(item); } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java index 1f7ed9a26c8..a724213eef7 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/ModLoadedCondition.java @@ -28,7 +28,7 @@ public ResourceLocation getID() } @Override - public boolean test() + public boolean test(IContext context) { return ModList.get().isLoaded(modid); } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/NotCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/NotCondition.java index 0a20c70dcb0..4b6a90198eb 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/NotCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/NotCondition.java @@ -26,12 +26,6 @@ public ResourceLocation getID() return NAME; } - @Override - public boolean test() - { - return test(IContext.EMPTY); - } - @Override public boolean test(IContext context) { diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/OrCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/OrCondition.java index ddc01c6c32c..107895f2009 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/OrCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/OrCondition.java @@ -43,12 +43,6 @@ public ResourceLocation getID() return NAME; } - @Override - public boolean test() - { - return test(IContext.EMPTY); - } - @Override public boolean test(IContext context) { diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java index 21662b0b9b2..fb9bdd68423 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java @@ -42,13 +42,7 @@ public ResourceLocation getID() @Override public boolean test(ICondition.IContext context) { - return context.getTag(tag).getValues().isEmpty(); - } - - @Override - public boolean test() - { - return test(IContext.EMPTY); + return context.getTag(tag).isEmpty(); } @Override diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/TrueCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/TrueCondition.java index d5f00899d64..51ae173038b 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/TrueCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/TrueCondition.java @@ -23,7 +23,7 @@ public ResourceLocation getID() } @Override - public boolean test() + public boolean test(IContext context) { return true; } diff --git a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index 2d0dc2ee8d2..13f5372160b 100644 --- a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -37,8 +37,7 @@ import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.resource.ResourcePackLoader; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Enables data providers to check if other data files currently exist. The @@ -147,7 +146,7 @@ public boolean exists(ResourceLocation loc, PackType packType) { if (!enable) { return true; } - return generated.get(packType).contains(loc) || getManager(packType).hasResource(loc); + return generated.get(packType).contains(loc) || getManager(packType).getResource(loc).isPresent(); } /** @@ -155,7 +154,7 @@ public boolean exists(ResourceLocation loc, PackType packType) { * convenience method to avoid repeating type/prefix/suffix and instead use the * common definitions in {@link ResourceType}, or a custom {@link IResourceType} * definition. - * + * * @param loc the base location of the resource, e.g. * {@code "minecraft:block/stone"} * @param type a {@link IResourceType} describing how to form the path to the @@ -169,7 +168,7 @@ public boolean exists(ResourceLocation loc, IResourceType type) { /** * Check if a given resource exists in the known resource packs. - * + * * @param loc the base location of the resource, e.g. * {@code "minecraft:block/stone"} * @param packType the type of resources to check @@ -190,13 +189,13 @@ public boolean exists(ResourceLocation loc, PackType packType, String pathSuffix *

* This should be called by data providers immediately when a new data object is * created, i.e. not during - * {@link DataProvider#run(net.minecraft.data.HashCache) run} but instead + * {@link DataProvider#run(net.minecraft.data.CachedOutput) run} but instead * when the "builder" (or whatever intermediate object) is created, such as a * {@link ModelBuilder}. *

* This represents a promise to generate the file later, since other * datagen may rely on this file existing. - * + * * @param loc the base location of the resource, e.g. * {@code "minecraft:block/stone"} * @param type a {@link IResourceType} describing how to form the path to the @@ -211,13 +210,13 @@ public void trackGenerated(ResourceLocation loc, IResourceType type) { *

* This should be called by data providers immediately when a new data object is * created, i.e. not during - * {@link DataProvider#run(HashCache) run} but instead + * {@link DataProvider#run(net.minecraft.data.CachedOutput) run} but instead * when the "builder" (or whatever intermediate object) is created, such as a * {@link ModelBuilder}. *

* This represents a promise to generate the file later, since other * datagen may rely on this file existing. - * + * * @param loc the base location of the resource, e.g. * {@code "minecraft:block/stone"} * @param packType the type of resources to check @@ -236,7 +235,7 @@ public Resource getResource(ResourceLocation loc, PackType packType, String path @VisibleForTesting public Resource getResource(ResourceLocation loc, PackType packType) throws IOException { - return getManager(packType).getResource(loc); + return getManager(packType).getResource(loc).orElseThrow(); } /** diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 56eea71adf7..7d76c218e6f 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -9,7 +9,6 @@ import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index 0fcdf3f0f6d..eaaa6c8df86 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -9,7 +9,6 @@ import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java index cd4f30dde29..b44c358f9cc 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java @@ -6,14 +6,13 @@ package net.minecraftforge.common.data; import com.google.gson.JsonObject; +import net.minecraft.data.CachedOutput; import net.minecraft.data.DataGenerator; -import net.minecraft.data.HashCache; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -25,6 +24,8 @@ import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.Tags; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.nio.file.Path; @@ -33,8 +34,8 @@ public final class ForgeRecipeProvider extends RecipeProvider { - private Map> replacements = new HashMap<>(); - private Set excludes = new HashSet<>(); + private final Map> replacements = new HashMap<>(); + private final Set excludes = new HashSet<>(); public ForgeRecipeProvider(DataGenerator generatorIn) { @@ -43,7 +44,7 @@ public ForgeRecipeProvider(DataGenerator generatorIn) private void exclude(ItemLike item) { - excludes.add(item.asItem().getRegistryName()); + excludes.add(ForgeRegistries.ITEMS.getKey(item.asItem())); } private void replace(ItemLike item, TagKey tag) @@ -54,15 +55,15 @@ private void replace(ItemLike item, TagKey tag) @Override protected void buildCraftingRecipes(Consumer consumer) { - replace(Items.STICK, Tags.Items.RODS_WOODEN); - replace(Items.GOLD_INGOT, Tags.Items.INGOTS_GOLD); - replace(Items.IRON_INGOT, Tags.Items.INGOTS_IRON); + replace(Items.STICK, Tags.Items.RODS_WOODEN); + replace(Items.GOLD_INGOT, Tags.Items.INGOTS_GOLD); + replace(Items.IRON_INGOT, Tags.Items.INGOTS_IRON); replace(Items.NETHERITE_INGOT, Tags.Items.INGOTS_NETHERITE); replace(Items.COPPER_INGOT, Tags.Items.INGOTS_COPPER); replace(Items.AMETHYST_SHARD, Tags.Items.GEMS_AMETHYST); - replace(Items.DIAMOND, Tags.Items.GEMS_DIAMOND); - replace(Items.EMERALD, Tags.Items.GEMS_EMERALD); - replace(Items.CHEST, Tags.Items.CHESTS_WOODEN); + replace(Items.DIAMOND, Tags.Items.GEMS_DIAMOND); + replace(Items.EMERALD, Tags.Items.GEMS_EMERALD); + replace(Items.CHEST, Tags.Items.CHESTS_WOODEN); replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONE_NORMAL); replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE); @@ -90,20 +91,17 @@ protected void buildCraftingRecipes(Consumer consumer) }); } - @Override - protected void saveAdvancement(HashCache cache, JsonObject advancementJson, Path pathIn) { - //NOOP - We dont replace any of the advancement things yet... - } - + @Nullable private FinishedRecipe enhance(FinishedRecipe vanilla) { - if (vanilla instanceof ShapelessRecipeBuilder.Result) - return enhance((ShapelessRecipeBuilder.Result)vanilla); - if (vanilla instanceof ShapedRecipeBuilder.Result) - return enhance((ShapedRecipeBuilder.Result)vanilla); + if (vanilla instanceof ShapelessRecipeBuilder.Result shapeless) + return enhance(shapeless); + if (vanilla instanceof ShapedRecipeBuilder.Result shaped) + return enhance(shaped); return null; } + @Nullable private FinishedRecipe enhance(ShapelessRecipeBuilder.Result vanilla) { List ingredients = getField(ShapelessRecipeBuilder.Result.class, vanilla, 4); @@ -120,6 +118,13 @@ private FinishedRecipe enhance(ShapelessRecipeBuilder.Result vanilla) return modified ? vanilla : null; } + @Override + protected void saveAdvancement(CachedOutput output, JsonObject advancementJson, Path pathIn) + { + //NOOP - We dont replace any of the advancement things yet... + } + + @Nullable private FinishedRecipe enhance(ShapedRecipeBuilder.Result vanilla) { Map ingredients = getField(ShapedRecipeBuilder.Result.class, vanilla, 5); @@ -136,6 +141,7 @@ private FinishedRecipe enhance(ShapedRecipeBuilder.Result vanilla) return modified ? vanilla : null; } + @Nullable private Ingredient enhance(ResourceLocation name, Ingredient vanilla) { if (excludes.contains(name)) @@ -154,11 +160,9 @@ private Ingredient enhance(ResourceLocation name, Ingredient vanilla) { items.add(new TagValue(replacement)); modified = true; - } - else + } else items.add(entry); - } - else + } else items.add(entry); } return modified ? Ingredient.fromValues(items.stream()) : null; @@ -171,9 +175,8 @@ private R getField(Class clz, T inst, int index) fld.setAccessible(true); try { - return (R)fld.get(inst); - } - catch (IllegalArgumentException | IllegalAccessException e) + return (R) fld.get(inst); + } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java index 9d971c1ff2a..a3be0b5a9ac 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java @@ -11,12 +11,11 @@ import net.minecraft.data.tags.TagsProvider; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.IForgeRegistryEntry; import org.jetbrains.annotations.Nullable; -public abstract class ForgeRegistryTagsProvider> extends TagsProvider +public abstract class ForgeRegistryTagsProvider extends TagsProvider { - private static > Registry wrapRegistry(IForgeRegistry forgeRegistry) + private static Registry wrapRegistry(IForgeRegistry forgeRegistry) { if (forgeRegistry.tags() == null) throw new IllegalArgumentException("Forge registry " + forgeRegistry.getRegistryName() + " does not have support for tags"); diff --git a/src/main/java/net/minecraftforge/common/data/GlobalLootModifierProvider.java b/src/main/java/net/minecraftforge/common/data/GlobalLootModifierProvider.java index e55d6255792..4c4fd9befce 100644 --- a/src/main/java/net/minecraftforge/common/data/GlobalLootModifierProvider.java +++ b/src/main/java/net/minecraftforge/common/data/GlobalLootModifierProvider.java @@ -9,6 +9,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import net.minecraft.data.CachedOutput; import net.minecraft.data.DataGenerator; import net.minecraft.data.HashCache; import net.minecraft.data.DataProvider; @@ -17,6 +18,7 @@ import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.IGlobalLootModifier; import net.minecraftforge.common.loot.LootModifier; +import net.minecraftforge.registries.ForgeRegistries; import java.io.IOException; import java.nio.file.Path; @@ -59,7 +61,7 @@ protected void replacing() protected abstract void start(); @Override - public void run(HashCache cache) throws IOException + public void run(CachedOutput cache) throws IOException { start(); @@ -73,16 +75,16 @@ public void run(HashCache cache) throws IOException Path modifierPath = gen.getOutputFolder().resolve(modPath + name + ".json"); JsonObject json = pair.getB(); - json.addProperty("type", pair.getA().getRegistryName().toString()); + json.addProperty("type", ForgeRegistries.LOOT_MODIFIER_SERIALIZERS.get().getKey(pair.getA()).toString()); - DataProvider.save(GSON, cache, json, modifierPath); + DataProvider.saveStable(cache, json, modifierPath); })); JsonObject forgeJson = new JsonObject(); forgeJson.addProperty("replace", this.replace); forgeJson.add("entries", GSON.toJsonTree(entries.stream().map(ResourceLocation::toString).collect(Collectors.toList()))); - DataProvider.save(GSON, cache, forgeJson, forgePath); + DataProvider.saveStable(cache, forgeJson, forgePath); } /** diff --git a/src/main/java/net/minecraftforge/common/data/LanguageProvider.java b/src/main/java/net/minecraftforge/common/data/LanguageProvider.java index 53f9e849417..f2255938c96 100644 --- a/src/main/java/net/minecraftforge/common/data/LanguageProvider.java +++ b/src/main/java/net/minecraftforge/common/data/LanguageProvider.java @@ -14,6 +14,9 @@ import java.util.TreeMap; import java.util.function.Supplier; +import com.google.common.hash.Hashing; +import com.google.gson.JsonObject; +import net.minecraft.data.CachedOutput; import org.apache.commons.lang3.text.translate.JavaUnicodeEscaper; import com.google.gson.Gson; @@ -31,7 +34,7 @@ @SuppressWarnings("deprecation") public abstract class LanguageProvider implements DataProvider { - private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create(); + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().setLenient().create(); private final Map data = new TreeMap<>(); private final DataGenerator gen; private final String modid; @@ -46,7 +49,7 @@ public LanguageProvider(DataGenerator gen, String modid, String locale) { protected abstract void addTranslations(); @Override - public void run(HashCache cache) throws IOException { + public void run(CachedOutput cache) throws IOException { addTranslations(); if (!data.isEmpty()) save(cache, data, this.gen.getOutputFolder().resolve("assets/" + modid + "/lang/" + locale + ".json")); @@ -57,19 +60,14 @@ public String getName() { return "Languages: " + locale; } - private void save(HashCache cache, Object object, Path target) throws IOException { - String data = GSON.toJson(object); - data = JavaUnicodeEscaper.outsideOf(0, 0x7f).translate(data); // Escape unicode after the fact so that it's not double escaped by GSON - String hash = DataProvider.SHA1.hashUnencodedChars(data).toString(); - if (!Objects.equals(cache.getHash(target), hash) || !Files.exists(target)) { - Files.createDirectories(target.getParent()); - - try (BufferedWriter bufferedwriter = Files.newBufferedWriter(target)) { - bufferedwriter.write(data); - } + private void save(CachedOutput cache, Object object, Path target) throws IOException { + // TODO: DataProvider.saveStable handles the caching and hashing already, but creating the JSON Object this way seems unreliable. -C + JsonObject json = new JsonObject(); + for (Map.Entry pair : data.entrySet()) { + json.addProperty(pair.getKey(), pair.getValue()); } - cache.putNew(target, hash); + DataProvider.saveStable(cache, json, target); } public void addBlock(Supplier key, String name) { diff --git a/src/main/java/net/minecraftforge/common/data/SoundDefinition.java b/src/main/java/net/minecraftforge/common/data/SoundDefinition.java index 72e70a0adf1..3576af8414e 100644 --- a/src/main/java/net/minecraftforge/common/data/SoundDefinition.java +++ b/src/main/java/net/minecraftforge/common/data/SoundDefinition.java @@ -10,8 +10,8 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/net/minecraftforge/common/data/SoundDefinitionsProvider.java b/src/main/java/net/minecraftforge/common/data/SoundDefinitionsProvider.java index c3e3a7e94e9..0ad437e678a 100644 --- a/src/main/java/net/minecraftforge/common/data/SoundDefinitionsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/SoundDefinitionsProvider.java @@ -8,6 +8,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; +import net.minecraft.data.CachedOutput; import net.minecraft.data.DataGenerator; import net.minecraft.data.HashCache; import net.minecraft.data.DataProvider; @@ -60,7 +61,7 @@ protected SoundDefinitionsProvider(final DataGenerator generator, final String m public abstract void registerSounds(); @Override - public void run(HashCache cache) throws IOException + public void run(CachedOutput cache) throws IOException { this.sounds.clear(); this.registerSounds(); @@ -229,7 +230,7 @@ private boolean validate(final String name, final SoundDefinition.Sound sound) // Differently from all the other errors, this is not a 'missing sound' but rather something completely different // that has broken the invariants of this sound definitions provider. In fact, a sound may only be either of // SOUND or EVENT type. Any other values is somebody messing with the internals, reflectively adding something - // to an enum or passing `null` to a parameter annotated with `@Nonnull`. + // to an enum or passing `null` to a parameter annotated with `@NotNull`. throw new IllegalArgumentException("The given sound '" + sound.name() + "' does not have a valid type: expected either SOUND or EVENT, but found " + sound.type()); } @@ -254,9 +255,9 @@ private boolean validateEvent(final String soundName, final ResourceLocation nam return valid; } - private void save(final HashCache cache, final Path targetFile) throws IOException + private void save(final CachedOutput cache, final Path targetFile) throws IOException { - DataProvider.save(GSON, cache, this.mapToJson(this.sounds), targetFile); + DataProvider.saveStable(cache, this.mapToJson(this.sounds), targetFile); } private JsonObject mapToJson(final Map map) diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java index d778a113d1a..248fc21d397 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java @@ -6,8 +6,6 @@ package net.minecraftforge.common.extensions; import net.minecraft.world.entity.vehicle.AbstractMinecart; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.ItemStack; import net.minecraft.tags.BlockTags; import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; @@ -43,20 +41,6 @@ default BlockPos getCurrentRailPosition() */ void moveMinecartOnRail(BlockPos pos); - /** - * This function returns an ItemStack that represents this cart. - * This should be an ItemStack that can be used by the player to place the cart, - * but is not necessary the item the cart drops when destroyed. - * @return An ItemStack that can be used to place the cart. - * - * @deprecated TODO Remove in 1.19 - use {@link AbstractMinecart#getPickResult()} instead - */ - @Deprecated(forRemoval = true) - default ItemStack getCartItem() - { - return new ItemStack(Items.MINECART); - } - /** * Returns true if this cart can currently use rails. * This function is mainly used to gracefully detach a minecart from a rail. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java index 19163772934..69521f39cc8 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java @@ -23,14 +23,15 @@ private Advancement.Builder self() } /** - * save function for the {@link Advancement.Builder} which uses the {@link ExistingFileHelper} to check if the parent is already known - * @param consumer A {@link Consumer} which the build {@link Advancement} is passed to - * @param id The {@link ResourceLocation} for the new {@link Advancement} - * @param fileHelper The {@link ExistingFileHelper} where all known {@link Advancement}s are registered - * @return The build {@link Advancement} - * @throws IllegalStateException is thrown if the parent of the {@link Advancement} is not known + * Saves this builder with the given id using the {@link ExistingFileHelper} to check if the parent is already known. + * + * @param saver a {@link Consumer} which saves any advancements provided + * @param id the {@link ResourceLocation} id for the new advancement + * @param fileHelper the {@link ExistingFileHelper} where all known advancements are registered + * @return the built advancement + * @throws IllegalStateException if the parent of the advancement is not known */ - default Advancement save(Consumer consumer ,ResourceLocation id, ExistingFileHelper fileHelper) + default Advancement save(Consumer saver, ResourceLocation id, ExistingFileHelper fileHelper) { boolean canBuild = self().canBuild((advancementId) -> { @@ -46,7 +47,7 @@ default Advancement save(Consumer consumer ,ResourceLocation id, Ex } Advancement advancement = self().build(id); - consumer.accept(advancement); + saver.accept(advancement); return advancement; } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBaseRailBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBaseRailBlock.java index 23e2ae39ab0..cd7c8372dd7 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBaseRailBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBaseRailBlock.java @@ -11,8 +11,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public interface IForgeBaseRailBlock { diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index 57180723951..616c9098433 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -6,10 +6,9 @@ package net.minecraftforge.common.extensions; import java.util.Optional; -import java.util.Set; -import javax.annotation.Nullable; import net.minecraft.client.Camera; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.LivingEntity; @@ -28,7 +27,6 @@ import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.tags.BlockTags; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; @@ -47,6 +45,7 @@ import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; import net.minecraftforge.fml.loading.FMLEnvironment; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("deprecation") public interface IForgeBlock @@ -375,12 +374,13 @@ default boolean isPortalFrame(BlockState state, BlockGetter level, BlockPos pos) * * @param state The current state * @param level The level + * @param randomSource Random source to use for experience randomness * @param pos Block position * @param fortuneLevel fortune enchantment level of tool being used * @param silkTouchLevel silk touch enchantment level of tool being used * @return Amount of XP from breaking this block. */ - default int getExpDrop(BlockState state, LevelReader level, BlockPos pos, int fortuneLevel, int silkTouchLevel) + default int getExpDrop(BlockState state, LevelReader level, RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { return 0; } @@ -533,7 +533,7 @@ default boolean canStickTo(BlockState state, BlockState other) */ default int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { - return ((FireBlock)Blocks.FIRE).getBurnOdd(state); + return ((FireBlock)Blocks.FIRE).getBurnOdds(state); } /** @@ -574,7 +574,7 @@ default void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable */ default int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { - return ((FireBlock)Blocks.FIRE).getFlameOdds(state); + return ((FireBlock)Blocks.FIRE).getIgniteOdds(state); } /** @@ -677,10 +677,23 @@ default boolean shouldDisplayFluidOverlay(BlockState state, BlockAndTintGetter l @Nullable default BlockState getToolModifiedState(BlockState state, UseOnContext context, ToolAction toolAction, boolean simulate) { - BlockState toolModifiedState = getToolModifiedState(state, context.getLevel(), context.getClickedPos(), - context.getPlayer(), context.getItemInHand(), toolAction); + ItemStack itemStack = context.getItemInHand(); + if (!itemStack.canPerformAction(toolAction)) + return null; - if (toolModifiedState == null && ToolActions.HOE_TILL == toolAction && context.getItemInHand().canPerformAction(ToolActions.HOE_TILL)) + if (ToolActions.AXE_STRIP == toolAction) + { + return AxeItem.getAxeStrippingState(state); + } else if (ToolActions.AXE_SCRAPE == toolAction) + { + return WeatheringCopper.getPrevious(state).orElse(null); + } else if (ToolActions.AXE_WAX_OFF == toolAction) + { + return Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock())).map(block -> block.withPropertiesOf(state)).orElse(null); + } else if (ToolActions.SHOVEL_FLATTEN == toolAction) + { + return ShovelItem.getShovelPathingState(state); + } else if (ToolActions.HOE_TILL == toolAction) { // Logic copied from HoeItem#TILLABLES; needs to be kept in sync during updating Block block = state.getBlock(); @@ -698,35 +711,6 @@ default BlockState getToolModifiedState(BlockState state, UseOnContext context, } } - return toolModifiedState; - } - - /** - * Returns the state that this block should transform into when right-clicked by a tool. - * For example: Used to determine if {@link ToolActions#AXE_STRIP an axe can strip} or {@link ToolActions#SHOVEL_FLATTEN a shovel can path}. - * Returns {@code null} if nothing should happen. - * - * @param state The current state - * @param level The level - * @param pos The block position in level - * @param player The player clicking the block - * @param stack The stack being used by the player - * @param toolAction The action being performed by the tool - * @return The resulting state after the action has been performed - * @deprecated Override and use {@link #getToolModifiedState(BlockState, UseOnContext, ToolAction, boolean)} instead - */ - @Nullable - // TODO 1.19: Remove this and move the default impl to the newer method in 1.19. Has to stay here to preserve behavior of overrides on this method. - @Deprecated(forRemoval = true, since = "1.18.2") - default BlockState getToolModifiedState(BlockState state, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction) - { - if (!stack.canPerformAction(toolAction)) return null; - if (ToolActions.AXE_STRIP == toolAction) return AxeItem.getAxeStrippingState(state); - else if(ToolActions.AXE_SCRAPE == toolAction) return WeatheringCopper.getPrevious(state).orElse(null); - else if(ToolActions.AXE_WAX_OFF == toolAction) return Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock())).map((p_150694_) -> { - return p_150694_.withPropertiesOf(state); - }).orElse(null); - else if (ToolActions.SHOVEL_FLATTEN == toolAction) return ShovelItem.getShovelPathingState(state); return null; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java index 10c98dc3bae..3d36c752d73 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java @@ -5,8 +5,6 @@ package net.minecraftforge.common.extensions; -import javax.annotation.Nonnull; - import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.network.Connection; @@ -26,6 +24,7 @@ import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import org.jetbrains.annotations.NotNull; public interface IForgeBlockEntity extends ICapabilitySerializable { @@ -137,7 +136,7 @@ else if (block != null && block != Blocks.BEACON) { // We have to capture any exceptions that may occur here because BUKKIT servers like to send // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! - // So we can not GARENTEE that the world state is the real state for the block... + // So we can not GUARANTEE that the world state is the real state for the block... // So, once again in the long line of US having to accommodate BUKKIT breaking things, // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. @@ -169,7 +168,7 @@ default void requestModelDataUpdate() * Note that this method may be called on a chunk render thread instead of the main client thread * @return Your model data */ - default @Nonnull IModelData getModelData() + default @NotNull IModelData getModelData() { return EmptyModelData.INSTANCE; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index d331e9109e3..2fcf6dcf851 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -6,9 +6,9 @@ package net.minecraftforge.common.extensions; import java.util.Optional; -import javax.annotation.Nullable; import net.minecraft.client.Camera; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.LivingEntity; @@ -39,6 +39,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; +import org.jetbrains.annotations.Nullable; public interface IForgeBlockState { @@ -316,14 +317,15 @@ default boolean isPortalFrame(BlockGetter level, BlockPos pos) * Gathers how much experience this block drops when broken. * * @param level The level + * @param randomSource Random source to use for experience randomness * @param pos Block position * @param fortuneLevel fortune enchantment level of tool being used * @param silkTouchLevel silk touch enchantment level of tool being used * @return Amount of XP from breaking this block. */ - default int getExpDrop(LevelReader level, BlockPos pos, int fortuneLevel, int silkTouchLevel) + default int getExpDrop(LevelReader level, RandomSource randomSource, BlockPos pos, int fortuneLevel, int silkTouchLevel) { - return self().getBlock().getExpDrop(self(), level, pos, fortuneLevel, silkTouchLevel); + return self().getBlock().getExpDrop(self(), level, randomSource, pos, fortuneLevel, silkTouchLevel); } default BlockState rotate(LevelAccessor level, BlockPos pos, Rotation direction) @@ -622,28 +624,6 @@ default BlockState getToolModifiedState(UseOnContext context, ToolAction toolAct return eventState != self() ? eventState : self().getBlock().getToolModifiedState(self(), context, toolAction, simulate); } - /** - * Returns the state that this block should transform into when right-clicked by a tool. - * For example: Used to determine if {@link ToolActions#AXE_STRIP an axe can strip} or {@link ToolActions#SHOVEL_FLATTEN a shovel can path}. - * Returns {@code null} if nothing should happen. - * - * @param level The level - * @param pos The block position in level - * @param player The player clicking the block - * @param stack The stack being used by the player - * @param toolAction The tool type to be considered when performing the action - * @return The resulting state after the action has been performed - * @deprecated Use {@link #getToolModifiedState(UseOnContext, ToolAction, boolean)} instead - */ - @Nullable - // TODO 1.19: Remove - @Deprecated(forRemoval = true, since = "1.18.2") - default BlockState getToolModifiedState(Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction) - { - BlockState eventState = net.minecraftforge.event.ForgeEventFactory.onToolUse(self(), level, pos, player, stack, toolAction); - return eventState != self() ? eventState : self().getBlock().getToolModifiedState(self(), level, pos, player, stack, toolAction); - } - /** * Checks if a player or entity handles movement on this block like scaffolding. * diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java index fcd174d5f6f..93b18561882 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java @@ -6,7 +6,6 @@ package net.minecraftforge.common.extensions; import java.util.Collection; -import javax.annotation.Nullable; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.AttributeInstance; @@ -25,6 +24,7 @@ import net.minecraftforge.common.ForgeSpawnEggItem; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.entity.PartEntity; +import org.jetbrains.annotations.Nullable; public interface IForgeEntity extends ICapabilitySerializable { diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java index 8b698a82101..897c148d60f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java @@ -5,22 +5,18 @@ package net.minecraftforge.common.extensions; -import java.util.Set; - -import javax.annotation.Nullable; - import net.minecraft.core.HolderSet; import net.minecraft.world.level.material.Material; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.AABB; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelReader; import net.minecraftforge.fluids.FluidAttributes; +import org.jetbrains.annotations.Nullable; public interface IForgeFluid { diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFriendlyByteBuf.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFriendlyByteBuf.java index c0883657406..aa771258487 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFriendlyByteBuf.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFriendlyByteBuf.java @@ -11,10 +11,9 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.IForgeRegistryEntry; import net.minecraftforge.registries.RegistryManager; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Objects; /** @@ -34,7 +33,7 @@ private FriendlyByteBuf self() * @param entry The entry who's registryName is to be written * @param The type of the entry. */ - default > void writeRegistryIdUnsafe(@Nonnull IForgeRegistry registry, @Nonnull T entry) + default void writeRegistryIdUnsafe(@NotNull IForgeRegistry registry, @NotNull T entry) { ForgeRegistry forgeRegistry = (ForgeRegistry) registry; int id = forgeRegistry.getID(entry); @@ -47,7 +46,7 @@ default > void writeRegistryIdUnsafe(@Nonnull I * @param registry The registry containing the entry represented by this key * @param entryKey The registry-name of an entry in this {@link IForgeRegistry} */ - default void writeRegistryIdUnsafe(@Nonnull IForgeRegistry registry, @Nonnull ResourceLocation entryKey) + default void writeRegistryIdUnsafe(@NotNull IForgeRegistry registry, @NotNull ResourceLocation entryKey) { ForgeRegistry forgeRegistry = (ForgeRegistry) registry; int id = forgeRegistry.getID(entryKey); @@ -59,7 +58,7 @@ default void writeRegistryIdUnsafe(@Nonnull IForgeRegistry registry, @Nonnull * read id, that the registry's default value will be returned. * @param registry The registry containing the entry */ - default > T readRegistryIdUnsafe(@Nonnull IForgeRegistry registry) + default T readRegistryIdUnsafe(@NotNull IForgeRegistry registry) { ForgeRegistry forgeRegistry = (ForgeRegistry) registry; int id = self().readVarInt(); @@ -67,23 +66,24 @@ default > T readRegistryIdUnsafe(@Nonnull IForg } /** - * Writes an given registry-entry's integer id to the specified buffer in combination with writing the containing registry's id. In contrast to - * {@link #writeRegistryIdUnsafe(IForgeRegistry, IForgeRegistryEntry)} this method checks every single step performed as well as + * Writes a given registry-entry's integer id to the specified buffer in combination with writing the containing registry's id. In contrast to + * {@link #writeRegistryIdUnsafe(IForgeRegistry, Object)} this method checks every single step performed as well as * writing the registry-id to the buffer, in order to prevent any unexpected behaviour. Therefore this method is to be preferred whenever possible, * over using the unsafe methods. + * + * @param registry The registry containing the entry * @param entry The entry to write * @param The type of the registry-entry - * @throws NullPointerException if the entry was null - * @throws IllegalArgumentException if the the registry could not be found or the registry does not contain the specified value + * @throws NullPointerException if the registry or entry was null + * @throws IllegalArgumentException if the registry does not contain the specified value */ - default > void writeRegistryId(@Nonnull T entry) + default void writeRegistryId(@NotNull IForgeRegistry registry, @NotNull T entry) { - Class regType = Objects.requireNonNull(entry,"Cannot write a null registry entry!").getRegistryType(); - IForgeRegistry retrievedRegistry = RegistryManager.ACTIVE.getRegistry(regType); - Preconditions.checkArgument(retrievedRegistry!=null,"Cannot write registry id for an unknown registry type: %s",regType.getName()); - ResourceLocation name = retrievedRegistry.getRegistryName(); - Preconditions.checkArgument(retrievedRegistry.containsValue(entry),"Cannot find %s in %s",entry.getRegistryName()!=null?entry.getRegistryName():entry,name); - ForgeRegistry reg = (ForgeRegistry)retrievedRegistry; + Objects.requireNonNull(registry, "Cannot write a null registry key!"); + Objects.requireNonNull(entry,"Cannot write a null registry entry!"); + ResourceLocation name = registry.getRegistryName(); + Preconditions.checkArgument(registry.containsValue(entry), "Cannot find %s in %s", registry.getKey(entry) != null ? registry.getKey(entry) : entry, name); + ForgeRegistry reg = (ForgeRegistry) registry; self().writeResourceLocation(name); //TODO change to writing a varInt once registries use id's self().writeVarInt(reg.getID(entry)); } @@ -94,7 +94,7 @@ default > void writeRegistryId(@Nonnull T entry * @param The type of the registry-entry. Notice that this should match the actual type written to the buffer. * @throws NullPointerException if the registry could not be found. */ - default > T readRegistryId() + default T readRegistryId() { ResourceLocation location = self().readResourceLocation(); //TODO change to reading a varInt once registries use id's ForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(location); @@ -107,10 +107,10 @@ default > T readRegistryId() * @throws IllegalArgumentException if the retrieved entries registryType doesn't match the one passed in. * @throws NullPointerException if the registry could not be found. */ - default > T readRegistryIdSafe(Class registrySuperType) + default T readRegistryIdSafe(Class registrySuperType) { T value = readRegistryId(); - if (!value.getRegistryType().equals(registrySuperType)) + if (!registrySuperType.isAssignableFrom(value.getClass())) throw new IllegalArgumentException("Attempted to read an registryValue of the wrong type from the Buffer!"); return value; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index a5f2198fd77..dbb1753aae5 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -10,9 +10,6 @@ import java.util.Set; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.collect.Multimap; import net.minecraft.world.damagesource.DamageSource; @@ -36,14 +33,14 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.InteractionResult; -import net.minecraft.resources.ResourceLocation; import net.minecraft.core.BlockPos; -import net.minecraft.util.Mth; import net.minecraft.network.chat.Component; import net.minecraft.world.level.Level; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; -import net.minecraftforge.registries.IForgeRegistryEntry; +import net.minecraftforge.registries.IForgeRegistry; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; // TODO systemic review of all extension functions. lots of unused -C public interface IForgeItem @@ -601,7 +598,7 @@ default boolean canContinueUsing(ItemStack oldStack, ItemStack newStack) * * @param itemStack the ItemStack to check * @return the Mod ID for the ItemStack, or null when there is no specially - * associated mod and {@link IForgeRegistryEntry#getRegistryName()} would return null. + * associated mod and {@link IForgeRegistry#getKey(Object)} would return null. */ @Nullable default String getCreatorModId(ItemStack itemStack) @@ -757,17 +754,17 @@ default boolean isDamageable(ItemStack stack) { return self().canBeDepleted(); } - + /** * Get a bounding box ({@link AABB}) of a sweep attack. - * + * * @param stack the stack held by the player. * @param player the performing the attack the attack. * @param target the entity targeted by the attack. * @return the bounding box. */ - @Nonnull - default AABB getSweepHitBox(@Nonnull ItemStack stack, @Nonnull Player player, @Nonnull Entity target) + @NotNull + default AABB getSweepHitBox(@NotNull ItemStack stack, @NotNull Player player, @NotNull Entity target) { return target.getBoundingBox().inflate(1.0D, 0.25D, 1.0D); } @@ -778,7 +775,7 @@ default AABB getSweepHitBox(@Nonnull ItemStack stack, @Nonnull Player player, @N * @param stack the stack * @return the default hide flags */ - default int getDefaultTooltipHideFlags(@Nonnull ItemStack stack) + default int getDefaultTooltipHideFlags(@NotNull ItemStack stack) { return 0; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index e23003c57c6..a2c91ff302f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -5,9 +5,6 @@ package net.minecraftforge.common.extensions; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.core.Registry; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.monster.EnderMan; @@ -35,6 +32,8 @@ import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /* * Extension added to ItemStack that bounces to ItemSack sensitive Item methods. Typically this is just for convince. @@ -483,16 +482,16 @@ default boolean canWalkOnPowderedSnow(LivingEntity wearer) { return self().getItem().canWalkOnPowderedSnow(self(), wearer); } - + /** * Get a bounding box ({@link AABB}) of a sweep attack. - * + * * @param player the performing the attack the attack. * @param target the entity targeted by the attack. * @return the bounding box. */ - @Nonnull - default AABB getSweepHitBox(@Nonnull Player player, @Nonnull Entity target) + @NotNull + default AABB getSweepHitBox(@NotNull Player player, @NotNull Entity target) { return self().getItem().getSweepHitBox(self(), player, target); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java index 65d2fd8ca85..3fddfbb213d 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java @@ -11,13 +11,14 @@ import com.google.gson.JsonObject; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagBuilder; +import net.minecraft.tags.TagEntry; public interface IForgeRawTagBuilder { - default Tag.Builder getRawBuilder() + default TagBuilder getRawBuilder() { - return (Tag.Builder)this; + return (TagBuilder)this; } /** @@ -25,10 +26,10 @@ default Tag.Builder getRawBuilder() */ default void serializeTagAdditions(final JsonObject tagJson) { - Tag.Builder rawBuilder = this.getRawBuilder(); - Stream removeEntries = rawBuilder.getRemoveEntries(); + TagBuilder rawBuilder = this.getRawBuilder(); + Stream removeEntries = rawBuilder.getRemoveEntries(); JsonArray removeEntriesAsJsonArray = new JsonArray(); - removeEntries.forEach(proxy ->proxy.entry().serializeTo(removeEntriesAsJsonArray)); + //removeEntries.forEach(proxy ->proxy.serializeTo(removeEntriesAsJsonArray)); // TODO: Figure out what the replacement for this is. -C if (removeEntriesAsJsonArray.size() > 0) { tagJson.add("remove", removeEntriesAsJsonArray); @@ -42,9 +43,9 @@ default void serializeTagAdditions(final JsonObject tagJson) * @param source The source of the caller for logging purposes (generally a modid) * @return The builder for chaining purposes */ - default Tag.Builder remove(final Tag.Entry tagEntry, final String source) + default TagBuilder remove(final TagEntry tagEntry, final String source) { - return this.getRawBuilder().remove(new Tag.BuilderEntry(tagEntry,source)); + return this.getRawBuilder().remove(tagEntry); } /** @@ -53,9 +54,9 @@ default Tag.Builder remove(final Tag.Entry tagEntry, final String source) * @param source The source of the caller for logging purposes (generally a modid) * @return The builder for chaining purposes */ - default Tag.Builder removeElement(final ResourceLocation elementID, final String source) + default TagBuilder removeElement(final ResourceLocation elementID, final String source) { - return this.remove(new Tag.ElementEntry(elementID), source); + return this.remove(TagEntry.element(elementID), source); } @@ -65,8 +66,8 @@ default Tag.Builder removeElement(final ResourceLocation elementID, final String * @param source The source of the caller for logging purposes (generally a modid) * @return The builder for chaining purposes */ - default Tag.Builder removeTag(final ResourceLocation tagID, final String source) + default TagBuilder removeTag(final ResourceLocation tagID, final String source) { - return this.remove(new Tag.TagEntry(tagID), source); + return this.remove(TagEntry.tag(tagID), source); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java index 39bee631c12..5d1884e637a 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java @@ -6,8 +6,6 @@ package net.minecraftforge.common.extensions; import net.minecraft.data.tags.TagsProvider; -import net.minecraft.tags.Tag; -import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; diff --git a/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java b/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java index 98cc8a87228..789a05bf095 100644 --- a/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java +++ b/src/main/java/net/minecraftforge/common/loot/CanToolPerformAction.java @@ -16,8 +16,8 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import net.minecraftforge.common.ToolAction; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Set; /** @@ -33,12 +33,12 @@ public CanToolPerformAction(ToolAction action) { this.action = action; } - @Nonnull + @NotNull public LootItemConditionType getType() { return LOOT_CONDITION_TYPE; } - @Nonnull + @NotNull public Set> getReferencedContextParams() { return ImmutableSet.of(LootContextParams.TOOL); } @@ -53,12 +53,12 @@ public static LootItemCondition.Builder canToolPerformAction(ToolAction action) } public static class Serializer implements net.minecraft.world.level.storage.loot.Serializer { - public void serialize(JsonObject json, CanToolPerformAction itemCondition, @Nonnull JsonSerializationContext context) { + public void serialize(JsonObject json, CanToolPerformAction itemCondition, @NotNull JsonSerializationContext context) { json.addProperty("action", itemCondition.action.name()); } - @Nonnull - public CanToolPerformAction deserialize(JsonObject json, @Nonnull JsonDeserializationContext context) { + @NotNull + public CanToolPerformAction deserialize(JsonObject json, @NotNull JsonDeserializationContext context) { return new CanToolPerformAction(ToolAction.get(json.get("action").getAsString())); } } diff --git a/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java b/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java index c833dfb7875..8ed66e1788b 100644 --- a/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java +++ b/src/main/java/net/minecraftforge/common/loot/GlobalLootModifierSerializer.java @@ -10,8 +10,6 @@ import net.minecraft.advancements.critereon.SerializationContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.GameData; -import net.minecraftforge.registries.IForgeRegistryEntry; /** * Abstract base deserializer for LootModifiers. Takes care of Forge registry things.
@@ -19,28 +17,7 @@ * read method to deserialize from json. * @param the Type to deserialize */ -public abstract class GlobalLootModifierSerializer implements IForgeRegistryEntry> { - private ResourceLocation registryName = null; - - public final GlobalLootModifierSerializer setRegistryName(String name) { - if (getRegistryName() != null) - throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); - - this.registryName = GameData.checkPrefix(name, true); - return this; - } - - //Helpers - @Override - public final GlobalLootModifierSerializer setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } - - public final GlobalLootModifierSerializer setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } - - @Override - public final ResourceLocation getRegistryName() { - return registryName; - } - +public abstract class GlobalLootModifierSerializer { /** * Most mods will likely not need more than
* return new MyModifier(conditionsIn)
@@ -68,18 +45,4 @@ public JsonObject makeConditions(LootItemCondition[] conditions) { json.add("conditions", SerializationContext.INSTANCE.serializeConditions(conditions)); return json; } - - /** - * Used by Forge's registry system. - */ - @Override - public final Class> getRegistryType() { - return castClass(GlobalLootModifierSerializer.class); - } - - @SuppressWarnings("unchecked") // Need this wrapper, because generics - private static Class castClass(Class cls) - { - return (Class)cls; - } } diff --git a/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java b/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java index 7776c6c6115..799b3a22566 100644 --- a/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java +++ b/src/main/java/net/minecraftforge/common/loot/IGlobalLootModifier.java @@ -5,12 +5,10 @@ package net.minecraftforge.common.loot; -import java.util.List; - -import javax.annotation.Nonnull; - +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; +import org.jetbrains.annotations.NotNull; /** * Implementation that defines what a global loot modifier must implement in order to be functional. @@ -25,6 +23,6 @@ public interface IGlobalLootModifier { * @param context the LootContext, identical to what is passed to loot tables * @return modified loot drops */ - @Nonnull - List apply(List generatedLoot, LootContext context); + @NotNull + ObjectArrayList apply(ObjectArrayList generatedLoot, LootContext context); } diff --git a/src/main/java/net/minecraftforge/common/loot/LootModifier.java b/src/main/java/net/minecraftforge/common/loot/LootModifier.java index e7b1a7cc371..7aa4e15188f 100644 --- a/src/main/java/net/minecraftforge/common/loot/LootModifier.java +++ b/src/main/java/net/minecraftforge/common/loot/LootModifier.java @@ -5,15 +5,14 @@ package net.minecraftforge.common.loot; -import java.util.List; import java.util.function.Predicate; -import javax.annotation.Nonnull; - +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemConditions; +import org.jetbrains.annotations.NotNull; /** * A base implementation of a Global Loot Modifier for modders to extend. @@ -23,7 +22,7 @@ public abstract class LootModifier implements IGlobalLootModifier { protected final LootItemCondition[] conditions; private final Predicate combinedConditions; - + /** * Constructs a LootModifier. * @param conditionsIn the ILootConditions that need to be matched before the loot is modified. @@ -32,13 +31,13 @@ protected LootModifier(LootItemCondition[] conditionsIn) { this.conditions = conditionsIn; this.combinedConditions = LootItemConditions.andConditions(conditionsIn); } - - @Nonnull + + @NotNull @Override - public final List apply(List generatedLoot, LootContext context) { + public final ObjectArrayList apply(ObjectArrayList generatedLoot, LootContext context) { return this.combinedConditions.test(context) ? this.doApply(generatedLoot, context) : generatedLoot; } - + /** * Applies the modifier to the generated loot (all loot conditions have already been checked * and have returned true). @@ -46,6 +45,6 @@ public final List apply(List generatedLoot, LootContext co * @param context the LootContext, identical to what is passed to loot tables * @return modified loot drops */ - @Nonnull - protected abstract List doApply(List generatedLoot, LootContext context); + @NotNull + protected abstract ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context); } diff --git a/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java b/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java index 5f2291c8c47..97c82c3082c 100644 --- a/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java +++ b/src/main/java/net/minecraftforge/common/loot/LootModifierManager.java @@ -68,32 +68,26 @@ protected void apply(Map resourceList, ResourceMa //new way ArrayList finalLocations = new ArrayList(); ResourceLocation resourcelocation = new ResourceLocation("forge","loot_modifiers/global_loot_modifiers.json"); - try { - //read in all data files from forge:loot_modifiers/global_loot_modifiers in order to do layering - for(Resource iresource : resourceManagerIn.getResources(resourcelocation)) { - try ( InputStream inputstream = iresource.getInputStream(); - Reader reader = new BufferedReader(new InputStreamReader(inputstream, StandardCharsets.UTF_8)); - ) { - JsonObject jsonobject = GsonHelper.fromJson(GSON_INSTANCE, reader, JsonObject.class); - boolean replace = jsonobject.get("replace").getAsBoolean(); - if(replace) finalLocations.clear(); - JsonArray entryList = jsonobject.get("entries").getAsJsonArray(); - for(JsonElement entry : entryList) { - String loc = entry.getAsString(); - ResourceLocation res = new ResourceLocation(loc); - if(finalLocations.contains(res)) finalLocations.remove(res); - finalLocations.add(res); - } + //read in all data files from forge:loot_modifiers/global_loot_modifiers in order to do layering + for(Resource iresource : resourceManagerIn.getResourceStack(resourcelocation)) { + try ( InputStream inputstream = iresource.open(); + Reader reader = new BufferedReader(new InputStreamReader(inputstream, StandardCharsets.UTF_8)); + ) { + JsonObject jsonobject = GsonHelper.fromJson(GSON_INSTANCE, reader, JsonObject.class); + boolean replace = jsonobject.get("replace").getAsBoolean(); + if(replace) finalLocations.clear(); + JsonArray entryList = jsonobject.get("entries").getAsJsonArray(); + for(JsonElement entry : entryList) { + String loc = entry.getAsString(); + ResourceLocation res = new ResourceLocation(loc); + if(finalLocations.contains(res)) finalLocations.remove(res); + finalLocations.add(res); } + } - catch (RuntimeException | IOException ioexception) { - LOGGER.error("Couldn't read global loot modifier list {} in data pack {}", resourcelocation, iresource.getSourceName(), ioexception); - } finally { - IOUtils.closeQuietly((Closeable)iresource); - } + catch (RuntimeException | IOException ioexception) { + LOGGER.error("Couldn't read global loot modifier list {} in data pack {}", resourcelocation, iresource.sourcePackId(), ioexception); } - } catch (IOException ioexception1) { - LOGGER.error("Couldn't read global loot modifier list from {}", resourcelocation, ioexception1); } //use layered config to fetch modifier data files (modifiers missing from config are disabled) finalLocations.forEach(location -> { diff --git a/src/main/java/net/minecraftforge/common/modloading/ForgeModStateProvider.java b/src/main/java/net/minecraftforge/common/modloading/ForgeModStateProvider.java deleted file mode 100644 index 6c7572fc667..00000000000 --- a/src/main/java/net/minecraftforge/common/modloading/ForgeModStateProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.modloading; - -public class ForgeModStateProvider { -// -// statusConsumer.ifPresent(c->c.accept("Creating registries")); -// dispatchAndHandleError(ModLoadingStage.CREATE_REGISTRIES, syncExecutor, parallelExecutor, periodicTask); -// ObjectHolderRegistry.findObjectHolders(); -// CapabilityManager.INSTANCE.injectCapabilities(modList.getAllScanData()); -// statusConsumer.ifPresent(c->c.accept("Adding custom tag types")); -// GameData.setCustomTagTypesFromRegistries(); -// statusConsumer.ifPresent(c->c.accept("Populating registries")); -// dispatchAndHandleError(ModLoadingStage.LOAD_REGISTRIES, syncExecutor, parallelExecutor, periodicTask); -} diff --git a/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java b/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java index a862885fcb2..c14c53174ed 100644 --- a/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java +++ b/src/main/java/net/minecraftforge/common/ticket/AABBTicket.java @@ -7,15 +7,14 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class AABBTicket extends SimpleTicket { - @Nonnull + @NotNull public final AABB axisAlignedBB; - public AABBTicket(@Nonnull AABB axisAlignedBB) + public AABBTicket(@NotNull AABB axisAlignedBB) { this.axisAlignedBB = axisAlignedBB; } diff --git a/src/main/java/net/minecraftforge/common/ticket/SimpleTicket.java b/src/main/java/net/minecraftforge/common/ticket/SimpleTicket.java index 521daa32a9b..299e43891db 100644 --- a/src/main/java/net/minecraftforge/common/ticket/SimpleTicket.java +++ b/src/main/java/net/minecraftforge/common/ticket/SimpleTicket.java @@ -6,9 +6,9 @@ package net.minecraftforge.common.ticket; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.function.Consumer; /** @@ -28,7 +28,7 @@ public abstract class SimpleTicket * Should not be called if you just want to register a ticket to a system like the {@link net.minecraftforge.common.FarmlandWaterManager} */ @SafeVarargs - public final void setManager(@Nonnull ITicketManager masterManager, @Nonnull ITicketManager... dummyManagers) + public final void setManager(@NotNull ITicketManager masterManager, @NotNull ITicketManager... dummyManagers) { Preconditions.checkState(this.masterManager == null, "Ticket is already registered to a managing system"); this.masterManager = masterManager; diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 66bc994255b..803d3859bb2 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -18,8 +18,7 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.Level; import net.minecraftforge.server.ServerLifecycleHooks; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Represents a captured snapshot of a block which will not change diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index 5eab1ca9b0f..8a31efc2b45 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -67,25 +67,23 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; import net.minecraftforge.server.ServerLifecycleHooks; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.util.Set; -import java.util.UUID; //Preliminary, simple Fake Player class public class FakePlayer extends ServerPlayer { public FakePlayer(ServerLevel level, GameProfile name) { - super(level.getServer(), level, name); + super(level.getServer(), level, name, null); this.connection = new FakePlayerNetHandler(level.getServer(), this); } @Override public Vec3 position(){ return new Vec3(0, 0, 0); } @Override public BlockPos blockPosition(){ return BlockPos.ZERO; } @Override public void displayClientMessage(Component chatComponent, boolean actionBar){} - @Override public void sendMessage(Component component, UUID senderUUID) {} @Override public void awardStat(Stat par1StatBase, int par2){} //@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){} @Override public boolean isInvulnerableTo(DamageSource source){ return true; } diff --git a/src/main/java/net/minecraftforge/common/util/ForgeSoundType.java b/src/main/java/net/minecraftforge/common/util/ForgeSoundType.java index 4809a57b04c..8e681e4f390 100644 --- a/src/main/java/net/minecraftforge/common/util/ForgeSoundType.java +++ b/src/main/java/net/minecraftforge/common/util/ForgeSoundType.java @@ -10,8 +10,8 @@ import net.minecraft.sounds.SoundEvent; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.function.Supplier; /** @@ -51,35 +51,35 @@ public ForgeSoundType(float volumeIn, float pitchIn, Supplier breakS this.fallSound = fallSoundIn; } - @Nonnull + @NotNull @Override public SoundEvent getBreakSound() { return breakSound.get(); } - @Nonnull + @NotNull @Override public SoundEvent getStepSound() { return stepSound.get(); } - @Nonnull + @NotNull @Override public SoundEvent getPlaceSound() { return placeSound.get(); } - @Nonnull + @NotNull @Override public SoundEvent getHitSound() { return hitSound.get(); } - @Nonnull + @NotNull @Override public SoundEvent getFallSound() { diff --git a/src/main/java/net/minecraftforge/common/util/ITeleporter.java b/src/main/java/net/minecraftforge/common/util/ITeleporter.java index 26dade024f0..5e89612bd55 100644 --- a/src/main/java/net/minecraftforge/common/util/ITeleporter.java +++ b/src/main/java/net/minecraftforge/common/util/ITeleporter.java @@ -7,8 +7,6 @@ import java.util.function.Function; -import javax.annotation.Nullable; - import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.portal.PortalInfo; import net.minecraft.world.entity.Entity; @@ -16,6 +14,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.level.portal.PortalForcer; import net.minecraft.server.level.ServerLevel; +import org.jetbrains.annotations.Nullable; /** * Interface for handling the placement of entities during dimension change. @@ -52,16 +51,16 @@ default Entity placeEntity(Entity entity, ServerLevel currentWorld, ServerLevel } /** - * Gets the PortalInfo. defaultPortalInfo references the - * vanilla code and should not be used for your purposes. - * Override this method to handle your own logic. + * Gets the PortalInfo. defaultPortalInfo references the + * vanilla code and should not be used for your purposes. + * Override this method to handle your own logic. *

* Return {@code null} to prevent teleporting. - * + * * @param entity The entity teleporting before the teleport * @param destWorld The world the entity is teleporting to * @param defaultPortalInfo A reference to the vanilla method for getting portal info. You should implement your own logic instead of using this - * + * * @return The location, rotation, and motion of the entity in the destWorld after the teleport */ @Nullable @@ -69,7 +68,7 @@ default PortalInfo getPortalInfo(Entity entity, ServerLevel destWorld, Function< { return this.isVanilla() ? defaultPortalInfo.apply(destWorld) : new PortalInfo(entity.position(), Vec3.ZERO, entity.getYRot(), entity.getXRot()); } - + /** * Is this teleporter the vanilla instance. */ diff --git a/src/main/java/net/minecraftforge/common/util/JsonUtils.java b/src/main/java/net/minecraftforge/common/util/JsonUtils.java index 89b98a6d790..ac0d47230c7 100644 --- a/src/main/java/net/minecraftforge/common/util/JsonUtils.java +++ b/src/main/java/net/minecraftforge/common/util/JsonUtils.java @@ -26,8 +26,7 @@ import net.minecraft.nbt.TagParser; import net.minecraft.nbt.CompoundTag; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class JsonUtils { diff --git a/src/main/java/net/minecraftforge/common/util/Lazy.java b/src/main/java/net/minecraftforge/common/util/Lazy.java index 11b744c8878..fb135079531 100644 --- a/src/main/java/net/minecraftforge/common/util/Lazy.java +++ b/src/main/java/net/minecraftforge/common/util/Lazy.java @@ -5,8 +5,8 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; /** @@ -19,7 +19,7 @@ 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) + static Lazy of(@NotNull Supplier supplier) { return new Lazy.Fast<>(supplier); } @@ -28,7 +28,7 @@ static Lazy of(@Nonnull Supplier 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) + static Lazy concurrentOf(@NotNull Supplier supplier) { return new Lazy.Concurrent<>(supplier); } diff --git a/src/main/java/net/minecraftforge/common/util/LazyOptional.java b/src/main/java/net/minecraftforge/common/util/LazyOptional.java index 458cf5dd98c..b4643a9e0fa 100644 --- a/src/main/java/net/minecraftforge/common/util/LazyOptional.java +++ b/src/main/java/net/minecraftforge/common/util/LazyOptional.java @@ -10,8 +10,6 @@ import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; @@ -21,6 +19,8 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * This object encapsulates a lazy value, with typical transformation operations @@ -35,7 +35,7 @@ * must never be null. *

* The empty instance can be retrieved with {@link #empty()}. - * + * * @param The type of the optional value. */ @ParametersAreNonnullByDefault @@ -51,13 +51,13 @@ public class LazyOptional private Set>> listeners = new HashSet<>(); private boolean isValid = true; - private static final @Nonnull LazyOptional EMPTY = new LazyOptional<>(null); + private static final @NotNull LazyOptional EMPTY = new LazyOptional<>(null); private static final Logger LOGGER = LogManager.getLogger(); /** * Construct a new {@link LazyOptional} that wraps the given * {@link NonNullSupplier}. - * + * * @param instanceSupplier The {@link NonNullSupplier} to wrap. Cannot return * null, but can be null itself. If null, this method * returns {@link #empty()}. @@ -79,7 +79,7 @@ public static LazyOptional empty() * This method hides an unchecked cast to the inferred type. Only use this if * you are sure the type should match. For capabilities, generally * {@link Capability#orEmpty(Capability, LazyOptional)} should be used. - * + * * @return This {@link LazyOptional}, cast to the inferred generic type */ @SuppressWarnings("unchecked") @@ -126,7 +126,7 @@ private T getValueUnsafe() /** * Check if this {@link LazyOptional} is non-empty. - * + * * @return {@code true} if this {@link LazyOptional} is non-empty, i.e. holds a * non-null supplier */ @@ -202,7 +202,7 @@ public Optional map(NonNullFunction mapper) * It is important to note that this method is not lazy, as * it must resolve the value of the supplier to validate it with the * predicate. - * + * * @param predicate A {@link NonNullPredicate} to apply to the result of the * contained supplier, if non-empty * @return An {@link Optional} containing the result of the contained diff --git a/src/main/java/net/minecraftforge/common/util/NonNullConsumer.java b/src/main/java/net/minecraftforge/common/util/NonNullConsumer.java index b4d4a9eeb01..0dc61d0da22 100644 --- a/src/main/java/net/minecraftforge/common/util/NonNullConsumer.java +++ b/src/main/java/net/minecraftforge/common/util/NonNullConsumer.java @@ -5,16 +5,16 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; /** * Equivalent to {@link Consumer}, except with nonnull contract. - * + * * @see Consumer */ @FunctionalInterface public interface NonNullConsumer { - void accept(@Nonnull T t); + void accept(@NotNull T t); } diff --git a/src/main/java/net/minecraftforge/common/util/NonNullFunction.java b/src/main/java/net/minecraftforge/common/util/NonNullFunction.java index 7153a232bd6..181517eb30b 100644 --- a/src/main/java/net/minecraftforge/common/util/NonNullFunction.java +++ b/src/main/java/net/minecraftforge/common/util/NonNullFunction.java @@ -5,17 +5,17 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import java.util.function.Function; /** * Equivalent to {@link Function}, except with nonnull contract. - * + * * @see Function */ @FunctionalInterface public interface NonNullFunction { - @Nonnull - R apply(@Nonnull T t); + @NotNull + R apply(@NotNull T t); } diff --git a/src/main/java/net/minecraftforge/common/util/NonNullLazy.java b/src/main/java/net/minecraftforge/common/util/NonNullLazy.java index 5ace42e565f..2c1b5b695df 100644 --- a/src/main/java/net/minecraftforge/common/util/NonNullLazy.java +++ b/src/main/java/net/minecraftforge/common/util/NonNullLazy.java @@ -5,7 +5,7 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import java.util.Objects; /** @@ -19,7 +19,7 @@ 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) + static NonNullLazy of(@NotNull NonNullSupplier supplier) { Lazy lazy = Lazy.of(supplier::get); return () -> Objects.requireNonNull(lazy.get()); @@ -29,7 +29,7 @@ static NonNullLazy of(@Nonnull NonNullSupplier 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) + static NonNullLazy concurrentOf(@NotNull NonNullSupplier supplier) { Lazy lazy = Lazy.concurrentOf(supplier::get); return () -> Objects.requireNonNull(lazy.get()); diff --git a/src/main/java/net/minecraftforge/common/util/NonNullPredicate.java b/src/main/java/net/minecraftforge/common/util/NonNullPredicate.java index 68f1ed4f884..8d265c9e03a 100644 --- a/src/main/java/net/minecraftforge/common/util/NonNullPredicate.java +++ b/src/main/java/net/minecraftforge/common/util/NonNullPredicate.java @@ -5,16 +5,16 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import java.util.function.Predicate; /** * Equivalent to {@link Predicate}, except with nonnull contract. - * + * * @see Predicate */ @FunctionalInterface public interface NonNullPredicate { - boolean test(@Nonnull T t); + boolean test(@NotNull T t); } diff --git a/src/main/java/net/minecraftforge/common/util/NonNullSupplier.java b/src/main/java/net/minecraftforge/common/util/NonNullSupplier.java index e76af491d5d..14adca0756c 100644 --- a/src/main/java/net/minecraftforge/common/util/NonNullSupplier.java +++ b/src/main/java/net/minecraftforge/common/util/NonNullSupplier.java @@ -5,16 +5,16 @@ package net.minecraftforge.common.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import java.util.function.Supplier; /** * Equivalent to {@link Supplier}, except with nonnull contract. - * + * * @see Supplier */ @FunctionalInterface public interface NonNullSupplier { - @Nonnull T get(); + @NotNull T get(); } diff --git a/src/main/java/net/minecraftforge/common/util/TextTable.java b/src/main/java/net/minecraftforge/common/util/TextTable.java index 5f975c58da3..6ba0df30001 100644 --- a/src/main/java/net/minecraftforge/common/util/TextTable.java +++ b/src/main/java/net/minecraftforge/common/util/TextTable.java @@ -7,8 +7,8 @@ import com.google.common.collect.Streams; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -93,7 +93,7 @@ private void printRow(StringBuilder destination, List values) } } - public void add(@Nonnull Object... values) + public void add(@NotNull Object... values) { if (values.length != columns.size()) { diff --git a/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java b/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java index bbf15e860a7..8200b099ffb 100644 --- a/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java +++ b/src/main/java/net/minecraftforge/common/util/WorldCapabilityData.java @@ -5,11 +5,9 @@ package net.minecraftforge.common.util; -import javax.annotation.Nullable; - import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.saveddata.SavedData; -import net.minecraftforge.common.capabilities.CapabilityProvider; +import org.jetbrains.annotations.Nullable; public class WorldCapabilityData extends SavedData { diff --git a/src/main/java/net/minecraftforge/common/world/BiomeModifier.java b/src/main/java/net/minecraftforge/common/world/BiomeModifier.java new file mode 100644 index 00000000000..3b4a179d8e2 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/world/BiomeModifier.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.world; + +import com.mojang.serialization.Codec; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.RegistryCodecs; +import net.minecraft.resources.RegistryFileCodec; +import net.minecraft.resources.RegistryOps; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.level.biome.Biome; +import net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo; +import net.minecraftforge.registries.ForgeRegistries; +import java.util.function.Function; + +/** + * JSON-serializable biome modifier. + * Requires a {@link Codec} to deserialize biome modifiers from biome modifier jsons. + *

+ * Biome modifier jsons have the following json format: + *

+ * {
+ *   "type": "yourmod:yourserializer", // Indicates a registered biome modifier serializer
+ *   // Additional fields can be specified here according to the codec
+ * }
+ * 
+ *

+ * Datapacks can also disable a biome modifier by overriding the json and using {@code "type": "forge:none"}.

+ */ +public interface BiomeModifier +{ + /** + * Codec for (de)serializing biome modifiers inline. + * Mods can use this for data generation. + */ + @SuppressWarnings("unchecked") + Codec DIRECT_CODEC = ExtraCodecs.lazyInitializedCodec(() -> ForgeRegistries.BIOME_MODIFIER_SERIALIZERS.get().getCodec()) + .dispatch(BiomeModifier::codec, Function.identity()); + + /** + * Codec for referring to biome modifiers by id in other datapack registry files. + * Can only be used with {@link RegistryOps}. + */ + Codec> REFERENCE_CODEC = RegistryFileCodec.create(ForgeRegistries.Keys.BIOME_MODIFIERS, DIRECT_CODEC); + + /** + * Codec for referring to biome modifiers by id, list of id, or tags. + * Can only be used with {@link RegistryOps}. + */ + Codec> LIST_CODEC = RegistryCodecs.homogeneousList(ForgeRegistries.Keys.BIOME_MODIFIERS, DIRECT_CODEC); + + /** + * Modifies the information via the provided biome builder. + * Allows mob spawns and world-gen features to be added or removed, + * and climate and client effects to be modified. + * + * @param biome the named biome being modified (with original data readable). + * @param phase biome modification phase. Biome modifiers apply in each phase in order of the enum constants. + * @param builder mutable biome info builder. Apply changes to this. + */ + void modify(Holder biome, Phase phase, BiomeInfo.Builder builder); + + /** + * @return the codec which serializes and deserializes this biome modifier + */ + Codec codec(); + + enum Phase + { + /** + * Catch-all for anything that needs to run before standard phases. + */ + BEFORE_EVERYTHING, + /** + * Additional features, mob spawns, etc. + */ + ADD, + /** + * Removal of features, mob spawns, etc. + */ + REMOVE, + /** + * Alteration of values such as climate or colors. + */ + MODIFY, + /** + * Catch-all for anything that needs to run after standard phases. + */ + AFTER_EVERYTHING + } +} diff --git a/src/main/java/net/minecraftforge/common/world/BiomeSpecialEffectsBuilder.java b/src/main/java/net/minecraftforge/common/world/BiomeSpecialEffectsBuilder.java new file mode 100644 index 00000000000..10c482bfbcd --- /dev/null +++ b/src/main/java/net/minecraftforge/common/world/BiomeSpecialEffectsBuilder.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.world; + +import java.util.Optional; + +import net.minecraft.sounds.Music; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.level.biome.AmbientAdditionsSettings; +import net.minecraft.world.level.biome.AmbientMoodSettings; +import net.minecraft.world.level.biome.AmbientParticleSettings; +import net.minecraft.world.level.biome.BiomeSpecialEffects; + +/** + * Extension of the vanilla builder but also provides read access and a copy-from-existing-data helper. + * Also, the base builder crashes if certain values aren't specified on build, so this enforces the setting of those. + */ +public class BiomeSpecialEffectsBuilder extends BiomeSpecialEffects.Builder +{ + public static BiomeSpecialEffectsBuilder copyOf(BiomeSpecialEffects baseEffects) + { + BiomeSpecialEffectsBuilder builder = BiomeSpecialEffectsBuilder.create(baseEffects.getFogColor(), baseEffects.getWaterColor(), baseEffects.getWaterFogColor(), baseEffects.getSkyColor()); + builder.grassColorModifier = baseEffects.getGrassColorModifier(); + baseEffects.getFoliageColorOverride().ifPresent(builder::foliageColorOverride); + baseEffects.getGrassColorOverride().ifPresent(builder::grassColorOverride); + baseEffects.getAmbientParticleSettings().ifPresent(builder::ambientParticle); + baseEffects.getAmbientLoopSoundEvent().ifPresent(builder::ambientLoopSound); + baseEffects.getAmbientMoodSettings().ifPresent(builder::ambientMoodSound); + baseEffects.getAmbientAdditionsSettings().ifPresent(builder::ambientAdditionsSound); + baseEffects.getBackgroundMusic().ifPresent(builder::backgroundMusic); + return builder; + } + + public static BiomeSpecialEffectsBuilder create(int fogColor, int waterColor, int waterFogColor, int skyColor) + { + return new BiomeSpecialEffectsBuilder(fogColor, waterColor, waterFogColor, skyColor); + } + + protected BiomeSpecialEffectsBuilder(int fogColor, int waterColor, int waterFogColor, int skyColor) + { + super(); + this.fogColor(fogColor); + this.waterColor(waterColor); + this.waterFogColor(waterFogColor); + this.skyColor(skyColor); + } + + public int getFogColor() + { + return this.fogColor.getAsInt(); + } + + public int waterColor() + { + return this.waterColor.getAsInt(); + } + + public int getWaterFogColor() + { + return this.waterFogColor.getAsInt(); + } + + public int getSkyColor() + { + return this.skyColor.getAsInt(); + } + + public BiomeSpecialEffects.GrassColorModifier getGrassColorModifier() + { + return this.grassColorModifier; + } + + public Optional getFoliageColorOverride() + { + return this.foliageColorOverride; + } + + public Optional getGrassColorOverride() + { + return this.grassColorOverride; + } + + public Optional getAmbientParticle() + { + return this.ambientParticle; + } + + public Optional getAmbientLoopSound() + { + return this.ambientLoopSoundEvent; + } + + public Optional getAmbientMoodSound() + { + return this.ambientMoodSettings; + } + + public Optional getAmbientAdditionsSound() + { + return this.ambientAdditionsSettings; + } + + public Optional getBackgroundMusic() + { + return this.backgroundMusic; + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/world/ClimateSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/ClimateSettingsBuilder.java new file mode 100644 index 00000000000..346e0bf62df --- /dev/null +++ b/src/main/java/net/minecraftforge/common/world/ClimateSettingsBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.world; + +import net.minecraft.world.level.biome.Biome.ClimateSettings; +import net.minecraft.world.level.biome.Biome.Precipitation; +import net.minecraft.world.level.biome.Biome.TemperatureModifier; + +/** + * Builder for {@link ClimateSettings}. + */ +public class ClimateSettingsBuilder +{ + private Precipitation precipitation; + private float temperature; + private TemperatureModifier temperatureModifier; + private float downfall; + + /** + * @param settings Existing ClimateSettings. + * @return A new builder with a copy of that ClimateSettings's values. + */ + public static ClimateSettingsBuilder copyOf(ClimateSettings settings) + { + return create(settings.precipitation(), settings.temperature(), settings.temperatureModifier(), settings.downfall()); + } + + /** + * @param precipitation Synced to clients, determines weather effects + * @param temperature Synced to clients, affects foliage color, freezing, and weather effects. + * Vanilla values are in the range [-0.5, 2.0] + * @param temperatureModifier Synced to clients, applies a positional modifier to temperature. + * Frozen Oceans use this to have occasional warm patches. + * @param downfall Synced to clients, affects foliage color. + * Biomes with downfall > 0.85 count as humid, inhibiting fire spread. + * @return a new builder with the given values + */ + public static ClimateSettingsBuilder create(Precipitation precipitation, float temperature, TemperatureModifier temperatureModifier, float downfall) + { + return new ClimateSettingsBuilder(precipitation, temperature, temperatureModifier, downfall); + } + + private ClimateSettingsBuilder(Precipitation precipitation, float temperature, TemperatureModifier temperatureModifier, float downfall) + { + this.precipitation = precipitation; + this.temperature = temperature; + this.temperatureModifier = temperatureModifier; + this.downfall = downfall; + } + + /** + * @return A new ClimateSettings with the finalized values. + */ + public ClimateSettings build() + { + return new ClimateSettings(this.precipitation, this.temperature, this.temperatureModifier, this.downfall); + } + + /** + * @return Synced to clients, determines weather effects. + */ + public Precipitation getPrecipitation() + { + return precipitation; + } + + /** + * @param precipitation Synced to clients, determines weather effects. + */ + public void setPrecipitation(Precipitation precipitation) + { + this.precipitation = precipitation; + } + + /** + * {@return Synced to clients, affects foliage color, freezing, and weather effects} + * Vanilla values are in the range [-0.5, 2.0]. + */ + public float getTemperature() + { + return temperature; + } + + /** + * @param temperature Synced to clients, affects foliage color, freezing, and weather effects. + * Vanilla values are in the range [-0.5, 2.0]. + */ + public void setTemperature(float temperature) + { + this.temperature = temperature; + } + + /** + * {@return temperatureModifier Synced to clients, applies a positional modifier to temperature.} + * Frozen Oceans use this to have occasional warm patches. + */ + public TemperatureModifier getTemperatureModifier() + { + return temperatureModifier; + } + + /** + * @param temperatureModifier Synced to clients, applies a positional modifier to temperature. + * Frozen Oceans use this to have occasional warm patches. + */ + public void setTemperatureModifier(TemperatureModifier temperatureModifier) + { + this.temperatureModifier = temperatureModifier; + } + + /** + * {@return Synced to clients, affects foliage color.} + * Biomes with downfall > 0.85 count as humid, inhibiting fire spread. + */ + public float getDownfall() + { + return downfall; + } + + /** + * @param downfall Synced to clients, affects foliage color. + * Biomes with downfall > 0.85 count as humid, inhibiting fire spread. + */ + public void setDownfall(float downfall) + { + this.downfall = downfall; + } +} diff --git a/src/main/java/net/minecraftforge/common/world/ForgeWorldPreset.java b/src/main/java/net/minecraftforge/common/world/ForgeWorldPreset.java index a4b50a89ea4..a165388d171 100644 --- a/src/main/java/net/minecraftforge/common/world/ForgeWorldPreset.java +++ b/src/main/java/net/minecraftforge/common/world/ForgeWorldPreset.java @@ -11,19 +11,16 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; +import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraftforge.common.ForgeConfig; import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.ForgeRegistryEntry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public class ForgeWorldPreset extends ForgeRegistryEntry +public class ForgeWorldPreset { private static final Logger LOGGER = LogManager.getLogger(); @@ -57,12 +54,12 @@ public ForgeWorldPreset(IBasicChunkGeneratorFactory factory) public String getTranslationKey() { - return Util.makeDescriptionId("generator", getRegistryName()); + return Util.makeDescriptionId("generator", ForgeRegistries.WORLD_TYPES.get().getKey(this)); } public Component getDisplayName() { - return new TranslatableComponent(getTranslationKey()); + return Component.translatable(getTranslationKey()); } /** @@ -86,9 +83,10 @@ public interface IChunkGeneratorFactory default WorldGenSettings createSettings(RegistryAccess dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest, String generatorSettings) { Registry dimensionTypeRegistry = dynamicRegistries.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); + Registry levelStemRegistry = dynamicRegistries.registryOrThrow(Registry.LEVEL_STEM_REGISTRY); return new WorldGenSettings(seed, generateStructures, bonusChest, WorldGenSettings.withOverworld(dimensionTypeRegistry, - DimensionType.defaultDimensions(dynamicRegistries, seed), + levelStemRegistry, createChunkGenerator(dynamicRegistries, seed, generatorSettings))); } } diff --git a/src/main/java/net/minecraftforge/common/world/MobSpawnSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/MobSpawnSettingsBuilder.java index 13218bda5b9..ce17de0a6bc 100644 --- a/src/main/java/net/minecraftforge/common/world/MobSpawnSettingsBuilder.java +++ b/src/main/java/net/minecraftforge/common/world/MobSpawnSettingsBuilder.java @@ -9,11 +9,10 @@ import java.util.List; import java.util.Set; -import javax.annotation.Nullable; - import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.biome.MobSpawnSettings; +import org.jetbrains.annotations.Nullable; public class MobSpawnSettingsBuilder extends MobSpawnSettings.Builder { diff --git a/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java b/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java new file mode 100644 index 00000000000..2a2f9ea5c39 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.world; + +import java.util.List; +import java.util.Locale; + +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import net.minecraft.core.Holder; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.ClimateSettings; +import net.minecraft.world.level.biome.BiomeGenerationSettings; +import net.minecraft.world.level.biome.BiomeSpecialEffects; +import net.minecraft.world.level.biome.MobSpawnSettings; + +/** + * Holds lazy-evaluable modified biome info. + * Memoizers are not used because it's important to return null + * without evaluating the biome info if it's accessed outside of a server context. + */ +public class ModifiableBiomeInfo +{ + @NotNull + private final BiomeInfo originalBiomeInfo; + @Nullable + private BiomeInfo modifiedBiomeInfo = null; + + /** + * @param originalBiomeInfo BiomeInfo representing the original state of a biome when the biome was constructed. + */ + public ModifiableBiomeInfo(@NotNull final BiomeInfo originalBiomeInfo) + { + this.originalBiomeInfo = originalBiomeInfo; + } + + /** + * {@return The modified biome info if modified biome info has been generated, otherwise gets original biome info} + */ + @NotNull + public BiomeInfo get() + { + return this.modifiedBiomeInfo == null + ? originalBiomeInfo + : modifiedBiomeInfo; + } + + /** + * {@return The original biome info that the associated biome was created with} + */ + @NotNull + public BiomeInfo getOriginalBiomeInfo() + { + return this.originalBiomeInfo; + } + + /** + * {@return Modified biome info; null if it hasn't been set yet} + */ + @Nullable + public BiomeInfo getModifiedBiomeInfo() + { + return this.modifiedBiomeInfo; + } + + /** + * Internal forge method; the game will crash if mods invoke this. + * Creates and caches the modified biome info. + * @param biome named biome with original data. + * @param biomeModifiers biome modifiers to apply. + * + * @throws IllegalStateException if invoked more than once. + */ + @ApiStatus.Internal + public void applyBiomeModifiers(final Holder biome, final List biomeModifiers) + { + if (this.modifiedBiomeInfo != null) + throw new IllegalStateException(String.format(Locale.ENGLISH, "Biome %s already modified", biome)); + + BiomeInfo original = this.getOriginalBiomeInfo(); + final BiomeInfo.Builder builder = BiomeInfo.Builder.copyOf(original); + for (BiomeModifier.Phase phase : BiomeModifier.Phase.values()) + { + for (BiomeModifier modifier : biomeModifiers) + { + modifier.modify(biome, phase, builder); + } + } + this.modifiedBiomeInfo = builder.build(); + } + + /** + * Record containing raw biome data. + * @param climateSettings Weather and temperature settings. + * @param effects Client-relevant effects for rendering and sound. + * @param generationSettings Worldgen features and carvers. + * @param mobSpawnSettings Mob spawn settings. + */ + public record BiomeInfo(ClimateSettings climateSettings, BiomeSpecialEffects effects, BiomeGenerationSettings generationSettings, MobSpawnSettings mobSpawnSettings) + { + public static class Builder + { + private ClimateSettingsBuilder climateSettings; + private BiomeSpecialEffects.Builder effects; + private BiomeGenerationSettingsBuilder generationSettings; + private MobSpawnSettingsBuilder mobSpawnSettings; + + /** + * @param biome A biome that has not had its modified biome data generated yet + * @return A ModifiedBiomeInfo.Builder with a copy of the biome's data + */ + public static Builder copyOf(final BiomeInfo original) + { + final ClimateSettingsBuilder climateBuilder = ClimateSettingsBuilder.copyOf(original.climateSettings()); + final BiomeSpecialEffects.Builder effectsBuilder = BiomeSpecialEffectsBuilder.copyOf(original.effects()); + final BiomeGenerationSettingsBuilder generationBuilder = new BiomeGenerationSettingsBuilder(original.generationSettings()); + final MobSpawnSettingsBuilder mobSpawnBuilder = new MobSpawnSettingsBuilder(original.mobSpawnSettings()); + + return new Builder( + climateBuilder, + effectsBuilder, + generationBuilder, + mobSpawnBuilder + ); + } + + private Builder(final ClimateSettingsBuilder climateSettings, final BiomeSpecialEffects.Builder effects, final BiomeGenerationSettingsBuilder generationSettings, final MobSpawnSettingsBuilder mobSpawnSettings) + { + this.climateSettings = climateSettings; + this.effects = effects; + this.generationSettings = generationSettings; + this.mobSpawnSettings = mobSpawnSettings; + } + + public BiomeInfo build() + { + return new BiomeInfo(this.climateSettings.build(), this.effects.build(), this.generationSettings.build(), this.mobSpawnSettings.build()); + } + + public ClimateSettingsBuilder getClimateSettings() + { + return climateSettings; + } + + public BiomeSpecialEffects.Builder getEffects() + { + return effects; + } + + public BiomeGenerationSettingsBuilder getGenerationSettings() + { + return generationSettings; + } + + public MobSpawnSettingsBuilder getMobSpawnSettings() + { + return mobSpawnSettings; + } + } + } +} diff --git a/src/main/java/net/minecraftforge/common/world/NoneBiomeModifier.java b/src/main/java/net/minecraftforge/common/world/NoneBiomeModifier.java new file mode 100644 index 00000000000..0a6c70abcc4 --- /dev/null +++ b/src/main/java/net/minecraftforge/common/world/NoneBiomeModifier.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.common.world; + +import com.mojang.serialization.Codec; +import net.minecraft.core.Holder; +import net.minecraft.world.level.biome.Biome; +import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo.Builder; + +public class NoneBiomeModifier implements BiomeModifier +{ + public static final NoneBiomeModifier INSTANCE = new NoneBiomeModifier(); + + @Override + public void modify(Holder biome, Phase phase, Builder builder) + { + // NOOP - intended for datapack makers who want to disable a biome modifier + } + + @Override + public Codec codec() + { + return ForgeMod.NONE_BIOME_MODIFIER_TYPE.get(); + } +} diff --git a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java index f668ac7a3ec..7e0411ef5b5 100644 --- a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java @@ -10,12 +10,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** - * - * AnvilUpdateEvent is fired when the inputs (either input stack, or the name) to an anvil are changed.
+ * + * AnvilUpdateEvent is fired when the inputs (either input stack, or the name) to an anvil are changed.
* It is called from {@link AnvilMenu#createResult()}.
* If the event is canceled, vanilla behavior will not run, and the output will be set to {@link ItemStack#EMPTY}.
* If the event is not canceled, but the output is not empty, it will set the output and not run vanilla behavior.
@@ -78,7 +77,7 @@ public String getName() * If this event is cancelled, this output stack is discarded. * @return The item to set in the output (rightmost) anvil slot. */ - public ItemStack getOutput() + public ItemStack getOutput() { return output; } @@ -93,7 +92,7 @@ public void setOutput(ItemStack output) } /** - * This is the level cost of this anvil operation.
+ * This is the level cost of this anvil operation.
* When unchanged, it is guaranteed to be left.getRepairCost() + right.getRepairCost(). * @return The level cost of this anvil operation. */ diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index f1639a8219b..62316c7b98e 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -10,17 +10,14 @@ import java.util.function.BooleanSupplier; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.mojang.authlib.GameProfile; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.brigadier.CommandDispatcher; +import net.minecraft.network.chat.ChatSender; import net.minecraft.server.ReloadableServerResources; import net.minecraft.server.players.PlayerList; +import net.minecraft.util.RandomSource; import net.minecraft.world.Container; -import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownEnderpearl; import net.minecraft.world.level.portal.PortalShape; @@ -35,15 +32,12 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.Player.BedSleepingProblem; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; @@ -71,16 +65,12 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.Level; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.biome.MobSpawnSettings; import net.minecraft.world.level.storage.ServerLevelData; import net.minecraft.world.level.storage.PlayerDataStorage; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.RenderBlockOverlayEvent; -import net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.capabilities.CapabilityDispatcher; @@ -93,7 +83,6 @@ import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.event.entity.EntityStruckByLightningEvent; import net.minecraftforge.event.entity.EntityTeleportEvent; -import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; import net.minecraftforge.event.entity.ProjectileImpactEvent; import net.minecraftforge.event.entity.item.ItemExpireEvent; import net.minecraftforge.event.entity.living.AnimalTameEvent; @@ -121,10 +110,8 @@ import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.event.entity.player.SleepingTimeCheckEvent; -import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent; import net.minecraftforge.event.world.BlockEvent.BlockToolModificationEvent; import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent; import net.minecraftforge.event.world.BlockEvent.EntityMultiPlaceEvent; @@ -139,6 +126,8 @@ import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ForgeEventFactory { @@ -151,7 +140,7 @@ public static boolean onMultiBlockPlace(@Nullable Entity entity, List recipeType) + public static int getItemBurnTime(@NotNull ItemStack itemStack, int burnTime, @Nullable RecipeType recipeType) { FurnaceFuelBurnTimeEvent event = new FurnaceFuelBurnTimeEvent(itemStack, burnTime, recipeType); MinecraftForge.EVENT_BUS.post(event); @@ -333,56 +307,27 @@ public static void firePlayerLoadingEvent(Player player, PlayerDataStorage playe } @Nullable - public static Component onClientChat(ChatType type, Component message, @Nullable UUID senderUUID) + public static Component onClientChat(ChatType type, Component message, ChatSender chatSender) { - ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message, senderUUID); + ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message, chatSender); return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage(); } - @Nonnull + @NotNull public static String onClientSendMessage(String message) { ClientChatEvent event = new ClientChatEvent(message); return MinecraftForge.EVENT_BUS.post(event) ? "" : event.getMessage(); } - //TODO 1.19: Remove - @Deprecated(forRemoval = true, since = "1.18.2") - public static int onHoeUse(UseOnContext context) - { - UseHoeEvent event = new UseHoeEvent(context); - if (MinecraftForge.EVENT_BUS.post(event)) return -1; - if (event.getResult() == Result.ALLOW) - { - context.getItemInHand().hurtAndBreak(1, context.getPlayer(), player -> player.broadcastBreakEvent(context.getHand())); - return 1; - } - return 0; - } - @Nullable public static BlockState onToolUse(BlockState originalState, UseOnContext context, ToolAction toolAction, boolean simulate) { - // TODO 1.19: Remove ternary and just use BlockToolModificationEvent constructor with simulate parameter passed in - BlockToolModificationEvent event = simulate - ? new BlockToolModificationEvent(originalState, context, toolAction, true) - : new BlockToolInteractEvent(originalState, context, toolAction); + BlockToolModificationEvent event = new BlockToolModificationEvent(originalState, context, toolAction, simulate); return MinecraftForge.EVENT_BUS.post(event) ? null : event.getFinalState(); } - /** - * @deprecated Use {@link #onToolUse(BlockState, UseOnContext, ToolAction, boolean)} instead. - */ - @Nullable - // TODO 1.19: Remove - @Deprecated(forRemoval = true, since = "1.18.2") - public static BlockState onToolUse(BlockState originalState, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction) - { - BlockToolInteractEvent event = new BlockToolInteractEvent(level, pos, originalState, player, stack, toolAction); - return MinecraftForge.EVENT_BUS.post(event) ? null : event.getFinalState(); - } - - public static int onApplyBonemeal(@Nonnull Player player, @Nonnull Level level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack) + public static int onApplyBonemeal(@NotNull Player player, @NotNull Level level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull ItemStack stack) { BonemealEvent event = new BonemealEvent(player, level, pos, state, stack); if (MinecraftForge.EVENT_BUS.post(event)) return -1; @@ -396,7 +341,7 @@ public static int onApplyBonemeal(@Nonnull Player player, @Nonnull Level level, } @Nullable - public static InteractionResultHolder onBucketUse(@Nonnull Player player, @Nonnull Level level, @Nonnull ItemStack stack, @Nullable HitResult target) + public static InteractionResultHolder onBucketUse(@NotNull Player player, @NotNull Level level, @NotNull ItemStack stack, @Nullable HitResult target) { FillBucketEvent event = new FillBucketEvent(player, stack, level, target); if (MinecraftForge.EVENT_BUS.post(event)) return new InteractionResultHolder(InteractionResult.FAIL, stack); @@ -418,21 +363,22 @@ public static InteractionResultHolder onBucketUse(@Nonnull Player pla return null; } - public static boolean canEntityUpdate(Entity entity) + public static PlayLevelSoundEvent.AtEntity onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) { - EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(entity); + PlayLevelSoundEvent.AtEntity event = new PlayLevelSoundEvent.AtEntity(entity, name, category, volume, pitch); MinecraftForge.EVENT_BUS.post(event); - return event.getCanUpdate(); + return event; } - public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) + + public static PlayLevelSoundEvent.AtPosition onPlaySoundAtPosition(Level level, double x, double y, double z, SoundEvent name, SoundSource category, float volume, float pitch) { - PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, category, volume, pitch); + PlayLevelSoundEvent.AtPosition event = new PlayLevelSoundEvent.AtPosition(level, new Vec3(x, y, z), name, category, volume, pitch); MinecraftForge.EVENT_BUS.post(event); return event; } - public static int onItemExpire(ItemEntity entity, @Nonnull ItemStack item) + public static int onItemExpire(ItemEntity entity, @NotNull ItemStack item) { if (item.isEmpty()) return -1; ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.level))); @@ -465,7 +411,7 @@ public static boolean onAnimalTame(Animal animal, Player tamer) return MinecraftForge.EVENT_BUS.post(new AnimalTameEvent(animal, tamer)); } - public static BedSleepingProblem onPlayerSleepInBed(Player player, Optional pos) + public static Player.BedSleepingProblem onPlayerSleepInBed(Player player, Optional pos) { PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos); MinecraftForge.EVENT_BUS.post(event); @@ -556,24 +502,6 @@ public static void onPlayerBrewedPotion(Player player, ItemStack stack) MinecraftForge.EVENT_BUS.post(new PlayerBrewedPotionEvent(player, stack)); } - @OnlyIn(Dist.CLIENT) - public static boolean renderFireOverlay(Player player, PoseStack mat) - { - return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition()); - } - - @OnlyIn(Dist.CLIENT) - public static boolean renderWaterOverlay(Player player, PoseStack mat) - { - return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.defaultBlockState(), player.blockPosition()); - } - - @OnlyIn(Dist.CLIENT) - public static boolean renderBlockOverlay(Player player, PoseStack mat, OverlayType type, BlockState block, BlockPos pos) - { - return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, mat, type, block, pos)); - } - @Nullable public static CapabilityDispatcher gatherCapabilities(Class type, T provider) { @@ -688,7 +616,7 @@ public static boolean getMobGriefingEvent(Level level, Entity entity) return result == Result.DEFAULT ? level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) : result == Result.ALLOW; } - public static boolean saplingGrowTree(LevelAccessor level, Random rand, BlockPos pos) + public static boolean saplingGrowTree(LevelAccessor level, RandomSource rand, BlockPos pos) { SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(level, rand, pos); MinecraftForge.EVENT_BUS.post(event); @@ -865,33 +793,11 @@ public static void onPlayerPostTick(Player player) MinecraftForge.EVENT_BUS.post(new TickEvent.PlayerTickEvent(TickEvent.Phase.END, player)); } - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link #onPreWorldTick(Level, BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public static void onPreWorldTick(Level level) - { - onPreWorldTick(level, () -> false); - } - public static void onPreWorldTick(Level level, BooleanSupplier haveTime) { MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.START, level, haveTime)); } - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link #onPostWorldTick(Level, BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public static void onPostWorldTick(Level level) - { - onPostWorldTick(level, () -> false); - } - public static void onPostWorldTick(Level level, BooleanSupplier haveTime) { MinecraftForge.EVENT_BUS.post(new TickEvent.WorldTickEvent(LogicalSide.SERVER, TickEvent.Phase.END, level, haveTime)); @@ -907,33 +813,11 @@ public static void onPostClientTick() MinecraftForge.EVENT_BUS.post(new TickEvent.ClientTickEvent(TickEvent.Phase.END)); } - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link #onPreServerTick(BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public static void onPreServerTick() - { - onPreServerTick(() -> false); - } - public static void onPreServerTick(BooleanSupplier haveTime) { MinecraftForge.EVENT_BUS.post(new TickEvent.ServerTickEvent(TickEvent.Phase.START, haveTime)); } - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link #onPostServerTick(BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public static void onPostServerTick() - { - onPostServerTick(() -> false); - } - public static void onPostServerTick(BooleanSupplier haveTime) { MinecraftForge.EVENT_BUS.post(new TickEvent.ServerTickEvent(TickEvent.Phase.END, haveTime)); diff --git a/src/main/java/net/minecraftforge/event/GameShuttingDownEvent.java b/src/main/java/net/minecraftforge/event/GameShuttingDownEvent.java new file mode 100644 index 00000000000..56169689ece --- /dev/null +++ b/src/main/java/net/minecraftforge/event/GameShuttingDownEvent.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.event; + +import net.minecraftforge.eventbus.api.Event; + +/** + * A simple marker event that notifies when the game is about to close. + * Fires once on the physical client and physical server. + * Does not fire for the Integrated Server on a physical Client. + * + * On the client, the GL Context is still valid when the event is fired. + * Fired on the FORGE event bus. + * + * @author Curle + */ +public class GameShuttingDownEvent extends Event +{ + public GameShuttingDownEvent() {} +} diff --git a/src/main/java/net/minecraftforge/event/ItemAttributeModifierEvent.java b/src/main/java/net/minecraftforge/event/ItemAttributeModifierEvent.java index 4508b42bb42..ac5d1e0ea98 100644 --- a/src/main/java/net/minecraftforge/event/ItemAttributeModifierEvent.java +++ b/src/main/java/net/minecraftforge/event/ItemAttributeModifierEvent.java @@ -13,8 +13,8 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collection; /** diff --git a/src/main/java/net/minecraftforge/event/OnDatapackSyncEvent.java b/src/main/java/net/minecraftforge/event/OnDatapackSyncEvent.java index 787dc09bb32..12b82cc863c 100644 --- a/src/main/java/net/minecraftforge/event/OnDatapackSyncEvent.java +++ b/src/main/java/net/minecraftforge/event/OnDatapackSyncEvent.java @@ -5,11 +5,10 @@ package net.minecraftforge.event; -import javax.annotation.Nullable; - import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.PlayerList; import net.minecraftforge.eventbus.api.Event; +import org.jetbrains.annotations.Nullable; /** * Fires when a player joins the server or when the reload command is ran, diff --git a/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java b/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java new file mode 100644 index 00000000000..c0023fa5d79 --- /dev/null +++ b/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.event; + +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import java.util.Objects; + +/** + * PlayLevelSoundEvent is fired when a sound is played on a {@link Level}. + * This event is fired from {@link Level#playSound}, {@link Level#playSeededSound}, and {@link LocalPlayer#playSound}. + *

+ * {@link #getLevel()} contains the level the sound is being played in. + * {@link #getSound()} contains the sound event to be played. + * {@link #getOriginalVolume()} contains the original volume for the sound to be played at. + * {@link #getOriginalPitch()} contains the original pitch for the sound to be played at. + * {@link #getNewVolume()} contains the volume the sound will be played at. + * {@link #getNewPitch()} contains the pitch the sound will be played at. + *

+ * This event is {@link Cancelable cancelable}. + * If this event is canceled, the sound is not played. + *

+ * This event does not have a result. + *

+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + */ +@Cancelable +public class PlayLevelSoundEvent extends Event +{ + private final Level level; + private final float originalVolume; + private final float originalPitch; + private SoundEvent sound; + private SoundSource source; + private float newVolume; + private float newPitch; + + public PlayLevelSoundEvent(@NotNull Level level, @NotNull SoundEvent sound, @NotNull SoundSource source, float volume, float pitch) + { + this.level = level; + this.sound = sound; + this.source = source; + this.originalVolume = volume; + this.originalPitch = pitch; + this.newVolume = volume; + this.newPitch = pitch; + } + + /** + * {@return the level the sound is being played in} + */ + @NotNull + public Level getLevel() + { + return this.level; + } + + /** + * {@return the sound event to be played} + */ + @Nullable + public SoundEvent getSound() + { + return this.sound; + } + + /** + * Sets the sound event to be played. + */ + public void setSound(@Nullable SoundEvent sound) + { + this.sound = sound; + } + + /** + * {@return the sound source} + */ + @NotNull + public SoundSource getSource() + { + return this.source; + } + + /** + * Sets the sound source. + */ + public void setSource(@NotNull SoundSource source) + { + Objects.requireNonNull(source, "Sound source cannot be null"); + this.source = source; + } + + /** + * {@return the original volume for the sound to be played at} + */ + public float getOriginalVolume() + { + return this.originalVolume; + } + + /** + * {@return the original pitch for the sound to be played at} + */ + public float getOriginalPitch() + { + return this.originalPitch; + } + + /** + * {@return the volume the sound will be played at} + */ + public float getNewVolume() + { + return this.newVolume; + } + + /** + * Sets the volume the sound will be played at. + */ + public void setNewVolume(float newVolume) + { + this.newVolume = newVolume; + } + + /** + * {@return the pitch the sound will be played at} + */ + public float getNewPitch() + { + return this.newPitch; + } + + /** + * Sets the pitch the sound will be played at. + */ + public void setNewPitch(float newPitch) + { + this.newPitch = newPitch; + } + + /** + * PlayLevelSoundEvent.AtEntity is fired when a sound is played on the {@link Level} at an {@link Entity Entity}'s position. + * This event is fired from {@link Level#playSound}, {@link Level#playSeededSound}, and {@link LocalPlayer#playSound}. + *

+ * This event is {@link Cancelable cancelable}. + * If this event is canceled, the sound is not played. + *

+ * This event does not have a result. + *

+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + */ + public static class AtEntity extends PlayLevelSoundEvent + { + private final Entity entity; + + public AtEntity(Entity entity, SoundEvent sound, SoundSource source, float volume, float pitch) + { + super(entity.level, sound, source, volume, pitch); + this.entity = entity; + } + + /** + * {@return the entity the sound is being played on} + */ + public Entity getEntity() + { + return this.entity; + } + } + + /** + * PlayLevelSoundEvent.AtPosition is fired when a sound is played on the {@link Level} at a specific position. + * This event is fired from {@link Level#playSound} and {@link Level#playSeededSound}. + *

+ * This event is {@link Cancelable cancelable}. + * If this event is canceled, the sound is not played. + *

+ * This event does not have a result. + *

+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + */ + public static class AtPosition extends PlayLevelSoundEvent + { + private final Vec3 position; + + public AtPosition(Level level, Vec3 position, SoundEvent sound, SoundSource source, float volume, float pitch) + { + super(level, sound, source, volume, pitch); + this.position = position; + } + + /** + * {@return the position the sound is being played at} + */ + public Vec3 getPosition() + { + return this.position; + } + } +} diff --git a/src/main/java/net/minecraftforge/event/RegistryEvent.java b/src/main/java/net/minecraftforge/event/RegistryEvent.java deleted file mode 100644 index 5ea1949c08d..00000000000 --- a/src/main/java/net/minecraftforge/event/RegistryEvent.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event; - -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.stream.Collectors; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fml.event.IModBusEvent; -import org.apache.commons.lang3.Validate; - -import com.google.common.collect.ImmutableList; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.fml.ModContainer; -import net.minecraftforge.eventbus.api.GenericEvent; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.IForgeRegistryEntry; - -/** - * RegistryEvent supertype. - */ -public class RegistryEvent> extends GenericEvent implements IModBusEvent -{ - RegistryEvent(Class clazz) { - super(clazz); - } - - /** - * Register your objects for the appropriate registry type when you receive this event. - * - * event.getRegistry().register(...) - * - * The registries will be visited in alphabetic order of their name, except blocks and items, - * which will be visited FIRST and SECOND respectively. - * - * ObjectHolders will reload between Blocks and Items, and after all registries have been visited. - * @param The registry top level type - */ - public static class Register> extends RegistryEvent - { - private final IForgeRegistry registry; - private final ResourceLocation name; - - public Register(ResourceLocation name, IForgeRegistry registry) - { - super(registry.getRegistrySuperType()); - this.name = name; - this.registry = registry; - } - - public IForgeRegistry getRegistry() - { - return registry; - } - - public ResourceLocation getName() - { - return name; - } - - @Override - public String toString() { - return "RegistryEvent.Register<"+getName()+">"; - } - } - - public static class MissingMappings> extends RegistryEvent - { - private final IForgeRegistry registry; - private final ResourceLocation name; - private final ImmutableList> mappings; - private ModContainer activeMod; - - public MissingMappings(ResourceLocation name, IForgeRegistry registry, Collection> missed) - { - super(registry.getRegistrySuperType()); - this.registry = registry; - this.name = name; - this.mappings = ImmutableList.copyOf(missed); - } - - public void setModContainer(ModContainer mod) - { - this.activeMod = mod; - } - - public ResourceLocation getName() - { - return this.name; - } - - public IForgeRegistry getRegistry() - { - return this.registry; - } - - /* - * This used to be fired on the Mod specific bus, and we could tell which mod was asking for mappings. - * It no longer is, so this method is useless and just returns getAllMappings. - * TODO: Ask cpw how if he wants to re-enable the ModBus rethrow. - */ - @Deprecated - public ImmutableList> getMappings() - { - return this.activeMod == null ? getAllMappings() : getMappings(this.activeMod.getModId()); - } - - public ImmutableList> getMappings(String modid) - { - return ImmutableList.copyOf(this.mappings.stream().filter(e -> e.key.getNamespace().equals(modid)).collect(Collectors.toList())); - } - - public ImmutableList> getAllMappings() - { - return this.mappings; - } - - /** - * Actions you can take with this missing mapping. - *

    - *
  • {@link #IGNORE} means this missing mapping will be ignored. - *
  • {@link #WARN} means this missing mapping will generate a warning. - *
  • {@link #FAIL} means this missing mapping will prevent the world from loading. - *
- */ - public enum Action - { - /** - * Take the default action - */ - DEFAULT, - /** - * Ignore this missing mapping. This means the mapping will be abandoned - */ - IGNORE, - /** - * Generate a warning but allow loading to continue - */ - WARN, - /** - * Fail to load - */ - FAIL, - /** - * Remap this name to a new name (add a migration mapping) - */ - REMAP - } - - public static class Mapping> implements Comparable> - { - public final IForgeRegistry registry; - private final IForgeRegistry pool; - public final ResourceLocation key; - public final int id; - private Action action = Action.DEFAULT; - private T target; - - public Mapping(IForgeRegistry registry, IForgeRegistry pool, ResourceLocation key, int id) - { - this.registry = registry; - this.pool = pool; - this.key = key; - this.id = id; - } - - /** - * Ignore the missing item. - */ - public void ignore() - { - action = Action.IGNORE; - } - - /** - * Warn the user about the missing item. - */ - public void warn() - { - action = Action.WARN; - } - - /** - * Prevent the world from loading due to the missing item. - */ - public void fail() - { - action = Action.FAIL; - } - - /** - * Remap the missing entry to the specified object. - * - * Use this if you have renamed an entry. - * Existing references using the old name will point to the new one. - * - * @param target Entry to remap to. - */ - public void remap(T target) - { - Validate.notNull(target, "Remap target can not be null"); - Validate.isTrue(pool.getKey(target) != null, String.format(Locale.ENGLISH, "The specified entry %s hasn't been registered in registry yet.", target)); - action = Action.REMAP; - this.target = target; - } - - // internal - public Action getAction() - { - return this.action; - } - - public T getTarget() - { - return target; - } - - @Override - public int compareTo(Mapping o) - { - int ret = this.registry.getRegistryName().compareNamespaced(o.registry.getRegistryName()); - if (ret ==0) ret = this.key.compareNamespaced(o.key); - return ret; - } - } - } - - /** - * Called whenever the ID mapping might have changed. If you register for this event, you - * will be called back whenever the client or server loads an ID set. This includes both - * when the ID maps are loaded from disk, as well as when the ID maps revert to the initial - * state. - * - * Note: you cannot change the IDs that have been allocated, but you might want to use - * this event to update caches or other in-mod artifacts that might be impacted by an ID - * change. - * - * Fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS} - */ - public static class IdMappingEvent extends Event - { - public static class ModRemapping - { - public final ResourceLocation registry; - public final ResourceLocation key; - public final int oldId; - public final int newId; - - private ModRemapping(ResourceLocation registry, ResourceLocation key, int oldId, int newId) - { - this.registry = registry; - this.key = key; - this.oldId = oldId; - this.newId = newId; - } - } - - private final Map> remaps; - private final ImmutableSet keys; - - public final boolean isFrozen; - public IdMappingEvent(Map> remaps, boolean isFrozen) - { - this.isFrozen = isFrozen; - this.remaps = Maps.newHashMap(); - remaps.forEach((name, rm) -> - { - List tmp = Lists.newArrayList(); - rm.forEach((key, value) -> tmp.add(new ModRemapping(name, key, value[0], value[1]))); - tmp.sort(Comparator.comparingInt(o -> o.newId)); - this.remaps.put(name, ImmutableList.copyOf(tmp)); - }); - this.keys = ImmutableSet.copyOf(this.remaps.keySet()); - } - - public ImmutableSet getRegistries() - { - return this.keys; - } - - public ImmutableList getRemaps(ResourceLocation registry) - { - return this.remaps.get(registry); - } - } -} diff --git a/src/main/java/net/minecraftforge/event/ServerChatEvent.java b/src/main/java/net/minecraftforge/event/ServerChatEvent.java index b0592a2c793..d82510f5f90 100644 --- a/src/main/java/net/minecraftforge/event/ServerChatEvent.java +++ b/src/main/java/net/minecraftforge/event/ServerChatEvent.java @@ -5,6 +5,7 @@ package net.minecraftforge.event; +import net.minecraft.network.chat.MessageSignature; import net.minecraft.network.protocol.game.ServerboundChatPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.network.chat.Component; @@ -13,15 +14,17 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; +import javax.annotation.Nullable; + /** * ServerChatEvent is fired whenever a C01PacketChatMessage is processed.
- * This event is fired via {@link ForgeHooks#onServerChatEvent(ServerGamePacketListenerImpl, String, Component)}, + * This event is fired via {@link ForgeHooks#onServerChatEvent(ServerPlayer, String, Component)}, * which is executed by the {@link ServerGamePacketListenerImpl#handleChat(ServerboundChatPacket)}
*
- * {@link #username} contains the username of the player sending the chat message.
+ * {@link #username} contains the username of the player sending the chat message, unless fired from the server, where it is null.
* {@link #message} contains the message being sent.
- * {@link #player} the instance of EntityPlayerMP for the player sending the chat message.
- * {@link #component} contains the instance of ChatComponentTranslation for the sent message.
+ * {@link #player} the instance of ServerPlayer for the player sending the chat message, or null when fired from the server.
+ * {@link #component} contains the instance of Component for the sent message.
*
* This event is {@link Cancelable}.
* If this event is canceled, the chat message is never distributed to all clients.
@@ -33,15 +36,16 @@ @Cancelable public class ServerChatEvent extends net.minecraftforge.eventbus.api.Event { - private final String message, username; - private final ServerPlayer player; + private final String message; + private final @Nullable String username; + private final @Nullable ServerPlayer player; private Component component; - public ServerChatEvent(ServerPlayer player, String message, Component component) + public ServerChatEvent(@Nullable ServerPlayer player, String message, Component component) { super(); this.message = message; this.player = player; - this.username = player.getGameProfile().getName(); + this.username = player != null ? player.getGameProfile().getName() : null; this.component = component; } @@ -56,6 +60,6 @@ public Component getComponent() } public String getMessage() { return this.message; } - public String getUsername() { return this.username; } - public ServerPlayer getPlayer() { return this.player; } + public @Nullable String getUsername() { return this.username; } + public @Nullable ServerPlayer getPlayer() { return this.player; } } diff --git a/src/main/java/net/minecraftforge/event/TickEvent.java b/src/main/java/net/minecraftforge/event/TickEvent.java index e9d182d3138..537e2e0d606 100644 --- a/src/main/java/net/minecraftforge/event/TickEvent.java +++ b/src/main/java/net/minecraftforge/event/TickEvent.java @@ -34,20 +34,8 @@ public TickEvent(Type type, LogicalSide side, Phase phase) } public static class ServerTickEvent extends TickEvent { - private final BooleanSupplier haveTime; - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link ServerTickEvent#ServerTickEvent(Phase, BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public ServerTickEvent(Phase phase) - { - this(phase, () -> false); - } - public ServerTickEvent(Phase phase, BooleanSupplier haveTime) { super(Type.SERVER, LogicalSide.SERVER, phase); @@ -76,17 +64,6 @@ public static class WorldTickEvent extends TickEvent { public final Level world; private final BooleanSupplier haveTime; - /** - * TODO: Remove in 1.19 - * - * @deprecated Use {@link WorldTickEvent#WorldTickEvent(LogicalSide, Phase, Level, BooleanSupplier)} - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public WorldTickEvent(LogicalSide side, Phase phase, Level world) - { - this(side, phase, world, () -> false); - } - public WorldTickEvent(LogicalSide side, Phase phase, Level world, BooleanSupplier haveTime) { super(Type.WORLD, side, phase); @@ -98,7 +75,7 @@ public WorldTickEvent(LogicalSide side, Phase phase, Level world, BooleanSupplie * @return {@code true} whether the server has enough time to perform any * additional tasks (usually IO related) during the current tick, * otherwise {@code false} - * + * * @see ServerTickEvent#haveTime() */ public boolean haveTime() diff --git a/src/main/java/net/minecraftforge/event/VanillaGameEvent.java b/src/main/java/net/minecraftforge/event/VanillaGameEvent.java index 863bf52bd10..904c127151c 100644 --- a/src/main/java/net/minecraftforge/event/VanillaGameEvent.java +++ b/src/main/java/net/minecraftforge/event/VanillaGameEvent.java @@ -5,14 +5,14 @@ package net.minecraftforge.event; -import javax.annotation.Nullable; -import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import org.jetbrains.annotations.Nullable; /** * VanillaGameEvent is fired on the server whenever one of Vanilla's {@link GameEvent GameEvents} fire.
@@ -27,17 +27,16 @@ public class VanillaGameEvent extends Event { private final Level level; - @Nullable - private final Entity cause; private final GameEvent vanillaEvent; - private final BlockPos position; + private final Vec3 position; + private final GameEvent.Context context; - public VanillaGameEvent(Level level, @Nullable Entity cause, GameEvent vanillaEvent, BlockPos position) + public VanillaGameEvent(Level level, GameEvent vanillaEvent, Vec3 position, GameEvent.Context context) { this.level = level; - this.cause = cause; this.vanillaEvent = vanillaEvent; this.position = position; + this.context = context; } /** @@ -54,7 +53,7 @@ public Level getLevel() @Nullable public Entity getCause() { - return cause; + return context.sourceEntity(); } /** @@ -66,10 +65,18 @@ public GameEvent getVanillaEvent() } /** - * @return The position the event took place at. This may be a block or the block position of the entity targeted. + * @return The position the event took place at. */ - public BlockPos getEventPosition() + public Vec3 getEventPosition() { return position; } + + /** + * @return the context of the vanilla event + */ + public GameEvent.Context getContext() + { + return context; + } } diff --git a/src/main/java/net/minecraftforge/event/brewing/PlayerBrewedPotionEvent.java b/src/main/java/net/minecraftforge/event/brewing/PlayerBrewedPotionEvent.java index 6cece27d915..aa28d06578e 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PlayerBrewedPotionEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PlayerBrewedPotionEvent.java @@ -8,8 +8,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerEvent; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This event is called when a player picks up a potion from a brewing stand. @@ -18,7 +17,7 @@ public class PlayerBrewedPotionEvent extends PlayerEvent { private final ItemStack stack; - public PlayerBrewedPotionEvent(Player player, @Nonnull ItemStack stack) + public PlayerBrewedPotionEvent(Player player, @NotNull ItemStack stack) { super(player); this.stack = stack; @@ -27,7 +26,7 @@ public PlayerBrewedPotionEvent(Player player, @Nonnull ItemStack stack) /** * The ItemStack of the potion. */ - @Nonnull + @NotNull public ItemStack getStack() { return stack; diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java index 9257475be89..5aa40951b42 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java @@ -10,8 +10,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class PotionBrewEvent extends Event { @@ -22,14 +21,14 @@ protected PotionBrewEvent(NonNullList stacks) this.stacks = stacks; } - @Nonnull + @NotNull public ItemStack getItem(int index) { if (index < 0 || index >= stacks.size()) return ItemStack.EMPTY; return stacks.get(index); } - public void setItem(int index, @Nonnull ItemStack stack) + public void setItem(int index, @NotNull ItemStack stack) { if (index < stacks.size()) { diff --git a/src/main/java/net/minecraftforge/event/enchanting/EnchantmentLevelSetEvent.java b/src/main/java/net/minecraftforge/event/enchanting/EnchantmentLevelSetEvent.java index b92cb6832b7..4ee598865e4 100644 --- a/src/main/java/net/minecraftforge/event/enchanting/EnchantmentLevelSetEvent.java +++ b/src/main/java/net/minecraftforge/event/enchanting/EnchantmentLevelSetEvent.java @@ -8,8 +8,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Fired when the enchantment level is set for each of the three potential enchantments in the enchanting table. @@ -25,12 +24,12 @@ public class EnchantmentLevelSetEvent extends net.minecraftforge.eventbus.api.Ev private final BlockPos pos; private final int enchantRow; private final int power; - @Nonnull + @NotNull private final ItemStack itemStack; private final int originalLevel; private int level; - public EnchantmentLevelSetEvent(Level world, BlockPos pos, int enchantRow, int power, @Nonnull ItemStack itemStack, int level) + public EnchantmentLevelSetEvent(Level world, BlockPos pos, int enchantRow, int power, @NotNull ItemStack itemStack, int level) { this.world = world; this.pos = pos; @@ -43,7 +42,7 @@ public EnchantmentLevelSetEvent(Level world, BlockPos pos, int enchantRow, int p /** * Get the world object - * + * * @return the world object */ public Level getWorld() @@ -53,7 +52,7 @@ public Level getWorld() /** * Get the pos of the enchantment table - * + * * @return the pos of the enchantment table */ public BlockPos getPos() @@ -63,7 +62,7 @@ public BlockPos getPos() /** * Get the row for which the enchantment level is being set - * + * * @return the row for which the enchantment level is being set */ public int getEnchantRow() @@ -73,7 +72,7 @@ public int getEnchantRow() /** * Get the power (# of bookshelves) for the enchanting table - * + * * @return the power (# of bookshelves) for the enchanting table */ public int getPower() @@ -83,10 +82,10 @@ public int getPower() /** * Get the item being enchanted - * + * * @return the item being enchanted */ - @Nonnull + @NotNull public ItemStack getItem() { return itemStack; @@ -94,7 +93,7 @@ public ItemStack getItem() /** * Get the original level of the enchantment for this row (0-30) - * + * * @return the original level of the enchantment for this row (0-30) */ public int getOriginalLevel() @@ -104,7 +103,7 @@ public int getOriginalLevel() /** * Get the level of the enchantment for this row (0-30) - * + * * @return the level of the enchantment for this row (0-30) */ public int getLevel() @@ -114,7 +113,7 @@ public int getLevel() /** * Set the new level of the enchantment (0-30) - * + * * @param level the new level of the enchantment (0-30) */ public void setLevel(int level) diff --git a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java index 606dea2aeaa..2ad74ec92ad 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java @@ -54,38 +54,6 @@ public EntityConstructing(Entity entity) } } - /** - * CanUpdate is fired when an Entity is being created.
- * This event is fired whenever vanilla Minecraft determines that an entity
- * cannot update in {@code World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean)}
- *
- * {@link CanUpdate#canUpdate} contains the boolean value of whether this entity can update.
- * If the modder decides that this Entity can be updated, they may change canUpdate to true,
- * and the entity with then be updated.
- *
- * This event is not {@link Cancelable}.
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ - public static class CanUpdate extends EntityEvent - { - private boolean canUpdate = false; - public CanUpdate(Entity entity) - { - super(entity); - } - - public boolean getCanUpdate() - { - return canUpdate; - } - - public void setCanUpdate(boolean canUpdate) - { - this.canUpdate = canUpdate; - } - } - /** * This event is fired on server and client after an Entity has entered a different section.
* Sections are 16x16x16 block grids of the world.
diff --git a/src/main/java/net/minecraftforge/event/entity/EntityLeaveWorldEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityLeaveWorldEvent.java index 064dd97a2a8..878fe5d84a7 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityLeaveWorldEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityLeaveWorldEvent.java @@ -15,7 +15,7 @@ /** * EntityLeaveWorldEvent is fired when an Entity leaves the world.
* This event is fired whenever an Entity is removed from the world in - * {@link ClientLevel#removeEntity(int, Entity.RemovalReason)}, {@link ServerLevel#removeEntityComplete(Entity, boolean)}.
+ * {@link ClientLevel#removeEntity(int, Entity.RemovalReason)}.
*
* {@link #world} contains the world from which the entity is removed.
*
diff --git a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java deleted file mode 100644 index efb32c78ee9..00000000000 --- a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.entity; - -import net.minecraft.client.player.LocalPlayer; -import net.minecraft.world.entity.Entity; -import net.minecraft.sounds.SoundSource; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; - -/** - * PlaySoundAtEntityEvent is fired a sound is to be played at an Entity
- * This event is fired whenever a sound is set to be played at an Entity such as in - * {@link LocalPlayer#playSound(SoundEvent, float, float)} and - * {@link Level#playSound(Player, double, double, double, SoundEvent, SoundSource, float, float)}.
- *
- * {@link #name} contains the name of the sound to be played at the Entity.
- * {@link #volume} contains the volume at which the sound is to be played originally.
- * {@link #pitch} contains the pitch at which the sound is to be played originally.
- * {@link #newVolume} contains the volume at which the sound is actually played.
- * {@link #newPitch} contains the pitch at which the sound is actually played.
- * Changing the {@link #name} field will cause the sound of this name to be played instead of the originally intended sound.
- *
- * This event is {@link Cancelable}.
- * If this event is canceled, the sound is not played.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ -@net.minecraftforge.eventbus.api.Cancelable -public class PlaySoundAtEntityEvent extends EntityEvent -{ - private SoundEvent name; - private SoundSource category; - private final float volume; - private final float pitch; - private float newVolume; - private float newPitch; - - public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) - { - super(entity); - this.name = name; - this.category = category; - this.volume = volume; - this.pitch = pitch; - this.newVolume = volume; - this.newPitch = pitch; - } - - public SoundEvent getSound() { return this.name; } - public SoundSource getCategory() { return this.category; } - public float getDefaultVolume() { return this.volume; } - public float getDefaultPitch() { return this.pitch; } - public float getVolume() { return this.newVolume; } - public float getPitch() { return this.newPitch; } - public void setSound(SoundEvent value) { this.name = value; } - public void setCategory(SoundSource category) { this.category = category; } - public void setVolume(float value) { this.newVolume = value; } - public void setPitch(float value) { this.newPitch = value; } -} diff --git a/src/main/java/net/minecraftforge/event/entity/living/BabyEntitySpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/living/BabyEntitySpawnEvent.java index 8bd563de62a..d34ef1245a2 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/BabyEntitySpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/BabyEntitySpawnEvent.java @@ -13,7 +13,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * BabyEntitySpawnEvent is fired just before a baby entity is about to be spawned.
diff --git a/src/main/java/net/minecraftforge/event/entity/living/EnderManAngerEvent.java b/src/main/java/net/minecraftforge/event/entity/living/EnderManAngerEvent.java index 05a4b9230f0..7b296dc8219 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/EnderManAngerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/EnderManAngerEvent.java @@ -7,6 +7,7 @@ import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Player; +import net.minecraftforge.common.extensions.IForgeItem; import net.minecraftforge.eventbus.api.Cancelable; /** diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java index cb07abeede3..5a1fe9dd80d 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEntityUseItemEvent.java @@ -8,22 +8,21 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class LivingEntityUseItemEvent extends LivingEvent { private final ItemStack item; private int duration; - private LivingEntityUseItemEvent(LivingEntity entity, @Nonnull ItemStack item, int duration) + private LivingEntityUseItemEvent(LivingEntity entity, @NotNull ItemStack item, int duration) { super(entity); this.item = item; this.setDuration(duration); } - @Nonnull + @NotNull public ItemStack getItem() { return item; @@ -53,7 +52,7 @@ public void setDuration(int duration) @Cancelable public static class Start extends LivingEntityUseItemEvent { - public Start(LivingEntity entity, @Nonnull ItemStack item, int duration) + public Start(LivingEntity entity, @NotNull ItemStack item, int duration) { super(entity, item, duration); } @@ -68,7 +67,7 @@ public Start(LivingEntity entity, @Nonnull ItemStack item, int duration) @Cancelable public static class Tick extends LivingEntityUseItemEvent { - public Tick(LivingEntity entity, @Nonnull ItemStack item, int duration) + public Tick(LivingEntity entity, @NotNull ItemStack item, int duration) { super(entity, item, duration); } @@ -89,7 +88,7 @@ public Tick(LivingEntity entity, @Nonnull ItemStack item, int duration) @Cancelable public static class Stop extends LivingEntityUseItemEvent { - public Stop(LivingEntity entity, @Nonnull ItemStack item, int duration) + public Stop(LivingEntity entity, @NotNull ItemStack item, int duration) { super(entity, item, duration); } @@ -99,7 +98,7 @@ public Stop(LivingEntity entity, @Nonnull ItemStack item, int duration) * Fired after an item has fully finished being used. * The item has been notified that it was used, and the item/result stacks reflect after that state. * This means that when this is fired for a Potion, the potion effect has already been applied. - * + * * {@link LivingEntityUseItemEvent#item} is a copy of the item BEFORE it was used. * * If you wish to cancel those effects, you should cancel one of the above events. @@ -110,19 +109,19 @@ public Stop(LivingEntity entity, @Nonnull ItemStack item, int duration) public static class Finish extends LivingEntityUseItemEvent { private ItemStack result; - public Finish(LivingEntity entity, @Nonnull ItemStack item, int duration, @Nonnull ItemStack result) + public Finish(LivingEntity entity, @NotNull ItemStack item, int duration, @NotNull ItemStack result) { super(entity, item, duration); this.setResultStack(result); } - @Nonnull + @NotNull public ItemStack getResultStack() { return result; } - public void setResultStack(@Nonnull ItemStack result) + public void setResultStack(@NotNull ItemStack result) { this.result = result; } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEquipmentChangeEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEquipmentChangeEvent.java index ab5591e3448..e75d4c09e00 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEquipmentChangeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEquipmentChangeEvent.java @@ -10,8 +10,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * {@link LivingEquipmentChangeEvent} is fired when the Equipment of a Entity changes.
@@ -35,7 +34,7 @@ public class LivingEquipmentChangeEvent extends LivingEvent private final ItemStack from; private final ItemStack to; - public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlot slot, @Nonnull ItemStack from, @Nonnull ItemStack to) + public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlot slot, @NotNull ItemStack from, @NotNull ItemStack to) { super(entity); this.slot = slot; @@ -44,8 +43,8 @@ public LivingEquipmentChangeEvent(LivingEntity entity, EquipmentSlot slot, @Nonn } public EquipmentSlot getSlot() { return this.slot; } - @Nonnull + @NotNull public ItemStack getFrom() { return this.from; } - @Nonnull + @NotNull public ItemStack getTo() { return this.to; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java index 47491f6d64e..083c5db758a 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java @@ -12,8 +12,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.eventbus.api.Event; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * LivingEvent is fired whenever an event involving Living entities occurs.
diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java index 47abc28e36f..0e6acc16f12 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingExperienceDropEvent.java @@ -8,8 +8,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Event for when an entity drops experience on its death, can be used to change 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 89f8d821d48..032af302ace 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java @@ -5,18 +5,16 @@ package net.minecraftforge.event.entity.living; -import javax.annotation.Nullable; - import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.Level; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; -import net.minecraftforge.eventbus.api.Event.HasResult; +import net.minecraftforge.eventbus.api.Cancelable; +import org.jetbrains.annotations.Nullable; /** * LivingSpawnEvent is fired for any events associated with Living Entities spawn status.
@@ -106,29 +104,20 @@ public MobSpawnType getSpawnReason() *
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(Mob, LevelAccessor, float, float, float, BaseSpawner, MobSpawnType)}.
*
- * This event is {@link net.minecraftforge.eventbus.api.Cancelable}.
+ * This event is {@link Cancelable}.
* If this event is canceled, the Entity is not spawned.
*
* This event does not have a result. {@link HasResult}
*
* This event is fired on the {@link MinecraftForge#EVENT_BUS}. **/ - @net.minecraftforge.eventbus.api.Cancelable + @Cancelable public static class SpecialSpawn extends LivingSpawnEvent { @Nullable private final BaseSpawner spawner; private final MobSpawnType spawnReason; - /** - * @param spawner the position of a tileentity or approximate position of an entity that initiated the spawn if any - */ - @Deprecated(forRemoval = true, since = "1.18.1") - public SpecialSpawn(Mob entity, Level world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason) - { - this(entity, (LevelAccessor)world, x, y, z, spawner, spawnReason); - } - public SpecialSpawn(Mob entity, LevelAccessor world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason) { super(entity, world, x, y, z); diff --git a/src/main/java/net/minecraftforge/event/entity/living/LootingLevelEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LootingLevelEvent.java index 43e405e617c..3c9b2cd921f 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LootingLevelEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LootingLevelEvent.java @@ -7,9 +7,8 @@ import net.minecraft.world.entity.LivingEntity; -import javax.annotation.Nullable; - import net.minecraft.world.damagesource.DamageSource; +import org.jetbrains.annotations.Nullable; public class LootingLevelEvent extends LivingEvent { diff --git a/src/main/java/net/minecraftforge/event/entity/living/PotionEvent.java b/src/main/java/net/minecraftforge/event/entity/living/PotionEvent.java index 3e8ac34a497..557f0535ac3 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/PotionEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/PotionEvent.java @@ -11,9 +11,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * This Event and its subevents gets fired from {@link LivingEntity} on the {@link MinecraftForge#EVENT_BUS}.
@@ -22,7 +21,7 @@ public class PotionEvent extends LivingEvent { @Nullable protected final MobEffectInstance effect; - + public PotionEvent(LivingEntity living, MobEffectInstance effect) { super(living); @@ -36,7 +35,7 @@ public MobEffectInstance getPotionEffect() { return effect; } - + /** * This Event is fired when a Potion is about to get removed from an Entity. * This Event is {@link Cancelable}. @@ -46,19 +45,19 @@ public MobEffectInstance getPotionEffect() public static class PotionRemoveEvent extends PotionEvent { private final MobEffect potion; - + public PotionRemoveEvent(LivingEntity living, MobEffect potion) { super(living, living.getEffect(potion)); this.potion = potion; } - + public PotionRemoveEvent(LivingEntity living, MobEffectInstance effect) { super(living, effect); - this.potion = effect.getEffect(); + this.potion = effect.getEffect(); } - + /** * @return the Potion which is tried to remove from the Entity. */ @@ -66,7 +65,7 @@ public MobEffect getPotion() { return this.potion; } - + /** * @return the PotionEffect. In the remove event this can be null if the Entity does not have a {@link MobEffect} of the right type active. */ @@ -77,7 +76,7 @@ public MobEffectInstance getPotionEffect() return super.getPotionEffect(); } } - + /** * This Event is fired to check if a Potion can get applied to an Entity. * This Event is not {@link Cancelable} @@ -93,18 +92,18 @@ public PotionApplicableEvent(LivingEntity living, MobEffectInstance effect) { super(living, effect); } - + /** * @return the PotionEffect. */ @Override - @Nonnull + @NotNull public MobEffectInstance getPotionEffect() { return super.getPotionEffect(); } } - + /** * This Event is fired when a new Potion is added to the Entity. This is also fired if the Entity already has this effect but with different duration/level. * This Event is not {@link Cancelable} @@ -121,17 +120,17 @@ public PotionAddedEvent(LivingEntity living, MobEffectInstance oldEffect, MobEff this.oldEffect = oldEffect; this.source = source; } - + /** * @return the added PotionEffect. This is the umerged PotionEffect if the old PotionEffect is not null. */ @Override - @Nonnull + @NotNull public MobEffectInstance getPotionEffect() { return super.getPotionEffect(); } - + /** * @return the old PotionEffect. THis can be null if the entity did not have an effect of this kind before. */ @@ -152,7 +151,7 @@ public Entity getPotionSource() return source; } } - + /** * This Event is fired when a Potion effect expires on an Entity. * This Event is not {@link Cancelable} @@ -165,4 +164,4 @@ public PotionExpiryEvent(LivingEntity living, MobEffectInstance effect) super(living, effect); } } -} +} diff --git a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java index 78e71cb6a08..9649fb50b0f 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AnvilRepairEvent.java @@ -7,8 +7,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Fired when the player removes a "repaired" item from the Anvil's Output slot. @@ -19,15 +18,15 @@ */ public class AnvilRepairEvent extends PlayerEvent { - @Nonnull + @NotNull private final ItemStack left; // The left side of the input - @Nonnull + @NotNull private final ItemStack right; // The right side of the input - @Nonnull + @NotNull private final ItemStack output; // Set this to set the output stack private float breakChance; // Anvil's chance to break (reduced by 1 durability) when this is complete. Default is 12% (0.12f) - public AnvilRepairEvent(Player player, @Nonnull ItemStack left, @Nonnull ItemStack right, @Nonnull ItemStack output) + public AnvilRepairEvent(Player player, @NotNull ItemStack left, @NotNull ItemStack right, @NotNull ItemStack output) { super(player); this.output = output; @@ -40,21 +39,21 @@ public AnvilRepairEvent(Player player, @Nonnull ItemStack left, @Nonnull ItemSta * Get the output result from the anvil * @return the output */ - @Nonnull + @NotNull public ItemStack getItemResult() { return output; } /** * Get the first item input into the anvil * @return the first input slot */ - @Nonnull + @NotNull public ItemStack getItemInput() { return left; } /** * Get the second item input into the anvil * @return the second input slot */ - @Nonnull + @NotNull public ItemStack getIngredientInput() { return right; } public float getBreakChance() { return breakChance; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java index a59ccb5e4b1..f51cb641cfb 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java @@ -12,8 +12,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * ArrowLooseEvent is fired when a player stops using a bow.
@@ -38,7 +37,7 @@ public class ArrowLooseEvent extends PlayerEvent private final boolean hasAmmo; private int charge; - public ArrowLooseEvent(Player player, @Nonnull ItemStack bow, Level world, int charge, boolean hasAmmo) + public ArrowLooseEvent(Player player, @NotNull ItemStack bow, Level world, int charge, boolean hasAmmo) { super(player); this.bow = bow; @@ -47,7 +46,7 @@ public ArrowLooseEvent(Player player, @Nonnull ItemStack bow, Level world, int c this.hasAmmo = hasAmmo; } - @Nonnull + @NotNull public ItemStack getBow() { return this.bow; } public Level getWorld() { return this.world; } public boolean hasAmmo() { return this.hasAmmo; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java index bd04dd57cae..85b1b066250 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java @@ -12,8 +12,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.level.Level; import net.minecraftforge.common.MinecraftForge; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * ArrowNockEvent is fired when a player begins using a bow.
@@ -30,7 +29,7 @@ public class ArrowNockEvent extends PlayerEvent private final boolean hasAmmo; private InteractionResultHolder action; - public ArrowNockEvent(Player player, @Nonnull ItemStack item, InteractionHand hand, Level world, boolean hasAmmo) + public ArrowNockEvent(Player player, @NotNull ItemStack item, InteractionHand hand, Level world, boolean hasAmmo) { super(player); this.bow = item; @@ -39,7 +38,7 @@ public ArrowNockEvent(Player player, @Nonnull ItemStack item, InteractionHand ha this.hasAmmo = hasAmmo; } - @Nonnull + @NotNull public ItemStack getBow() { return this.bow; } public Level getWorld() { return this.world; } public InteractionHand getHand() { return this.hand; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index bd0ce8ddbc5..009f094cb88 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -11,8 +11,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This event is called when a player attempts to use Bonemeal on a block. @@ -33,7 +32,7 @@ public class BonemealEvent extends PlayerEvent private final BlockState block; private final ItemStack stack; - public BonemealEvent(@Nonnull Player player, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState block, @Nonnull ItemStack stack) + public BonemealEvent(@NotNull Player player, @NotNull Level world, @NotNull BlockPos pos, @NotNull BlockState block, @NotNull ItemStack stack) { super(player); this.world = world; @@ -57,7 +56,7 @@ public BlockState getBlock() return block; } - @Nonnull + @NotNull public ItemStack getStack() { return stack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java index f38a976d4f2..6a00343dcfa 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java @@ -11,9 +11,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.HitResult; import net.minecraft.world.level.Level; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * This event is fired when a player attempts to use a Empty bucket, it @@ -36,7 +35,7 @@ public class FillBucketEvent extends PlayerEvent private ItemStack result; - public FillBucketEvent(Player player, @Nonnull ItemStack current, Level world, @Nullable HitResult target) + public FillBucketEvent(Player player, @NotNull ItemStack current, Level world, @Nullable HitResult target) { super(player); this.current = current; @@ -44,12 +43,12 @@ public FillBucketEvent(Player player, @Nonnull ItemStack current, Level world, @ this.target = target; } - @Nonnull + @NotNull public ItemStack getEmptyBucket() { return this.current; } public Level getWorld(){ return this.world; } @Nullable public HitResult getTarget() { return this.target; } - @Nonnull + @NotNull public ItemStack getFilledBucket() { return this.result; } - public void setFilledBucket(@Nonnull ItemStack bucket) { this.result = bucket; } + public void setFilledBucket(@NotNull ItemStack bucket) { this.result = bucket; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java index c0788cd4784..24941e942d4 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ItemTooltipEvent.java @@ -12,14 +12,13 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.Component; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ItemTooltipEvent extends PlayerEvent { private final TooltipFlag flags; - @Nonnull + @NotNull private final ItemStack itemStack; private final List toolTip; @@ -27,7 +26,7 @@ public class ItemTooltipEvent extends PlayerEvent * This event is fired in {@link ItemStack#getTooltipLines(Player, TooltipFlag)}, which in turn is called from it's respective GUIContainer. * Tooltips are also gathered with a null entityPlayer during startup by {@link Minecraft#createSearchTrees()}. */ - public ItemTooltipEvent(@Nonnull ItemStack itemStack, @Nullable Player entityPlayer, List list, TooltipFlag flags) + public ItemTooltipEvent(@NotNull ItemStack itemStack, @Nullable Player entityPlayer, List list, TooltipFlag flags) { super(entityPlayer); this.itemStack = itemStack; @@ -46,7 +45,7 @@ public TooltipFlag getFlags() /** * The {@link ItemStack} with the tooltip. */ - @Nonnull + @NotNull public ItemStack getItemStack() { return itemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index a8b7a3d7266..7446bfc24f2 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -21,16 +21,15 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * PlayerDestroyItemEvent is fired when a player destroys an item.
* This event is fired whenever a player destroys an item in * {@link MultiPlayerGameMode#destroyBlock(BlockPos)}, - * {@link MultiPlayerGameMode#useItem(Player, Level, InteractionHand)}, - * {@link MultiPlayerGameMode#useItemOn(LocalPlayer, ClientLevel, InteractionHand, BlockHitResult)} , + * {@link MultiPlayerGameMode#useItem(Player, InteractionHand)}, + * {@link MultiPlayerGameMode#useItemOn(LocalPlayer, InteractionHand, BlockHitResult)} , * {@link Player#attack(Entity)}, * {@code Player#hurtCurrentlyUsedShield(float)}, * {@link Player#interactOn(Entity, InteractionHand)}, @@ -51,18 +50,18 @@ **/ public class PlayerDestroyItemEvent extends PlayerEvent { - @Nonnull + @NotNull private final ItemStack original; @Nullable private final InteractionHand hand; // May be null if this player destroys the item by any use besides holding it. - public PlayerDestroyItemEvent(Player player, @Nonnull ItemStack original, @Nullable InteractionHand hand) + public PlayerDestroyItemEvent(Player player, @NotNull ItemStack original, @Nullable InteractionHand hand) { super(player); this.original = original; this.hand = hand; } - @Nonnull + @NotNull public ItemStack getOriginal() { return this.original; } @Nullable public InteractionHand getHand() { return this.hand; } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index 5f13f3a56e3..6634a21d40f 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -23,9 +23,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraftforge.event.entity.living.LivingEvent; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * PlayerEvent is fired whenever an event involving Living entities occurs.
@@ -144,7 +143,7 @@ public static class NameFormat extends PlayerEvent private final Component username; private Component displayname; - public NameFormat(Player player, Component username) + public NameFormat(Player player, Component username) { super(player); this.username = username; @@ -191,7 +190,7 @@ public TabListNameFormat(Player player) { super(player); } - + @Nullable public Component getDisplayName() { @@ -408,17 +407,17 @@ public ItemEntity getOriginalEntity() { } public static class ItemCraftedEvent extends PlayerEvent { - @Nonnull + @NotNull private final ItemStack crafting; private final Container craftMatrix; - public ItemCraftedEvent(Player player, @Nonnull ItemStack crafting, Container craftMatrix) + public ItemCraftedEvent(Player player, @NotNull ItemStack crafting, Container craftMatrix) { super(player); this.crafting = crafting; this.craftMatrix = craftMatrix; } - @Nonnull + @NotNull public ItemStack getCrafting() { return this.crafting; @@ -431,15 +430,15 @@ public Container getInventory() } public static class ItemSmeltedEvent extends PlayerEvent { - @Nonnull + @NotNull private final ItemStack smelting; - public ItemSmeltedEvent(Player player, @Nonnull ItemStack crafting) + public ItemSmeltedEvent(Player player, @NotNull ItemStack crafting) { super(player); this.smelting = crafting; } - @Nonnull + @NotNull public ItemStack getSmelting() { return this.smelting; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index a02eff50747..29f0e34df7c 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -25,13 +25,12 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static net.minecraftforge.eventbus.api.Event.Result.DEFAULT; import static net.minecraftforge.eventbus.api.Event.Result.DENY; import net.minecraftforge.fml.LogicalSide; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * PlayerInteractEvent is fired when a player interacts in some way. @@ -134,7 +133,7 @@ public Entity getTarget() * If result equals {@link InteractionResult#PASS}, we proceed to {@link RightClickItem}.
*
* There are various results to this event, see the getters below.
- * Note that handling things differently on the client vs server may cause desynchronizations! + * Note that handling things differently on the client vs server may cause desynchronizations! */ @Cancelable public static class RightClickBlock extends PlayerInteractEvent @@ -311,7 +310,7 @@ public LeftClickEmpty(Player player) /** * @return The hand involved in this interaction. Will never be null. */ - @Nonnull + @NotNull public InteractionHand getHand() { return hand; @@ -320,7 +319,7 @@ public InteractionHand getHand() /** * @return The itemstack involved in this interaction, {@code ItemStack.EMPTY} if the hand was empty. */ - @Nonnull + @NotNull public ItemStack getItemStack() { return getPlayer().getItemInHand(hand); @@ -333,7 +332,7 @@ public ItemStack getItemStack() * Will never be null. * @return The position involved in this interaction. */ - @Nonnull + @NotNull public BlockPos getPos() { return pos; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java index 6c768f40486..14177f77b6d 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSetSpawnEvent.java @@ -10,8 +10,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; import net.minecraftforge.eventbus.api.Cancelable; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * This event is fired when a player's spawn point is set or reset.
@@ -24,7 +23,7 @@ public class PlayerSetSpawnEvent extends PlayerEvent private final boolean forced; @Nullable private final BlockPos newSpawn; - + public PlayerSetSpawnEvent(Player player, ResourceKey spawnWorld, @Nullable BlockPos newSpawn, boolean forced) { super(player); diff --git a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java deleted file mode 100644 index 5cc8b5e5456..00000000000 --- a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.entity.player; - -import net.minecraft.world.item.context.UseOnContext; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event.HasResult; - -import javax.annotation.Nonnull; - -/** - * This event is fired when a player attempts to use a Hoe on a block, it - * can be canceled to completely prevent any further processing. - * - * You can also set the result to ALLOW to mark the event as processed - * and damage the hoe. - * - * setResult(ALLOW) is the same as the old setHandled(); - */ -@Cancelable -@HasResult -// TODO 1.19: Remove -@Deprecated(forRemoval = true, since = "1.18.2") -public class UseHoeEvent extends PlayerEvent -{ - private final UseOnContext context;; - - public UseHoeEvent(UseOnContext context) - { - super(context.getPlayer()); - this.context = context; - } - - @Nonnull - public UseOnContext getContext() - { - return context; - } -} diff --git a/src/main/java/net/minecraftforge/event/furnace/FurnaceFuelBurnTimeEvent.java b/src/main/java/net/minecraftforge/event/furnace/FurnaceFuelBurnTimeEvent.java index 4fe02baff29..673b905dd5d 100644 --- a/src/main/java/net/minecraftforge/event/furnace/FurnaceFuelBurnTimeEvent.java +++ b/src/main/java/net/minecraftforge/event/furnace/FurnaceFuelBurnTimeEvent.java @@ -5,9 +5,6 @@ package net.minecraftforge.event.furnace; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeType; @@ -15,6 +12,8 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * {@link FurnaceFuelBurnTimeEvent} is fired when determining the fuel value for an ItemStack.
@@ -32,13 +31,13 @@ @Cancelable public class FurnaceFuelBurnTimeEvent extends Event { - @Nonnull + @NotNull private final ItemStack itemStack; @Nullable private final RecipeType recipeType; private int burnTime; - public FurnaceFuelBurnTimeEvent(@Nonnull ItemStack itemStack, int burnTime, @Nullable RecipeType recipeType) + public FurnaceFuelBurnTimeEvent(@NotNull ItemStack itemStack, int burnTime, @Nullable RecipeType recipeType) { this.itemStack = itemStack; this.burnTime = burnTime; @@ -48,7 +47,7 @@ public FurnaceFuelBurnTimeEvent(@Nonnull ItemStack itemStack, int burnTime, @Nul /** * Get the ItemStack "fuel" in question. */ - @Nonnull + @NotNull public ItemStack getItemStack() { return itemStack; diff --git a/src/main/java/net/minecraftforge/event/world/BiomeLoadingEvent.java b/src/main/java/net/minecraftforge/event/world/BiomeLoadingEvent.java deleted file mode 100644 index 62bf6bd4764..00000000000 --- a/src/main/java/net/minecraftforge/event/world/BiomeLoadingEvent.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.world; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeSpecialEffects; -import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder; -import net.minecraftforge.common.world.MobSpawnSettingsBuilder; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.EventPriority; - -import javax.annotation.Nullable; - -/** - * This event fires when a Biome is created from json or when a registered biome is re-created for worldgen. - * It allows mods to edit a biome (like add a mob spawn) before it gets used for worldgen. - * - * In order to maintain the most compatibility possible with other mods' modifications to a biome, - * the event should be assigned a {@link net.minecraftforge.eventbus.api.EventPriority} as follows: - * - * - Additions to any list/map contained in a biome : {@link EventPriority#HIGH} - * - Removals to any list/map contained in a biome : {@link EventPriority#NORMAL} - * - Any other modification : {@link EventPriority#LOW} - * - * Be aware that another mod could have done an operation beforehand, so an expected value out of a vanilla biome might not - * always be the same, depending on other mods. - */ -public class BiomeLoadingEvent extends Event -{ - private final ResourceLocation name; - private Biome.ClimateSettings climate; - private Biome.BiomeCategory category; - private BiomeSpecialEffects effects; - private final BiomeGenerationSettingsBuilder gen; - private final MobSpawnSettingsBuilder spawns; - - public BiomeLoadingEvent(@Nullable final ResourceLocation name, final Biome.ClimateSettings climate, final Biome.BiomeCategory category, final BiomeSpecialEffects effects, final BiomeGenerationSettingsBuilder gen, final MobSpawnSettingsBuilder spawns) - { - this.name = name; - this.climate = climate; - this.category = category; - this.effects = effects; - this.gen = gen; - this.spawns = spawns; - } - - /** - * This will get the registry name of the biome. - * It generally SHOULD NOT be null, but due to vanilla's biome handling and codec weirdness, there may be cases where it is. - * Do check for this possibility! - */ - @Nullable - public ResourceLocation getName() - { - return name; - } - - public Biome.ClimateSettings getClimate() - { - return climate; - } - - public void setClimate(final Biome.ClimateSettings value) - { - this.climate = value; - } - - public Biome.BiomeCategory getCategory() - { - return category; - } - - public void setCategory(final Biome.BiomeCategory value) - { - this.category = value; - } - - public BiomeSpecialEffects getEffects() - { - return effects; - } - - public void setEffects(final BiomeSpecialEffects value) - { - this.effects = value; - } - - public BiomeGenerationSettingsBuilder getGeneration() - { - return gen; - } - - public MobSpawnSettingsBuilder getSpawns() - { - return spawns; - } -} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 36656b9fab4..79e9628a889 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -29,9 +29,8 @@ import net.minecraftforge.eventbus.api.Event; import com.google.common.collect.ImmutableList; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class BlockEvent extends Event { @@ -86,7 +85,7 @@ public BreakEvent(Level world, BlockPos pos, BlockState state, Player player) { int fortuneLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, player.getMainHandItem()); int silkTouchLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, player.getMainHandItem()); - this.exp = state.getExpDrop(world, pos, fortuneLevel, silkTouchLevel); + this.exp = state.getExpDrop(world, world.random, pos, fortuneLevel, silkTouchLevel); } } @@ -129,7 +128,7 @@ public static class EntityPlaceEvent extends BlockEvent private final BlockState placedBlock; private final BlockState placedAgainst; - public EntityPlaceEvent(@Nonnull BlockSnapshot blockSnapshot, @Nonnull BlockState placedAgainst, @Nullable Entity entity) + public EntityPlaceEvent(@NotNull BlockSnapshot blockSnapshot, @NotNull BlockState placedAgainst, @Nullable Entity entity) { super(blockSnapshot.getLevel(), blockSnapshot.getPos(), !(entity instanceof Player) ? blockSnapshot.getReplacedBlock() : blockSnapshot.getCurrentBlock()); this.entity = entity; @@ -162,7 +161,7 @@ public static class EntityMultiPlaceEvent extends EntityPlaceEvent { private final List blockSnapshots; - public EntityMultiPlaceEvent(@Nonnull List blockSnapshots, @Nonnull BlockState placedAgainst, @Nullable Entity entity) { + public EntityMultiPlaceEvent(@NotNull List blockSnapshots, @NotNull BlockState placedAgainst, @Nullable Entity entity) { super(blockSnapshots.get(0), placedAgainst, entity); this.blockSnapshots = ImmutableList.copyOf(blockSnapshots); if (DEBUG) @@ -421,56 +420,7 @@ public PortalShape getPortalSize() * For example: Used to determine if {@link ToolActions#AXE_STRIP an axe can strip}, * {@link ToolActions#SHOVEL_FLATTEN a shovel can path}, or {@link ToolActions#HOE_TILL a hoe can till}. *

- * This deprecated subclass event is only fired when {@link #isSimulated()} is false. - * To receive simulated events, use {@link BlockToolModificationEvent}. - *

- * This event is {@link Cancelable}. If canceled, this will prevent the tool - * from changing the block's state. - * - * @deprecated Use {@link BlockToolModificationEvent} and put world-modifying actions behind if (!event.isSimulated()). - */ - @Cancelable - @Deprecated(forRemoval = true, since = "1.18.2") - public static class BlockToolInteractEvent extends BlockToolModificationEvent - { - private final Player player; - private final ItemStack stack; - - public BlockToolInteractEvent(BlockState originalState, @Nonnull UseOnContext context, ToolAction toolAction) - { - super(originalState, context, toolAction, false); - this.player = context.getPlayer(); - this.stack = context.getItemInHand(); - } - - public BlockToolInteractEvent(LevelAccessor world, BlockPos pos, BlockState originalState, Player player, ItemStack stack, ToolAction toolAction) - { - super(world, pos, originalState, toolAction); - this.player = player; - this.stack = stack; - } - - /** - * @return the player using the tool, never null - */ - @Nonnull - public Player getPlayer() - { - return this.player; - } - - public ItemStack getHeldItemStack() - { - return this.stack; - } - } - - /** - * Fired when a block is right-clicked by a tool to change its state. - * For example: Used to determine if {@link ToolActions#AXE_STRIP an axe can strip}, - * {@link ToolActions#SHOVEL_FLATTEN a shovel can path}, or {@link ToolActions#HOE_TILL a hoe can till}. - *

- * Care must be taken to ensure world-modifying events are only performed if {@link #isSimulated()} returns {@code true}. + * Care must be taken to ensure world-modifying events are only performed if {@link #isSimulated()} returns {@code false}. *

* This event is {@link Cancelable}. If canceled, this will prevent the tool * from changing the block's state. @@ -482,7 +432,7 @@ public static class BlockToolModificationEvent extends BlockEvent private final boolean simulate; private BlockState state; - public BlockToolModificationEvent(BlockState originalState, @Nonnull UseOnContext context, ToolAction toolAction, boolean simulate) + public BlockToolModificationEvent(BlockState originalState, @NotNull UseOnContext context, ToolAction toolAction, boolean simulate) { super(context.getLevel(), context.getClickedPos(), originalState); this.context = context; @@ -491,16 +441,6 @@ public BlockToolModificationEvent(BlockState originalState, @Nonnull UseOnContex this.simulate = simulate; } - // TODO 1.19: Remove - BlockToolModificationEvent(LevelAccessor level, BlockPos pos, BlockState originalState, ToolAction toolAction) - { - super(level, pos, originalState); - this.context = null; - this.state = originalState; - this.toolAction = toolAction; - this.simulate = false; - } - /** * @return the player using the tool. * May be null based on what was provided by {@link #getContext() the use on context}. @@ -540,13 +480,11 @@ public boolean isSimulated() } /** - * Returns the nullable use on context that this event was performed in. - * Starting in 1.19, this will never be null. + * Returns the nonnull use on context that this event was performed in. * - * @return the nullable use on context that this event was performed in + * @return the nonnull use on context that this event was performed in */ - // TODO 1.19: Remove nullable annotation and add non-null annotation - @Nullable + @NotNull public UseOnContext getContext() { return context; diff --git a/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java index 893ecc349d7..7e6d28d3711 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java @@ -13,7 +13,6 @@ import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.storage.ChunkSerializer; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; diff --git a/src/main/java/net/minecraftforge/event/world/PistonEvent.java b/src/main/java/net/minecraftforge/event/world/PistonEvent.java index d9eaa56a5be..91664a11e50 100644 --- a/src/main/java/net/minecraftforge/event/world/PistonEvent.java +++ b/src/main/java/net/minecraftforge/event/world/PistonEvent.java @@ -5,13 +5,12 @@ package net.minecraftforge.event.world; -import javax.annotation.Nullable; - import net.minecraft.world.level.block.piston.PistonStructureResolver; import net.minecraft.core.Direction; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraftforge.eventbus.api.Cancelable; +import org.jetbrains.annotations.Nullable; /** * Base piston event, use {@link PistonEvent.Post} and {@link PistonEvent.Pre} diff --git a/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java index 7c260def346..9741cd51222 100644 --- a/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java @@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.SaplingBlock; import net.minecraft.world.level.block.state.BlockState; @@ -19,7 +20,7 @@ /** * SaplingGrowTreeEvent is fired when a sapling grows into a tree.
* This event is fired during sapling growth in - * {@link SaplingBlock#advanceTree(ServerLevel, BlockPos, BlockState, Random)} .
+ * {@link SaplingBlock#advanceTree(ServerLevel, BlockPos, BlockState, RandomSource)} .
*
* {@link #pos} contains the coordinates of the growing sapling.
* {@link #rand} contains an instance of Random for use.
@@ -35,9 +36,9 @@ public class SaplingGrowTreeEvent extends WorldEvent { private final BlockPos pos; - private final Random rand; + private final RandomSource rand; - public SaplingGrowTreeEvent(LevelAccessor world, Random rand, BlockPos pos) + public SaplingGrowTreeEvent(LevelAccessor world, RandomSource rand, BlockPos pos) { super(world); this.rand = rand; @@ -49,7 +50,7 @@ public BlockPos getPos() return pos; } - public Random getRand() + public RandomSource getRand() { return rand; } diff --git a/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java b/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java index 817b52e4484..067efe94bfb 100644 --- a/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java +++ b/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java @@ -11,10 +11,8 @@ import java.util.List; import java.util.Map; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.level.SpawnData; import net.minecraft.world.level.biome.MobSpawnSettings; -import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; -import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.EventPriority; @@ -34,13 +32,13 @@ public class StructureSpawnListGatherEvent extends Event { - private final StructureFeature structure; + private final Structure structure; private final Map> entitySpawns = new HashMap<>(); private final Map> entitySpawnsUnmodifiableLists = new HashMap<>(); private final Map> entitySpawnsUnmodifiable = Collections.unmodifiableMap(entitySpawnsUnmodifiableLists); private boolean insideOnly; - public StructureSpawnListGatherEvent(StructureFeature structure) + public StructureSpawnListGatherEvent(Structure structure) { this.structure = structure; this.insideOnly = false; @@ -57,7 +55,7 @@ public StructureSpawnListGatherEvent(StructureFeature structure) /** * @return Structure to add or remove spawns to/from. */ - public StructureFeature getStructure() + public Structure getStructure() { return structure; } diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index 4b5f7a60d75..afd47c01bab 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -50,7 +50,7 @@ public LevelAccessor getWorld() /** * WorldEvent.Load is fired when Minecraft loads a world.
* This event is fired when a world is loaded in - * {@link ClientLevel#ClientLevel(ClientPacketListener, ClientLevel.ClientLevelData, ResourceKey, DimensionType, int, int, Supplier, LevelRenderer, boolean, long)}, + * {@code ClientLevel#ClientLevel(ClientPacketListener, ClientLevel.ClientLevelData, ResourceKey, DimensionType, int, int, Supplier, LevelRenderer, boolean, long)}, * {@code MinecraftServer#createLevels(ChunkProgressListener)}.
*
* This event is not {@link Cancelable}.
diff --git a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java index de4ebaf4419..ff6b058b238 100644 --- a/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/DispenseFluidContainer.java @@ -5,8 +5,6 @@ package net.minecraftforge.fluids; -import javax.annotation.Nonnull; - import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.core.BlockSource; @@ -18,6 +16,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import org.jetbrains.annotations.NotNull; /** * Fills or drains a fluid container item using a Dispenser. @@ -36,8 +35,8 @@ private DispenseFluidContainer() {} private final DefaultDispenseItemBehavior dispenseBehavior = new DefaultDispenseItemBehavior(); @Override - @Nonnull - public ItemStack execute(@Nonnull BlockSource source, @Nonnull ItemStack stack) + @NotNull + public ItemStack execute(@NotNull BlockSource source, @NotNull ItemStack stack) { if (FluidUtil.getFluidContained(stack).isPresent()) { @@ -52,8 +51,8 @@ public ItemStack execute(@Nonnull BlockSource source, @Nonnull ItemStack stack) /** * Picks up fluid in front of a Dispenser and fills a container with it. */ - @Nonnull - private ItemStack fillContainer(@Nonnull BlockSource source, @Nonnull ItemStack stack) + @NotNull + private ItemStack fillContainer(@NotNull BlockSource source, @NotNull ItemStack stack) { Level level = source.getLevel(); Direction dispenserFacing = source.getBlockState().getValue(DispenserBlock.FACING); @@ -84,8 +83,8 @@ else if (((DispenserBlockEntity)source.getEntity()).addItem(resultStack) < 0) /** * Drains a filled container and places the fluid in front of the Dispenser. */ - @Nonnull - private ItemStack dumpContainer(BlockSource source, @Nonnull ItemStack stack) + @NotNull + private ItemStack dumpContainer(BlockSource source, @NotNull ItemStack stack) { ItemStack singleStack = stack.copy(); singleStack.setCount(1); diff --git a/src/main/java/net/minecraftforge/fluids/FluidActionResult.java b/src/main/java/net/minecraftforge/fluids/FluidActionResult.java index abfe93526bf..c2512912816 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidActionResult.java +++ b/src/main/java/net/minecraftforge/fluids/FluidActionResult.java @@ -5,9 +5,8 @@ package net.minecraftforge.fluids; -import javax.annotation.Nonnull; - import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; /** * Holds the result of a fluid action from {@link FluidUtil}. @@ -23,15 +22,15 @@ public class FluidActionResult public static final FluidActionResult FAILURE = new FluidActionResult(false, ItemStack.EMPTY); public final boolean success; - @Nonnull + @NotNull public final ItemStack result; - public FluidActionResult(@Nonnull ItemStack result) + public FluidActionResult(@NotNull ItemStack result) { this(true, result); } - private FluidActionResult(boolean success, @Nonnull ItemStack result) + private FluidActionResult(boolean success, @NotNull ItemStack result) { this.success = success; this.result = result; @@ -42,7 +41,7 @@ public boolean isSuccess() return success; } - @Nonnull + @NotNull public ItemStack getResult() { return result; diff --git a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java index 93c97781d27..92052360fd1 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidAttributes.java +++ b/src/main/java/net/minecraftforge/fluids/FluidAttributes.java @@ -5,8 +5,6 @@ package net.minecraftforge.fluids; -import javax.annotation.Nullable; - import net.minecraft.world.item.BucketItem; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.dimension.DimensionType; @@ -15,7 +13,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.level.BlockAndTintGetter; import java.util.function.BiFunction; @@ -33,6 +30,8 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.phys.BlockHitResult; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; /** * Minecraft Forge Fluid Implementation @@ -126,7 +125,7 @@ public class FluidAttributes protected FluidAttributes(Builder builder, Fluid fluid) { - this.translationKey = builder.translationKey != null ? builder.translationKey : Util.makeDescriptionId("fluid", fluid.getRegistryName()); + this.translationKey = builder.translationKey != null ? builder.translationKey : Util.makeDescriptionId("fluid", ForgeRegistries.FLUIDS.getKey(fluid)); this.stillTexture = builder.stillTexture; this.flowingTexture = builder.flowingTexture; this.overlayTexture = builder.overlayTexture; @@ -213,7 +212,7 @@ public void vaporize(@Nullable Player player, Level worldIn, BlockPos pos, Fluid */ public Component getDisplayName(FluidStack stack) { - return new TranslatableComponent(getTranslationKey()); + return Component.translatable(getTranslationKey()); } /** diff --git a/src/main/java/net/minecraftforge/fluids/FluidStack.java b/src/main/java/net/minecraftforge/fluids/FluidStack.java index 9a7da68b475..b72efd5b617 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -7,6 +7,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; import net.minecraft.nbt.Tag; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; @@ -17,12 +18,10 @@ import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IRegistryDelegate; - -import javax.annotation.Nonnull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -55,7 +54,7 @@ public class FluidStack private boolean isEmpty; private int amount; private CompoundTag tag; - private IRegistryDelegate fluidDelegate; + private Holder.Reference fluidDelegate; public FluidStack(Fluid fluid, int amount) { @@ -66,10 +65,10 @@ public FluidStack(Fluid fluid, int amount) } else if (ForgeRegistries.FLUIDS.getKey(fluid) == null) { - LOGGER.fatal("Failed attempt to create a FluidStack for an unregistered Fluid {} (type {})", fluid.getRegistryName(), fluid.getClass().getName()); + LOGGER.fatal("Failed attempt to create a FluidStack for an unregistered Fluid {} (type {})", ForgeRegistries.FLUIDS.getKey(fluid), fluid.getClass().getName()); throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid"); } - this.fluidDelegate = fluid.delegate; + this.fluidDelegate = ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid); this.amount = amount; updateEmpty(); @@ -122,7 +121,7 @@ public static FluidStack loadFluidStackFromNBT(CompoundTag nbt) public CompoundTag writeToNBT(CompoundTag nbt) { - nbt.putString("FluidName", getFluid().getRegistryName().toString()); + nbt.putString("FluidName", ForgeRegistries.FLUIDS.getKey(getFluid()).toString()); nbt.putInt("Amount", amount); if (tag != null) @@ -134,7 +133,7 @@ public CompoundTag writeToNBT(CompoundTag nbt) public void writeToPacket(FriendlyByteBuf buf) { - buf.writeRegistryId(getFluid()); + buf.writeRegistryId(ForgeRegistries.FLUIDS, getFluid()); buf.writeVarInt(getAmount()); buf.writeNbt(tag); } @@ -258,7 +257,7 @@ public FluidStack copy() * The FluidStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same */ - public boolean isFluidEqual(@Nonnull FluidStack other) + public boolean isFluidEqual(@NotNull FluidStack other) { return getFluid() == other.getFluid() && isFluidStackTagEqual(other); } @@ -271,7 +270,7 @@ private boolean isFluidStackTagEqual(FluidStack other) /** * Determines if the NBT Tags are equal. Useful if the FluidIDs are known to be equal. */ - public static boolean areFluidStackTagsEqual(@Nonnull FluidStack stack1, @Nonnull FluidStack stack2) + public static boolean areFluidStackTagsEqual(@NotNull FluidStack stack1, @NotNull FluidStack stack2) { return stack1.isFluidStackTagEqual(stack2); } @@ -281,7 +280,7 @@ public static boolean areFluidStackTagsEqual(@Nonnull FluidStack stack1, @Nonnul * * @return true if this FluidStack contains the other FluidStack (same fluid and >= amount) */ - public boolean containsFluid(@Nonnull FluidStack other) + public boolean containsFluid(@NotNull FluidStack other) { return isFluidEqual(other) && amount >= other.amount; } @@ -306,7 +305,7 @@ public boolean isFluidStackIdentical(FluidStack other) * The ItemStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same */ - public boolean isFluidEqual(@Nonnull ItemStack other) + public boolean isFluidEqual(@NotNull ItemStack other) { return FluidUtil.getFluidContained(other).map(this::isFluidEqual).orElse(false); } diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index b8d8b18212b..11492583e4d 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -5,9 +5,6 @@ package net.minecraftforge.fluids; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.base.Preconditions; import net.minecraft.world.item.BucketItem; import net.minecraft.world.level.block.Block; @@ -43,6 +40,8 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class FluidUtil { @@ -63,7 +62,7 @@ private FluidUtil() * @param side The side of the block to interact with. May be null. * @return true if the interaction succeeded and updated the item held by the player, false otherwise. */ - public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull InteractionHand hand, @Nonnull Level level, @Nonnull BlockPos pos, @Nullable Direction side) + public static boolean interactWithFluidHandler(@NotNull Player player, @NotNull InteractionHand hand, @NotNull Level level, @NotNull BlockPos pos, @Nullable Direction side) { Preconditions.checkNotNull(level); Preconditions.checkNotNull(pos); @@ -82,7 +81,7 @@ public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull * @param handler The fluid handler. * @return true if the interaction succeeded and updated the item held by the player, false otherwise. */ - public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull InteractionHand hand, @Nonnull IFluidHandler handler) + public static boolean interactWithFluidHandler(@NotNull Player player, @NotNull InteractionHand hand, @NotNull IFluidHandler handler) { Preconditions.checkNotNull(player); Preconditions.checkNotNull(hand); @@ -124,8 +123,8 @@ public static boolean interactWithFluidHandler(@Nonnull Player player, @Nonnull * @param doFill true if the container should actually be filled, false if it should be simulated. * @return a {@link FluidActionResult} holding the filled container if successful. */ - @Nonnull - public static FluidActionResult tryFillContainer(@Nonnull ItemStack container, IFluidHandler fluidSource, int maxAmount, @Nullable Player player, boolean doFill) + @NotNull + public static FluidActionResult tryFillContainer(@NotNull ItemStack container, IFluidHandler fluidSource, int maxAmount, @Nullable Player player, boolean doFill) { ItemStack containerCopy = ItemHandlerHelper.copyStackWithSize(container, 1); // do not modify the input return getFluidHandler(containerCopy) @@ -168,8 +167,8 @@ public static FluidActionResult tryFillContainer(@Nonnull ItemStack container, I * @return a {@link FluidActionResult} holding the empty container if the fluid handler was filled. * NOTE If the container is consumable, the empty container will be null on success. */ - @Nonnull - public static FluidActionResult tryEmptyContainer(@Nonnull ItemStack container, IFluidHandler fluidDestination, int maxAmount, @Nullable Player player, boolean doDrain) + @NotNull + public static FluidActionResult tryEmptyContainer(@NotNull ItemStack container, IFluidHandler fluidDestination, int maxAmount, @Nullable Player player, boolean doDrain) { ItemStack containerCopy = ItemHandlerHelper.copyStackWithSize(container, 1); // do not modify the input return getFluidHandler(containerCopy) @@ -209,8 +208,8 @@ public static FluidActionResult tryEmptyContainer(@Nonnull ItemStack container, * @param doFill true if the container should actually be filled, false if it should be simulated. * @return a {@link FluidActionResult} holding the result and the resulting container. The resulting container is empty on failure. */ - @Nonnull - public static FluidActionResult tryFillContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidSource, IItemHandler inventory, int maxAmount, @Nullable Player player, boolean doFill) + @NotNull + public static FluidActionResult tryFillContainerAndStow(@NotNull ItemStack container, IFluidHandler fluidSource, IItemHandler inventory, int maxAmount, @Nullable Player player, boolean doFill) { if (container.isEmpty()) { @@ -277,8 +276,8 @@ else if (container.getCount() == 1) // don't need to stow anything, just fill th * @param doDrain true if the container should actually be drained, false if it should be simulated. * @return a {@link FluidActionResult} holding the result and the resulting container. The resulting container is empty on failure. */ - @Nonnull - public static FluidActionResult tryEmptyContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidDestination, IItemHandler inventory, int maxAmount, @Nullable Player player, boolean doDrain) + @NotNull + public static FluidActionResult tryEmptyContainerAndStow(@NotNull ItemStack container, IFluidHandler fluidDestination, IItemHandler inventory, int maxAmount, @Nullable Player player, boolean doDrain) { if (container.isEmpty()) { @@ -340,7 +339,7 @@ else if (container.getCount() == 1) // don't need to stow anything, just fill an * @param doTransfer True if the transfer should actually be done, false if it should be simulated. * @return the fluidStack that was transferred from the source to the destination. null on failure. */ - @Nonnull + @NotNull public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluidHandler fluidSource, int maxAmount, boolean doTransfer) { FluidStack drainable = fluidSource.drain(maxAmount, IFluidHandler.FluidAction.SIMULATE); @@ -362,7 +361,7 @@ public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluid * @param doTransfer True if the transfer should actually be done, false if it should be simulated. * @return the fluidStack that was transferred from the source to the destination. null on failure. */ - @Nonnull + @NotNull public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluidHandler fluidSource, FluidStack resource, boolean doTransfer) { FluidStack drainable = fluidSource.drain(resource, IFluidHandler.FluidAction.SIMULATE); @@ -380,7 +379,7 @@ public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluid * Modders: Instead of this method, use {@link #tryFluidTransfer(IFluidHandler, IFluidHandler, FluidStack, boolean)} * or {@link #tryFluidTransfer(IFluidHandler, IFluidHandler, int, boolean)}. */ - @Nonnull + @NotNull private static FluidStack tryFluidTransfer_Internal(IFluidHandler fluidDestination, IFluidHandler fluidSource, FluidStack drainable, boolean doTransfer) { int fillableAmount = fluidDestination.fill(drainable, IFluidHandler.FluidAction.SIMULATE); @@ -416,7 +415,7 @@ private static FluidStack tryFluidTransfer_Internal(IFluidHandler fluidDestinati * * Vanilla buckets will be converted to universal buckets if they are enabled. */ - public static LazyOptional getFluidHandler(@Nonnull ItemStack itemStack) + public static LazyOptional getFluidHandler(@NotNull ItemStack itemStack) { return itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); } @@ -424,7 +423,7 @@ public static LazyOptional getFluidHandler(@Nonnull ItemStack /** * Helper method to get the fluid contained in an itemStack */ - public static Optional getFluidContained(@Nonnull ItemStack container) + public static Optional getFluidContained(@NotNull ItemStack container) { if (!container.isEmpty()) { @@ -469,8 +468,8 @@ public static LazyOptional getFluidHandler(Level level, BlockPos * @param side The side of the fluid that is being drained. * @return a {@link FluidActionResult} holding the result and the resulting container. */ - @Nonnull - public static FluidActionResult tryPickUpFluid(@Nonnull ItemStack emptyContainer, @Nullable Player playerIn, Level level, BlockPos pos, Direction side) + @NotNull + public static FluidActionResult tryPickUpFluid(@NotNull ItemStack emptyContainer, @Nullable Player playerIn, Level level, BlockPos pos, Direction side) { if (emptyContainer.isEmpty() || level == null || pos == null) { @@ -512,8 +511,8 @@ else if (block instanceof BucketPickup) * @param resource The fluidStack to place * @return the container's ItemStack with the remaining amount of fluid if the placement was successful, null otherwise */ - @Nonnull - public static FluidActionResult tryPlaceFluid(@Nullable Player player, Level level, InteractionHand hand, BlockPos pos, @Nonnull ItemStack container, FluidStack resource) + @NotNull + public static FluidActionResult tryPlaceFluid(@Nullable Player player, Level level, InteractionHand hand, BlockPos pos, @NotNull ItemStack container, FluidStack resource) { ItemStack containerCopy = ItemHandlerHelper.copyStackWithSize(container, 1); // do not modify the input return getFluidHandler(containerCopy) @@ -644,8 +643,8 @@ public static void destroyBlockOnFluidPlacement(Level level, BlockPos pos) * @return a filled vanilla bucket or filled universal bucket. * Returns empty itemStack if none of the enabled buckets can hold the fluid. */ - @Nonnull - public static ItemStack getFilledBucket(@Nonnull FluidStack fluidStack) + @NotNull + public static ItemStack getFilledBucket(@NotNull FluidStack fluidStack) { Fluid fluid = fluidStack.getFluid(); diff --git a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java index 220b7d73fb1..46922e4d4c6 100644 --- a/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java +++ b/src/main/java/net/minecraftforge/fluids/ForgeFlowingFluid.java @@ -6,7 +6,6 @@ package net.minecraftforge.fluids; import java.util.Optional; -import javax.annotation.Nonnull; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -24,8 +23,9 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.function.Supplier; public abstract class ForgeFlowingFluid extends FlowingFluid @@ -132,7 +132,7 @@ public boolean isSame(Fluid fluidIn) { return fluidIn == still.get() || fluidIn == flowing.get(); } - @Nonnull + @NotNull @Override public Optional getPickupSound() { diff --git a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java index 368dfef57bb..86b15c330ed 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java @@ -9,8 +9,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraftforge.fluids.capability.IFluidHandler; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Implement this interface on Block classes which represent world-placeable Fluids. @@ -35,7 +34,7 @@ public interface IFluidBlock * @param action If SIMULATE, the placement will only be simulated * @return the amount of fluid extracted from the provided stack to achieve some fluid level */ - int place(Level level, BlockPos pos, @Nonnull FluidStack fluidStack, IFluidHandler.FluidAction action); + int place(Level level, BlockPos pos, @NotNull FluidStack fluidStack, IFluidHandler.FluidAction action); /** * Attempt to drain the block. This method should be called by devices such as pumps. @@ -46,7 +45,7 @@ public interface IFluidBlock * If SIMULATE, the drain will only be simulated. * @return the fluid stack after draining the block */ - @Nonnull + @NotNull FluidStack drain(Level level, BlockPos pos, IFluidHandler.FluidAction action); /** diff --git a/src/main/java/net/minecraftforge/fluids/IFluidTank.java b/src/main/java/net/minecraftforge/fluids/IFluidTank.java index 1340a54c739..4d3842a7bb8 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidTank.java @@ -6,8 +6,7 @@ package net.minecraftforge.fluids; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This interface represents a Fluid Tank. IT IS NOT REQUIRED but is provided for convenience. @@ -19,7 +18,7 @@ public interface IFluidTank { /** * @return FluidStack representing the fluid in the tank, null if the tank is empty. */ - @Nonnull + @NotNull FluidStack getFluid(); /** @@ -50,7 +49,7 @@ public interface IFluidTank { * @param action If SIMULATE, the drain will only be simulated. * @return Amount of fluid that was removed (or would be, if simulated) from the tank. */ - @Nonnull + @NotNull FluidStack drain(int maxDrain, FluidAction action); /** @@ -58,7 +57,7 @@ public interface IFluidTank { * @param action If SIMULATE, the drain will only be simulated. * @return FluidStack representing fluid that was removed (or would be, if simulated) from the tank. */ - @Nonnull + @NotNull FluidStack drain(FluidStack resource, FluidAction action); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/IFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/IFluidHandler.java index 48a7124988d..83f7c86589c 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/IFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/capability/IFluidHandler.java @@ -5,9 +5,8 @@ package net.minecraftforge.fluids.capability; -import javax.annotation.Nonnull; - import net.minecraftforge.fluids.*; +import org.jetbrains.annotations.NotNull; /** * Implement this interface as a capability which should handle fluids, generally storing them in @@ -52,7 +51,7 @@ public boolean simulate() { * @param tank Tank to query. * @return FluidStack in a given tank. FluidStack.EMPTY if the tank is empty. */ - @Nonnull + @NotNull FluidStack getFluidInTank(int tank); /** @@ -72,7 +71,7 @@ public boolean simulate() { * @return TRUE if the tank can hold the FluidStack, not considering current state. * (Basically, is a given fluid EVER allowed in this tank?) Return FALSE if the answer to that question is 'no.' */ - boolean isFluidValid(int tank, @Nonnull FluidStack stack); + boolean isFluidValid(int tank, @NotNull FluidStack stack); /** * Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler. @@ -91,7 +90,7 @@ public boolean simulate() { * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ - @Nonnull + @NotNull FluidStack drain(FluidStack resource, FluidAction action); /** @@ -104,7 +103,7 @@ public boolean simulate() { * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ - @Nonnull + @NotNull FluidStack drain(int maxDrain, FluidAction action); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/IFluidHandlerItem.java b/src/main/java/net/minecraftforge/fluids/capability/IFluidHandlerItem.java index 28de7f58202..1f13b5dc8a7 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/IFluidHandlerItem.java +++ b/src/main/java/net/minecraftforge/fluids/capability/IFluidHandlerItem.java @@ -5,9 +5,8 @@ package net.minecraftforge.fluids.capability; -import javax.annotation.Nonnull; - import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; /** * ItemStacks handled by an {@link IFluidHandler} may change, so this class allows @@ -21,6 +20,6 @@ public interface IFluidHandlerItem extends IFluidHandler * for their filled and empty states. * May be an empty item if the container was drained and is consumable. */ - @Nonnull + @NotNull ItemStack getContainer(); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/ItemFluidContainer.java b/src/main/java/net/minecraftforge/fluids/capability/ItemFluidContainer.java index 886097fab65..4e175ffcaa9 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/ItemFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/capability/ItemFluidContainer.java @@ -10,9 +10,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A simple fluid container, to replace the functionality of the old FluidContainerRegistry and IFluidContainerItem. @@ -33,7 +32,7 @@ public ItemFluidContainer(Item.Properties properties, int capacity) } @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable CompoundTag nbt) + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable CompoundTag nbt) { return new FluidHandlerItemStack(stack, capacity); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java index 5d6a289b8fb..f57982a56a9 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/capability/TileFluidHandler.java @@ -15,17 +15,16 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.capability.templates.FluidTank; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class TileFluidHandler extends BlockEntity { protected FluidTank tank = new FluidTank(FluidAttributes.BUCKET_VOLUME); - + private final LazyOptional holder = LazyOptional.of(() -> tank); - public TileFluidHandler(@Nonnull BlockEntityType blockEntityType, BlockPos pos, BlockState state) + public TileFluidHandler(@NotNull BlockEntityType blockEntityType, BlockPos pos, BlockState state) { super(blockEntityType, pos, state); } @@ -45,8 +44,8 @@ protected void saveAdditional(CompoundTag tag) } @Override - @Nonnull - public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction facing) + @NotNull + public LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction facing) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) return holder.cast(); diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/EmptyFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/templates/EmptyFluidHandler.java index 7dcc133dc8b..6a94c60e4c7 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/EmptyFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/EmptyFluidHandler.java @@ -5,12 +5,10 @@ package net.minecraftforge.fluids.capability.templates; -import javax.annotation.Nonnull; - import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; public class EmptyFluidHandler implements IFluidHandler { @@ -21,7 +19,7 @@ protected EmptyFluidHandler() {} @Override public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @@ -29,7 +27,7 @@ protected EmptyFluidHandler() {} public int getTankCapacity(int tank) { return 0; } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { return true; } + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @Override public int fill(FluidStack resource, FluidAction action) @@ -37,14 +35,14 @@ public int fill(FluidStack resource, FluidAction action) return 0; } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { return FluidStack.EMPTY; } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStack.java b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStack.java index e9feb6b3988..2b75d1c5111 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStack.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStack.java @@ -5,9 +5,6 @@ package net.minecraftforge.fluids.capability.templates; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.core.Direction; @@ -18,7 +15,8 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * FluidHandlerItemStack is a template capability provider for ItemStacks. @@ -35,7 +33,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv private final LazyOptional holder = LazyOptional.of(() -> this); - @Nonnull + @NotNull protected ItemStack container; protected int capacity; @@ -43,20 +41,20 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv * @param container The container itemStack, data is stored on it directly as NBT. * @param capacity The maximum capacity of this fluid tank. */ - public FluidHandlerItemStack(@Nonnull ItemStack container, int capacity) + public FluidHandlerItemStack(@NotNull ItemStack container, int capacity) { this.container = container; this.capacity = capacity; } - @Nonnull + @NotNull @Override public ItemStack getContainer() { return container; } - @Nonnull + @NotNull public FluidStack getFluid() { CompoundTag tagCompound = container.getTag(); @@ -85,7 +83,7 @@ public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -99,7 +97,7 @@ public int getTankCapacity(int tank) { } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @@ -144,7 +142,7 @@ public int fill(FluidStack resource, FluidAction doFill) } } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -155,7 +153,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return drain(resource.getAmount(), action); } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { @@ -211,8 +209,8 @@ protected void setContainerToEmpty() } @Override - @Nonnull - public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction facing) + @NotNull + public LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction facing) { return CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY.orEmpty(capability, holder); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStackSimple.java b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStackSimple.java index d547364c4f7..598fde5159b 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStackSimple.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidHandlerItemStackSimple.java @@ -5,9 +5,6 @@ package net.minecraftforge.fluids.capability.templates; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.core.Direction; @@ -18,7 +15,8 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * FluidHandlerItemStackSimple is a template capability provider for ItemStacks. @@ -32,7 +30,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili private final LazyOptional holder = LazyOptional.of(() -> this); - @Nonnull + @NotNull protected ItemStack container; protected int capacity; @@ -40,20 +38,20 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili * @param container The container itemStack, data is stored on it directly as NBT. * @param capacity The maximum capacity of this fluid tank. */ - public FluidHandlerItemStackSimple(@Nonnull ItemStack container, int capacity) + public FluidHandlerItemStackSimple(@NotNull ItemStack container, int capacity) { this.container = container; this.capacity = capacity; } - @Nonnull + @NotNull @Override public ItemStack getContainer() { return container; } - @Nonnull + @NotNull public FluidStack getFluid() { CompoundTag tagCompound = container.getTag(); @@ -82,7 +80,7 @@ public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -96,13 +94,13 @@ public int getTankCapacity(int tank) { } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @Override - public int fill(@Nonnull FluidStack resource, FluidAction action) + public int fill(@NotNull FluidStack resource, FluidAction action) { if (container.getCount() != 1 || resource.isEmpty() || !canFillFluidType(resource)) { @@ -127,7 +125,7 @@ public int fill(@Nonnull FluidStack resource, FluidAction action) return 0; } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -138,7 +136,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return drain(resource.getAmount(), action); } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { @@ -188,8 +186,8 @@ protected void setContainerToEmpty() } @Override - @Nonnull - public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction facing) + @NotNull + public LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction facing) { return CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY.orEmpty(capability, holder); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java index 2f71cbb7015..9d14f32a085 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/FluidTank.java @@ -9,9 +9,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.function.Predicate; /** @@ -22,7 +21,7 @@ public class FluidTank implements IFluidHandler, IFluidTank { protected Predicate validator; - @Nonnull + @NotNull protected FluidStack fluid = FluidStack.EMPTY; protected int capacity; @@ -61,7 +60,7 @@ public int getCapacity() return capacity; } - @Nonnull + @NotNull public FluidStack getFluid() { return fluid; @@ -92,7 +91,7 @@ public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -106,7 +105,7 @@ public int getTankCapacity(int tank) { } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return isFluidValid(stack); } @@ -156,7 +155,7 @@ public int fill(FluidStack resource, FluidAction action) return filled; } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -167,7 +166,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return drain(resource.getAmount(), action); } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { diff --git a/src/main/java/net/minecraftforge/fluids/capability/templates/VoidFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/templates/VoidFluidHandler.java index 558afdf53ca..c26cf458eb0 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/templates/VoidFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/capability/templates/VoidFluidHandler.java @@ -8,9 +8,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; -import javax.annotation.Nonnull; - -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; /** * VoidFluidHandler is a template fluid handler that can be filled indefinitely without ever getting full. @@ -25,7 +23,7 @@ public VoidFluidHandler() {} @Override public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; } @@ -33,7 +31,7 @@ public VoidFluidHandler() {} public int getTankCapacity(int tank) { return Integer.MAX_VALUE; } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { return true; } + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @Override public int fill(FluidStack resource, FluidAction action) @@ -41,14 +39,14 @@ public int fill(FluidStack resource, FluidAction action) return resource.getAmount(); } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { return FluidStack.EMPTY; } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { diff --git a/src/main/java/net/minecraftforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java b/src/main/java/net/minecraftforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java index 592bbffa671..3696aea8642 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java +++ b/src/main/java/net/minecraftforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java @@ -5,8 +5,6 @@ package net.minecraftforge.fluids.capability.wrappers; -import javax.annotation.Nonnull; - import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.BucketPickup; @@ -16,8 +14,10 @@ import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; public class BucketPickupHandlerWrapper implements IFluidHandler { @@ -40,7 +40,7 @@ public int getTanks() return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -63,7 +63,7 @@ public int getTankCapacity(int tank) } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @@ -74,7 +74,7 @@ public int fill(FluidStack resource, FluidAction action) return 0; } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -93,7 +93,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) { //Be loud if something went wrong LOGGER.error("Fluid removed without successfully being picked up. Fluid {} at {} in {} matched requested type, but after performing pickup was {}.", - fluidState.getType().getRegistryName(), blockPos, world.dimension().location(), bucket.getFluid().getRegistryName()); + ForgeRegistries.FLUIDS.getKey(fluidState.getType()), blockPos, world.dimension().location(), ForgeRegistries.FLUIDS.getKey(bucket.getFluid())); return FluidStack.EMPTY; } return extracted; @@ -113,7 +113,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return FluidStack.EMPTY; } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { diff --git a/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBlockWrapper.java b/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBlockWrapper.java index ce6986bc794..3c415d29097 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBlockWrapper.java +++ b/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBlockWrapper.java @@ -5,7 +5,6 @@ package net.minecraftforge.fluids.capability.wrappers; -import javax.annotation.Nonnull; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraftforge.fluids.FluidAttributes; @@ -13,7 +12,7 @@ import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; +import org.jetbrains.annotations.NotNull; public class FluidBlockWrapper implements IFluidHandler { @@ -34,7 +33,7 @@ public int getTanks() return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -57,7 +56,7 @@ public int getTankCapacity(int tank) } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return stack.getFluid() == fluidBlock.getFluid(); } @@ -68,7 +67,7 @@ public int fill(FluidStack resource, FluidAction action) return fluidBlock.place(world, blockPos, resource, action); } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -87,7 +86,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return FluidStack.EMPTY; } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { diff --git a/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBucketWrapper.java b/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBucketWrapper.java index 362d8caca3d..9e7bb442cbf 100644 --- a/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBucketWrapper.java +++ b/src/main/java/net/minecraftforge/fluids/capability/wrappers/FluidBucketWrapper.java @@ -5,9 +5,6 @@ package net.minecraftforge.fluids.capability.wrappers; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.world.level.material.Fluids; import net.minecraft.core.Direction; import net.minecraftforge.common.ForgeMod; @@ -20,13 +17,13 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; - import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.MilkBucketItem; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Wrapper for vanilla and forge buckets. @@ -36,15 +33,15 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide { private final LazyOptional holder = LazyOptional.of(() -> this); - @Nonnull + @NotNull protected ItemStack container; - public FluidBucketWrapper(@Nonnull ItemStack container) + public FluidBucketWrapper(@NotNull ItemStack container) { this.container = container; } - @Nonnull + @NotNull @Override public ItemStack getContainer() { @@ -60,7 +57,7 @@ public boolean canFillFluidType(FluidStack fluid) return !fluid.getFluid().getAttributes().getBucket(fluid).isEmpty(); } - @Nonnull + @NotNull public FluidStack getFluid() { Item item = container.getItem(); @@ -78,7 +75,7 @@ else if (item instanceof MilkBucketItem && ForgeMod.MILK.isPresent()) } } - protected void setFluid(@Nonnull FluidStack fluidStack) + protected void setFluid(@NotNull FluidStack fluidStack) { if (fluidStack.isEmpty()) container = new ItemStack(Items.BUCKET); @@ -92,7 +89,7 @@ public int getTanks() { return 1; } - @Nonnull + @NotNull @Override public FluidStack getFluidInTank(int tank) { @@ -106,7 +103,7 @@ public int getTankCapacity(int tank) { } @Override - public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { + public boolean isFluidValid(int tank, @NotNull FluidStack stack) { return true; } @@ -127,7 +124,7 @@ public int fill(FluidStack resource, FluidAction action) return FluidAttributes.BUCKET_VOLUME; } - @Nonnull + @NotNull @Override public FluidStack drain(FluidStack resource, FluidAction action) { @@ -149,7 +146,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) return FluidStack.EMPTY; } - @Nonnull + @NotNull @Override public FluidStack drain(int maxDrain, FluidAction action) { @@ -170,10 +167,10 @@ public FluidStack drain(int maxDrain, FluidAction action) return FluidStack.EMPTY; } - + @Override - @Nonnull - public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction facing) + @NotNull + public LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction facing) { return CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY.orEmpty(capability, holder); } diff --git a/src/main/java/net/minecraftforge/forge/event/lifecycle/GatherDataEvent.java b/src/main/java/net/minecraftforge/forge/event/lifecycle/GatherDataEvent.java index 43a47fcb886..3edad1e287a 100644 --- a/src/main/java/net/minecraftforge/forge/event/lifecycle/GatherDataEvent.java +++ b/src/main/java/net/minecraftforge/forge/event/lifecycle/GatherDataEvent.java @@ -6,6 +6,7 @@ package net.minecraftforge.forge.event.lifecycle; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import net.minecraft.DetectedVersion; import net.minecraft.data.DataGenerator; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.Event; @@ -82,7 +83,7 @@ public boolean isFlat() { } public DataGenerator makeGenerator(final Function pathEnhancer, final boolean shouldExecute) { - final DataGenerator generator = new DataGenerator(pathEnhancer.apply(path), inputs); + final DataGenerator generator = new DataGenerator(pathEnhancer.apply(path), inputs, DetectedVersion.tryDetectVersion(), shouldExecute); if (shouldExecute) generators.add(generator); return generator; @@ -94,7 +95,7 @@ public void runAll() { paths.values().forEach(LamdbaExceptionUtils.rethrowConsumer(lst -> { DataGenerator parent = lst.get(0); for (int x = 1; x < lst.size(); x++) - lst.get(x).getProviders().forEach(parent::addProvider); + lst.get(x).getProviders().forEach(i -> parent.addProvider(true, i)); parent.run(); })); } diff --git a/src/main/java/net/minecraftforge/internal/TextComponentMessageFormatHandler.java b/src/main/java/net/minecraftforge/internal/TextComponentMessageFormatHandler.java index 93285cc3023..b94d7325827 100644 --- a/src/main/java/net/minecraftforge/internal/TextComponentMessageFormatHandler.java +++ b/src/main/java/net/minecraftforge/internal/TextComponentMessageFormatHandler.java @@ -5,15 +5,16 @@ package net.minecraftforge.internal; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraftforge.common.ForgeI18n; import java.util.function.Consumer; public class TextComponentMessageFormatHandler { - public static int handle(final TranslatableComponent parent, final Consumer addChild, final Object[] formatArgs, final String format) { + public static int handle(final TranslatableContents parent, final Consumer addChild, final Object[] formatArgs, final String format) { try { final String formattedString = ForgeI18n.parseFormat(format, formatArgs); @@ -27,8 +28,7 @@ public static int handle(final TranslatableComponent parent, final Consumer

{ @@ -39,7 +38,7 @@ public void setSize(int size) } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { validateSlotIndex(slot); this.stacks.set(slot, stack); @@ -53,7 +52,7 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { validateSlotIndex(slot); @@ -61,12 +60,12 @@ public ItemStack getStackInSlot(int slot) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.isEmpty()) return ItemStack.EMPTY; - + if (!isItemValid(slot, stack)) return stack; @@ -106,7 +105,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount == 0) @@ -152,13 +151,13 @@ public int getSlotLimit(int slot) return 64; } - protected int getStackLimit(int slot, @Nonnull ItemStack stack) + protected int getStackLimit(int slot, @NotNull ItemStack stack) { return Math.min(getSlotLimit(slot), stack.getMaxStackSize()); } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return true; } diff --git a/src/main/java/net/minecraftforge/items/SlotItemHandler.java b/src/main/java/net/minecraftforge/items/SlotItemHandler.java index a5fab90c150..89665de8992 100644 --- a/src/main/java/net/minecraftforge/items/SlotItemHandler.java +++ b/src/main/java/net/minecraftforge/items/SlotItemHandler.java @@ -10,7 +10,7 @@ import net.minecraft.world.SimpleContainer; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class SlotItemHandler extends Slot { @@ -26,7 +26,7 @@ public SlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int y } @Override - public boolean mayPlace(@Nonnull ItemStack stack) + public boolean mayPlace(@NotNull ItemStack stack) { if (stack.isEmpty()) return false; @@ -34,7 +34,7 @@ public boolean mayPlace(@Nonnull ItemStack stack) } @Override - @Nonnull + @NotNull public ItemStack getItem() { return this.getItemHandler().getStackInSlot(index); @@ -42,14 +42,14 @@ public ItemStack getItem() // Override if your IItemHandler does not implement IItemHandlerModifiable @Override - public void set(@Nonnull ItemStack stack) + public void set(@NotNull ItemStack stack) { ((IItemHandlerModifiable) this.getItemHandler()).setStackInSlot(index, stack); this.setChanged(); } @Override - public void onQuickCraft(@Nonnull ItemStack oldStackIn, @Nonnull ItemStack newStackIn) + public void onQuickCraft(@NotNull ItemStack oldStackIn, @NotNull ItemStack newStackIn) { } @@ -61,7 +61,7 @@ public int getMaxStackSize() } @Override - public int getMaxStackSize(@Nonnull ItemStack stack) + public int getMaxStackSize(@NotNull ItemStack stack) { ItemStack maxAdd = stack.copy(); int maxInput = stack.getMaxStackSize(); @@ -97,7 +97,7 @@ public boolean mayPickup(Player playerIn) } @Override - @Nonnull + @NotNull public ItemStack remove(int amount) { return this.getItemHandler().extractItem(index, amount, false); diff --git a/src/main/java/net/minecraftforge/items/VanillaHopperItemHandler.java b/src/main/java/net/minecraftforge/items/VanillaHopperItemHandler.java index 66b70337084..84db25e980d 100644 --- a/src/main/java/net/minecraftforge/items/VanillaHopperItemHandler.java +++ b/src/main/java/net/minecraftforge/items/VanillaHopperItemHandler.java @@ -8,8 +8,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.HopperBlockEntity; import net.minecraftforge.items.wrapper.InvWrapper; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class VanillaHopperItemHandler extends InvWrapper { @@ -22,8 +21,8 @@ public VanillaHopperItemHandler(HopperBlockEntity hopper) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (simulate) { diff --git a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java index 502e49c615e..27b80af5c1a 100644 --- a/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java +++ b/src/main/java/net/minecraftforge/items/VanillaInventoryCodeHooks.java @@ -19,9 +19,9 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Optional; public class VanillaInventoryCodeHooks @@ -70,7 +70,7 @@ public static Boolean extractHook(Level level, Hopper dest) /** * Copied from BlockDropper#dispense and added capability support */ - public static boolean dropperInsertHook(Level level, BlockPos pos, DispenserBlockEntity dropper, int slot, @Nonnull ItemStack stack) + public static boolean dropperInsertHook(Level level, BlockPos pos, DispenserBlockEntity dropper, int slot, @NotNull ItemStack stack) { Direction enumfacing = level.getBlockState(pos).getValue(DropperBlock.FACING); BlockPos blockpos = pos.relative(enumfacing); diff --git a/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java index 3168aafe807..4b0177537fa 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/CombinedInvWrapper.java @@ -7,8 +7,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; // combines multiple IItemHandlerModifiable into one interface public class CombinedInvWrapper implements IItemHandlerModifiable @@ -66,7 +65,7 @@ protected int getSlotFromIndex(int slot, int index) } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { int index = getIndexForSlot(slot); IItemHandlerModifiable handler = getHandlerFromIndex(index); @@ -81,7 +80,7 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { int index = getIndexForSlot(slot); @@ -91,8 +90,8 @@ public ItemStack getStackInSlot(int slot) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { int index = getIndexForSlot(slot); IItemHandlerModifiable handler = getHandlerFromIndex(index); @@ -101,7 +100,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { int index = getIndexForSlot(slot); @@ -120,7 +119,7 @@ public int getSlotLimit(int slot) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { int index = getIndexForSlot(slot); IItemHandlerModifiable handler = getHandlerFromIndex(index); diff --git a/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java b/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java index bd0cb61b487..369fb4953d3 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java +++ b/src/main/java/net/minecraftforge/items/wrapper/EmptyHandler.java @@ -8,8 +8,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class EmptyHandler implements IItemHandlerModifiable { @@ -22,28 +21,28 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { return ItemStack.EMPTY; } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return stack; } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { // nothing to do here } @@ -55,7 +54,7 @@ public int getSlotLimit(int slot) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return false; } diff --git a/src/main/java/net/minecraftforge/items/wrapper/EntityEquipmentInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/EntityEquipmentInvWrapper.java index fad1db72009..c35f07ab65f 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/EntityEquipmentInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/EntityEquipmentInvWrapper.java @@ -13,10 +13,9 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - /** * Exposes the armor or hands inventory of an {@link LivingEntity} as an {@link IItemHandler} using {@link LivingEntity#getItemBySlot(EquipmentSlot)} and @@ -61,16 +60,16 @@ public int getSlots() return slots.size(); } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(final int slot) { return entity.getItemBySlot(validateSlotIndex(slot)); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(final int slot, @Nonnull final ItemStack stack, final boolean simulate) + public ItemStack insertItem(final int slot, @NotNull final ItemStack stack, final boolean simulate) { if (stack.isEmpty()) return ItemStack.EMPTY; @@ -109,7 +108,7 @@ public ItemStack insertItem(final int slot, @Nonnull final ItemStack stack, fina return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - limit) : ItemStack.EMPTY; } - @Nonnull + @NotNull @Override public ItemStack extractItem(final int slot, final int amount, final boolean simulate) { @@ -152,13 +151,13 @@ public int getSlotLimit(final int slot) return equipmentSlot.getType() == EquipmentSlot.Type.ARMOR ? 1 : 64; } - protected int getStackLimit(final int slot, @Nonnull final ItemStack stack) + protected int getStackLimit(final int slot, @NotNull final ItemStack stack) { return Math.min(getSlotLimit(slot), stack.getMaxStackSize()); } @Override - public void setStackInSlot(final int slot, @Nonnull final ItemStack stack) + public void setStackInSlot(final int slot, @NotNull final ItemStack stack) { final EquipmentSlot equipmentSlot = validateSlotIndex(slot); if (ItemStack.matches(entity.getItemBySlot(equipmentSlot), stack)) @@ -167,7 +166,7 @@ public void setStackInSlot(final int slot, @Nonnull final ItemStack stack) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return true; } diff --git a/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java index 52bd14b1d33..95d21fda2b0 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/InvWrapper.java @@ -9,8 +9,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class InvWrapper implements IItemHandlerModifiable { @@ -48,15 +47,15 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { return getInv().getItem(slot); } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.isEmpty()) return ItemStack.EMPTY; @@ -144,7 +143,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount == 0) @@ -179,7 +178,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { getInv().setItem(slot, stack); } @@ -191,7 +190,7 @@ public int getSlotLimit(int slot) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return getInv().canPlaceItem(slot, stack); } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index 3a1cdb5d13a..b90e2e7b0c5 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -8,8 +8,7 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class PlayerArmorInvWrapper extends RangedWrapper { @@ -22,8 +21,8 @@ public PlayerArmorInvWrapper(Inventory inv) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { EquipmentSlot equ = null; for (EquipmentSlot s : EquipmentSlot.values()) diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java index 13fffd0e68a..bc69cf46261 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java @@ -8,8 +8,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Exposes the player inventory WITHOUT the armor inventory as IItemHandler. @@ -26,8 +25,8 @@ public PlayerMainInvWrapper(Inventory inv) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { ItemStack rest = super.insertItem(slot, stack, simulate); if (rest.getCount()!= stack.getCount()) diff --git a/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java index 4873004502c..38c5e610e90 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/RangedWrapper.java @@ -8,8 +8,7 @@ import com.google.common.base.Preconditions; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * A wrapper that composes another IItemHandlerModifiable, exposing only a range of the composed slots. @@ -36,7 +35,7 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { if (checkSlot(slot)) @@ -48,8 +47,8 @@ public ItemStack getStackInSlot(int slot) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (checkSlot(slot)) { @@ -60,7 +59,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { if (checkSlot(slot)) @@ -72,7 +71,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { if (checkSlot(slot)) { @@ -92,7 +91,7 @@ public int getSlotLimit(int slot) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { if (checkSlot(slot)) { diff --git a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java index 0f60096a365..8b963f231af 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java @@ -11,9 +11,8 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class SidedInvWrapper implements IItemHandlerModifiable { @@ -73,7 +72,7 @@ public int getSlots() } @Override - @Nonnull + @NotNull public ItemStack getStackInSlot(int slot) { int i = getSlot(inv, slot, side); @@ -81,8 +80,8 @@ public ItemStack getStackInSlot(int slot) } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.isEmpty()) return ItemStack.EMPTY; @@ -169,7 +168,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) + public void setStackInSlot(int slot, @NotNull ItemStack stack) { int slot1 = getSlot(inv, slot, side); @@ -183,7 +182,7 @@ private void setInventorySlotContents(int slot, ItemStack stack) { } @Override - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount == 0) @@ -231,7 +230,7 @@ public int getSlotLimit(int slot) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) + public boolean isItemValid(int slot, @NotNull ItemStack stack) { int slot1 = getSlot(inv, slot, side); return slot1 == -1 ? false : inv.canPlaceItem(slot1, stack); diff --git a/src/main/java/net/minecraftforge/logging/ModelLoaderErrorMessage.java b/src/main/java/net/minecraftforge/logging/ModelLoaderErrorMessage.java index 501b2b35e19..12d427d8e58 100644 --- a/src/main/java/net/minecraftforge/logging/ModelLoaderErrorMessage.java +++ b/src/main/java/net/minecraftforge/logging/ModelLoaderErrorMessage.java @@ -35,10 +35,10 @@ private static void buildLookups() { .flatMap(block -> block.getStateDefinition().getPossibleStates().stream()) .forEach(state -> reverseBlockMap.put(BlockModelShaper.stateToModelLocation(state), state)); - ForgeRegistries.ITEMS.forEach(item -> + ForgeRegistries.ITEMS.getKeys().forEach(key -> { - ModelResourceLocation memory = getInventoryVariant(ForgeRegistries.ITEMS.getKey(item).toString()); - reverseItemMap.put(memory, item.getRegistryName().toString()); + ModelResourceLocation memory = getInventoryVariant(key.toString()); + reverseItemMap.put(memory, key.toString()); }); } diff --git a/src/main/java/net/minecraftforge/network/HandshakeHandler.java b/src/main/java/net/minecraftforge/network/HandshakeHandler.java index 877d57e3d32..9f5415ebf80 100644 --- a/src/main/java/net/minecraftforge/network/HandshakeHandler.java +++ b/src/main/java/net/minecraftforge/network/HandshakeHandler.java @@ -10,13 +10,12 @@ import net.minecraft.core.Registry; import net.minecraft.network.Connection; +import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.handshake.ClientIntentionPacket; import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; import net.minecraft.network.protocol.login.ServerboundCustomQueryPacket; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.network.ServerLoginPacketListenerImpl; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.LogMessageAdapter; @@ -191,7 +190,7 @@ void handleServerModListOnClient(HandshakeMessages.S2CModList serverModList, Sup LOGGER.error(FMLHSMARKER, "Terminating connection with server, mismatched mod list"); //Populate the mod mismatch attribute with a new mismatch data instance to indicate that the disconnect happened due to a mod mismatch c.get().getNetworkManager().channel().attr(NetworkConstants.FML_MOD_MISMATCH_DATA).set(ModMismatchData.channel(mismatchedChannels, NetworkHooks.getConnectionData(c.get().getNetworkManager()), true)); - c.get().getNetworkManager().disconnect(new TextComponent("Connection closed - mismatched mod channel list")); + c.get().getNetworkManager().disconnect(Component.literal("Connection closed - mismatched mod channel list")); return; } // Validate synced custom datapack registries, client cannot be missing any present on the server. @@ -208,7 +207,7 @@ void handleServerModListOnClient(HandshakeMessages.S2CModList serverModList, Sup } if (!missingDataPackRegistries.isEmpty()) { - c.get().getNetworkManager().disconnect(new TranslatableComponent("fml.menu.multiplayer.missingdatapackregistries", String.join(", ", missingDataPackRegistries))); + c.get().getNetworkManager().disconnect(Component.translatable("fml.menu.multiplayer.missingdatapackregistries", String.join(", ", missingDataPackRegistries))); return; } NetworkConstants.handshakeChannel.reply(new HandshakeMessages.C2SModListReply(), c.get()); @@ -247,7 +246,7 @@ void handleClientModListOnServer(HandshakeMessages.C2SModListReply clientModList if (!mismatchedChannels.isEmpty()) { LOGGER.error(FMLHSMARKER, "Terminating connection with client, mismatched mod list"); NetworkConstants.handshakeChannel.reply(new HandshakeMessages.S2CChannelMismatchData(mismatchedChannels), c.get()); - c.get().getNetworkManager().disconnect(new TextComponent("Connection closed - mismatched mod channel list")); + c.get().getNetworkManager().disconnect(Component.literal("Connection closed - mismatched mod channel list")); return; } LOGGER.debug(FMLHSMARKER, "Accepted client connection mod list"); @@ -263,7 +262,7 @@ void handleModMismatchData(HandshakeMessages.S2CChannelMismatchData modMismatchD c.get().setPacketHandled(true); //Populate the mod mismatch attribute with a new mismatch data instance to indicate that the disconnect happened due to a mod mismatch c.get().getNetworkManager().channel().attr(NetworkConstants.FML_MOD_MISMATCH_DATA).set(ModMismatchData.channel(modMismatchData.getMismatchedChannelData(), NetworkHooks.getConnectionData(c.get().getNetworkManager()), false)); - c.get().getNetworkManager().disconnect(new TextComponent("Connection closed - mismatched mod channel list")); + c.get().getNetworkManager().disconnect(Component.literal("Connection closed - mismatched mod channel list")); } } @@ -314,7 +313,7 @@ private boolean handleRegistryLoading(final Supplier conte LOGGER.error(FMLHSMARKER, "Failed to load registry, closing connection."); //Populate the mod mismatch attribute with a new mismatch data instance to indicate that the disconnect happened due to a mod mismatch this.manager.channel().attr(NetworkConstants.FML_MOD_MISMATCH_DATA).set(ModMismatchData.registry(registryMismatches.get(), NetworkHooks.getConnectionData(contextSupplier.get().getNetworkManager()))); - this.manager.disconnect(new TextComponent("Failed to synchronize registry data from server, closing connection")); + this.manager.disconnect(Component.literal("Failed to synchronize registry data from server, closing connection")); } return successfulConnection.get(); } diff --git a/src/main/java/net/minecraftforge/network/HandshakeMessages.java b/src/main/java/net/minecraftforge/network/HandshakeMessages.java index b40b34ae807..c27c81d561f 100644 --- a/src/main/java/net/minecraftforge/network/HandshakeMessages.java +++ b/src/main/java/net/minecraftforge/network/HandshakeMessages.java @@ -92,11 +92,7 @@ public static S2CModList decode(FriendlyByteBuf input) for (int x = 0; x < len; x++) registries.add(input.readResourceLocation()); - // Datapack Registries may or may not be sent in 1.18.2 due to netcode changes. - // TODO 1.19: Remove optionalness of datapack registry list in the mod list packet. - List>> dataPackRegistries = input.isReadable() - ? input.readCollection(ArrayList::new, buf -> ResourceKey.createRegistryKey(buf.readResourceLocation())) - : List.of(); + List>> dataPackRegistries = input.readCollection(ArrayList::new, buf -> ResourceKey.createRegistryKey(buf.readResourceLocation())); return new S2CModList(mods, channels, registries, dataPackRegistries); } @@ -113,14 +109,9 @@ public void encode(FriendlyByteBuf output) output.writeVarInt(registries.size()); registries.forEach(output::writeResourceLocation); - - // The list of synced datapack registry names is not sent in 1.18.2 if the list is empty. - // TODO 1.19: should send an empty list if the list is empty. + Set>> dataPackRegistries = DataPackRegistriesHooks.getSyncedCustomRegistries(); - if (!dataPackRegistries.isEmpty()) - { - output.writeCollection(dataPackRegistries, (buf,key) -> buf.writeResourceLocation(key.location())); - } + output.writeCollection(dataPackRegistries, (buf, key) -> buf.writeResourceLocation(key.location())); } public List getModList() { @@ -134,7 +125,7 @@ public List getRegistries() { public Map getChannels() { return this.channels; } - + /** * @return list of ids of non-vanilla syncable datapack registries on the server. */ diff --git a/src/main/java/net/minecraftforge/network/NetworkEvent.java b/src/main/java/net/minecraftforge/network/NetworkEvent.java index da525ee8643..08761f4a66c 100644 --- a/src/main/java/net/minecraftforge/network/NetworkEvent.java +++ b/src/main/java/net/minecraftforge/network/NetworkEvent.java @@ -5,8 +5,6 @@ package net.minecraftforge.network; -import javax.annotation.Nullable; - import io.netty.util.Attribute; import io.netty.util.AttributeKey; @@ -20,6 +18,7 @@ import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.common.util.LogicalSidedProvider; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/net/minecraftforge/network/NetworkHooks.java b/src/main/java/net/minecraftforge/network/NetworkHooks.java index d234d8fe5df..294803a7d8e 100644 --- a/src/main/java/net/minecraftforge/network/NetworkHooks.java +++ b/src/main/java/net/minecraftforge/network/NetworkHooks.java @@ -15,7 +15,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.fml.util.thread.EffectiveSide; import net.minecraftforge.client.ConfigGuiHandler.ConfigGuiFactory; import net.minecraftforge.network.ConnectionData.ModMismatchData; @@ -40,8 +40,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerContainerEvent; import net.minecraftforge.fml.config.ConfigTracker; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class NetworkHooks { @@ -80,7 +79,7 @@ public static boolean onCustomPayload(final ICustomPacket packet, final Conne private static boolean validateSideForProcessing(final ICustomPacket packet, final NetworkInstance ni, final Connection manager) { if (packet.getDirection().getReceptionSide() != EffectiveSide.get()) { - manager.disconnect(new TextComponent("Illegal packet received, terminating connection")); + manager.disconnect(Component.literal("Illegal packet received, terminating connection")); return false; } return true; @@ -88,7 +87,7 @@ private static boolean validateSideForProcessing(final ICustomPacket packet, public static void validatePacketDirection(final NetworkDirection packetDirection, final Optional expectedDirection, final Connection connection) { if (packetDirection != expectedDirection.orElse(packetDirection)) { - connection.disconnect(new TextComponent("Illegal packet received, terminating connection")); + connection.disconnect(Component.literal("Illegal packet received, terminating connection")); throw new IllegalStateException("Invalid packet received, aborting connection"); } } diff --git a/src/main/java/net/minecraftforge/network/PlayMessages.java b/src/main/java/net/minecraftforge/network/PlayMessages.java index 68a3e943b10..1ad8b3839f4 100644 --- a/src/main/java/net/minecraftforge/network/PlayMessages.java +++ b/src/main/java/net/minecraftforge/network/PlayMessages.java @@ -12,7 +12,6 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.protocol.game.ClientboundAddMobPacket; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -36,7 +35,7 @@ public class PlayMessages { /** * Used to spawn a custom entity without the same restrictions as - * {@link ClientboundAddEntityPacket} or {@link ClientboundAddMobPacket} + * {@link ClientboundAddEntityPacket} * * To customize how your entity is created clientside (instead of using the default factory provided to the {@link EntityType}) * see {@link EntityType.Builder#setCustomClientFactory}. @@ -143,7 +142,7 @@ public static void handle(SpawnEntity msg, Supplier ctx) return; } - e.setPacketCoordinates(msg.posX, msg.posY, msg.posZ); + e.setPos(msg.posX, msg.posY, msg.posZ); e.absMoveTo(msg.posX, msg.posY, msg.posZ, (msg.yaw * 360) / 256.0F, (msg.pitch * 360) / 256.0F); e.setYHeadRot((msg.headYaw * 360) / 256.0F); e.setYBodyRot((msg.headYaw * 360) / 256.0F); diff --git a/src/main/java/net/minecraftforge/network/filters/ForgeConnectionNetworkFilter.java b/src/main/java/net/minecraftforge/network/filters/ForgeConnectionNetworkFilter.java index e25f19a0fa3..0209ab5e02d 100644 --- a/src/main/java/net/minecraftforge/network/filters/ForgeConnectionNetworkFilter.java +++ b/src/main/java/net/minecraftforge/network/filters/ForgeConnectionNetworkFilter.java @@ -9,8 +9,6 @@ import java.util.Map; import java.util.function.BiConsumer; -import javax.annotation.Nullable; - import io.netty.channel.ChannelHandler; import net.minecraft.network.protocol.Packet; import net.minecraft.network.Connection; @@ -21,6 +19,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; import com.google.common.collect.ImmutableMap; +import org.jetbrains.annotations.Nullable; /** * Network filter for forge-forge connections. diff --git a/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java b/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java index c4da94f1915..e1c01611fce 100644 --- a/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java +++ b/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java @@ -8,16 +8,14 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.annotation.Nonnull; import io.netty.channel.ChannelHandler; +import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.SharedSuggestionProvider; -import net.minecraft.commands.synchronization.ArgumentTypes; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.network.protocol.Packet; @@ -32,6 +30,7 @@ import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryManager; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import com.google.common.collect.ImmutableMap; @@ -68,7 +67,7 @@ protected boolean isNecessary(Connection manager) * Filter for SEntityPropertiesPacket. Filters out any entity attributes that are not in the "minecraft" namespace. * A vanilla client would ignore these with an error log. */ - @Nonnull + @NotNull private static ClientboundUpdateAttributesPacket filterEntityProperties(ClientboundUpdateAttributesPacket msg) { ClientboundUpdateAttributesPacket newPacket = new ClientboundUpdateAttributesPacket(msg.getEntityId(), Collections.emptyList()); @@ -85,12 +84,15 @@ private static ClientboundUpdateAttributesPacket filterEntityProperties(Clientbo * Filter for SCommandListPacket. Uses {@link CommandTreeCleaner} to filter out any ArgumentTypes that are not in the "minecraft" or "brigadier" namespace. * A vanilla client would fail to deserialize the packet and disconnect with an error message if these were sent. */ - @Nonnull + @NotNull private static ClientboundCommandsPacket filterCommandList(ClientboundCommandsPacket packet) { - RootCommandNode root = packet.getRoot(); + CommandBuildContext commandBuildContext = new CommandBuildContext(RegistryAccess.BUILTIN.get()); + commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY); + RootCommandNode root = packet.getRoot(commandBuildContext); RootCommandNode newRoot = CommandTreeCleaner.cleanArgumentTypes(root, argType -> { - ResourceLocation id = ArgumentTypes.getId(argType); + ArgumentTypeInfo info = ArgumentTypeInfos.byClass(argType); + ResourceLocation id = Registry.COMMAND_ARGUMENT_TYPE.getKey(info); return id != null && (id.getNamespace().equals("minecraft") || id.getNamespace().equals("brigadier")); }); return new ClientboundCommandsPacket(newRoot); diff --git a/src/main/java/net/minecraftforge/network/filters/VanillaPacketFilter.java b/src/main/java/net/minecraftforge/network/filters/VanillaPacketFilter.java index b23501b306b..16aeaaaece1 100644 --- a/src/main/java/net/minecraftforge/network/filters/VanillaPacketFilter.java +++ b/src/main/java/net/minecraftforge/network/filters/VanillaPacketFilter.java @@ -11,12 +11,11 @@ import java.util.function.BiConsumer; import java.util.function.Function; -import javax.annotation.Nonnull; - import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; import net.minecraft.network.protocol.Packet; import net.minecraft.network.Connection; +import org.jetbrains.annotations.NotNull; /** * A filter for vanilla impl packets. @@ -34,7 +33,7 @@ protected VanillaPacketFilter(Map>, BiConsumer> Map.Entry>, BiConsumer, List>>> handler(Class cls, Function> function) { return handler(cls, (pkt, list) -> list.add(function.apply(cls.cast(pkt)))); @@ -43,7 +42,7 @@ protected static > Map.Entry>, BiC /** * Helper function for building the handler map. */ - @Nonnull + @NotNull protected static > Map.Entry>, BiConsumer, List>>> handler(Class cls, BiConsumer, List>> consumer) { return new AbstractMap.SimpleEntry<>(cls, consumer); diff --git a/src/main/java/net/minecraftforge/registries/DataSerializerEntry.java b/src/main/java/net/minecraftforge/registries/DataSerializerEntry.java deleted file mode 100644 index c223899aa93..00000000000 --- a/src/main/java/net/minecraftforge/registries/DataSerializerEntry.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; - -import net.minecraft.network.syncher.EntityDataSerializer; - -public final class DataSerializerEntry extends ForgeRegistryEntry -{ - private final EntityDataSerializer serializer; - - public DataSerializerEntry(EntityDataSerializer serializer) - { - this.serializer = serializer; - } - - public EntityDataSerializer getSerializer() - { - return serializer; - } -} diff --git a/src/main/java/net/minecraftforge/registries/DeferredRegister.java b/src/main/java/net/minecraftforge/registries/DeferredRegister.java index 8123587b470..3e17879123d 100644 --- a/src/main/java/net/minecraftforge/registries/DeferredRegister.java +++ b/src/main/java/net/minecraftforge/registries/DeferredRegister.java @@ -12,7 +12,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.tags.ITagManager; @@ -64,22 +63,11 @@ public class DeferredRegister * @see #create(ResourceKey, String) * @see #create(ResourceLocation, String) */ - public static > DeferredRegister create(IForgeRegistry reg, String modid) + public static DeferredRegister create(IForgeRegistry reg, String modid) { return new DeferredRegister<>(reg, modid); } - /** - * Use for custom registries that are made during the NewRegistry event. - * - * @deprecated Use {@link #create(ResourceLocation, String)} and {@link #makeRegistry(Class, Supplier)} instead - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static > DeferredRegister create(Class base, String modid) - { - return new DeferredRegister<>(null, base, modid, false); - } - /** * DeferredRegister factory for custom forge registries, {@link Registry vanilla registries}, * or {@link BuiltinRegistries built-in registries} to lookup based on the provided registry key. @@ -88,7 +76,7 @@ public static > DeferredRegister create(Clas * If the registry is never created, any {@link RegistryObject}s made from this DeferredRegister will throw an exception. * To allow the optional existence of a registry without error, use {@link #createOptional(ResourceKey, String)}. * - * @param key the key of the registry to reference + * @param key the key of the registry to reference. May come from another DeferredRegister through {@link #getRegistryKey()}. * @param modid the namespace for all objects registered to this DeferredRegister * @see #createOptional(ResourceKey, String) * @see #create(IForgeRegistry, String) @@ -96,7 +84,7 @@ public static > DeferredRegister create(Clas */ public static DeferredRegister create(ResourceKey> key, String modid) { - return new DeferredRegister<>(key, null, modid, false); + return new DeferredRegister<>(key, modid, false); } /** @@ -114,7 +102,7 @@ public static DeferredRegister create(ResourceKey> */ public static DeferredRegister createOptional(ResourceKey> key, String modid) { - return new DeferredRegister<>(key, null, modid, true); + return new DeferredRegister<>(key, modid, true); } /** @@ -133,7 +121,7 @@ public static DeferredRegister createOptional(ResourceKey DeferredRegister create(ResourceLocation registryName, String modid) { - return new DeferredRegister<>(ResourceKey.createRegistryKey(registryName), null, modid, false); + return new DeferredRegister<>(ResourceKey.createRegistryKey(registryName), modid, false); } /** @@ -151,13 +139,10 @@ public static DeferredRegister create(ResourceLocation registryName, Stri */ public static DeferredRegister createOptional(ResourceLocation registryName, String modid) { - return new DeferredRegister<>(ResourceKey.createRegistryKey(registryName), null, modid, true); + return new DeferredRegister<>(ResourceKey.createRegistryKey(registryName), modid, true); } - @Nullable // Nullable when superType is not null private final ResourceKey> registryKey; - @Nullable // Nullable when registryKey is not null - private final Class> superType; private final String modid; private final boolean optionalRegistry; private final Map, Supplier> entries = new LinkedHashMap<>(); @@ -169,19 +154,16 @@ public static DeferredRegister createOptional(ResourceLocation registryNa private SetMultimap, Supplier> optionalTags; private boolean seenRegisterEvent = false; - private > DeferredRegister(@Nullable ResourceKey> registryKey, @Nullable Class base, - String modid, boolean optionalRegistry) + private DeferredRegister(ResourceKey> registryKey, String modid, boolean optionalRegistry) { this.registryKey = registryKey; - this.superType = base; this.modid = modid; this.optionalRegistry = optionalRegistry; } - @SuppressWarnings("unchecked") - private > DeferredRegister(IForgeRegistry reg, String modid) + private DeferredRegister(IForgeRegistry reg, String modid) { - this((ResourceKey>) (ResourceKey) reg.getRegistryKey(), reg.getRegistrySuperType(), modid, false); + this(reg.getRegistryKey(), modid, false); } /** @@ -195,7 +177,7 @@ private > DeferredRegister(IForgeRegistry re public RegistryObject register(final String name, final Supplier sup) { if (seenRegisterEvent) - throw new IllegalStateException("Cannot register new entries to DeferredRegister after RegistryEvent.Register has been fired."); + throw new IllegalStateException("Cannot register new entries to DeferredRegister after RegisterEvent has been fired."); Objects.requireNonNull(name); Objects.requireNonNull(sup); final ResourceLocation key = new ResourceLocation(modid, name); @@ -205,54 +187,28 @@ public RegistryObject register(final String name, final Supplie ret = this.optionalRegistry ? RegistryObject.createOptional(key, this.registryKey, this.modid) : RegistryObject.create(key, this.registryKey, this.modid); - else if (this.superType != null) - ret = RegistryObject.of(key, (Class) this.superType, this.modid); else throw new IllegalStateException("Could not create RegistryObject in DeferredRegister"); - Supplier prevValue = entries.putIfAbsent((RegistryObject) ret, () -> { - I value = sup.get(); - if (value instanceof IForgeRegistryEntry regEntry) - regEntry.setRegistryName(key); - return value; - }); - if (prevValue != null) + if (entries.putIfAbsent((RegistryObject) ret, sup) != null) { throw new IllegalArgumentException("Duplicate registration " + name); + } return ret; } - /** - * For custom registries only, fills the {@link #registryFactory} to be called later see {@link #register(IEventBus)} - * - * Calls {@link RegistryBuilder#setName} and {@link RegistryBuilder#setType} automatically. - * - * @param name Path of the registry's {@link ResourceLocation} - * @param sup Supplier of the RegistryBuilder that is called to fill {@link #type} during the NewRegistry event - * @return A supplier of the {@link IForgeRegistry} created by the builder. - * - * @deprecated Use {@link #create(ResourceLocation, String)} and {@link #makeRegistry(Class, Supplier)} instead - */ - @SuppressWarnings("unchecked") - @Deprecated(forRemoval = true, since = "1.18.2") - public > Supplier> makeRegistry(final String name, final Supplier> sup) - { - return makeRegistry(new ResourceLocation(modid, name), (Class) this.superType, sup); - } - /** * Only used for custom registries to fill the forge registry held in this DeferredRegister. * - * Calls {@link RegistryBuilder#setName} and {@link RegistryBuilder#setType} automatically. + * Calls {@link RegistryBuilder#setName} automatically. * - * @param base The base type to use in the created {@link IForgeRegistry} * @param sup Supplier of a RegistryBuilder that initializes a {@link IForgeRegistry} during the {@link NewRegistryEvent} event * @return A supplier of the {@link IForgeRegistry} created by the builder. * Will always return null until after the {@link NewRegistryEvent} event fires. */ - public > Supplier> makeRegistry(final Class base, final Supplier> sup) + public Supplier> makeRegistry(final Supplier> sup) { - return makeRegistry(this.registryKey.location(), base, sup); + return makeRegistry(this.registryKey.location(), sup); } /** @@ -351,15 +307,13 @@ public void addOptionalTagDefaults(@NotNull TagKey name, @NotNull Set register) { } @SubscribeEvent - public void handleEvent(RegistryEvent.Register event) { + public void handleEvent(RegisterEvent event) { register.addEntries(event); } } @@ -384,67 +338,55 @@ public Collection> getEntries() return entriesView; } + /** + * @return The registry key stored in this deferred register. Useful for creating new deferred registers based on an existing one. + */ + public ResourceKey> getRegistryKey() + { + return this.registryKey; + } + /** * @return The registry name stored in this deferred register. Useful for creating new deferred registers based on an existing one. */ - @Nullable + @NotNull public ResourceLocation getRegistryName() { - return this.registryKey == null ? null : this.registryKey.location(); + return Objects.requireNonNull(this.registryKey).location(); } - // TODO 1.19: Remove this E method generic in favor of the class generic T when IForgeRegistry and RegistryBuilder no longer require IForgeRegistryEntry - private > Supplier> makeRegistry(final ResourceLocation registryName, final Class superType, final Supplier> sup) { + private Supplier> makeRegistry(final ResourceLocation registryName, final Supplier> sup) { if (registryName == null) throw new IllegalStateException("Cannot create a registry without specifying a registry name"); - if (superType == null) - throw new IllegalStateException("Cannot create a registry without specifying a base type"); if (RegistryManager.ACTIVE.getRegistry(registryName) != null || this.registryFactory != null) throw new IllegalStateException("Cannot create a registry for a type that already exists"); - this.registryFactory = () -> sup.get().setName(registryName).setType(superType); - return new Supplier<>() - { - private IForgeRegistry registry; - - @Override - public IForgeRegistry get() - { - // Keep trying to capture until it's not null - if (registry == null) - registry = RegistryManager.ACTIVE.getRegistry(registryName); - - return registry; - } - }; + this.registryFactory = () -> sup.get().setName(registryName); + return new RegistryHolder<>(this.registryKey); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings("unchecked") private void onFill(IForgeRegistry registry) { if (this.optionalTags == null) return; - // TODO 1.19: Put back the here and fix the unsafe generic operations - ITagManager tagManager = registry.tags(); + ITagManager tagManager = (ITagManager) registry.tags(); if (tagManager == null) throw new IllegalStateException("The forge registry " + registry.getRegistryName() + " does not support tags, but optional tags were registered!"); Multimaps.asMap(this.optionalTags).forEach(tagManager::addOptionalTagDefaults); } - @SuppressWarnings({ "rawtypes", "unchecked" }) - private void addEntries(RegistryEvent.Register event) + private void addEntries(RegisterEvent event) { - IForgeRegistry storedType = findForgeRegistry(); - if (storedType != null && event.getGenericType() == storedType.getRegistrySuperType()) + if (event.getRegistryKey().equals(this.registryKey)) { this.seenRegisterEvent = true; - IForgeRegistry reg = (IForgeRegistry) event.getRegistry(); for (Entry, Supplier> e : entries.entrySet()) { - ((IForgeRegistry) reg).register((IForgeRegistryEntry) e.getValue().get()); - e.getKey().updateReference(reg); + event.register(this.registryKey, e.getKey().getId(), () -> e.getValue().get()); + e.getKey().updateReference(event); } } } @@ -454,33 +396,24 @@ private void createRegistry(NewRegistryEvent event) event.create(this.registryFactory.get(), this::onFill); } - @SuppressWarnings({ "unchecked", "removal", "rawtypes" }) - private void vanillaRegister(VanillaRegisterEvent event) + private static class RegistryHolder implements Supplier> { - if (this.registryKey != null && event.vanillaRegistry.key() == (ResourceKey)this.registryKey) - { - this.seenRegisterEvent = true; - for (Entry, Supplier> e : entries.entrySet()) - { - Registry.register((Registry) event.vanillaRegistry, e.getKey().getId(), e.getValue().get()); - e.getKey().updateReference((Registry) event.vanillaRegistry); - } - } - } + private final ResourceKey> registryKey; + private IForgeRegistry registry = null; - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Nullable - private IForgeRegistry findForgeRegistry() - { - if (this.registryKey != null) + private RegistryHolder(ResourceKey> registryKey) { - return RegistryManager.ACTIVE.getRegistry((ResourceKey) this.registryKey); + this.registryKey = registryKey; } - else if (this.superType != null) + + @Override + public IForgeRegistry get() { - return RegistryManager.ACTIVE.getRegistry((Class) this.superType); - } + // Keep looking up the registry until it's not null + if (this.registry == null) + this.registry = RegistryManager.ACTIVE.getRegistry(this.registryKey); - return null; + return this.registry; + } } } diff --git a/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java b/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java index a54fec3467f..39732dfaed6 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java +++ b/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java @@ -22,6 +22,8 @@ public static void setup(IEventBus modEventBus) ForgeRegistries.DEFERRED_DATA_SERIALIZERS.register(modEventBus); ForgeRegistries.DEFERRED_LOOT_MODIFIER_SERIALIZERS.register(modEventBus); ForgeRegistries.DEFERRED_WORLD_TYPES.register(modEventBus); + ForgeRegistries.DEFERRED_BIOME_MODIFIER_SERIALIZERS.register(modEventBus); + ForgeRegistries.DEFERRED_BIOME_MODIFIERS.register(modEventBus); setup = true; } diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java index dc08f0db689..5b63fcf8ba2 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java @@ -5,6 +5,10 @@ package net.minecraftforge.registries; +import com.mojang.serialization.Codec; +import net.minecraft.network.syncher.EntityDataSerializer; +import net.minecraft.world.entity.decoration.PaintingVariant; +import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.Block; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.entity.EntityType; @@ -13,7 +17,6 @@ import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.entity.schedule.Schedule; import net.minecraft.world.entity.ai.sensing.SensorType; -import net.minecraft.world.entity.decoration.Motive; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.inventory.MenuType; @@ -35,11 +38,11 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType; import net.minecraft.world.level.levelgen.carver.WorldCarver; import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; import net.minecraftforge.common.Tags; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; +import net.minecraftforge.common.world.BiomeModifier; import net.minecraftforge.common.world.ForgeWorldPreset; import java.util.function.Supplier; @@ -47,11 +50,11 @@ /** * A class that exposes static references to all vanilla and Forge registries. * Created to have a central place to access the registries directly if modders need. - * It is still advised that if you are registering things to use {@link net.minecraftforge.event.RegistryEvent.Register} or {@link net.minecraftforge.registries.DeferredRegister}, but queries and iterations can use this. + * It is still advised that if you are registering things to use {@link RegisterEvent} or {@link net.minecraftforge.registries.DeferredRegister}, but queries and iterations can use this. */ public class ForgeRegistries { - static { init(); } // This must be above the fields so we guarantee it's run before getRegistry is called. Yay static inializers + static { init(); } // This must be above the fields so we guarantee it's run before getRegistry is called. Yay static initializers // Game objects public static final IForgeRegistry BLOCKS = RegistryManager.ACTIVE.getRegistry(Keys.BLOCKS); @@ -65,7 +68,8 @@ public class ForgeRegistries public static final IForgeRegistry> BLOCK_ENTITIES = RegistryManager.ACTIVE.getRegistry(Keys.BLOCK_ENTITY_TYPES); public static final IForgeRegistry> PARTICLE_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.PARTICLE_TYPES); public static final IForgeRegistry> CONTAINERS = RegistryManager.ACTIVE.getRegistry(Keys.CONTAINER_TYPES); - public static final IForgeRegistry PAINTING_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.PAINTING_TYPES); + public static final IForgeRegistry PAINTING_VARIANTS = RegistryManager.ACTIVE.getRegistry(Keys.PAINTING_VARIANTS); + public static final IForgeRegistry> RECIPE_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.RECIPE_TYPES); public static final IForgeRegistry> RECIPE_SERIALIZERS = RegistryManager.ACTIVE.getRegistry(Keys.RECIPE_SERIALIZERS); public static final IForgeRegistry ATTRIBUTES = RegistryManager.ACTIVE.getRegistry(Keys.ATTRIBUTES); public static final IForgeRegistry> STAT_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.STAT_TYPES); @@ -82,7 +86,6 @@ public class ForgeRegistries public static final IForgeRegistry> WORLD_CARVERS = RegistryManager.ACTIVE.getRegistry(Keys.WORLD_CARVERS); public static final IForgeRegistry> FEATURES = RegistryManager.ACTIVE.getRegistry(Keys.FEATURES); public static final IForgeRegistry CHUNK_STATUS = RegistryManager.ACTIVE.getRegistry(Keys.CHUNK_STATUS); - public static final IForgeRegistry> STRUCTURE_FEATURES = RegistryManager.ACTIVE.getRegistry(Keys.STRUCTURE_FEATURES); public static final IForgeRegistry> BLOCK_STATE_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.BLOCK_STATE_PROVIDER_TYPES); public static final IForgeRegistry> FOLIAGE_PLACER_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.FOLIAGE_PLACER_TYPES); public static final IForgeRegistry> TREE_DECORATOR_TYPES = RegistryManager.ACTIVE.getRegistry(Keys.TREE_DECORATOR_TYPES); @@ -91,12 +94,18 @@ public class ForgeRegistries public static final IForgeRegistry BIOMES = RegistryManager.ACTIVE.getRegistry(Keys.BIOMES); // Custom forge registries - static final DeferredRegister DEFERRED_DATA_SERIALIZERS = DeferredRegister.create(Keys.DATA_SERIALIZERS, Keys.DATA_SERIALIZERS.location().getNamespace()); - public static final Supplier> DATA_SERIALIZERS = DEFERRED_DATA_SERIALIZERS.makeRegistry(DataSerializerEntry.class, GameData::getDataSerializersRegistryBuilder); + static final DeferredRegister> DEFERRED_DATA_SERIALIZERS = DeferredRegister.create(Keys.DATA_SERIALIZERS, Keys.DATA_SERIALIZERS.location().getNamespace()); + public static final Supplier>> DATA_SERIALIZERS = DEFERRED_DATA_SERIALIZERS.makeRegistry(GameData::getDataSerializersRegistryBuilder); static final DeferredRegister> DEFERRED_LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(Keys.LOOT_MODIFIER_SERIALIZERS, Keys.LOOT_MODIFIER_SERIALIZERS.location().getNamespace()); - public static final Supplier>> LOOT_MODIFIER_SERIALIZERS = DEFERRED_LOOT_MODIFIER_SERIALIZERS.makeRegistry(GameData.c(GlobalLootModifierSerializer.class), GameData::getGLMSerializersRegistryBuilder); + public static final Supplier>> LOOT_MODIFIER_SERIALIZERS = DEFERRED_LOOT_MODIFIER_SERIALIZERS.makeRegistry(GameData::getGLMSerializersRegistryBuilder); static final DeferredRegister DEFERRED_WORLD_TYPES = DeferredRegister.create(Keys.WORLD_TYPES, Keys.WORLD_TYPES.location().getNamespace()); - public static final Supplier> WORLD_TYPES = DEFERRED_WORLD_TYPES.makeRegistry(ForgeWorldPreset.class, GameData::getWorldTypesRegistryBuilder); + public static final Supplier> WORLD_TYPES = DEFERRED_WORLD_TYPES.makeRegistry(GameData::getWorldTypesRegistryBuilder); + static final DeferredRegister> DEFERRED_BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(Keys.BIOME_MODIFIER_SERIALIZERS, Keys.BIOME_MODIFIER_SERIALIZERS.location().getNamespace()); + public static final Supplier>> BIOME_MODIFIER_SERIALIZERS = DEFERRED_BIOME_MODIFIER_SERIALIZERS.makeRegistry(() -> new RegistryBuilder>().disableSaving().disableSync()); + + // Custom forge datapack registries + static final DeferredRegister DEFERRED_BIOME_MODIFIERS = DeferredRegister.create(Keys.BIOME_MODIFIERS, "forge"); + public static final Supplier> BIOME_MODIFIERS_BUILTIN = DEFERRED_BIOME_MODIFIERS.makeRegistry(() -> new RegistryBuilder().disableSaving().dataPackRegistry(BiomeModifier.DIRECT_CODEC)); public static final class Keys { //Vanilla @@ -110,10 +119,11 @@ public static final class Keys { public static final ResourceKey> SOUND_EVENTS = key("sound_event"); public static final ResourceKey> ENCHANTMENTS = key("enchantment"); public static final ResourceKey>> ENTITY_TYPES = key("entity_type"); - public static final ResourceKey> PAINTING_TYPES = key("motive"); + public static final ResourceKey> PAINTING_VARIANTS = key("painting_variant"); public static final ResourceKey>> PARTICLE_TYPES = key("particle_type"); public static final ResourceKey>> CONTAINER_TYPES = key("menu"); public static final ResourceKey>> BLOCK_ENTITY_TYPES = key("block_entity_type"); + public static final ResourceKey>> RECIPE_TYPES = key("recipe_type"); public static final ResourceKey>> RECIPE_SERIALIZERS = key("recipe_serializer"); public static final ResourceKey> VILLAGER_PROFESSIONS = key("villager_profession"); public static final ResourceKey> POI_TYPES = key("point_of_interest_type"); @@ -124,7 +134,6 @@ public static final class Keys { public static final ResourceKey>> WORLD_CARVERS = key("worldgen/carver"); public static final ResourceKey>> FEATURES = key("worldgen/feature"); public static final ResourceKey> CHUNK_STATUS = key("chunk_status"); - public static final ResourceKey>> STRUCTURE_FEATURES = key("worldgen/structure_feature"); public static final ResourceKey>> BLOCK_STATE_PROVIDER_TYPES = key("worldgen/block_state_provider_type"); public static final ResourceKey>> FOLIAGE_PLACER_TYPES = key("worldgen/foliage_placer_type"); public static final ResourceKey>> TREE_DECORATOR_TYPES = key("worldgen/tree_decorator_type"); @@ -133,9 +142,13 @@ public static final class Keys { public static final ResourceKey> BIOMES = key("worldgen/biome"); // Forge - public static final ResourceKey> DATA_SERIALIZERS = key("data_serializers"); + public static final ResourceKey>> DATA_SERIALIZERS = key("data_serializers"); public static final ResourceKey>> LOOT_MODIFIER_SERIALIZERS = key("forge:loot_modifier_serializers"); public static final ResourceKey> WORLD_TYPES = key("forge:world_types"); + public static final ResourceKey>> BIOME_MODIFIER_SERIALIZERS = key("forge:biome_modifier_serializers"); + + // Forge Dynamic + public static final ResourceKey> BIOME_MODIFIERS = key("forge:biome_modifier"); private static ResourceKey> key(String name) { diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 657273679b5..1f33ac24bfa 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -15,6 +15,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.tags.TagKey; +import net.minecraft.world.level.biome.Biome; import net.minecraftforge.common.util.LogMessageAdapter; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; @@ -39,8 +40,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.core.Registry; import net.minecraftforge.common.util.TablePrinter; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.event.RegistryEvent.MissingMappings; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -48,7 +47,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class ForgeRegistry> implements IForgeRegistryInternal, IForgeRegistryModifiable +public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegistryModifiable { public static Marker REGISTRIES = MarkerManager.getMarker("REGISTRIES"); private static Marker REGISTRYDUMP = MarkerManager.getMarker("REGISTRYDUMP"); @@ -57,7 +56,6 @@ public class ForgeRegistry> implements IForgeRe private final BiMap ids = HashBiMap.create(); private final BiMap names = HashBiMap.create(); private final BiMap, V> keys = HashBiMap.create(); - private final Class superType; private final Map aliases = Maps.newHashMap(); final Map slaves = Maps.newHashMap(); private final ResourceLocation defaultKey; @@ -72,10 +70,11 @@ public class ForgeRegistry> implements IForgeRe private final Set dummies = Sets.newHashSet(); private final Set blocked = Sets.newHashSet(); private final Multimap overrides = ArrayListMultimap.create(); + private final Map> delegatesByName = Maps.newHashMap(); + private final Map> delegatesByValue = Maps.newHashMap(); private final BiMap, V> owners = HashBiMap.create(); private final ForgeRegistryTagManager tagManager; private final DummyFactory dummyFactory; - private final boolean isDelegated; private final int min; private final int max; private final boolean allowOverrides; @@ -98,7 +97,6 @@ public class ForgeRegistry> implements IForgeRe this.key = ResourceKey.createRegistryKey(name); this.builder = builder; this.stage = stage; - this.superType = builder.getType(); this.defaultKey = builder.getDefault(); this.defaultResourceKey = ResourceKey.create(key, defaultKey); this.min = builder.getMinId(); @@ -111,7 +109,6 @@ public class ForgeRegistry> implements IForgeRe this.bake = builder.getBake(); this.missing = builder.getMissingFactory(); this.dummyFactory = builder.getDummyFactory(); - this.isDelegated = ForgeRegistryEntry.class.isAssignableFrom(superType); //TODO: Make this IDelegatedRegistryEntry? this.allowOverrides = builder.getAllowOverrides(); this.isModifiable = builder.getAllowModifications(); this.hasWrapper = builder.getHasWrapper(); @@ -121,9 +118,15 @@ public class ForgeRegistry> implements IForgeRe } @Override - public void register(V value) + public void register(String key, V value) { - add(-1, value); + register(GameData.checkPrefix(key, true), value); + } + + @Override + public void register(ResourceLocation key, V value) + { + add(-1, key, value); } @Override @@ -166,26 +169,12 @@ public ResourceKey> getRegistryKey() return this.key; } - @Override - public Class getRegistrySuperType() - { - return superType; - } - @NotNull public Codec getCodec() { return this.codec; } - @SuppressWarnings("unchecked") - @Override - public void registerAll(V... values) - { - for (V value : values) - register(value); - } - @Override public boolean containsKey(ResourceLocation key) { @@ -254,6 +243,17 @@ Registry getWrapper() : this.getSlaveMap(NamespacedWrapper.Factory.ID, NamespacedWrapper.class); } + @NotNull + Registry getWrapperOrThrow() + { + Registry wrapper = getWrapper(); + + if (wrapper == null) + throw new IllegalStateException("Cannot query wrapper for non-wrapped forge registry!"); + + return wrapper; + } + @SuppressWarnings("unchecked") @NotNull Optional> getHolderHelper() @@ -373,7 +373,7 @@ public ResourceKey getKey(int id) void validateKey() { if (this.defaultKey != null) - Validate.notNull(this.defaultValue, "Missing default of ForgeRegistry: " + this.defaultKey + " Type: " + this.superType); + Validate.notNull(this.defaultValue, "Missing default of ForgeRegistry: " + this.defaultKey + " Name: " + this.name); } @Nullable @@ -387,15 +387,14 @@ ForgeRegistry copy(RegistryManager stage) return new ForgeRegistry<>(stage, name, builder); } - int add(int id, V value) + int add(int id, ResourceLocation key, V value) { final String owner = ModLoadingContext.get().getActiveNamespace(); - return add(id, value, owner); + return add(id, key, value, owner); } - int add(int id, V value, String owner) + int add(int id, ResourceLocation key, V value, String owner) { - ResourceLocation key = value == null ? null : value.getRegistryName(); Preconditions.checkNotNull(key, "Can't use a null-name for the registry, object %s.", value); Preconditions.checkNotNull(value, "Can't add null-object to the registry, name %s.", key); @@ -444,23 +443,21 @@ int add(int id, V value, String owner) this.keys.put(rkey, value); this.ids.put(idToUse, value); this.availabilityMap.set(idToUse); - this.owners.put(new OverrideOwner(owner == null ? key.getPath() : owner, rkey), value); + this.owners.put(new OverrideOwner(owner == null ? key.getNamespace() : owner, rkey), value); - if (isDelegated) + if (hasWrapper) { - getDelegate(value).setName(key); + Holder.Reference delegate = bindDelegate(rkey, value); if (oldEntry != null) { if (!this.overrides.get(key).contains(oldEntry)) this.overrides.put(key, oldEntry); this.overrides.get(key).remove(value); - if (this.stage == RegistryManager.ACTIVE) - getDelegate(oldEntry).changeReference(value); } } if (this.add != null) - this.add.onAdd(this, this.stage, idToUse, value, oldEntry); + this.add.onAdd(this, this.stage, idToUse, rkey, value, oldEntry); if (this.dummies.remove(key)) LOGGER.debug(REGISTRIES,"Registry {} Dummy Remove: {}", this.name, key); @@ -505,25 +502,66 @@ void addDummy(ResourceLocation key) LOGGER.trace(REGISTRIES,"Registry {} dummy: {}", this.name, key); } - @SuppressWarnings("unchecked") - private RegistryDelegate getDelegate(V thing) + @NotNull + @Override + public Optional> getDelegate(ResourceKey rkey) { - if (isDelegated) - return (RegistryDelegate)((ForgeRegistryEntry)thing).delegate; - else - throw new IllegalStateException("Tried to get existing delegate from registry that is not delegated."); + return Optional.ofNullable(delegatesByName.get(rkey.location())); + } + + @NotNull + @Override + public Holder.Reference getDelegateOrThrow(ResourceKey rkey) + { + return getDelegate(rkey).orElseThrow(() -> new IllegalArgumentException(String.format(Locale.ENGLISH, "No delegate exists for key %s", rkey))); + } + + @NotNull + @Override + public Optional> getDelegate(ResourceLocation key) + { + return Optional.ofNullable(delegatesByName.get(key)); + } + + @NotNull + @Override + public Holder.Reference getDelegateOrThrow(ResourceLocation key) + { + return getDelegate(key).orElseThrow(() -> new IllegalArgumentException(String.format(Locale.ENGLISH, "No delegate exists for key %s", key))); + } + + @NotNull + @Override + public Optional> getDelegate(V value) + { + return Optional.ofNullable(delegatesByValue.get(value)); + } + + @NotNull + @Override + public Holder.Reference getDelegateOrThrow(V value) + { + return getDelegate(value).orElseThrow(() -> new IllegalArgumentException(String.format(Locale.ENGLISH, "No delegate exists for value %s", value))); + } + + private Holder.Reference bindDelegate(ResourceKey rkey, V value) + { + Holder.Reference delegate = delegatesByName.computeIfAbsent(rkey.location(), k -> Holder.Reference.createStandAlone(this.getWrapperOrThrow(), rkey)); + delegate.bind(rkey, value); + delegatesByValue.put(value, delegate); + return delegate; } void resetDelegates() { - if (!this.isDelegated) + if (!this.hasWrapper) return; - for (V value : this) - getDelegate(value).changeReference(value); + for (Entry, V> entry : this.keys.entrySet()) + bindDelegate(entry.getKey(), entry.getValue()); - for (V value: this.overrides.values()) - getDelegate(value).changeReference(value); + for (Entry entry : this.overrides.entries()) + bindDelegate(ResourceKey.create(this.key, entry.getKey()), entry.getValue()); } V getDefault() @@ -596,8 +634,6 @@ void sync(ResourceLocation name, ForgeRegistry from) LOGGER.debug(REGISTRIES,"Registry {} Sync: {} -> {}", this.name, this.stage.getName(), from.stage.getName()); if (this == from) throw new IllegalArgumentException("WTF We are the same!?!?!"); - if (from.superType != this.superType) - throw new IllegalArgumentException("Attempted to copy to incompatible registry: " + name + " " + from.superType + " -> " + this.superType); this.isFrozen = false; @@ -628,7 +664,7 @@ void sync(ResourceLocation name, ForgeRegistry from) int id = from.getID(entry.getKey()); if (overrides.isEmpty()) { - int realId = add(id, entry.getValue()); + int realId = add(id, entry.getKey(), entry.getValue()); if (id != realId && id != -1) { LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, entry.getKey(), id, realId); @@ -647,7 +683,7 @@ void sync(ResourceLocation name, ForgeRegistry from) errored = true; continue; } - int realId = add(id, value, owner.owner); + int realId = add(id, entry.getKey(), value, owner.owner); if (id != realId && id != -1) { LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, entry.getKey(), id, realId); @@ -739,11 +775,6 @@ public void unfreeze() this.isFrozen = false; } - RegistryEvent.Register getRegisterEvent(ResourceLocation name) - { - return new RegistryEvent.Register(name, this); - } - void dump(ResourceLocation name) { // Building a good looking table is not cheap, so only do it if the debug logger is enabled. @@ -771,7 +802,7 @@ void dump(ResourceLocation name) private record DumpRow(String id, String key, String value, String dummied) {} - public void loadIds(Map ids, Map overrides, Map missing, Map remapped, ForgeRegistry old, ResourceLocation name) + public void loadIds(Map ids, Map overrides, Map missing, Map remapped, ForgeRegistry old, ResourceLocation name) { Map ovs = Maps.newHashMap(overrides); for (Map.Entry entry : ids.entrySet()) @@ -804,7 +835,7 @@ public void loadIds(Map ids, Map {} (map).", this.name, name, itemName, currId, newId); - remapped.put(itemName, new Integer[] {currId, newId}); + remapped.put(itemName, new IdMappingEvent.IdRemapping(currId, newId)); } V obj = old.getRaw(itemName); @@ -836,12 +867,12 @@ else if (currId != newId) if (primaryName.equals(owner.owner)) continue; - int realId = add(newId, value, owner.owner); + int realId = add(newId, itemName, value, owner.owner); if (newId != realId) LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, entry.getKey(), newId, realId); } - int realId = add(newId, obj, primaryName == null ? itemName.getPath() : primaryName); + int realId = add(newId, itemName, obj, primaryName == null ? itemName.getNamespace() : primaryName); if (realId != newId) LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, entry.getKey(), newId, realId); ovs.remove(itemName); @@ -864,7 +895,7 @@ else if (currId != newId) LOGGER.info(REGISTRIES,"Registry {}: Activating override {} for {}", this.name, owner, itemName); int newId = this.getID(itemName); - int realId = this.add(newId, _new, owner); + int realId = this.add(newId, itemName, _new, owner); if (newId != realId) LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, entry.getKey(), newId, realId); } @@ -925,7 +956,7 @@ private void createAndAddDummy(ResourceLocation key, int id) LOGGER.debug(REGISTRIES,"Registry {} remove: {} {}", this.name, key, oldid); } - int realId = this.add(id, dummy); + int realId = this.add(id, key, dummy); if (realId != id) LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, key, id, realId); this.dummies.add(key); @@ -1157,66 +1188,67 @@ public static Snapshot read(FriendlyByteBuf buff) } } - public MissingMappings getMissingEvent(ResourceLocation name, Map map) + @SuppressWarnings("unchecked") + public MissingMappingsEvent getMissingEvent(ResourceLocation name, Map map) { - List> lst = Lists.newArrayList(); + List> lst = Lists.newArrayList(); ForgeRegistry pool = RegistryManager.ACTIVE.getRegistry(name); - map.forEach((rl, id) -> lst.add(new MissingMappings.Mapping(this, pool, rl, id))); - return new MissingMappings(name, this, lst); + map.forEach((rl, id) -> lst.add(new MissingMappingsEvent.Mapping<>(this, pool, rl, id))); + return new MissingMappingsEvent(ResourceKey.createRegistryKey(name), this, (Collection>) (Collection) lst); } - void processMissingEvent(ResourceLocation name, ForgeRegistry pool, List> mappings, Map missing, Map remaps, Collection defaulted, Collection failed, boolean injectNetworkDummies) + void processMissingEvent(ResourceLocation name, ForgeRegistry pool, List> mappings, Map missing, Map remaps, Collection defaulted, Collection failed, boolean injectNetworkDummies) { LOGGER.debug(REGISTRIES,"Processing missing event for {}:", name); int ignored = 0; - for (MissingMappings.Mapping remap : mappings) + for (MissingMappingsEvent.Mapping remap : mappings) { - MissingMappings.Action action = remap.getAction(); + MissingMappingsEvent.Action action = remap.action; - if (action == MissingMappings.Action.REMAP) + if (action == MissingMappingsEvent.Action.REMAP) { // entry re-mapped, finish the registration with the new name/object, but the old id - int currId = getID(remap.getTarget()); - ResourceLocation newName = pool.getKey(remap.getTarget()); + int currId = getID(remap.target); + ResourceLocation newName = pool.getKey(remap.target); LOGGER.debug(REGISTRIES," Remapping {} -> {}.", remap.key, newName); missing.remove(remap.key); //I don't think this will work, but I dont think it ever worked.. the item is already in the map with a different id... we want to fix that.. - int realId = this.add(remap.id, remap.getTarget()); + int realId = this.add(remap.id, newName, remap.target); if (realId != remap.id) - LOGGER.warn(REGISTRIES,"Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", newName, this.getRegistrySuperType(), remap.id, realId); + LOGGER.warn(REGISTRIES, "Registered object did not get ID it asked for. Name: {} Expected: {} Got: {}", newName, remap.id, realId); this.addAlias(remap.key, newName); if (currId != realId) { LOGGER.info(REGISTRIES,"Fixed id mismatch {}: {} (init) -> {} (map).", newName, currId, realId); - remaps.put(newName, new Integer[] {currId, realId}); + remaps.put(newName, new IdMappingEvent.IdRemapping(currId, realId)); } } else { // block item missing, warn as requested and block the id - if (action == MissingMappings.Action.DEFAULT) + if (action == MissingMappingsEvent.Action.DEFAULT) { V m = this.missing == null ? null : this.missing.createMissing(remap.key, injectNetworkDummies); if (m == null) defaulted.add(remap.key); else - this.add(remap.id, m, remap.key.getPath()); + this.add(remap.id, remap.key, m, remap.key.getNamespace()); } - else if (action == MissingMappings.Action.IGNORE) + else if (action == MissingMappingsEvent.Action.IGNORE) { LOGGER.debug(REGISTRIES,"Ignoring {}", remap.key); ignored++; } - else if (action == MissingMappings.Action.FAIL) + else if (action == MissingMappingsEvent.Action.FAIL) { LOGGER.debug(REGISTRIES,"Failing {}!", remap.key); failed.add(remap.key); } - else if (action == MissingMappings.Action.WARN) + else if (action == MissingMappingsEvent.Action.WARN) { LOGGER.warn(REGISTRIES,"{} may cause world breakage!", remap.key); } diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistryEntry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistryEntry.java deleted file mode 100644 index 42bc4d0af08..00000000000 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistryEntry.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; - -import com.google.common.reflect.TypeToken; - -import net.minecraft.resources.ResourceLocation; -import javax.annotation.Nullable; - -/** - * Default implementation of IForgeRegistryEntry, this is necessary to reduce redundant code. - * This also enables the registrie's ability to manage delegates. Which are automatically updated - * if another entry overrides existing ones in the registry. - */ -@SuppressWarnings("unchecked") -public abstract class ForgeRegistryEntry> implements IForgeRegistryEntry -{ - @SuppressWarnings("serial") - private final TypeToken token = new TypeToken(getClass()){}; - public final IRegistryDelegate delegate = new RegistryDelegate<>((V)this, (Class)token.getRawType()); - private ResourceLocation registryName = null; - - public final V setRegistryName(String name) - { - if (getRegistryName() != null) - throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); - - this.registryName = checkRegistryName(name); - return (V)this; - } - - //Helper functions - public final V setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); } - - public final V setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); } - - @Nullable - public final ResourceLocation getRegistryName() - { - if (delegate.name() != null) return delegate.name(); - return registryName != null ? registryName : null; - } - - public final Class getRegistryType() { return (Class)token.getRawType(); } - - /** - * This will assert that the registry name is valid and warn about potential registry overrides - * It is important as it detects cases where modders unintentionally register objects with the "minecraft" namespace, leading to dangerous errors later. - * @param name The registry name - * @return A verified "correct" registry name - */ - ResourceLocation checkRegistryName(String name) - { - return GameData.checkPrefix(name, true); - } - - /** - * This class exists for registry entries which are dynamic (e.g. loaded via data packs), and also exist in a forge registry prior to that. - * Due to this, the registry name will be set via the codec not during initial registration, and as a result, we want to not warn about possible overrides as the registry name will be set outside of mod context. - */ - public abstract static class UncheckedRegistryEntry> extends ForgeRegistryEntry - { - @Override - ResourceLocation checkRegistryName(String name) - { - return new ResourceLocation(name); - } - } -} diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistryTag.java b/src/main/java/net/minecraftforge/registries/ForgeRegistryTag.java index 6d26d3e19c1..d86bc9afb8c 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistryTag.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistryTag.java @@ -9,6 +9,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.tags.TagKey; +import net.minecraft.util.RandomSource; import net.minecraftforge.registries.tags.ITag; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -20,7 +21,7 @@ import java.util.Spliterator; import java.util.stream.Stream; -class ForgeRegistryTag> implements ITag +class ForgeRegistryTag implements ITag { private final TagKey key; @Nullable @@ -77,7 +78,7 @@ public boolean contains(V value) } @Override - public Optional getRandomElement(Random random) + public Optional getRandomElement(RandomSource random) { return Util.getRandomSafe(this.getContents(), random); } diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistryTagManager.java b/src/main/java/net/minecraftforge/registries/ForgeRegistryTagManager.java index fad2dcdc089..12391af600c 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistryTagManager.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistryTagManager.java @@ -23,7 +23,7 @@ import java.util.function.Supplier; import java.util.stream.Stream; -class ForgeRegistryTagManager> implements ITagManager +class ForgeRegistryTagManager implements ITagManager { private final ForgeRegistry owner; private volatile Map, ITag> tags = new IdentityHashMap<>(); diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index f58f39eb1b1..b1a9d74026d 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -5,86 +5,65 @@ package net.minecraftforge.registries; -import com.google.common.collect.*; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; import com.mojang.serialization.Lifecycle; - -import java.util.*; - +import net.minecraft.core.DefaultedRegistry; +import net.minecraft.core.IdMapper; +import net.minecraft.core.MappedRegistry; +import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; -import net.minecraft.world.level.block.AirBlock; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.network.syncher.EntityDataSerializer; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.DefaultAttributes; -import net.minecraft.world.entity.ai.memory.MemoryModuleType; -import net.minecraft.world.entity.schedule.Activity; -import net.minecraft.world.entity.schedule.Schedule; -import net.minecraft.world.entity.ai.sensing.SensorType; -import net.minecraft.world.entity.decoration.Motive; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.network.syncher.EntityDataSerializer; -import net.minecraft.core.particles.ParticleType; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.level.block.AirBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.stats.StatType; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.core.DefaultedRegistry; -import net.minecraft.core.Registry; -import net.minecraft.core.MappedRegistry; -import net.minecraft.world.entity.ai.village.poi.PoiType; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.levelgen.DebugLevelSource; -import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType; -import net.minecraft.world.level.levelgen.carver.WorldCarver; import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.StructureFeature; -import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; -import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Material; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.util.LogMessageAdapter; import net.minecraftforge.common.world.ForgeWorldPreset; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.event.RegistryEvent.MissingMappings; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.IModStateTransition; import net.minecraftforge.fml.StartupMessageManager; import net.minecraftforge.fml.util.EnhancedRuntimeException; import net.minecraftforge.fml.util.thread.EffectiveSide; - import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; - -import java.lang.reflect.Field; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; import java.util.function.BiConsumer; -import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES; import static net.minecraftforge.registries.ForgeRegistries.Keys.*; -import net.minecraft.core.IdMapper; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; - /** * INTERNAL ONLY * MODDERS SHOULD HAVE NO REASON TO USE THIS CLASS @@ -97,7 +76,6 @@ public class GameData private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap"); private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid"); private static final ResourceLocation BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE = new ResourceLocation("minecraft:blockstatetopointofinteresttype"); - private static final ResourceLocation SERIALIZER_TO_ENTRY = new ResourceLocation("forge:serializer_to_entry"); private static final ResourceLocation STRUCTURES = new ResourceLocation("minecraft:structures"); private static boolean hasInit = false; @@ -120,77 +98,73 @@ public static void init() hasInit = true; // Game objects - makeRegistry(BLOCKS, Block.class, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").vanillaHolder(Block::builtInRegistryHolder).create(); - makeRegistry(FLUIDS, Fluid.class, "empty").vanillaHolder(Fluid::builtInRegistryHolder).create(); - makeRegistry(ITEMS, Item.class, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").vanillaHolder(Item::builtInRegistryHolder).create(); - makeRegistry(MOB_EFFECTS, MobEffect.class).legacyName("potions").create(); + makeRegistry(BLOCKS, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").vanillaHolder(Block::builtInRegistryHolder).create(); + makeRegistry(FLUIDS, "empty").vanillaHolder(Fluid::builtInRegistryHolder).create(); + makeRegistry(ITEMS, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").vanillaHolder(Item::builtInRegistryHolder).create(); + makeRegistry(MOB_EFFECTS).legacyName("potions").create(); //makeRegistry(BIOMES, Biome.class).legacyName("biomes").create(); - makeRegistry(SOUND_EVENTS, SoundEvent.class).legacyName("soundevents").create(); - makeRegistry(POTIONS, Potion.class, "empty").legacyName("potiontypes").create(); - makeRegistry(ENCHANTMENTS, Enchantment.class).legacyName("enchantments").create(); - makeRegistry(ENTITY_TYPES, c(EntityType.class), "pig").legacyName("entities").vanillaHolder(EntityType::builtInRegistryHolder).create(); - makeRegistry(BLOCK_ENTITY_TYPES, c(BlockEntityType.class)).disableSaving().legacyName("blockentities").create(); - makeRegistry(PARTICLE_TYPES, c(ParticleType.class)).disableSaving().create(); - makeRegistry(CONTAINER_TYPES, c(MenuType.class)).disableSaving().create(); - makeRegistry(PAINTING_TYPES, Motive.class, "kebab").create(); - makeRegistry(RECIPE_SERIALIZERS, c(RecipeSerializer.class)).disableSaving().create(); - makeRegistry(ATTRIBUTES, Attribute.class).onValidate(AttributeCallbacks.INSTANCE).disableSaving().disableSync().create(); - makeRegistry(STAT_TYPES, c(StatType.class)).create(); + makeRegistry(SOUND_EVENTS).legacyName("soundevents").create(); + makeRegistry(POTIONS, "empty").legacyName("potiontypes").create(); + makeRegistry(ENCHANTMENTS).legacyName("enchantments").create(); + makeRegistry(ENTITY_TYPES, "pig").legacyName("entities").vanillaHolder(EntityType::builtInRegistryHolder).create(); + makeRegistry(BLOCK_ENTITY_TYPES).disableSaving().legacyName("blockentities").create(); + makeRegistry(PARTICLE_TYPES).disableSaving().create(); + makeRegistry(CONTAINER_TYPES).disableSaving().create(); + makeRegistry(PAINTING_VARIANTS, "kebab").create(); + makeRegistry(RECIPE_TYPES).disableSaving().disableSync().create(); + makeRegistry(RECIPE_SERIALIZERS).disableSaving().create(); + makeRegistry(ATTRIBUTES).onValidate(AttributeCallbacks.INSTANCE).disableSaving().disableSync().create(); + makeRegistry(STAT_TYPES).create(); // Villagers - makeRegistry(VILLAGER_PROFESSIONS, VillagerProfession.class, "none").create(); - makeRegistry(POI_TYPES, PoiType.class, "unemployed").addCallback(PointOfInterestTypeCallbacks.INSTANCE).disableSync().create(); - makeRegistry(MEMORY_MODULE_TYPES, c(MemoryModuleType.class), "dummy").disableSync().create(); - makeRegistry(SENSOR_TYPES, c(SensorType.class), "dummy").disableSaving().disableSync().create(); - makeRegistry(SCHEDULES, Schedule.class).disableSaving().disableSync().create(); - makeRegistry(ACTIVITIES, Activity.class).disableSaving().disableSync().create(); + makeRegistry(VILLAGER_PROFESSIONS, "none").create(); + makeRegistry(POI_TYPES).addCallback(PointOfInterestTypeCallbacks.INSTANCE).disableSync().create(); + makeRegistry(MEMORY_MODULE_TYPES, "dummy").disableSync().create(); + makeRegistry(SENSOR_TYPES, "dummy").disableSaving().disableSync().create(); + makeRegistry(SCHEDULES).disableSaving().disableSync().create(); + makeRegistry(ACTIVITIES).disableSaving().disableSync().create(); // Worldgen - makeRegistry(WORLD_CARVERS, c(WorldCarver.class)).disableSaving().disableSync().create(); - makeRegistry(FEATURES, c(Feature.class)).addCallback(FeatureCallbacks.INSTANCE).disableSaving().disableSync().create(); - makeRegistry(CHUNK_STATUS, ChunkStatus.class, "empty").disableSaving().disableSync().create(); - makeRegistry(STRUCTURE_FEATURES, c(StructureFeature.class)).disableSaving().disableSync().create(); - makeRegistry(BLOCK_STATE_PROVIDER_TYPES, c(BlockStateProviderType.class)).disableSaving().disableSync().create(); - makeRegistry(FOLIAGE_PLACER_TYPES, c(FoliagePlacerType.class)).disableSaving().disableSync().create(); - makeRegistry(TREE_DECORATOR_TYPES, c(TreeDecoratorType.class)).disableSaving().disableSync().create(); + makeRegistry(WORLD_CARVERS).disableSaving().disableSync().create(); + makeRegistry(FEATURES).addCallback(FeatureCallbacks.INSTANCE).disableSaving().disableSync().create(); + makeRegistry(CHUNK_STATUS, "empty").disableSaving().disableSync().create(); + makeRegistry(BLOCK_STATE_PROVIDER_TYPES).disableSaving().disableSync().create(); + makeRegistry(FOLIAGE_PLACER_TYPES).disableSaving().disableSync().create(); + makeRegistry(TREE_DECORATOR_TYPES).disableSaving().disableSync().create(); // Dynamic Worldgen - makeRegistry(BIOMES, Biome.class).disableSync().create(); + makeRegistry(BIOMES).disableSync().create(); } - static RegistryBuilder getDataSerializersRegistryBuilder() + static RegistryBuilder> getDataSerializersRegistryBuilder() { - return makeRegistry(DATA_SERIALIZERS, DataSerializerEntry.class, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides() - .addCallback(SerializerCallbacks.INSTANCE); + return makeRegistry(DATA_SERIALIZERS, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides(); } static RegistryBuilder> getGLMSerializersRegistryBuilder() { - return makeRegistry(LOOT_MODIFIER_SERIALIZERS, c(GlobalLootModifierSerializer.class)).disableSaving().disableSync(); + return makeRegistry(LOOT_MODIFIER_SERIALIZERS).disableSaving().disableSync(); } static RegistryBuilder getWorldTypesRegistryBuilder() { - return makeRegistry(WORLD_TYPES, ForgeWorldPreset.class).disableSaving().disableSync(); + return makeRegistry(WORLD_TYPES).disableSaving().disableSync(); } - @SuppressWarnings("unchecked") //Ugly hack to let us pass in a typed Class object. Remove when we remove type specific references. - static Class c(Class cls) { return (Class)cls; } - - private static > RegistryBuilder makeRegistry(ResourceKey> key, Class type) + private static RegistryBuilder makeRegistry(ResourceKey> key) { - return new RegistryBuilder().setName(key.location()).setType(type).setMaxID(MAX_VARINT).hasWrapper(); + return new RegistryBuilder().setName(key.location()).setMaxID(MAX_VARINT).hasWrapper(); } - private static > RegistryBuilder makeRegistry(ResourceKey> key, Class type, int min, int max) + private static RegistryBuilder makeRegistry(ResourceKey> key, int min, int max) { - return new RegistryBuilder().setName(key.location()).setType(type).setIDRange(min, max).hasWrapper(); + return new RegistryBuilder().setName(key.location()).setIDRange(min, max).hasWrapper(); } - private static > RegistryBuilder makeRegistry(ResourceKey> key, Class type, String _default) + private static RegistryBuilder makeRegistry(ResourceKey> key, String _default) { - return new RegistryBuilder().setName(key.location()).setType(type).setMaxID(MAX_VARINT).hasWrapper().setDefaultKey(new ResourceLocation(_default)); + return new RegistryBuilder().setName(key.location()).setMaxID(MAX_VARINT).hasWrapper().setDefaultKey(new ResourceLocation(_default)); } - public static > MappedRegistry getWrapper(ResourceKey> key, Lifecycle lifecycle) + public static MappedRegistry getWrapper(ResourceKey> key, Lifecycle lifecycle) { IForgeRegistry reg = RegistryManager.ACTIVE.getRegistry(key); Validate.notNull(reg, "Attempted to get vanilla wrapper for unknown registry: " + key.toString()); @@ -200,7 +174,7 @@ public static > MappedRegistry getWrapper(Re return ret; } - public static > DefaultedRegistry getWrapper(ResourceKey> key, Lifecycle lifecycle, String defKey) + public static DefaultedRegistry getWrapper(ResourceKey> key, Lifecycle lifecycle, String defKey) { IForgeRegistry reg = RegistryManager.ACTIVE.getRegistry(key); Validate.notNull(reg, "Attempted to get vanilla wrapper for unknown registry: " + key.toString()); @@ -228,37 +202,13 @@ public static Map getBlockStatePointOfInterestTypeMap() return RegistryManager.ACTIVE.getRegistry(POI_TYPES).getSlaveMap(BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE, Map.class); } - @SuppressWarnings("unchecked") - public static Map, DataSerializerEntry> getSerializerMap() - { - ForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(DATA_SERIALIZERS); - return registry == null ? null : registry.getSlaveMap(SERIALIZER_TO_ENTRY, Map.class); - } - - @SuppressWarnings("unchecked") - public static BiMap> getStructureMap() - { - return (BiMap>) RegistryManager.ACTIVE.getRegistry(FEATURES).getSlaveMap(STRUCTURES, BiMap.class); - } - - public static > K register_impl(K value) - { - Validate.notNull(value, "Attempted to register a null object"); - Validate.notNull(value.getRegistryName(), String.format(Locale.ENGLISH, "Attempt to register object without having set a registry name %s (type %s)", value, value.getClass().getName())); - final IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(value.getRegistryType()); - Validate.notNull(registry, "Attempted to registry object without creating registry first: " + value.getRegistryType().getName()); - registry.register(value); - return value; - } - @SuppressWarnings({ "unchecked", "rawtypes" }) public static void vanillaSnapshot() { LOGGER.debug(REGISTRIES, "Creating vanilla freeze snapshot"); - for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) + for (Map.Entry> r : RegistryManager.ACTIVE.registries.entrySet()) { - final Class clazz = RegistryManager.ACTIVE.getSuperType(r.getKey()); - loadRegistry(r.getKey(), RegistryManager.ACTIVE, RegistryManager.VANILLA, clazz, true); + loadRegistry(r.getKey(), RegistryManager.ACTIVE, RegistryManager.VANILLA, true); } RegistryManager.VANILLA.registries.forEach((name, reg) -> { @@ -282,10 +232,9 @@ public static void freezeData() LOGGER.debug(REGISTRIES, "Freezing registries"); Registry.REGISTRY.stream().filter(r -> r instanceof MappedRegistry).forEach(r -> ((MappedRegistry)r).freeze()); - for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) + for (Map.Entry> r : RegistryManager.ACTIVE.registries.entrySet()) { - final Class clazz = RegistryManager.ACTIVE.getSuperType(r.getKey()); - loadRegistry(r.getKey(), RegistryManager.ACTIVE, RegistryManager.FROZEN, clazz, true); + loadRegistry(r.getKey(), RegistryManager.ACTIVE, RegistryManager.FROZEN, true); } RegistryManager.FROZEN.registries.forEach((name, reg) -> { @@ -318,15 +267,14 @@ public static void revertTo(final RegistryManager target, boolean fireEvents) RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.resetDelegates()); LOGGER.debug(REGISTRIES, "Reverting to {} data state.", target.getName()); - for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) + for (Map.Entry> r : RegistryManager.ACTIVE.registries.entrySet()) { - final Class clazz = RegistryManager.ACTIVE.getSuperType(r.getKey()); - loadRegistry(r.getKey(), target, RegistryManager.ACTIVE, clazz, true); + loadRegistry(r.getKey(), target, RegistryManager.ACTIVE, true); } RegistryManager.ACTIVE.registries.forEach((name, reg) -> reg.bake()); // the id mapping has reverted, fire remap events for those that care about id changes if (fireEvents) { - fireRemapEvent(ImmutableMap.of(), true); + fireRemapEvent(ImmutableMap.of(), true); ObjectHolderRegistry.applyObjectHolders(); } @@ -338,14 +286,19 @@ public static void revertTo(final RegistryManager target, boolean fireEvents) public static void revert(RegistryManager state, ResourceLocation registry, boolean lock) { LOGGER.debug(REGISTRIES, "Reverting {} to {}", registry, state.getName()); - final Class clazz = RegistryManager.ACTIVE.getSuperType(registry); - loadRegistry(registry, state, RegistryManager.ACTIVE, clazz, lock); + loadRegistry(registry, state, RegistryManager.ACTIVE, lock); LOGGER.debug(REGISTRIES, "Reverting complete"); } - public static Stream> generateRegistryEvents() { - List keys = Lists.newArrayList(RegistryManager.ACTIVE.registries.keySet()); - keys.sort((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2))); + @SuppressWarnings("deprecation") + public static void postRegisterEvents() + { + Set keySet = new HashSet<>(RegistryManager.ACTIVE.registries.keySet()); + keySet.addAll(RegistryManager.getVanillaRegistryKeys()); + keySet.addAll(BuiltinRegistries.REGISTRY.keySet()); + List keys = keySet.stream() + .sorted((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2))) + .collect(Collectors.toList()); //Move Blocks to first, and Items to second. keys.remove(BLOCKS.location()); @@ -354,65 +307,44 @@ public static Stream> generateRegistryEven keys.add(0, BLOCKS.location()); keys.add(1, ITEMS.location()); - final Function> registerEventGenerator = rl -> RegistryManager.ACTIVE.getRegistry(rl).getRegisterEvent(rl); - return keys.stream().map(rl -> IModStateTransition.EventGenerator.fromFunction(mc -> registerEventGenerator.apply(rl))); - } - - public static CompletableFuture> preRegistryEventDispatch(final Executor executor, final IModStateTransition.EventGenerator> eventGenerator) { - return CompletableFuture.runAsync(()-> { - final RegistryEvent.Register event = eventGenerator.apply(null); - final ResourceLocation rl = event.getName(); - ForgeRegistry fr = (ForgeRegistry) event.getRegistry(); - StartupMessageManager.modLoaderConsumer().ifPresent(s -> s.accept("REGISTERING " + rl)); - fr.unfreeze(); - }, executor).thenApply(v->Collections.emptyList()); - } - - public static CompletableFuture> postRegistryEventDispatch(final Executor executor, final IModStateTransition.EventGenerator> eventGenerator) { - return CompletableFuture.runAsync(()-> { - final RegistryEvent.Register event = eventGenerator.apply(null); - final ResourceLocation rl = event.getName(); - ForgeRegistry fr = (ForgeRegistry) event.getRegistry(); - fr.freeze(); - applyHolderLookups(rl); - }, executor).handle((v, t)->t != null ? Collections.singletonList(t): Collections.emptyList()); - } + RuntimeException aggregate = new RuntimeException(); - private static void applyHolderLookups(ResourceLocation registryName) - { - LOGGER.debug(REGISTRIES, "Applying holder lookups: {}", registryName); - ObjectHolderRegistry.applyObjectHolders(registryName::equals); - LOGGER.debug(REGISTRIES, "Holder lookups applied: {}", registryName); - } - - @SuppressWarnings("deprecation") - public static CompletableFuture> checkForRevertToVanilla(final Executor executor, final CompletableFuture> listCompletableFuture) { - return listCompletableFuture.whenCompleteAsync((errors, except) -> { - if (except != null) { - LOGGER.fatal("Detected errors during registry event dispatch, rolling back to VANILLA state"); - revertTo(RegistryManager.VANILLA, false); - LOGGER.fatal("Detected errors during registry event dispatch, roll back to VANILLA complete"); - } else { - RegistryManager.getVanillaRegistryKeys().forEach(registryName -> { - Registry registry = Registry.REGISTRY.get(registryName); - if (registry == null) - return; - postVanillaRegisterEvent(registry); - }); - BuiltinRegistries.REGISTRY.forEach(GameData::postVanillaRegisterEvent); - net.minecraftforge.common.ForgeHooks.modifyAttributes(); + for (ResourceLocation rootRegistryName : keys) + { + try + { + ResourceKey> registryKey = ResourceKey.createRegistryKey(rootRegistryName); + ForgeRegistry forgeRegistry = RegistryManager.ACTIVE.getRegistry(rootRegistryName); + Registry vanillaRegistry = Registry.REGISTRY.containsKey(rootRegistryName) ? Registry.REGISTRY.get(rootRegistryName) : BuiltinRegistries.REGISTRY.get(rootRegistryName); + RegisterEvent registerEvent = new RegisterEvent(registryKey, forgeRegistry, vanillaRegistry); + + StartupMessageManager.modLoaderConsumer().ifPresent(s -> s.accept("REGISTERING " + registryKey.location())); + if (forgeRegistry != null) + forgeRegistry.unfreeze(); + + ModLoader.get().postEvent(registerEvent); + + if (forgeRegistry != null) + forgeRegistry.freeze(); + LOGGER.debug(REGISTRIES, "Applying holder lookups: {}", registryKey.location()); + ObjectHolderRegistry.applyObjectHolders(registryKey.location()::equals); + LOGGER.debug(REGISTRIES, "Holder lookups applied: {}", registryKey.location()); + } catch (Throwable t) + { + aggregate.addSuppressed(t); } - }, executor); - } - - @SuppressWarnings("removal") - private static void postVanillaRegisterEvent(Registry registry) - { - if (RegistryManager.ACTIVE.getRegistry(registry.key().location()) != null) - return; + } - ModLoader.get().postEvent(new VanillaRegisterEvent(registry)); - applyHolderLookups(registry.key().location()); + if (aggregate.getSuppressed().length > 0) + { + LOGGER.fatal("Failed to register some entries, see suppressed exceptions for details", aggregate); + LOGGER.fatal("Detected errors during registry event dispatch, rolling back to VANILLA state"); + revertTo(RegistryManager.VANILLA, false); + LOGGER.fatal("Detected errors during registry event dispatch, roll back to VANILLA complete"); + } else + { + ForgeHooks.modifyAttributes(); + } } //Lets us clear the map so we can rebuild it. @@ -440,7 +372,7 @@ private static class BlockCallbacks implements IForgeRegistry.AddCallback static final BlockCallbacks INSTANCE = new BlockCallbacks(); @Override - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, Block block, @Nullable Block oldBlock) + public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, Block block, @Nullable Block oldBlock) { if (oldBlock != null) { @@ -448,7 +380,7 @@ public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, in StateDefinition newContainer = block.getStateDefinition(); // Test vanilla blockstates, if the number matches, make sure they also match in their string representations - if (block.getRegistryName().getNamespace().equals("minecraft") && !oldContainer.getProperties().equals(newContainer.getProperties())) + if (key.location().getNamespace().equals("minecraft") && !oldContainer.getProperties().equals(newContainer.getProperties())) { String oldSequence = oldContainer.getProperties().stream() .map(s -> String.format(Locale.ENGLISH, "%s={%s}", s.getName(), @@ -460,8 +392,8 @@ public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, in .collect(Collectors.joining(";")); LOGGER.error(REGISTRIES,()-> LogMessageAdapter.adapt(sb-> { - sb.append("Registry replacements for vanilla block '").append(block.getRegistryName()). - append("' must not change the number or order of blockstates.\n"); + sb.append("Registry replacements for vanilla block '").append(key.location()) + .append("' must not change the number or order of blockstates.\n"); sb.append("\tOld: ").append(oldSequence).append('\n'); sb.append("\tNew: ").append(newSequence); })); @@ -500,7 +432,6 @@ public int getId(BlockState key) public Block createDummy(ResourceLocation key) { Block ret = new BlockDummyAir(Block.Properties.of(Material.AIR)); - GameData.forceRegistryName(ret, key); return ret; } @@ -543,7 +474,7 @@ private static class ItemCallbacks implements IForgeRegistry.AddCallback, static final ItemCallbacks INSTANCE = new ItemCallbacks(); @Override - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, Item item, @Nullable Item oldItem) + public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, Item item, @Nullable Item oldItem) { if (oldItem instanceof BlockItem) { @@ -586,32 +517,6 @@ public void onValidate(IForgeRegistryInternal owner, RegistryManager } } - private static class SerializerCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.CreateCallback - { - static final SerializerCallbacks INSTANCE = new SerializerCallbacks(); - - @Override - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, DataSerializerEntry entry, @Nullable DataSerializerEntry oldEntry) - { - @SuppressWarnings("unchecked") - Map, DataSerializerEntry> map = owner.getSlaveMap(SERIALIZER_TO_ENTRY, Map.class); - if (oldEntry != null) map.remove(oldEntry.getSerializer()); - map.put(entry.getSerializer(), entry); - } - - @Override - public void onClear(IForgeRegistryInternal owner, RegistryManager stage) - { - owner.getSlaveMap(SERIALIZER_TO_ENTRY, Map.class).clear(); - } - - @Override - public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) - { - owner.setSlaveMap(SERIALIZER_TO_ENTRY, new IdentityHashMap<>()); - } - } - private static class FeatureCallbacks implements IForgeRegistry.ClearCallback>, IForgeRegistry.CreateCallback> { static final FeatureCallbacks INSTANCE = new FeatureCallbacks(); @@ -629,19 +534,19 @@ public void onCreate(IForgeRegistryInternal> owner, RegistryManager s } } - private static class PointOfInterestTypeCallbacks implements IForgeRegistry.AddCallback , IForgeRegistry.ClearCallback, IForgeRegistry.CreateCallback + private static class PointOfInterestTypeCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.CreateCallback { static final PointOfInterestTypeCallbacks INSTANCE = new PointOfInterestTypeCallbacks(); @Override - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, PoiType obj, @Nullable PoiType oldObj) + public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, PoiType obj, @Nullable PoiType oldObj) { Map map = owner.getSlaveMap(BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE, Map.class); if (oldObj != null) { - oldObj.getBlockStates().forEach(map::remove); + oldObj.matchingStates().forEach(map::remove); } - obj.getBlockStates().forEach((state) -> + obj.matchingStates().forEach((state) -> { PoiType oldType = map.put(state, obj); if (oldType != null) @@ -664,7 +569,7 @@ public void onCreate(IForgeRegistryInternal owner, RegistryManager stag } } - private static > void loadRegistry(final ResourceLocation registryName, final RegistryManager from, final RegistryManager to, final Class regType, boolean freeze) + private static void loadRegistry(final ResourceLocation registryName, final RegistryManager from, final RegistryManager to, boolean freeze) { ForgeRegistry fromRegistry = from.getRegistry(registryName); if (fromRegistry == null) @@ -739,15 +644,14 @@ public static Multimap injectSnapshot(Map> remaps = Maps.newHashMap(); + final Map> remaps = Maps.newHashMap(); final LinkedHashMap> missing = Maps.newLinkedHashMap(); // Load the snapshot into the "STAGING" registry snapshot.forEach((key, value) -> { - final Class clazz = RegistryManager.ACTIVE.getSuperType(key); remaps.put(key, Maps.newLinkedHashMap()); missing.put(key, Maps.newLinkedHashMap()); - loadPersistentDataToStagingRegistry(RegistryManager.ACTIVE, STAGING, remaps.get(key), missing.get(key), key, value, clazz); + loadPersistentDataToStagingRegistry(RegistryManager.ACTIVE, STAGING, remaps.get(key), missing.get(key), key, value); }); snapshot.forEach((key, value) -> @@ -789,21 +693,25 @@ else if (isLocalWorld) { ResourceLocation name = m.getKey(); ForgeRegistry reg = STAGING.getRegistry(name); - RegistryEvent.MissingMappings event = reg.getMissingEvent(name, m.getValue()); + MissingMappingsEvent event = reg.getMissingEvent(name, m.getValue()); MinecraftForge.EVENT_BUS.post(event); - List> lst = event.getAllMappings().stream().filter(e -> e.getAction() == MissingMappings.Action.DEFAULT).sorted((a, b) -> a.toString().compareTo(b.toString())).collect(Collectors.toList()); + List> lst = event.getAllMappings(reg.getRegistryKey()).stream() + .filter(e -> e.action == MissingMappingsEvent.Action.DEFAULT) + .sorted(Comparator.comparing(Object::toString)) + .collect(Collectors.toList()); if (!lst.isEmpty()) { - LOGGER.error(REGISTRIES,()->LogMessageAdapter.adapt(sb->{ + LOGGER.error(REGISTRIES, () -> LogMessageAdapter.adapt(sb -> { sb.append("Unidentified mapping from registry ").append(name).append('\n'); - lst.stream().sorted().forEach(map->sb.append('\t').append(map.key).append(": ").append(map.id).append('\n')); + lst.stream().sorted().forEach(map -> sb.append('\t').append(map.key).append(": ").append(map.id).append('\n')); })); } - event.getAllMappings().stream().filter(e -> e.getAction() == MissingMappings.Action.FAIL).forEach(fail -> failed.put(name, fail.key)); + event.getAllMappings(reg.getRegistryKey()).stream() + .filter(e -> e.action == MissingMappingsEvent.Action.FAIL) + .forEach(fail -> failed.put(name, fail.key)); - final Class clazz = RegistryManager.ACTIVE.getSuperType(name); - processMissing(clazz, name, STAGING, event, m.getValue(), remaps.get(name), defaulted.get(name), failed.get(name), !isLocalWorld); + processMissing(name, STAGING, event, m.getValue(), remaps.get(name), defaulted.get(name), failed.get(name), !isLocalWorld); }); if (!defaulted.isEmpty() && !isLocalWorld) @@ -853,8 +761,7 @@ else if (isLocalWorld) // So we load it from the frozen persistent registry RegistryManager.ACTIVE.registries.forEach((name, reg) -> { - final Class clazz = RegistryManager.ACTIVE.getSuperType(name); - loadFrozenDataToStagingRegistry(STAGING, name, remaps.get(name), clazz); + loadFrozenDataToStagingRegistry(STAGING, name, remaps.get(name)); }); } @@ -862,11 +769,10 @@ else if (isLocalWorld) STAGING.registries.forEach((name, reg) -> reg.validateContent(name)); // Load the STAGING registry into the ACTIVE registry - //for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) + //for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) RegistryManager.ACTIVE.registries.forEach((key, value) -> { - final Class registrySuperType = RegistryManager.ACTIVE.getSuperType(key); - loadRegistry(key, STAGING, RegistryManager.ACTIVE, registrySuperType, true); + loadRegistry(key, STAGING, RegistryManager.ACTIVE, true); }); RegistryManager.ACTIVE.registries.forEach((name, reg) -> { @@ -886,14 +792,14 @@ else if (isLocalWorld) return ArrayListMultimap.create(); } - private static void fireRemapEvent(final Map> remaps, final boolean isFreezing) { + private static void fireRemapEvent(final Map> remaps, final boolean isFreezing) { StartupMessageManager.modLoaderConsumer().ifPresent(s->s.accept("Remapping mod data")); - MinecraftForge.EVENT_BUS.post(new RegistryEvent.IdMappingEvent(remaps, isFreezing)); + MinecraftForge.EVENT_BUS.post(new IdMappingEvent(remaps, isFreezing)); StartupMessageManager.modLoaderConsumer().ifPresent(s->s.accept("Remap complete")); } //Has to be split because of generics, Yay! - private static > void loadPersistentDataToStagingRegistry(RegistryManager pool, RegistryManager to, Map remaps, Map missing, ResourceLocation name, ForgeRegistry.Snapshot snap, Class regType) + private static void loadPersistentDataToStagingRegistry(RegistryManager pool, RegistryManager to, Map remaps, Map missing, ResourceLocation name, ForgeRegistry.Snapshot snap) { ForgeRegistry active = pool.getRegistry(name); if (active == null) @@ -908,15 +814,15 @@ private static > void loadPersistentDataToStagi //Another bouncer for generic reasons @SuppressWarnings("unchecked") - private static > void processMissing(Class clazz, ResourceLocation name, RegistryManager STAGING, MissingMappings e, Map missing, Map remaps, Collection defaulted, Collection failed, boolean injectNetworkDummies) + private static void processMissing(ResourceLocation name, RegistryManager STAGING, MissingMappingsEvent e, Map missing, Map remaps, Collection defaulted, Collection failed, boolean injectNetworkDummies) { - List> mappings = ((MissingMappings)e).getAllMappings(); + List> mappings = e.getAllMappings(ResourceKey.createRegistryKey(name)); ForgeRegistry active = RegistryManager.ACTIVE.getRegistry(name); ForgeRegistry staging = STAGING.getRegistry(name); staging.processMissingEvent(name, active, mappings, missing, remaps, defaulted, failed, injectNetworkDummies); } - private static > void loadFrozenDataToStagingRegistry(RegistryManager STAGING, ResourceLocation name, Map remaps, Class clazz) + private static void loadFrozenDataToStagingRegistry(RegistryManager STAGING, ResourceLocation name, Map remaps) { ForgeRegistry frozen = RegistryManager.FROZEN.getRegistry(name); ForgeRegistry newRegistry = STAGING.getRegistry(name, RegistryManager.FROZEN); @@ -943,37 +849,9 @@ public static ResourceLocation checkPrefix(String name, boolean warnOverrides) String prefix = ModLoadingContext.get().getActiveNamespace(); if (warnOverrides && !oldPrefix.equals(prefix) && oldPrefix.length() > 0) { - LogManager.getLogger().info("Potentially Dangerous alternative prefix `{}` for name `{}`, expected `{}`. This could be a intended override, but in most cases indicates a broken mod.", oldPrefix, name, prefix); + LogManager.getLogger().debug("Mod `{}` attempting to register `{}` to the namespace `{}`. This could be intended, but likely means an EventBusSubscriber without a modid.", prefix, name, oldPrefix); prefix = oldPrefix; } return new ResourceLocation(prefix, name); } - - private static Field regName; - private static void forceRegistryName(IForgeRegistryEntry entry, ResourceLocation name) - { - if (regName == null) - { - try - { - regName = ForgeRegistryEntry.class.getDeclaredField("registryName"); - regName.setAccessible(true); - } - catch (NoSuchFieldException | SecurityException e) - { - LOGGER.error(REGISTRIES, "Could not get `registryName` field from IForgeRegistryEntry.Impl", e); - throw new RuntimeException(e); - } - } - try - { - regName.set(entry, name); - } - catch (IllegalArgumentException | IllegalAccessException e) - { - LOGGER.error(REGISTRIES,"Could not set `registryName` field in IForgeRegistryEntry.Impl to `{}`", name.toString(), e); - throw new RuntimeException(e); - } - - } } diff --git a/src/main/java/net/minecraftforge/registries/IForgeRegistry.java b/src/main/java/net/minecraftforge/registries/IForgeRegistry.java index f532a397e3c..aa701f6d595 100644 --- a/src/main/java/net/minecraftforge/registries/IForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/IForgeRegistry.java @@ -24,16 +24,17 @@ * * @param The top level type for the registry */ -public interface IForgeRegistry> extends Iterable +public interface IForgeRegistry extends Iterable { ResourceKey> getRegistryKey(); ResourceLocation getRegistryName(); - Class getRegistrySuperType(); - void register(V value); - - @SuppressWarnings("unchecked") - void registerAll(V... values); + /** + * The supplied string key will be prefixed with the currently active mod's mod id. + * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. + */ + void register(String key, V value); + void register(ResourceLocation key, V value); boolean containsKey(ResourceLocation key); boolean containsValue(V value); @@ -76,6 +77,13 @@ public interface IForgeRegistry> extends Iterab */ @Nullable ITagManager tags(); + @NotNull Optional> getDelegate(ResourceKey rkey); + @NotNull Holder.Reference getDelegateOrThrow(ResourceKey rkey); + @NotNull Optional> getDelegate(ResourceLocation key); + @NotNull Holder.Reference getDelegateOrThrow(ResourceLocation key); + @NotNull Optional> getDelegate(V value); + @NotNull Holder.Reference getDelegateOrThrow(V value); + /** * Retrieve the slave map of type T from the registry. * Slave maps are maps which are dependent on registry content in some way. @@ -91,9 +99,9 @@ public interface IForgeRegistry> extends Iterab * on the client side from a server side synchronization, or when a world is loaded. */ @FunctionalInterface - interface AddCallback> + interface AddCallback { - void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, V obj, @Nullable V oldObj); + void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, V obj, @Nullable V oldObj); } /** @@ -101,7 +109,7 @@ interface AddCallback> * or server. */ @FunctionalInterface - interface ClearCallback> + interface ClearCallback { void onClear(IForgeRegistryInternal owner, RegistryManager stage); } @@ -110,7 +118,7 @@ interface ClearCallback> * Callback fired when a registry instance is created. Populate slave maps here. */ @FunctionalInterface - interface CreateCallback> + interface CreateCallback { void onCreate(IForgeRegistryInternal owner, RegistryManager stage); } @@ -119,7 +127,7 @@ interface CreateCallback> * Callback fired when the registry contents are validated. */ @FunctionalInterface - interface ValidateCallback> + interface ValidateCallback { void onValidate(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceLocation key, V obj); } @@ -128,7 +136,7 @@ interface ValidateCallback> * Callback fired when the registry is done processing. Used to calculate state ID maps. */ @FunctionalInterface - interface BakeCallback> + interface BakeCallback { void onBake(IForgeRegistryInternal owner, RegistryManager stage); } @@ -137,7 +145,7 @@ interface BakeCallback> * Factory for creating dummy entries, allowing worlds to be loaded and keep the missing block references. */ @FunctionalInterface - interface DummyFactory> + interface DummyFactory { V createDummy(ResourceLocation key); } @@ -146,7 +154,7 @@ interface DummyFactory> * */ @FunctionalInterface - interface MissingFactory> + interface MissingFactory { V createMissing(ResourceLocation key, boolean isNetwork); } diff --git a/src/main/java/net/minecraftforge/registries/IForgeRegistryEntry.java b/src/main/java/net/minecraftforge/registries/IForgeRegistryEntry.java deleted file mode 100644 index 93b75cb3da3..00000000000 --- a/src/main/java/net/minecraftforge/registries/IForgeRegistryEntry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; -import net.minecraft.resources.ResourceLocation; - -import javax.annotation.Nullable; - -public interface IForgeRegistryEntry -{ - /** - * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. - * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. - * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. - * - * The supplied name will be prefixed with the currently active mod's modId. - * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. - * - * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. - * - * Returns 'this' to allow for chaining. - * - * @param name Unique registry name - * @return This instance - */ - V setRegistryName(ResourceLocation name); - - /** - * A unique identifier for this entry, if this entry is registered already it will return it's official registry name. - * Otherwise it will return the name set in setRegistryName(). - * If neither are valid null is returned. - * - * @return Unique identifier or null. - */ - @Nullable - ResourceLocation getRegistryName(); - - /** - * Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one - * registry per concrete class. - * - * @return Root registry type. - */ - Class getRegistryType(); -} diff --git a/src/main/java/net/minecraftforge/registries/IForgeRegistryInternal.java b/src/main/java/net/minecraftforge/registries/IForgeRegistryInternal.java index be52423fa9a..f4ba3d7890e 100644 --- a/src/main/java/net/minecraftforge/registries/IForgeRegistryInternal.java +++ b/src/main/java/net/minecraftforge/registries/IForgeRegistryInternal.java @@ -7,7 +7,7 @@ import net.minecraft.resources.ResourceLocation; -public interface IForgeRegistryInternal> extends IForgeRegistry +public interface IForgeRegistryInternal extends IForgeRegistry { void setSlaveMap(ResourceLocation name, Object obj); } diff --git a/src/main/java/net/minecraftforge/registries/IForgeRegistryModifiable.java b/src/main/java/net/minecraftforge/registries/IForgeRegistryModifiable.java index b280fcc2f28..ad383b006fe 100644 --- a/src/main/java/net/minecraftforge/registries/IForgeRegistryModifiable.java +++ b/src/main/java/net/minecraftforge/registries/IForgeRegistryModifiable.java @@ -7,7 +7,7 @@ import net.minecraft.resources.ResourceLocation; -public interface IForgeRegistryModifiable> extends IForgeRegistry +public interface IForgeRegistryModifiable extends IForgeRegistry { void clear(); V remove(ResourceLocation key); diff --git a/src/main/java/net/minecraftforge/registries/IHolderHelperHolder.java b/src/main/java/net/minecraftforge/registries/IHolderHelperHolder.java index 0756ee2a325..b137642e73b 100644 --- a/src/main/java/net/minecraftforge/registries/IHolderHelperHolder.java +++ b/src/main/java/net/minecraftforge/registries/IHolderHelperHolder.java @@ -5,7 +5,7 @@ package net.minecraftforge.registries; -interface IHolderHelperHolder> +interface IHolderHelperHolder { NamespacedHolderHelper getHolderHelper(); } diff --git a/src/main/java/net/minecraftforge/registries/IRegistryDelegate.java b/src/main/java/net/minecraftforge/registries/IRegistryDelegate.java deleted file mode 100644 index 62c0d9e293b..00000000000 --- a/src/main/java/net/minecraftforge/registries/IRegistryDelegate.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; - -import net.minecraft.resources.ResourceLocation; - -import java.util.function.Supplier; - - -/** - * A registry delegate for holding references to items or blocks - * These should be safe to use in things like lists though aliased items and blocks will not - * have object identity with respect to their delegate. - * - * @author cpw - * - * @param the type of thing we're holding onto - */ -public interface IRegistryDelegate extends Supplier { - /** - * Get the referent pointed at by this delegate. This will be the currently active item or block, and will change - * as world saves come and go. Note that item.delegate.get() may NOT be the same object as item, due to item and - * block substitution. - * - * @return The referred object - */ - @Override - T get(); - - /** - * Get the unique resource location for this delegate. Completely static after registration has completed, and - * will never change. - * @return The name - */ - ResourceLocation name(); - - /** - * Get the delegate type. It will be dependent on the registry this delegate is sourced from. - * @return The type of delegate - */ - Class type(); -} diff --git a/src/main/java/net/minecraftforge/registries/IdMappingEvent.java b/src/main/java/net/minecraftforge/registries/IdMappingEvent.java new file mode 100644 index 00000000000..f04c4dfb354 --- /dev/null +++ b/src/main/java/net/minecraftforge/registries/IdMappingEvent.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.registries; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.eventbus.api.Event; + +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +/** + * Called whenever the ID mapping might have changed. If you register for this event, you + * will be called back whenever the client or server loads an ID set. This includes both + * when the ID maps are loaded from disk, as well as when the ID maps revert to the initial + * state. + *

+ * Note: you cannot change the IDs that have been allocated, but you might want to use + * this event to update caches or other in-mod artifacts that might be impacted by an ID + * change. + *

+ * Fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS forge bus}. + */ +public class IdMappingEvent extends Event +{ + public static class ModRemapping + { + public final ResourceLocation registry; + public final ResourceLocation key; + public final int oldId; + public final int newId; + + private ModRemapping(ResourceLocation registry, ResourceLocation key, int oldId, int newId) + { + this.registry = registry; + this.key = key; + this.oldId = oldId; + this.newId = newId; + } + } + + public record IdRemapping(int currId, int newId) {} + + private final Map> remaps; + private final ImmutableSet keys; + + private final boolean isFrozen; + + public IdMappingEvent(Map> remaps, boolean isFrozen) + { + this.isFrozen = isFrozen; + this.remaps = Maps.newHashMap(); + remaps.forEach((name, rm) -> + { + List tmp = Lists.newArrayList(); + rm.forEach((key, value) -> tmp.add(new ModRemapping(name, key, value.currId, value.newId))); + tmp.sort(Comparator.comparingInt(o -> o.newId)); + this.remaps.put(name, ImmutableList.copyOf(tmp)); + }); + this.keys = ImmutableSet.copyOf(this.remaps.keySet()); + } + + public ImmutableSet getRegistries() + { + return this.keys; + } + + public ImmutableList getRemaps(ResourceLocation registry) + { + return this.remaps.get(registry); + } + + public boolean isFrozen() + { + return isFrozen; + } +} diff --git a/src/main/java/net/minecraftforge/registries/MissingMappingsEvent.java b/src/main/java/net/minecraftforge/registries/MissingMappingsEvent.java new file mode 100644 index 00000000000..8b8457ff01d --- /dev/null +++ b/src/main/java/net/minecraftforge/registries/MissingMappingsEvent.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.registries; + +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.eventbus.api.Event; +import org.apache.commons.lang3.Validate; + +import java.util.Collection; +import java.util.List; +import java.util.Locale; + +/** + * Fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS forge bus}. + */ +public class MissingMappingsEvent extends Event +{ + private final ResourceKey> key; + private final IForgeRegistry registry; + private final List> mappings; + + public MissingMappingsEvent(ResourceKey> key, IForgeRegistry registry, Collection> missed) + { + this.key = key; + this.registry = registry; + this.mappings = List.copyOf(missed); + } + + public ResourceKey> getKey() + { + return this.key; + } + + public IForgeRegistry getRegistry() + { + return this.registry; + } + + /** + * @return An immutable list of missing mappings for the given namespace. + * Empty if the registry key doesn't match {@link #getKey()}. + */ + @SuppressWarnings("unchecked") + public List> getMappings(ResourceKey> registryKey, String namespace) + { + return registryKey == this.key + ? (List>) (List) this.mappings.stream().filter(e -> e.key.getNamespace().equals(namespace)).toList() + : List.of(); + } + + /** + * @return An immutable list of all missing mappings. + * Empty if the registry key doesn't match {@link #getKey()}. + */ + @SuppressWarnings("unchecked") + public List> getAllMappings(ResourceKey> registryKey) + { + return registryKey == this.key ? (List>) (List) this.mappings : List.of(); + } + + /** + * Actions you can take with this missing mapping. + *

    + *
  • {@link #IGNORE} means this missing mapping will be ignored. + *
  • {@link #WARN} means this missing mapping will generate a warning. + *
  • {@link #FAIL} means this missing mapping will prevent the world from loading. + *
+ */ + public enum Action + { + /** + * Take the default action + */ + DEFAULT, + /** + * Ignore this missing mapping. This means the mapping will be abandoned + */ + IGNORE, + /** + * Generate a warning but allow loading to continue + */ + WARN, + /** + * Fail to load + */ + FAIL, + /** + * Remap this name to a new name (add a migration mapping) + */ + REMAP + } + + public static class Mapping implements Comparable> + { + private final IForgeRegistry registry; + private final IForgeRegistry pool; + final ResourceLocation key; + final int id; + Action action = Action.DEFAULT; + T target; + + public Mapping(IForgeRegistry registry, IForgeRegistry pool, ResourceLocation key, int id) + { + this.registry = registry; + this.pool = pool; + this.key = key; + this.id = id; + } + + /** + * Ignore the missing item. + */ + public void ignore() + { + action = Action.IGNORE; + } + + /** + * Warn the user about the missing item. + */ + public void warn() + { + action = Action.WARN; + } + + /** + * Prevent the world from loading due to the missing item. + */ + public void fail() + { + action = Action.FAIL; + } + + /** + * Remap the missing entry to the specified object. + *

+ * Use this if you have renamed an entry. + * Existing references using the old name will point to the new one. + * + * @param target Entry to remap to. + */ + public void remap(T target) + { + Validate.notNull(target, "Remap target can not be null"); + Validate.isTrue(pool.getKey(target) != null, + String.format(Locale.ENGLISH, "The specified entry %s hasn't been registered in registry yet.", target)); + action = Action.REMAP; + this.target = target; + } + + public IForgeRegistry getRegistry() + { + return this.registry; + } + + public ResourceLocation getKey() + { + return key; + } + + public int getId() + { + return this.id; + } + + @Override + public int compareTo(Mapping o) + { + int ret = this.registry.getRegistryName().compareNamespaced(o.registry.getRegistryName()); + if (ret == 0) + ret = this.key.compareNamespaced(o.key); + return ret; + } + } +} diff --git a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java index a32d455ca04..63bb0e53828 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java @@ -10,17 +10,16 @@ import java.util.Map; import java.util.Optional; import java.util.OptionalInt; -import java.util.Random; import java.util.Set; import java.util.function.Function; import java.util.stream.Stream; -import javax.annotation.Nullable; - +import com.mojang.serialization.DataResult; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; +import net.minecraft.util.RandomSource; import org.apache.commons.lang3.Validate; import net.minecraft.resources.ResourceKey; @@ -29,8 +28,9 @@ import net.minecraft.core.DefaultedRegistry; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; +import org.jetbrains.annotations.Nullable; -class NamespacedDefaultedWrapper> extends DefaultedRegistry implements ILockableRegistry, IHolderHelperHolder +class NamespacedDefaultedWrapper extends DefaultedRegistry implements ILockableRegistry, IHolderHelperHolder { private final ForgeRegistry delegate; private final NamespacedHolderHelper holders; @@ -54,14 +54,11 @@ public Holder registerMapping(final int id, final ResourceKey key, final T Validate.notNull(value); this.elementsLifecycle = this.elementsLifecycle.add(lifecycle); - if (value.getRegistryName() == null) - value.setRegistryName(key.location()); - - T oldValue = this.delegate.getRaw(value.getRegistryName()); + T oldValue = this.delegate.getRaw(key.location()); - int realId = this.delegate.add(id, value); + int realId = this.delegate.add(id, key.location(), value); - return this.holders.onAdded(RegistryManager.ACTIVE, realId, value, oldValue); + return this.holders.onAdded(RegistryManager.ACTIVE, realId, key, value, oldValue); } @Override @@ -194,8 +191,8 @@ public NamespacedHolderHelper getHolderHelper() @Override public Optional> getHolder(int id) { return this.holders.getHolder(id); } @Override public Optional> getHolder(ResourceKey key) { return this.holders.getHolder(key); } - @Override public Holder getOrCreateHolder(ResourceKey key) { return this.holders.getOrCreateHolder(key); } - @Override public Optional> getRandom(Random rand) { return this.holders.getRandom(rand); } + @Override public DataResult> getOrCreateHolder(ResourceKey key) { return DataResult.success(this.holders.getOrCreateHolder(key)); } + @Override public Optional> getRandom(RandomSource rand) { return this.holders.getRandom(rand); } @Override public Stream> holders() { return this.holders.holders(); } @Override public boolean isKnownTagName(TagKey name) { return this.holders.isKnownTagName(name); } @Override public Stream, HolderSet.Named>> getTags() { return this.holders.getTags(); } @@ -212,7 +209,7 @@ public NamespacedHolderHelper getHolderHelper() @Deprecated @Override public void lock(){ this.locked = true; } - public static class Factory> implements IForgeRegistry.CreateCallback, IForgeRegistry.AddCallback + public static class Factory implements IForgeRegistry.CreateCallback, IForgeRegistry.AddCallback { public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper"); @@ -225,9 +222,9 @@ public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) @Override @SuppressWarnings("unchecked") - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, V value, V oldValue) + public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, V value, V oldValue) { - owner.getSlaveMap(ID, NamespacedDefaultedWrapper.class).holders.onAdded(stage, id, value, oldValue); + owner.getSlaveMap(ID, NamespacedDefaultedWrapper.class).holders.onAdded(stage, id, key, value, oldValue); } } } diff --git a/src/main/java/net/minecraftforge/registries/NamespacedHolderHelper.java b/src/main/java/net/minecraftforge/registries/NamespacedHolderHelper.java index 5c54bb3a1ba..664b024da54 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedHolderHelper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedHolderHelper.java @@ -20,10 +20,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nullable; - import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; +import net.minecraft.util.RandomSource; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,8 +38,9 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -class NamespacedHolderHelper> +class NamespacedHolderHelper { private static final Logger LOGGER = LogManager.getLogger(); private final ForgeRegistry owner; @@ -100,7 +100,7 @@ Holder getOrCreateHolder(ResourceKey key) }); } - Optional> getRandom(Random rand) + Optional> getRandom(RandomSource rand) { Optional> ret = Util.getRandomSafe(this.getSortedHolders(), rand).map(Holder::hackyErase); if (this.defaultKey != null) @@ -247,13 +247,11 @@ boolean isIntrusive() } @Nullable - Holder onAdded(RegistryManager stage, int id, T newValue, T oldValue) + Holder onAdded(RegistryManager stage, int id, ResourceKey key, T newValue, T oldValue) { if (stage != RegistryManager.ACTIVE && (this.holderLookup == null || !stage.isStaging())) // Intrusive handlers need updating in staging. return null; // Only do holder shit on the active registries, not pending or snapshots. - ResourceKey key = ResourceKey.create(this.self.key(), newValue.getRegistryName()); - //Holder.Reference oldHolder = oldValue == null ? null : getHolder(key, oldValue); // Do we need to do anything with the old holder? We cant update its pointer unless its non-intrusive... // And if thats the case, then we *should* get its reference in newHolder @@ -262,7 +260,7 @@ Holder onAdded(RegistryManager stage, int id, T newValue, T oldValue) this.holdersById.size(Math.max(this.holdersById.size(), id + 1)); this.holdersById.set(id, newHolder); - this.holdersByName.put(newValue.getRegistryName(), newHolder); + this.holdersByName.put(key.location(), newHolder); this.holders.put(newValue, newHolder); newHolder.bind(key, newValue); this.holdersSorted = null; @@ -285,7 +283,7 @@ private Holder.Reference getHolder(ResourceKey key, T value) if (this.holderLookup != null) return this.holderLookup.apply(value); - return this.holdersByName.computeIfAbsent(value.getRegistryName(), k -> Holder.Reference.createStandAlone(this.self, key)); + return this.holdersByName.computeIfAbsent(key.location(), k -> Holder.Reference.createStandAlone(this.self, key)); } private List> getSortedHolders() diff --git a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java index e520764e0d8..1cb258a93c2 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java @@ -10,13 +10,11 @@ import java.util.Map; import java.util.Optional; import java.util.OptionalInt; -import java.util.Random; import java.util.Set; import java.util.function.Function; import java.util.stream.Stream; -import javax.annotation.Nullable; - +import com.mojang.serialization.DataResult; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.resources.ResourceKey; @@ -25,14 +23,16 @@ import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; +import net.minecraft.util.RandomSource; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; +import org.jetbrains.annotations.Nullable; -class NamespacedWrapper> extends MappedRegistry implements ILockableRegistry, IHolderHelperHolder +class NamespacedWrapper extends MappedRegistry implements ILockableRegistry, IHolderHelperHolder { private static final Logger LOGGER = LogManager.getLogger(); private final ForgeRegistry delegate; @@ -57,16 +57,13 @@ public Holder registerMapping(int id, ResourceKey key, T value, Lifecycle Validate.notNull(value); this.elementsLifecycle = this.elementsLifecycle.add(lifecycle); - if (value.getRegistryName() == null) - value.setRegistryName(key.location()); - - T oldValue = get(value.getRegistryName()); + T oldValue = get(key); - int realId = this.delegate.add(id, value); + int realId = this.delegate.add(id, key.location(), value); if (realId != id && id != -1) - LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId); + LOGGER.warn("Registered object did not get ID it asked for. Name: {} Expected: {} Got: {}", key, id, realId); - return this.holders.onAdded(RegistryManager.ACTIVE, realId, value, oldValue); + return this.holders.onAdded(RegistryManager.ACTIVE, realId, key, value, oldValue); } @Override @@ -192,8 +189,8 @@ public NamespacedHolderHelper getHolderHelper() @Override public Optional> getHolder(int id) { return this.holders.getHolder(id); } @Override public Optional> getHolder(ResourceKey key) { return this.holders.getHolder(key); } - @Override public Holder getOrCreateHolder(ResourceKey key) { return this.holders.getOrCreateHolder(key); } - @Override public Optional> getRandom(Random rand) { return this.holders.getRandom(rand); } + @Override public DataResult> getOrCreateHolder(ResourceKey key) { return DataResult.success(this.holders.getOrCreateHolder(key)); } + @Override public Optional> getRandom(RandomSource rand) { return this.holders.getRandom(rand); } @Override public Stream> holders() { return this.holders.holders(); } @Override public boolean isKnownTagName(TagKey name) { return this.holders.isKnownTagName(name); } @Override public Stream, HolderSet.Named>> getTags() { return this.holders.getTags(); } @@ -210,7 +207,7 @@ public NamespacedHolderHelper getHolderHelper() @Deprecated @Override public void lock(){ this.locked = true; } - public static class Factory> implements IForgeRegistry.CreateCallback, IForgeRegistry.AddCallback + public static class Factory implements IForgeRegistry.CreateCallback, IForgeRegistry.AddCallback { public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper"); @@ -223,9 +220,9 @@ public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) @Override @SuppressWarnings("unchecked") - public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, V value, V oldValue) + public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, ResourceKey key, V value, V oldValue) { - owner.getSlaveMap(ID, NamespacedWrapper.class).holders.onAdded(stage, id, value, oldValue); + owner.getSlaveMap(ID, NamespacedWrapper.class).holders.onAdded(stage, id, key, value, oldValue); } } } diff --git a/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java b/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java index 2f842f4f1d5..680d10f1d1d 100644 --- a/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java +++ b/src/main/java/net/minecraftforge/registries/NewRegistryEvent.java @@ -37,7 +37,7 @@ public NewRegistryEvent() {} * @param builder The builder to turn into a {@link IForgeRegistry} * @return A supplier of the {@link IForgeRegistry} created by the builder. Resolving too early will return null. */ - public > Supplier> create(RegistryBuilder builder) + public Supplier> create(RegistryBuilder builder) { return create(builder, null); } @@ -49,7 +49,7 @@ public > Supplier> create(Reg * @param onFill Called when the returned supplier is filled with the registry * @return a supplier of the {@link IForgeRegistry} created by the builder. Resolving too early will return null. */ - public > Supplier> create(RegistryBuilder builder, @Nullable Consumer> onFill) + public Supplier> create(RegistryBuilder builder, @Nullable Consumer> onFill) { RegistryHolder registryHolder = new RegistryHolder<>(); @@ -58,75 +58,57 @@ public > Supplier> create(Reg return registryHolder; } - @SuppressWarnings("rawtypes") void fill() { + RuntimeException aggregate = new RuntimeException(); Map, IForgeRegistry> builtRegistries = new IdentityHashMap<>(); - RuntimeException aggregate = new RuntimeException("Failed to create some forge registries, see suppressed exceptions for details"); - for (RegistryData registryData : this.registries) + + for (RegistryData data : this.registries) { - RegistryBuilder builder = registryData.builder(); - try - { - builtRegistries.put(builder, builder.create()); - } catch (Exception e) + try { + buildRegistry(builtRegistries, data); + } catch (Throwable t) { - aggregate.addSuppressed(e); + aggregate.addSuppressed(t); + return; } } - builtRegistries.forEach((builder, reg) -> { - try - { - RegistryAccess.RegistryData dataPackRegistryData = builder.getDataPackRegistryData(); - if (dataPackRegistryData != null) // if this is a datapack registry - { - if (!BuiltinRegistries.REGISTRY.containsKey(reg.getRegistryName())) - { - DataPackRegistriesHooks.addRegistryCodec(dataPackRegistryData); - RegistryManager.registerToBuiltinRegistry((ForgeRegistry) reg); - } - } - else if (builder.getHasWrapper() && !Registry.REGISTRY.containsKey(reg.getRegistryName())) - RegistryManager.registerToRootRegistry((ForgeRegistry) reg); - } catch (Exception e) - { - aggregate.addSuppressed(e); - } - }); + if (aggregate.getSuppressed().length > 0) + LOGGER.error(LogUtils.FATAL_MARKER, "Failed to create some forge registries, see suppressed exceptions for details", aggregate); + } - for (RegistryData data : this.registries) + private void buildRegistry(Map, IForgeRegistry> builtRegistries, RegistryData data) + { + RegistryBuilder builder = data.builder; + IForgeRegistry registry = builder.create(); + + builtRegistries.put(builder, registry); + + RegistryAccess.RegistryData dataPackRegistryData = builder.getDataPackRegistryData(); + if (dataPackRegistryData != null) // if this is a datapack registry { - IForgeRegistry registry = builtRegistries.get(data.builder); - if (registry != null) + if (!BuiltinRegistries.REGISTRY.containsKey(registry.getRegistryName())) { - data.registryHolder.registry = registry; - try - { - if (data.onFill != null) - data.onFill.accept(registry); - } catch (Exception e) - { - aggregate.addSuppressed(e); - } + DataPackRegistriesHooks.addRegistryCodec(dataPackRegistryData); + RegistryManager.registerToBuiltinRegistry((ForgeRegistry) registry); } } + else if (builder.getHasWrapper() && !Registry.REGISTRY.containsKey(registry.getRegistryName())) + RegistryManager.registerToRootRegistry((ForgeRegistry) registry); - if (aggregate.getSuppressed().length > 0) - { - // Something had an exception, log and propagate with a throw for when FML eventually logs this too - LOGGER.error("", aggregate); - throw aggregate; - } + data.registryHolder.registry = registry; + if (data.onFill != null) + data.onFill.accept(registry); } - private record RegistryData>( + private record RegistryData( RegistryBuilder builder, RegistryHolder registryHolder, Consumer> onFill ) {} - private static class RegistryHolder> implements Supplier> + private static class RegistryHolder implements Supplier> { IForgeRegistry registry = null; diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolder.java b/src/main/java/net/minecraftforge/registries/ObjectHolder.java index 3685860db54..f92b2ecaf34 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolder.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolder.java @@ -5,6 +5,9 @@ package net.minecraftforge.registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.fml.common.Mod; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -15,15 +18,22 @@ * from the registry. These values can then be referred within mod code directly. */ @Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.FIELD}) +@Target(ElementType.FIELD) public @interface ObjectHolder { /** - * If used on a class, this represents a modid only. - * If used on a field, it represents a name, which can be abbreviated or complete. - * Abbreviated names derive their modid from an enclosing ObjectHolder at the class level. + * The name of the registry to load registry entries from. + * This string is parsed as a {@link ResourceLocation} and can contain a namespace. + * + * @return the registry name + */ + String registryName(); + + /** + * Represents a name in the form of a {@link ResourceLocation} which points to a registry object from the registry given by {@link #registryName()}. + * Must specify the modid if not inside a class annotated with {@link Mod}. * - * @return either a modid or a name based on the rules above + * @return a name in the form of a {@link ResourceLocation} */ String value(); } diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java index 11010e24488..47843e4ba1b 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java @@ -7,58 +7,43 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.Collections; -import java.util.LinkedList; import java.util.Locale; -import java.util.Queue; import java.util.function.Consumer; import java.util.function.Predicate; import net.minecraft.resources.ResourceLocation; import net.minecraft.ResourceLocationException; -import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("rawtypes") class ObjectHolderRef implements Consumer> { private static final Logger LOGGER = LogManager.getLogger(); - private Field field; - private ResourceLocation injectedObject; - private boolean isValid; - private ForgeRegistry registry; + private final Field field; + private final ResourceLocation injectedObject; + private final ForgeRegistry registry; - public ObjectHolderRef(Field field, ResourceLocation injectedObject) - { - this(field, injectedObject.toString(), false); - } - - ObjectHolderRef(Field field, String injectedObject, boolean extractFromExistingValues) + @SuppressWarnings("unchecked") + @Nullable + static ObjectHolderRef create(ResourceLocation registryName, Field field, String injectedObject, boolean extractFromExistingValues) { - this.registry = getRegistryForType(field); - this.field = field; - this.isValid = registry != null; + ForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryName); + if (registry == null) + return null; + ResourceLocation injectedObjectName; if (extractFromExistingValues) { try { Object existing = field.get(null); - // nothing is ever allowed to replace AIR - if (!isValid || (existing == null || existing == registry.getDefault())) - { - this.injectedObject = null; - this.field = null; - this.isValid = false; - return; - } - else - { - this.injectedObject = ((IForgeRegistryEntry)existing).getRegistryName(); - } + // Nothing is ever allowed to replace AIR + if (existing == null || existing == registry.getDefault()) + return null; + injectedObjectName = ((ForgeRegistry) registry).getKey(existing); } catch (IllegalAccessException e) { @@ -69,7 +54,7 @@ public ObjectHolderRef(Field field, ResourceLocation injectedObject) { try { - this.injectedObject = new ResourceLocation(injectedObject); + injectedObjectName = new ResourceLocation(injectedObject); } catch (ResourceLocationException e) { @@ -77,10 +62,8 @@ public ObjectHolderRef(Field field, ResourceLocation injectedObject) } } - if (this.injectedObject == null || !isValid()) - { - throw new IllegalStateException(String.format(Locale.ENGLISH, "The ObjectHolder annotation cannot apply to a field that does not map to a registry. Ensure the registry was created during the RegistryEvent.NewRegistry event. (found : %s at %s.%s)", field.getType().getName(), field.getDeclaringClass().getName(), field.getName())); - } + if (injectedObjectName == null) + throw new IllegalStateException(String.format(Locale.ENGLISH, "The ObjectHolder annotation cannot apply to a field that does not map to a registry. Ensure the registry was created during NewRegistryEvent. (found : %s at %s.%s)", field.getType().getName(), field.getDeclaringClass().getName(), field.getName())); field.setAccessible(true); @@ -88,36 +71,15 @@ public ObjectHolderRef(Field field, ResourceLocation injectedObject) { throw new RuntimeException("@ObjectHolder on final field, our transformer did not run? " + field.getDeclaringClass().getName() + "/" + field.getName()); } - } - @SuppressWarnings("unchecked") - @Nullable - private ForgeRegistry getRegistryForType(Field field) - { - Queue> typesToExamine = new LinkedList>(); - typesToExamine.add(field.getType()); - - ForgeRegistry registry = null; - while (!typesToExamine.isEmpty() && registry == null) - { - Class type = typesToExamine.remove(); - Collections.addAll(typesToExamine, type.getInterfaces()); - if (IForgeRegistryEntry.class.isAssignableFrom(type)) - { - registry = (ForgeRegistry)RegistryManager.ACTIVE.getRegistry((Class)type); - final Class parentType = type.getSuperclass(); - if (parentType != null) - { - typesToExamine.add(parentType); - } - } - } - return registry; + return new ObjectHolderRef(registry, field, injectedObjectName); } - public boolean isValid() + private ObjectHolderRef(ForgeRegistry registry, Field field, ResourceLocation injectedObject) { - return isValid; + this.registry = registry; + this.field = field; + this.injectedObject = injectedObject; } @Override @@ -127,7 +89,7 @@ public void accept(Predicate filter) return; Object thing; - if (isValid && registry.containsKey(injectedObject) && !registry.isDummied(injectedObject)) + if (registry.containsKey(injectedObject) && !registry.isDummied(injectedObject)) { thing = registry.getValue(injectedObject); } diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java index da2330b9323..93fe517aa85 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRegistry.java @@ -15,7 +15,6 @@ import java.util.Set; import java.util.function.Consumer; import java.util.function.Predicate; -import java.util.stream.Collectors; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fml.ModList; @@ -24,10 +23,9 @@ import com.google.common.collect.Maps; -import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; @@ -72,6 +70,17 @@ public static synchronized boolean removeHandler(Consumer>> objectHolders = new HashSet<>(); private static final Type OBJECT_HOLDER = Type.getType(ObjectHolder.class); private static final Type MOD = Type.getType(Mod.class); + // Hardcoded list of vanilla classes that should have object holders for each field of the given registry type. + // IMPORTANT: Updates to this collection must be reflected in ObjectHolderDefinalize. Duplicated cuz classloaders, yay! + // Classnames are validated below. + private static final List VANILLA_OBJECT_HOLDERS = List.of( + new VanillaObjectHolderData("net.minecraft.world.level.block.Blocks", "block", "net.minecraft.world.level.block.Block"), + new VanillaObjectHolderData("net.minecraft.world.item.Items", "item", "net.minecraft.world.item.Item"), + new VanillaObjectHolderData("net.minecraft.world.item.enchantment.Enchantments", "enchantment", "net.minecraft.world.item.enchantment.Enchantment"), + new VanillaObjectHolderData("net.minecraft.world.effect.MobEffects", "mob_effect", "net.minecraft.world.effect.MobEffect"), + new VanillaObjectHolderData("net.minecraft.core.particles.ParticleTypes", "particle_type", "net.minecraft.core.particles.ParticleType"), + new VanillaObjectHolderData("net.minecraft.sounds.SoundEvents", "sound_event", "net.minecraft.sounds.SoundEvent") + ); public static void findObjectHolders() { @@ -80,24 +89,46 @@ public static void findObjectHolders() .map(ModFileScanData::getAnnotations) .flatMap(Collection::stream) .filter(a -> OBJECT_HOLDER.equals(a.annotationType()) || MOD.equals(a.annotationType())) - .collect(Collectors.toList()); + .toList(); Map classModIds = Maps.newHashMap(); Map> classCache = Maps.newHashMap(); - // Gather all @Mod classes, so that @ObjectHolder's in those classes don't need to specify the mod id, Modder convince - annotations.stream().filter(a -> MOD.equals(a.annotationType())).forEach(data -> classModIds.put(data.clazz(), (String)data.annotationData().get("value"))); + // Gather all @Mod classes so that @ObjectHolder's in those classes don't need to specify the mod id; modder convenience + annotations.stream() + .filter(a -> MOD.equals(a.annotationType())) + .forEach(data -> classModIds.put(data.clazz(), (String)data.annotationData().get("value"))); + + // Validate all the vanilla class-level object holders then scan those first + VANILLA_OBJECT_HOLDERS.forEach(data -> { + try + { + Class holderClass = Class.forName(data.holderClass(), true, ObjectHolderRegistry.class.getClassLoader()); + Class registryClass = Class.forName(data.registryType(), true, ObjectHolderRegistry.class.getClassLoader()); + + Type holderType = Type.getType(holderClass); + classCache.put(holderType, holderClass); + scanTarget(classModIds, classCache, holderType, null, registryClass, data.registryName(), "minecraft", true, true); + } + catch (ClassNotFoundException e) + { + throw new RuntimeException("Vanilla class not found, should not be possible", e); + } + }); - // double pass - get all the class level annotations first, then the field level annotations - annotations.stream().filter(a -> OBJECT_HOLDER.equals(a.annotationType())).filter(a -> a.targetType() == ElementType.TYPE) - .forEach(data -> scanTarget(classModIds, classCache, data.clazz(), null, (String)data.annotationData().get("value"), true, data.clazz().getClassName().startsWith("net.minecraft."))); + // Scan actual fields annotated with @ObjectHolder second + annotations.stream() + .filter(a -> OBJECT_HOLDER.equals(a.annotationType())).filter(a -> a.targetType() == ElementType.FIELD) + .forEach(data -> scanTarget(classModIds, classCache, data.clazz(), + data.memberName(), null, (String)data.annotationData().get("registryName"), + (String)data.annotationData().get("value"), false, false)); - annotations.stream().filter(a -> OBJECT_HOLDER.equals(a.annotationType())).filter(a -> a.targetType() == ElementType.FIELD) - .forEach(data -> scanTarget(classModIds, classCache, data.clazz(), data.memberName(), (String)data.annotationData().get("value"), false, false)); LOGGER.debug(REGISTRIES,"Found {} ObjectHolder annotations", objectHolders.size()); } - private static void scanTarget(Map classModIds, Map> classCache, Type type, @Nullable String annotationTarget, String value, boolean isClass, boolean extractFromValue) + private static void scanTarget(Map classModIds, Map> classCache, Type type, + @Nullable String annotationTarget, @Nullable Class registryClass, String registryName, + String value, boolean isClass, boolean extractFromValue) { Class clazz; if (classCache.containsKey(type)) @@ -119,7 +150,7 @@ private static void scanTarget(Map classModIds, Map } if (isClass) { - scanClassForFields(classModIds, type, value, clazz, extractFromValue); + scanClassForFields(classModIds, type, new ResourceLocation(registryName), registryClass, value, clazz, extractFromValue); } else { @@ -136,8 +167,8 @@ private static void scanTarget(Map classModIds, Map try { Field f = clazz.getDeclaredField(annotationTarget); - ObjectHolderRef ref = new ObjectHolderRef(f, value, extractFromValue); - if (ref.isValid()) + ObjectHolderRef ref = ObjectHolderRef.create(new ResourceLocation(registryName), f, value, extractFromValue); + if (ref != null) addHandler(ref); } catch (NoSuchFieldException ex) @@ -148,25 +179,45 @@ private static void scanTarget(Map classModIds, Map } } - private static void scanClassForFields(Map classModIds, Type targetClass, String value, Class clazz, boolean extractFromExistingValues) + private static void scanClassForFields(Map classModIds, Type targetClass, + ResourceLocation registryName, Class registryClass, String value, Class clazz, boolean extractFromExistingValues) { classModIds.put(targetClass, value); final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC; for (Field f : clazz.getFields()) { - if (((f.getModifiers() & flags) != flags) || f.isAnnotationPresent(ObjectHolder.class)) + if (((f.getModifiers() & flags) != flags) || f.isAnnotationPresent(ObjectHolder.class) || !registryClass.isAssignableFrom(f.getType())) continue; - ObjectHolderRef ref = new ObjectHolderRef(f, value + ':' + f.getName().toLowerCase(Locale.ENGLISH), extractFromExistingValues); - if (ref.isValid()) + ObjectHolderRef ref = ObjectHolderRef.create(registryName, f, value + ':' + f.getName().toLowerCase(Locale.ENGLISH), extractFromExistingValues); + if (ref != null) addHandler(ref); } } + private static ResourceLocation getRegistryName(Map classRegistryNames, @Nullable String registryName, + Type targetClass, Object declaration) + { + if (registryName != null) + return new ResourceLocation(registryName); + + if (classRegistryNames.containsKey(targetClass)) + return classRegistryNames.get(targetClass); + + throw new IllegalStateException("No registry name was declared for " + declaration); + } + public static void applyObjectHolders() { - LOGGER.debug(REGISTRIES,"Applying holder lookups"); - applyObjectHolders(key -> true); - LOGGER.debug(REGISTRIES,"Holder lookups applied"); + try + { + LOGGER.debug(REGISTRIES, "Applying holder lookups"); + applyObjectHolders(key -> true); + LOGGER.debug(REGISTRIES, "Holder lookups applied"); + } catch (RuntimeException e) + { + // It is more important that the calling contexts continue without exception to prevent further cascading errors + LOGGER.error("", e); + } } public static void applyObjectHolders(Predicate filter) @@ -185,10 +236,9 @@ public static void applyObjectHolders(Predicate filter) if (aggregate.getSuppressed().length > 0) { - // Something had an exception, log and propagate with a throw for when FML eventually logs this too - LOGGER.error("", aggregate); throw aggregate; } } + private record VanillaObjectHolderData(String holderClass, String registryName, String registryType) {} } diff --git a/src/main/java/net/minecraftforge/registries/RegisterEvent.java b/src/main/java/net/minecraftforge/registries/RegisterEvent.java new file mode 100644 index 00000000000..332aed7eefb --- /dev/null +++ b/src/main/java/net/minecraftforge/registries/RegisterEvent.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.registries; + +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.event.IModBusEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Consumer; +import java.util.function.Supplier; + +/** + * This event fires for each forge and vanilla registry when all registries are ready to have modded objects registered. + *

+ * Fired on the {@link IModBusEvent mod bus}. + * + * @see #register(ResourceKey, ResourceLocation, Supplier) + * @see #register(ResourceKey, Consumer) + */ +public class RegisterEvent extends Event implements IModBusEvent +{ + @NotNull + private final ResourceKey> registryKey; + @Nullable + final ForgeRegistry forgeRegistry; + @Nullable + private final Registry vanillaRegistry; + + RegisterEvent(@NotNull ResourceKey> registryKey, @Nullable ForgeRegistry forgeRegistry, @Nullable Registry vanillaRegistry) + { + this.registryKey = registryKey; + this.forgeRegistry = forgeRegistry; + this.vanillaRegistry = vanillaRegistry; + } + + /** + * Registers the value with the given name to the stored registry if the provided registry key matches this event's registry key. + * + * @param registryKey the key of the registry to register the value to + * @param name the name of the object to register as its key + * @param valueSupplier a supplier of the object value + * @param the type of the registry + * @see #register(ResourceKey, Consumer) a register variant making registration of multiple objects less redundant + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void register(ResourceKey> registryKey, ResourceLocation name, Supplier valueSupplier) + { + if (this.registryKey.equals(registryKey)) + { + if (this.forgeRegistry != null) + ((IForgeRegistry) this.forgeRegistry).register(name, valueSupplier.get()); + else if (this.vanillaRegistry != null) + Registry.register((Registry) this.vanillaRegistry, name, valueSupplier.get()); + } + } + + /** + * Calls the provided consumer with a register helper if the provided registry key matches this event's registry key. + * + * @param registryKey the key of the registry to register objects to + * @param the type of the registry + * @see #register(ResourceKey, ResourceLocation, Supplier) a register variant targeted towards registering one or two objects + */ + public void register(ResourceKey> registryKey, Consumer> consumer) + { + if (this.registryKey.equals(registryKey)) + { + consumer.accept((name, value) -> register(registryKey, name, () -> value)); + } + } + + /** + * @return The registry key linked to this event + */ + @NotNull + public ResourceKey> getRegistryKey() + { + return registryKey; + } + + /** + * @return The forge registry for the given registry key, or {@code null} if the registry is not a forge registry + */ + @Nullable + @SuppressWarnings("unchecked") + public IForgeRegistry getForgeRegistry() + { + return (IForgeRegistry) forgeRegistry; + } + + /** + * @return The vanilla registry for the given registry key, or {@code null} if the registry is not a vanilla registry + */ + @Nullable + @SuppressWarnings("unchecked") + public Registry getVanillaRegistry() + { + return (Registry) vanillaRegistry; + } + + @Override + public String toString() + { + return "RegisterEvent"; + } + + @FunctionalInterface + public interface RegisterHelper + { + /** + * Registers the given value with the given name to the registry. + * The namespace is inferred based on the active mod container. + * If you wish to specify a namespace, use {@link #register(ResourceLocation, Object)} instead. + * + * @param name the name of the object to register as its key with the namespaced inferred from the active mod container + * @param value the object value + */ + default void register(String name, T value) + { + register(new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), name), value); + } + + /** + * Registers the given value with the given name to the registry. + * + * @param key the resource key of the object to register + * @param value the object value + */ + default void register(ResourceKey key, T value) + { + register(key.location(), value); + } + + /** + * Registers the given value with the given name to the registry. + * + * @param name the name of the object to register as its key + * @param value the object value + */ + void register(ResourceLocation name, T value); + } +} diff --git a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java index 1ed93a40776..e35e4bcfdb8 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java +++ b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java @@ -22,15 +22,13 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.registries.IForgeRegistry.*; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; - -public class RegistryBuilder> +public class RegistryBuilder { private static final int MAX_ID = Integer.MAX_VALUE - 1; private ResourceLocation registryName; - private Class registryType; private ResourceLocation optionalDefaultKey; private int minId = 0; private int maxId = MAX_ID; @@ -56,12 +54,6 @@ public RegistryBuilder setName(ResourceLocation name) return this; } - public RegistryBuilder setType(Class type) - { - this.registryType = type; - return this; - } - public RegistryBuilder setIDRange(int min, int max) { this.minId = Math.max(min, 0); @@ -326,10 +318,10 @@ public AddCallback getAdd() if (addCallback.size() == 1) return addCallback.get(0); - return (owner, stage, id, obj, old) -> + return (owner, stage, id, key, obj, old) -> { for (AddCallback cb : this.addCallback) - cb.onAdd(owner, stage, id, obj, old); + cb.onAdd(owner, stage, id, key, obj, old); }; } @@ -393,11 +385,6 @@ public BakeCallback getBake() }; } - public Class getType() - { - return registryType; - } - @Nullable public ResourceLocation getDefault() { diff --git a/src/main/java/net/minecraftforge/registries/RegistryDelegate.java b/src/main/java/net/minecraftforge/registries/RegistryDelegate.java deleted file mode 100644 index 2c0b8def1a0..00000000000 --- a/src/main/java/net/minecraftforge/registries/RegistryDelegate.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; - -import com.google.common.base.Objects; - -import net.minecraft.resources.ResourceLocation; - -/* - * This is the internal implementation class of the delegate. - */ -final class RegistryDelegate implements IRegistryDelegate -{ - private T referent; - private ResourceLocation name; - private final Class type; - - public RegistryDelegate(T referent, Class type) - { - this.referent = referent; - this.type = type; - } - - @Override - public T get() { return referent; } - @Override - public ResourceLocation name() { return name; } - @Override - public Class type() { return this.type; } - - void changeReference(T newTarget){ this.referent = newTarget; } - public void setName(ResourceLocation name) { this.name = name; } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof RegistryDelegate) - { - RegistryDelegate other = (RegistryDelegate) obj; - return Objects.equal(other.name, name); - } - return false; - } - - @Override - public int hashCode() - { - return Objects.hashCode(name); - } -} diff --git a/src/main/java/net/minecraftforge/registries/RegistryManager.java b/src/main/java/net/minecraftforge/registries/RegistryManager.java index c6b48be50f6..7fcfe601adb 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryManager.java +++ b/src/main/java/net/minecraftforge/registries/RegistryManager.java @@ -10,15 +10,12 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; import java.util.stream.Collectors; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; import com.mojang.serialization.Lifecycle; import net.minecraft.core.WritableRegistry; @@ -26,7 +23,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.core.Registry; -import net.minecraftforge.fml.IModStateTransition; +import net.minecraftforge.fml.ModLoader; import net.minecraftforge.network.HandshakeMessages; import net.minecraftforge.registries.ForgeRegistry.Snapshot; import org.apache.commons.lang3.tuple.Pair; @@ -41,8 +38,7 @@ public class RegistryManager public static final RegistryManager FROZEN = new RegistryManager("FROZEN"); private static Set vanillaRegistryKeys = Set.of(); - BiMap>> registries = HashBiMap.create(); - private BiMap>, ResourceLocation> superTypes = HashBiMap.create(); + BiMap> registries = HashBiMap.create(); private Set persisted = Sets.newHashSet(); private Set synced = Sets.newHashSet(); private Map legacyNames = new HashMap<>(); @@ -69,39 +65,22 @@ boolean isStaging() } @SuppressWarnings("unchecked") - public > Class getSuperType(ResourceLocation key) - { - return (Class)superTypes.inverse().get(key); - } - - @SuppressWarnings("unchecked") - public > ForgeRegistry getRegistry(ResourceLocation key) + public ForgeRegistry getRegistry(ResourceLocation key) { return (ForgeRegistry)this.registries.get(key); } - public > ForgeRegistry getRegistry(ResourceKey> key) + public ForgeRegistry getRegistry(ResourceKey> key) { return getRegistry(key.location()); } - /** - * @see #getRegistry(ResourceLocation) - * @see #getRegistry(ResourceKey) - * @deprecated The uniqueness of registry super types will not be guaranteed starting in 1.19. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public > IForgeRegistry getRegistry(Class cls) - { - return getRegistry(superTypes.get(cls)); - } - - public > ResourceLocation getName(IForgeRegistry reg) + public ResourceLocation getName(IForgeRegistry reg) { return this.registries.inverse().get(reg); } - public > ResourceLocation updateLegacyName(ResourceLocation legacyName) + public ResourceLocation updateLegacyName(ResourceLocation legacyName) { ResourceLocation originalName = legacyName; while (getRegistry(legacyName) == null) @@ -115,7 +94,7 @@ public > ResourceLocation updateLegacyName(Reso return legacyName; } - public > ForgeRegistry getRegistry(ResourceLocation key, RegistryManager other) + public ForgeRegistry getRegistry(ResourceLocation key, RegistryManager other) { if (!this.registries.containsKey(key)) { @@ -123,7 +102,6 @@ public > ForgeRegistry getRegistry(ResourceL if (ot == null) return null; this.registries.put(key, ot.copy(this)); - this.superTypes.put(ot.getRegistrySuperType(), key); if (other.persisted.contains(key)) this.persisted.add(key); if (other.synced.contains(key)) @@ -135,24 +113,12 @@ public > ForgeRegistry getRegistry(ResourceL return getRegistry(key); } - > ForgeRegistry createRegistry(ResourceLocation name, RegistryBuilder builder) + ForgeRegistry createRegistry(ResourceLocation name, RegistryBuilder builder) { - Set> parents = Sets.newHashSet(); - findSuperTypes(builder.getType(), parents); - SetView> overlappedTypes = Sets.intersection(parents, superTypes.keySet()); - if (!overlappedTypes.isEmpty()) - { - Class foundType = overlappedTypes.iterator().next(); - LOGGER.error("Found existing registry of type {} named {}, you cannot create a new registry ({}) with type {}, as {} has a parent of that type", - foundType, superTypes.get(foundType), name, builder.getType(), builder.getType()); - throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type"); - } if (registries.containsKey(name)) - throw new IllegalArgumentException("Attempted to register a registry for " + name + " with type " - + builder.getType().getName() + " but it already exists as " + registries.get(name).getRegistrySuperType().getName()); + throw new IllegalArgumentException("Attempted to register a registry for " + name + " but it already exists"); ForgeRegistry reg = new ForgeRegistry(this, name, builder); registries.put(name, reg); - superTypes.put(builder.getType(), name); if (builder.getSaveToDisc()) this.persisted.add(name); if (builder.getSync()) @@ -162,18 +128,18 @@ > ForgeRegistry createRegistry(ResourceLocat return getRegistry(name); } - static > void registerToRootRegistry(ForgeRegistry forgeReg) + static void registerToRootRegistry(ForgeRegistry forgeReg) { injectForgeRegistry(forgeReg, Registry.REGISTRY); } - static > void registerToBuiltinRegistry(ForgeRegistry forgeReg) + static void registerToBuiltinRegistry(ForgeRegistry forgeReg) { injectForgeRegistry(forgeReg, BuiltinRegistries.REGISTRY); } @SuppressWarnings("unchecked") - private static > void injectForgeRegistry(ForgeRegistry forgeReg, Registry> rootRegistry) + private static void injectForgeRegistry(ForgeRegistry forgeReg, Registry> rootRegistry) { WritableRegistry> registry = (WritableRegistry>) rootRegistry; Registry wrapper = forgeReg.getWrapper(); @@ -181,25 +147,14 @@ private static > void injectForgeRegistry(Forge registry.register(forgeReg.getRegistryKey(), wrapper, Lifecycle.experimental()); } - public static IModStateTransition.EventGenerator newRegistryEventGenerator() + public static void postNewRegistryEvent() { NewRegistryEvent event = new NewRegistryEvent(); - return mc -> event; - } + vanillaRegistryKeys = Set.copyOf(Registry.REGISTRY.keySet()); + ModLoader.get().postEvent(event); - public static CompletableFuture> preNewRegistryEvent(final Executor executor, - final IModStateTransition.EventGenerator eventGenerator) - { - return CompletableFuture.runAsync(() -> vanillaRegistryKeys = Set.copyOf(Registry.REGISTRY.keySet()), executor) - .handle((v, t) -> t != null ? Collections.singletonList(t) : Collections.emptyList()); - } - - public static CompletableFuture> postNewRegistryEvent(final Executor executor, - final IModStateTransition.EventGenerator eventGenerator) - { - return CompletableFuture.runAsync(() -> eventGenerator.apply(null).fill(), executor) - .handle((v, t) -> t != null ? Collections.singletonList(t) : Collections.emptyList()); + event.fill(); } private void addLegacyName(ResourceLocation legacyName, ResourceLocation name) @@ -239,7 +194,6 @@ public void clean() this.persisted.clear(); this.synced.clear(); this.registries.clear(); - this.superTypes.clear(); } public static List> generateRegistryPackets(boolean isLocal) diff --git a/src/main/java/net/minecraftforge/registries/RegistryObject.java b/src/main/java/net/minecraftforge/registries/RegistryObject.java index e1e5ab63434..9f0edb532d0 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryObject.java +++ b/src/main/java/net/minecraftforge/registries/RegistryObject.java @@ -33,29 +33,6 @@ public final class RegistryObject implements Supplier @Nullable private Holder holder; - /** - * @deprecated The uniqueness of registry super types will not be guaranteed starting in 1.19. - * Use {@link #create(ResourceLocation, ResourceLocation, String)}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static , U extends T> RegistryObject of(final ResourceLocation name, Supplier> registryType) { - return new RegistryObject<>(name, registryType); - } - - /** - * Factory for a {@link RegistryObject} that stores the value of an object from the provided forge registry once it is ready. - * - * @param name the name of the object to look up in the forge registry - * @param registry the forge registry - * @return a {@link RegistryObject} that stores the value of an object from the provided forge registry once it is ready - * @deprecated Use {@link #create(ResourceLocation, IForgeRegistry)} instead. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static , U extends T> RegistryObject of(final ResourceLocation name, IForgeRegistry registry) - { - return new RegistryObject<>(name, registry); - } - /** * Factory for a {@link RegistryObject} that stores the value of an object from the provided forge registry once it is ready. * @@ -63,39 +40,9 @@ public static , U extends T> RegistryObject * @param registry the forge registry * @return a {@link RegistryObject} that stores the value of an object from the provided forge registry once it is ready */ - public static , U extends T> RegistryObject create(final ResourceLocation name, IForgeRegistry registry) - { - return new RegistryObject<>(name, registry); - } - - /** - * @deprecated The uniqueness of registry super types will not be guaranteed starting in 1.19. - * Use {@link #create(ResourceLocation, ResourceLocation, String)}. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static , U extends T> RegistryObject of(final ResourceLocation name, final Class baseType, String modid) { - return new RegistryObject<>(name, baseType, modid); - } - - /** - * Factory for a {@link RegistryObject} that stores the value of an object from a registry once it is ready based on a lookup of the provided registry key. - *

- * If a registry with the given key cannot be found, an exception will be thrown when trying to fill this RegistryObject. - * Use {@link #createOptional(ResourceLocation, ResourceKey, String)} for RegistryObjects of optional registries. - * - * @param name the name of the object to look up in a registry - * @param registryKey the key of the registry. Supports lookups on {@link BuiltinRegistries}, {@link Registry}, and {@link RegistryManager#ACTIVE}. - * @param modid the mod id calling context - * @return a {@link RegistryObject} that stores the value of an object from a registry once it is ready - * @see #createOptional(ResourceLocation, ResourceKey, String) - * @see #create(ResourceLocation, IForgeRegistry) - * @see #create(ResourceLocation, ResourceLocation, String) - * @deprecated Use {@link #create(ResourceLocation, ResourceKey, String)} instead. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static RegistryObject of(final ResourceLocation name, final ResourceKey> registryKey, String modid) + public static RegistryObject create(final ResourceLocation name, IForgeRegistry registry) { - return new RegistryObject<>(name, registryKey.location(), modid, false); + return new RegistryObject(name, registry); } /** @@ -138,27 +85,6 @@ public static RegistryObject createOptional(final ResourceLo return new RegistryObject<>(name, registryKey.location(), modid, true); } - /** - * Factory for a {@link RegistryObject} that stores the value of an object from a registry once it is ready based on a lookup of the provided registry name. - *

- * If a registry with the given name cannot be found, an exception will be thrown when trying to fill this RegistryObject. - * Use {@link #createOptional(ResourceLocation, ResourceLocation, String)} for RegistryObjects of optional registries. - * - * @param name the name of the object to look up in a registry - * @param registryName the name of the registry. Supports lookups on {@link BuiltinRegistries}, {@link Registry}, and {@link RegistryManager#ACTIVE}. - * @param modid the mod id calling context - * @return a {@link RegistryObject} that stores the value of an object from a registry once it is ready - * @see #createOptional(ResourceLocation, ResourceLocation, String) - * @see #create(ResourceLocation, IForgeRegistry) - * @see #create(ResourceLocation, ResourceKey, String) - * @deprecated Use {@link #create(ResourceLocation, ResourceLocation, String)} instead. - */ - @Deprecated(forRemoval = true, since = "1.18.2") - public static RegistryObject of(final ResourceLocation name, final ResourceLocation registryName, String modid) - { - return new RegistryObject<>(name, registryName, modid, false); - } - /** * Factory for a {@link RegistryObject} that stores the value of an object from a registry once it is ready based on a lookup of the provided registry name. *

@@ -208,66 +134,24 @@ private static RegistryObject empty() { private RegistryObject() { this.name = null; + this.key = null; this.optionalRegistry = false; } - @Deprecated(forRemoval = true, since = "1.18.2") - private > RegistryObject(ResourceLocation name, Supplier> registryType) - { - this(name, RegistryManager.ACTIVE.getRegistry(registryType.get())); - } - @SuppressWarnings("unchecked") - private > RegistryObject(ResourceLocation name, IForgeRegistry registry) + private RegistryObject(ResourceLocation name, IForgeRegistry registry) { if (registry == null) throw new IllegalArgumentException("Invalid registry argument, must not be null"); this.name = name; + this.key = (ResourceKey) ResourceKey.create(registry.getRegistryKey(), name); this.optionalRegistry = false; ObjectHolderRegistry.addHandler(pred -> { if (pred.test(registry.getRegistryName())) this.updateReference((IForgeRegistry) registry); }); - this.updateReference(((IForgeRegistry) registry)); - } - - @SuppressWarnings("unchecked") - @Deprecated(forRemoval = true, since = "1.18.2") - private > RegistryObject(final ResourceLocation name, final Class baseType, final String modid) - { - this.name = name; - this.optionalRegistry = false; - final Throwable callerStack = new Throwable("Calling Site from mod: " + modid); - ObjectHolderRegistry.addHandler(new Consumer>() - { - private IForgeRegistry registry; - private boolean invalidRegistry = false; - - @Override - public void accept(Predicate pred) - { - if (invalidRegistry) - return; - if (registry == null) - { - this.registry = RegistryManager.ACTIVE.getRegistry(baseType); - if (registry == null) - { - invalidRegistry = true; - throw new IllegalStateException("Unable to find registry for type " + baseType.getName() + " for mod \"" + modid + "\". Check the 'caused by' to see further stack.", callerStack); - } - } - if (pred.test(registry.getRegistryName())) - RegistryObject.this.updateReference((IForgeRegistry) registry); - } - }); - IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(baseType); - // allow registry to be null, this might be for a custom registry that does not exist yet - if (registry != null) - { - this.updateReference(((IForgeRegistry) registry)); - } + this.updateReference((IForgeRegistry) registry); } private RegistryObject(final ResourceLocation name, final ResourceLocation registryName, final String modid, boolean optionalRegistry) @@ -322,16 +206,13 @@ public T get() } @SuppressWarnings("unchecked") - @Deprecated(since = "1.18.1") // TODO: make package-private - public void updateReference(IForgeRegistry registry) + void updateReference(IForgeRegistry registry) { - if (this.name == null) + if (this.name == null || this.key == null) return; if (registry.containsKey(this.name)) { this.value = registry.getValue(this.name); - if (this.key == null) - this.key = (ResourceKey) ResourceKey.create(registry.getRegistryKey(), this.name); this.holder = (Holder) registry.getHolder(this.name).orElse(null); } else @@ -344,13 +225,11 @@ public void updateReference(IForgeRegistry registry) @SuppressWarnings("unchecked") void updateReference(Registry registry) { - if (this.name == null) + if (this.name == null || this.key == null) return; if (registry.containsKey(this.name)) { this.value = registry.get(this.name); - if (this.key == null) - this.key = (ResourceKey) ResourceKey.create(registry.key(), this.name); this.holder = ((Registry) registry).getHolder(this.key).orElse(null); } else @@ -390,6 +269,22 @@ void updateReference(ResourceLocation registryName) this.holder = null; } + void updateReference(RegisterEvent event) + { + IForgeRegistry forgeRegistry = event.getForgeRegistry(); + if (forgeRegistry != null) + { + updateReference(forgeRegistry); + return; + } + + Registry vanillaRegistry = event.getVanillaRegistry(); + if (vanillaRegistry != null) + updateReference(vanillaRegistry); + else + this.value = null; + } + private static boolean registryExists(ResourceLocation registryName) { return RegistryManager.ACTIVE.getRegistry(registryName) != null @@ -404,7 +299,7 @@ public ResourceLocation getId() /** * Returns the resource key that points to the registry and name of this registry object. - * Nullable only when the deprecated factories {@link #of(ResourceLocation, Class, String)} or {@link #of(ResourceLocation, Supplier)} are used. + * Nullable only if this RegistryObject is empty and has no name. * * @return the resource key that points to the registry and name of this registry object */ @@ -584,9 +479,7 @@ public T orElseThrow(Supplier exceptionSuppli * This should only be used in cases where vanilla code requires passing in a Holder. * Mod-written code should rely on RegistryObjects or Suppliers instead. *

- * The returned optional will be empty if the registry does not exist - * or if the deprecated factories {@link #of(ResourceLocation, Class, String)} - * or {@link #of(ResourceLocation, Supplier)} are used. + * The returned optional will be empty if the registry does not exist. * Otherwise, the optional Holder will be present even if {@link #isPresent()} returns false. * * @return an optional {@link Holder} instance pointing to this RegistryObject's name and value @@ -603,7 +496,7 @@ public Optional> getHolder() registry = (Registry) BuiltinRegistries.REGISTRY.get(registryName); if (registry != null) - this.holder = registry.getOrCreateHolder(this.key); + this.holder = registry.getOrCreateHolder(this.key).result().get(); } return Optional.ofNullable(this.holder); diff --git a/src/main/java/net/minecraftforge/registries/VanillaRegisterEvent.java b/src/main/java/net/minecraftforge/registries/VanillaRegisterEvent.java deleted file mode 100644 index aee573a7083..00000000000 --- a/src/main/java/net/minecraftforge/registries/VanillaRegisterEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.registries; - -import net.minecraft.core.Registry; -import net.minecraft.data.BuiltinRegistries; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fml.event.IModBusEvent; -import org.jetbrains.annotations.NotNull; - -/** - * Intermediary event for registering to vanilla registries from both {@link Registry} and {@link BuiltinRegistries}. - * This is a stopgap measure until 1.19 comes with the rework of forge registries, at which point it will be deleted. - * Internal for forge-uses only, see {@link DeferredRegister#vanillaRegister(VanillaRegisterEvent)} for how it is used. - */ -@Deprecated(forRemoval = true, since = "1.18.2") -class VanillaRegisterEvent extends Event implements IModBusEvent -{ - @NotNull - final Registry vanillaRegistry; - - VanillaRegisterEvent(@NotNull Registry vanillaRegistry) - { - this.vanillaRegistry = vanillaRegistry; - } -} diff --git a/src/main/java/net/minecraftforge/registries/tags/ITag.java b/src/main/java/net/minecraftforge/registries/tags/ITag.java index 27bbb72651d..bf5675d83c4 100644 --- a/src/main/java/net/minecraftforge/registries/tags/ITag.java +++ b/src/main/java/net/minecraftforge/registries/tags/ITag.java @@ -6,6 +6,7 @@ package net.minecraftforge.registries.tags; import net.minecraft.tags.TagKey; +import net.minecraft.util.RandomSource; import java.util.Optional; import java.util.Random; @@ -31,7 +32,7 @@ public interface ITag extends Iterable boolean contains(V value); - Optional getRandomElement(Random random); + Optional getRandomElement(RandomSource random); /** * @return {@code true} if this tag was loaded with a value (including empty), diff --git a/src/main/java/net/minecraftforge/registries/tags/ITagManager.java b/src/main/java/net/minecraftforge/registries/tags/ITagManager.java index d8385bfd4d2..1d9a9a9b1b4 100644 --- a/src/main/java/net/minecraftforge/registries/tags/ITagManager.java +++ b/src/main/java/net/minecraftforge/registries/tags/ITagManager.java @@ -9,7 +9,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.IForgeRegistryEntry; import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -21,7 +20,7 @@ * A tag manager holds information about all tags currently bound to a forge registry. * This should be preferred to any {@link Holder}-related methods. */ -public interface ITagManager> extends Iterable> +public interface ITagManager extends Iterable> { /** * Queries this tag manager for a tag with the given tag key. diff --git a/src/main/java/net/minecraftforge/resource/DelegatingResourcePack.java b/src/main/java/net/minecraftforge/resource/DelegatingResourcePack.java index 0bb1f60ea38..6a314b32458 100644 --- a/src/main/java/net/minecraftforge/resource/DelegatingResourcePack.java +++ b/src/main/java/net/minecraftforge/resource/DelegatingResourcePack.java @@ -74,10 +74,10 @@ public T getMetadataSection(MetadataSectionSerializer deserializer) throw } @Override - public Collection getResources(PackType type, String pathIn, String pathIn2, int maxDepth, Predicate filter) + public Collection getResources(PackType type, String pathIn, String pathIn2, Predicate filter) { return delegates.stream() - .flatMap(r -> r.getResources(type, pathIn, pathIn2, maxDepth, filter).stream()) + .flatMap(r -> r.getResources(type, pathIn, pathIn2, filter).stream()) .collect(Collectors.toList()); } diff --git a/src/main/java/net/minecraftforge/resource/PathResourcePack.java b/src/main/java/net/minecraftforge/resource/PathResourcePack.java index 55701e5b5cc..4e2fa350b77 100644 --- a/src/main/java/net/minecraftforge/resource/PathResourcePack.java +++ b/src/main/java/net/minecraftforge/resource/PathResourcePack.java @@ -101,7 +101,7 @@ protected boolean hasResource(String name) } @Override - public Collection getResources(PackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate filter) + public Collection getResources(PackType type, String resourceNamespace, String pathIn, Predicate filter) { try { @@ -110,11 +110,11 @@ public Collection getResources(PackType type, String resourceN return Files.walk(root) .map(root::relativize) - .filter(path -> path.getNameCount() <= maxDepth && !path.toString().endsWith(".mcmeta") && path.startsWith(inputPath)) - .filter(path -> filter.test(path.getFileName().toString())) + .filter(path -> !path.toString().endsWith(".mcmeta") && path.startsWith(inputPath)) // It is VERY IMPORTANT that we do not rely on Path.toString as this is inconsistent between operating systems // Join the path names ourselves to force forward slashes .map(path -> new ResourceLocation(resourceNamespace, Joiner.on('/').join(path))) + .filter(filter) .collect(Collectors.toList()); } catch (IOException e) diff --git a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java index 97ed11f2b2a..5eda9d90441 100644 --- a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java +++ b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java @@ -29,8 +29,6 @@ import net.minecraftforge.forgespi.locating.IModFile; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - public class ResourcePackLoader { private static Map modResourcePacks; @@ -57,9 +55,9 @@ public static PathResourcePack createPackForMod(IModFileInfo mf) { return new PathResourcePack(mf.getFile().getFileName(), mf.getFile().getFilePath()){ final IModFile modFile = mf.getFile(); - @Nonnull + @NotNull @Override - protected Path resolve(@Nonnull String... paths) + protected Path resolve(@NotNull String... paths) { return modFile.findResource(paths); } diff --git a/src/main/java/net/minecraftforge/server/LanguageHook.java b/src/main/java/net/minecraftforge/server/LanguageHook.java index bcd0791030d..03d4da956db 100644 --- a/src/main/java/net/minecraftforge/server/LanguageHook.java +++ b/src/main/java/net/minecraftforge/server/LanguageHook.java @@ -8,6 +8,7 @@ import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import net.minecraft.locale.Language; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.MinecraftServer; @@ -19,6 +20,7 @@ import org.apache.logging.log4j.Logger; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; @@ -45,7 +47,11 @@ public static void captureLanguageMap(Map table) // The below is based on client side net.minecraft.client.resources.Locale code private static void loadLocaleData(final List allResources) { - allResources.stream().map(Resource::getInputStream).forEach(LanguageHook::loadLocaleData); + allResources.forEach(res -> { + try { + LanguageHook.loadLocaleData(res.open()); + } catch (IOException ignored) {} // TODO: this should not be ignored -C + }); } private static void loadLocaleData(final InputStream inputstream) { @@ -71,8 +77,7 @@ private static void loadLanguage(String langName, MinecraftServer server) { resourceManager.getNamespaces().forEach(namespace -> { try { ResourceLocation langResource = new ResourceLocation(namespace, langFile); - loadLocaleData(resourceManager.getResources(langResource)); - } catch (FileNotFoundException fnfe) { + loadLocaleData(resourceManager.getResourceStack(langResource)); } catch (Exception exception) { LOGGER.warn("Skipped language file: {}:{}", namespace, langFile, exception); } diff --git a/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java index 63a4f43dd14..47dbb9795f0 100644 --- a/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java +++ b/src/main/java/net/minecraftforge/server/ServerLifecycleHooks.java @@ -8,6 +8,7 @@ import static net.minecraftforge.fml.Logging.CORE; import java.nio.file.Path; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; @@ -16,13 +17,18 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.gametest.framework.GameTestServer; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.RepositorySource; import net.minecraft.world.level.storage.LevelResource; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.common.util.LogicalSidedProvider; +import net.minecraftforge.common.world.BiomeModifier; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.ModLoadingWarning; @@ -46,7 +52,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.server.packs.repository.Pack; import net.minecraft.server.MinecraftServer; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.config.ConfigTracker; @@ -59,6 +64,7 @@ import net.minecraftforge.fml.loading.FileUtils; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.registries.DataPackRegistriesHooks; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.GameData; public class ServerLifecycleHooks @@ -83,6 +89,7 @@ public static boolean handleServerAboutToStart(final MinecraftServer server) // on the dedi server we need to force the stuff to setup properly LogicalSidedProvider.setServer(()->server); ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.SERVER, getServerConfigPath(server)); + runBiomeModifiers(server); return !MinecraftForge.EVENT_BUS.post(new ServerAboutToStartEvent(server)); } @@ -140,7 +147,7 @@ public static MinecraftServer getCurrentServer() public static boolean handleServerLogin(final ClientIntentionPacket packet, final Connection manager) { if (!allowLogins.get()) { - TextComponent text = new TextComponent("Server is still starting! Please wait before reconnecting."); + MutableComponent text = Component.literal("Server is still starting! Please wait before reconnecting."); LOGGER.info(SERVERHOOKS,"Disconnecting Player (server is still starting): {}", text.getContents()); manager.send(new ClientboundLoginDisconnectPacket(text)); manager.disconnect(text); @@ -151,25 +158,9 @@ public static boolean handleServerLogin(final ClientIntentionPacket packet, fina final ConnectionType connectionType = ConnectionType.forVersionFlag(packet.getFMLVersion()); final int versionNumber = connectionType.getFMLVersionNumber(packet.getFMLVersion()); - if (connectionType == ConnectionType.MODDED) - { - // Allow clients with incorrect netcode version to connect to netversion 3 servers, - // if and only if client is netversion 2 and server has no syncable non-vanilla datapack registries. - // TODO 1.19: Remove netcode backwards-compatability in 1.19, as there will be no clients on netversion 2 in 1.19. - Set>> customDatapackRegistries = DataPackRegistriesHooks.getSyncedCustomRegistries(); - if (versionNumber == 2) - { - if (!customDatapackRegistries.isEmpty()) - { - rejectConnection(manager, connectionType, "Missing required datapack registries: " + String.join(", ", customDatapackRegistries.stream().map(key -> key.location().toString()).toList())); - return false; - } - } - else if (versionNumber != NetworkConstants.FMLNETVERSION) - { - rejectConnection(manager, connectionType, "This modded server is not impl compatible with your modded client. Please verify your Forge version closely matches the server. Got net version "+ versionNumber + " this server is net version "+ NetworkConstants.FMLNETVERSION); - return false; - } + if (connectionType == ConnectionType.MODDED && versionNumber != NetworkConstants.FMLNETVERSION) { + rejectConnection(manager, connectionType, "This modded server is not impl compatible with your modded client. Please verify your Forge version closely matches the server. Got net version " + versionNumber + " this server is net version " + NetworkConstants.FMLNETVERSION); + return false; } if (connectionType == ConnectionType.VANILLA && !NetworkRegistry.acceptsVanillaClientConnections()) { @@ -188,7 +179,7 @@ else if (versionNumber != NetworkConstants.FMLNETVERSION) private static void rejectConnection(final Connection manager, ConnectionType type, String message) { manager.setProtocol(ConnectionProtocol.LOGIN); LOGGER.info(SERVERHOOKS, "Disconnecting {} connection attempt: {}", type, message); - TextComponent text = new TextComponent(message); + MutableComponent text = Component.literal(message); manager.send(new ClientboundLoginDisconnectPacket(text)); manager.disconnect(text); } @@ -219,4 +210,21 @@ private static void serverPackFinder(Map m consumer.accept(packInfo); } } + + private static void runBiomeModifiers(final MinecraftServer server) + { + final RegistryAccess registries = server.registryAccess(); + + // The order of holders() is the order modifiers were loaded in. + final List modifiers = registries.registryOrThrow(ForgeRegistries.Keys.BIOME_MODIFIERS) + .holders() + .map(Holder::value) + .toList(); + + // Apply sorted biome modifiers to each biome. + registries.registryOrThrow(Registry.BIOME_REGISTRY).holders().forEach(biomeHolder -> + { + biomeHolder.value().modifiableBiomeInfo().applyBiomeModifiers(biomeHolder, modifiers); + }); + } } diff --git a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java index e806977da06..d9f942d8b30 100644 --- a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java +++ b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java @@ -10,8 +10,8 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.BaseComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ChunkAccess; @@ -67,9 +67,9 @@ protected Queue buildQueue() return ret; } - public BaseComponent getStartMessage(CommandSourceStack sender) + public MutableComponent getStartMessage(CommandSourceStack sender) { - return new TranslatableComponent("commands.forge.gen.start", total, start.getX(), start.getZ(), dim); + return Component.translatable("commands.forge.gen.start", total, start.getX(), start.getZ(), dim); } @Override @@ -107,7 +107,7 @@ public boolean doWork() if (++lastNotification >= notificationFrequency || lastNotifcationTime < System.currentTimeMillis() - 60*1000) { - listener.sendSuccess(new TranslatableComponent("commands.forge.gen.progress", total - queue.size(), total), true); + listener.sendSuccess(Component.translatable("commands.forge.gen.progress", total - queue.size(), total), true); lastNotification = 0; lastNotifcationTime = System.currentTimeMillis(); } @@ -126,7 +126,7 @@ public boolean doWork() if (queue.size() == 0) { - listener.sendSuccess(new TranslatableComponent("commands.forge.gen.complete", genned, total, dim.dimension().location()), true); + listener.sendSuccess(Component.translatable("commands.forge.gen.complete", genned, total, dim.dimension().location()), true); /* TODO: Readd if/when we introduce world unloading, or get Mojang to do it. if (keepingLoaded != null && !keepingLoaded) DimensionManager.keepLoaded(dim, false); diff --git a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java index 26e408cd295..048a250cb9a 100644 --- a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java @@ -10,10 +10,9 @@ import com.mojang.brigadier.context.CommandContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import net.minecraft.network.chat.TextComponent; import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.Component; import net.minecraftforge.fml.config.ConfigTracker; import net.minecraftforge.fml.config.ModConfig; @@ -44,13 +43,13 @@ private static int showFile(final CommandContext context) { final String configFileName = ConfigTracker.INSTANCE.getConfigFileName(modId, type); if (configFileName != null) { File f = new File(configFileName); - context.getSource().sendSuccess(new TranslatableComponent("commands.config.getwithtype", + context.getSource().sendSuccess(Component.translatable("commands.config.getwithtype", modId, type, - new TextComponent(f.getName()).withStyle(ChatFormatting.UNDERLINE). - withStyle((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath()))) + Component.literal(f.getName()).withStyle(ChatFormatting.UNDERLINE). + withStyle((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath()))) ), true); } else { - context.getSource().sendSuccess(new TranslatableComponent("commands.config.noconfig", modId, type), + context.getSource().sendSuccess(Component.translatable("commands.config.noconfig", modId, type), true); } return 0; diff --git a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java index 928d18dcf15..3c5b11b425e 100644 --- a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java @@ -7,10 +7,9 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.core.Registry; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.server.level.ServerLevel; @@ -29,7 +28,7 @@ class DimensionsCommand return Commands.literal("dimensions") .requires(cs->cs.hasPermission(0)) //permission .executes(ctx -> { - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.dimensions.list"), true); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.dimensions.list"), true); final Registry reg = ctx.getSource().registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); Map> types = new HashMap<>(); @@ -38,7 +37,7 @@ class DimensionsCommand } types.keySet().stream().sorted().forEach(key -> { - ctx.getSource().sendSuccess(new TextComponent(key + ": " + types.get(key).stream().map(ResourceLocation::toString).sorted().collect(Collectors.joining(", "))), false); + ctx.getSource().sendSuccess(Component.literal(key + ": " + types.get(key).stream().map(ResourceLocation::toString).sorted().collect(Collectors.joining(", "))), false); }); return 0; }); diff --git a/src/main/java/net/minecraftforge/server/command/EntityCommand.java b/src/main/java/net/minecraftforge/server/command/EntityCommand.java index af0d1fb397b..9350da03a21 100644 --- a/src/main/java/net/minecraftforge/server/command/EntityCommand.java +++ b/src/main/java/net/minecraftforge/server/command/EntityCommand.java @@ -23,11 +23,10 @@ import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.DimensionArgument; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ChunkPos; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.level.Level; import net.minecraft.server.level.ServerLevel; import net.minecraftforge.registries.ForgeRegistries; @@ -45,9 +44,9 @@ class EntityCommand private static class EntityListCommand { - private static final SimpleCommandExceptionType INVALID_FILTER = new SimpleCommandExceptionType(new TranslatableComponent("commands.forge.entity.list.invalid")); - private static final DynamicCommandExceptionType INVALID_DIMENSION = new DynamicCommandExceptionType(dim -> new TranslatableComponent("commands.forge.entity.list.invalidworld", dim)); - private static final SimpleCommandExceptionType NO_ENTITIES = new SimpleCommandExceptionType(new TranslatableComponent("commands.forge.entity.list.none")); + private static final SimpleCommandExceptionType INVALID_FILTER = new SimpleCommandExceptionType(Component.translatable("commands.forge.entity.list.invalid")); + private static final DynamicCommandExceptionType INVALID_DIMENSION = new DynamicCommandExceptionType(dim -> Component.translatable("commands.forge.entity.list.invalidworld", dim)); + private static final SimpleCommandExceptionType NO_ENTITIES = new SimpleCommandExceptionType(Component.translatable("commands.forge.entity.list.none")); static ArgumentBuilder register() { return Commands.literal("list") @@ -77,7 +76,7 @@ private static int execute(CommandSourceStack sender, String filter, ResourceKey Map>> list = Maps.newHashMap(); level.getEntities().getAll().forEach(e -> { - MutablePair> info = list.computeIfAbsent(e.getType().getRegistryName(), k -> MutablePair.of(0, Maps.newHashMap())); + MutablePair> info = list.computeIfAbsent(ForgeRegistries.ENTITIES.getKey(e.getType()), k -> MutablePair.of(0, Maps.newHashMap())); ChunkPos chunk = new ChunkPos(e.blockPosition()); info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); @@ -90,7 +89,7 @@ private static int execute(CommandSourceStack sender, String filter, ResourceKey if (info == null) throw NO_ENTITIES.create(); - sender.sendSuccess(new TranslatableComponent("commands.forge.entity.list.single.header", name, info.getLeft()), false); + sender.sendSuccess(Component.translatable("commands.forge.entity.list.single.header", name, info.getLeft()), false); List> toSort = new ArrayList<>(); toSort.addAll(info.getRight().entrySet()); toSort.sort((a, b) -> { @@ -104,7 +103,7 @@ private static int execute(CommandSourceStack sender, String filter, ResourceKey for (Map.Entry e : toSort) { if (limit-- == 0) break; - sender.sendSuccess(new TextComponent(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z), false); + sender.sendSuccess(Component.literal(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z), false); } return toSort.size(); } @@ -130,8 +129,8 @@ private static int execute(CommandSourceStack sender, String filter, ResourceKey throw NO_ENTITIES.create(); int count = info.stream().mapToInt(Pair::getRight).sum(); - sender.sendSuccess(new TranslatableComponent("commands.forge.entity.list.multiple.header", count), false); - info.forEach(e -> sender.sendSuccess(new TextComponent(" " + e.getValue() + ": " + e.getKey()), false)); + sender.sendSuccess(Component.translatable("commands.forge.entity.list.multiple.header", count), false); + info.forEach(e -> sender.sendSuccess(Component.literal(" " + e.getValue() + ": " + e.getKey()), false)); return info.size(); } } diff --git a/src/main/java/net/minecraftforge/server/command/EnumArgument.java b/src/main/java/net/minecraftforge/server/command/EnumArgument.java index eb2a03b793b..1a4c282c7b8 100644 --- a/src/main/java/net/minecraftforge/server/command/EnumArgument.java +++ b/src/main/java/net/minecraftforge/server/command/EnumArgument.java @@ -13,10 +13,11 @@ import com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.SharedSuggestionProvider; -import net.minecraft.commands.synchronization.ArgumentSerializer; +import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import java.util.Arrays; import java.util.Collection; @@ -26,7 +27,7 @@ public class EnumArgument> implements ArgumentType { private static final Dynamic2CommandExceptionType INVALID_ENUM = new Dynamic2CommandExceptionType( - (found, constants) -> new TranslatableComponent("commands.forge.arguments.enum.invalid", constants, found)); + (found, constants) -> Component.translatable("commands.forge.arguments.enum.invalid", constants, found)); private final Class enumClass; public static > EnumArgument enumArgument(Class enumClass) { @@ -56,22 +57,22 @@ public Collection getExamples() { return Stream.of(enumClass.getEnumConstants()).map(Object::toString).collect(Collectors.toList()); } - public static class Serializer implements ArgumentSerializer> + public static class Info> implements ArgumentTypeInfo, Info.Template> { @Override - public void serializeToNetwork(EnumArgument argument, FriendlyByteBuf buffer) + public void serializeToNetwork(Template template, FriendlyByteBuf buffer) { - buffer.writeUtf(argument.enumClass.getName()); + buffer.writeUtf(template.enumClass.getName()); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") @Override - public EnumArgument deserializeFromNetwork(FriendlyByteBuf buffer) + public Template deserializeFromNetwork(FriendlyByteBuf buffer) { try { String name = buffer.readUtf(); - return new EnumArgument(Class.forName(name)); + return new Template((Class) Class.forName(name)); } catch (ClassNotFoundException e) { @@ -80,9 +81,37 @@ public EnumArgument deserializeFromNetwork(FriendlyByteBuf buffer) } @Override - public void serializeToJson(EnumArgument argument, JsonObject json) + public void serializeToJson(Template template, JsonObject json) { - json.addProperty("enum", argument.enumClass.getName()); + json.addProperty("enum", template.enumClass.getName()); + } + + @Override + public Template unpack(EnumArgument argument) + { + return new Template(argument.enumClass); + } + + public class Template implements ArgumentTypeInfo.Template> + { + final Class enumClass; + + Template(Class enumClass) + { + this.enumClass = enumClass; + } + + @Override + public EnumArgument instantiate(CommandBuildContext p_223435_) + { + return new EnumArgument<>(this.enumClass); + } + + @Override + public ArgumentTypeInfo, ?> type() + { + return Info.this; + } } } } diff --git a/src/main/java/net/minecraftforge/server/command/ModListCommand.java b/src/main/java/net/minecraftforge/server/command/ModListCommand.java index e4dacabc2fc..f8e9f142498 100644 --- a/src/main/java/net/minecraftforge/server/command/ModListCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ModListCommand.java @@ -8,7 +8,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.fml.ModList; import java.util.Locale; @@ -20,7 +20,7 @@ class ModListCommand { return Commands.literal("mods") .requires(cs->cs.hasPermission(0)) //permission .executes(ctx -> { - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.mods.list", + ctx.getSource().sendSuccess(Component.translatable("commands.forge.mods.list", ModList.get().applyForEachModFile(modFile -> // locator - filename : firstmod (version) - numberofmods\n String.format(Locale.ROOT, "%s %s : %s (%s) - %d", diff --git a/src/main/java/net/minecraftforge/server/command/TPSCommand.java b/src/main/java/net/minecraftforge/server/command/TPSCommand.java index 080c8db9dcb..ab388a004f7 100644 --- a/src/main/java/net/minecraftforge/server/command/TPSCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TPSCommand.java @@ -12,7 +12,7 @@ import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.DimensionArgument; import net.minecraft.core.Registry; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.server.level.ServerLevel; @@ -35,7 +35,7 @@ class TPSCommand @SuppressWarnings("resource") double meanTickTime = mean(ctx.getSource().getServer().tickTimes) * 1.0E-6D; double meanTPS = Math.min(1000.0/meanTickTime, 20); - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); return 0; } @@ -52,7 +52,7 @@ private static int sendTime(CommandSourceStack cs, ServerLevel dim) throws Comma final Registry reg = cs.registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); double worldTickTime = mean(times) * 1.0E-6D; double worldTPS = Math.min(1000.0 / worldTickTime, 20); - cs.sendSuccess(new TranslatableComponent("commands.forge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); + cs.sendSuccess(Component.translatable("commands.forge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); return 1; } diff --git a/src/main/java/net/minecraftforge/server/command/TagsCommand.java b/src/main/java/net/minecraftforge/server/command/TagsCommand.java index bef602563b6..25f8a252414 100644 --- a/src/main/java/net/minecraftforge/server/command/TagsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TagsCommand.java @@ -25,12 +25,7 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; -import net.minecraft.network.chat.ClickEvent; -import net.minecraft.network.chat.ComponentUtils; -import net.minecraft.network.chat.HoverEvent; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.*; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -67,11 +62,11 @@ class TagsCommand ResourceKey.createRegistryKey(new ResourceLocation("root")); private static final DynamicCommandExceptionType UNKNOWN_REGISTRY = new DynamicCommandExceptionType(key -> - new TranslatableComponent("commands.forge.tags.error.unknown_registry", key)); + Component.translatable("commands.forge.tags.error.unknown_registry", key)); private static final Dynamic2CommandExceptionType UNKNOWN_TAG = new Dynamic2CommandExceptionType((tag, registry) -> - new TranslatableComponent("commands.forge.tags.error.unknown_tag", tag, registry)); + Component.translatable("commands.forge.tags.error.unknown_tag", tag, registry)); private static final Dynamic2CommandExceptionType UNKNOWN_ELEMENT = new Dynamic2CommandExceptionType((tag, registry) -> - new TranslatableComponent("commands.forge.tags.error.unknown_element", tag, registry)); + Component.translatable("commands.forge.tags.error.unknown_element", tag, registry)); public static ArgumentBuilder register() { @@ -121,7 +116,7 @@ private static int listTags(final CommandContext ctx, final final long tagCount = registry.getTags().count(); ctx.getSource().sendSuccess(createMessage( - new TranslatableComponent("commands.forge.tags.registry_key", new TextComponent(registryKey.location().toString()).withStyle(ChatFormatting.GOLD)), + Component.translatable("commands.forge.tags.registry_key", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD)), "commands.forge.tags.tag_count", "commands.forge.tags.copy_tag_names", tagCount, @@ -149,9 +144,9 @@ private static int listTagElements(final CommandContext ctx, .orElseThrow(() -> UNKNOWN_TAG.create(tagKey.location(), registryKey.location())); ctx.getSource().sendSuccess(createMessage( - new TranslatableComponent("commands.forge.tags.tag_key", - new TextComponent(tagKey.registry().location().toString()).withStyle(ChatFormatting.GOLD), - new TextComponent(tagKey.location().toString()).withStyle(ChatFormatting.DARK_GREEN)), + Component.translatable("commands.forge.tags.tag_key", + Component.literal(tagKey.registry().location().toString()).withStyle(ChatFormatting.GOLD), + Component.literal(tagKey.location().toString()).withStyle(ChatFormatting.DARK_GREEN)), "commands.forge.tags.element_count", "commands.forge.tags.copy_element_names", tag.size(), @@ -179,9 +174,9 @@ private static int queryElementTags(final CommandContext ctx final long containingTagsCount = elementHolder.tags().count(); ctx.getSource().sendSuccess(createMessage( - new TranslatableComponent("commands.forge.tags.element", - new TextComponent(registryKey.location().toString()).withStyle(ChatFormatting.GOLD), - new TextComponent(elementLocation.toString()).withStyle(ChatFormatting.YELLOW)), + Component.translatable("commands.forge.tags.element", + Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD), + Component.literal(elementLocation.toString()).withStyle(ChatFormatting.YELLOW)), "commands.forge.tags.containing_tag_count", "commands.forge.tags.copy_tag_names", containingTagsCount, @@ -193,7 +188,7 @@ private static int queryElementTags(final CommandContext ctx return (int) containingTagsCount; } - private static MutableComponent createMessage(final TranslatableComponent header, + private static MutableComponent createMessage(final MutableComponent header, final String containsText, final String copyHoverText, final long count, @@ -205,26 +200,26 @@ private static MutableComponent createMessage(final TranslatableComponent header final long totalPages = (count - 1) / PAGE_SIZE + 1; final long actualPage = Mth.clamp(currentPage, 1, totalPages); - MutableComponent containsComponent = new TranslatableComponent(containsText, count); + MutableComponent containsComponent = Component.translatable(containsText, count); if (count > 0) // Highlight the count text, make it clickable, and append page counters { containsComponent = ComponentUtils.wrapInSquareBrackets(containsComponent.withStyle(s -> s .withColor(ChatFormatting.GREEN) .withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, allElementNames)) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new TranslatableComponent(copyHoverText))))); - containsComponent = new TranslatableComponent("commands.forge.tags.page_info", + Component.translatable(copyHoverText))))); + containsComponent = Component.translatable("commands.forge.tags.page_info", containsComponent, actualPage, totalPages); } - final MutableComponent tagElements = new TextComponent("").append(containsComponent); + final MutableComponent tagElements = Component.literal("").append(containsComponent); names.get() .sorted() .skip(PAGE_SIZE * (actualPage - 1)) .limit(PAGE_SIZE) - .map(TextComponent::new) + .map(Component::literal) .map(t -> t.withStyle(elementColor)) - .map(t -> new TextComponent("\n - ").append(t)) + .map(t -> Component.translatable("\n - ").append(t)) .forEach(tagElements::append); return header.append("\n").append(tagElements); diff --git a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java index 86efba6b2e1..9734713a687 100644 --- a/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java +++ b/src/main/java/net/minecraftforge/server/command/TextComponentHelper.java @@ -6,14 +6,14 @@ package net.minecraftforge.server.command; import net.minecraft.commands.CommandSource; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.locale.Language; -import net.minecraft.network.chat.BaseComponent; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.network.ConnectionType; import net.minecraftforge.network.NetworkHooks; +import org.spongepowered.asm.mixin.Mutable; import java.util.Locale; @@ -25,13 +25,13 @@ private TextComponentHelper() {} * Detects when sending to a vanilla client and falls back to sending english, * since they don't have the lang data necessary to translate on the client. */ - public static BaseComponent createComponentTranslation(CommandSource source, final String translation, final Object... args) + public static MutableComponent createComponentTranslation(CommandSource source, final String translation, final Object... args) { if (isVanillaClient(source)) { - return new TextComponent(String.format(Locale.ENGLISH, Language.getInstance().getOrDefault(translation), args)); + return Component.literal(String.format(Locale.ENGLISH, Language.getInstance().getOrDefault(translation), args)); } - return new TranslatableComponent(translation, args); + return Component.translatable(translation, args); } private static boolean isVanillaClient(CommandSource sender) diff --git a/src/main/java/net/minecraftforge/server/command/TrackCommand.java b/src/main/java/net/minecraftforge/server/command/TrackCommand.java index 84a50be34e1..08ae07956f9 100644 --- a/src/main/java/net/minecraftforge/server/command/TrackCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TrackCommand.java @@ -21,7 +21,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.server.timings.ForgeTimings; import net.minecraftforge.server.timings.TimeTracker; @@ -51,7 +51,7 @@ private static class StartTrackingCommand int duration = IntegerArgumentType.getInteger(ctx, "duration"); TimeTracker.BLOCK_ENTITY_UPDATE.reset(); TimeTracker.BLOCK_ENTITY_UPDATE.enable(duration); - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.tracking.be.enabled", duration), true); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.be.enabled", duration), true); return 0; }) ) @@ -62,7 +62,7 @@ private static class StartTrackingCommand int duration = IntegerArgumentType.getInteger(ctx, "duration"); TimeTracker.ENTITY_UPDATE.reset(); TimeTracker.ENTITY_UPDATE.enable(duration); - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.tracking.entity.enabled", duration), true); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.entity.enabled", duration), true); return 0; }) ) @@ -79,14 +79,14 @@ private static class ResetTrackingCommand .then(Commands.literal("te") .executes(ctx -> { TimeTracker.BLOCK_ENTITY_UPDATE.reset(); - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.tracking.be.reset"), true); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.be.reset"), true); return 0; }) ) .then(Commands.literal("entity") .executes(ctx -> { TimeTracker.ENTITY_UPDATE.reset(); - ctx.getSource().sendSuccess(new TranslatableComponent("commands.forge.tracking.entity.reset"), true); + ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.entity.reset"), true); return 0; }) ); @@ -116,7 +116,7 @@ private static int execute(CommandSourceStack source, TimeTracker tracker List> timingsList = getSortedTimings(tracker); if (timingsList.isEmpty()) { - source.sendSuccess(new TranslatableComponent("commands.forge.tracking.no_data"), true); + source.sendSuccess(Component.translatable("commands.forge.tracking.no_data"), true); } else { @@ -137,13 +137,13 @@ private static class TrackResultsEntity { Entity entity = data.getObject().get(); if (entity == null) - return new TranslatableComponent("commands.forge.tracking.invalid"); + return Component.translatable("commands.forge.tracking.invalid"); BlockPos pos = entity.blockPosition(); double averageTimings = data.getAverageTimings(); String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms"); - return new TranslatableComponent("commands.forge.tracking.timing_entry", entity.getType().getRegistryName(), entity.level.dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); + return Component.translatable("commands.forge.tracking.timing_entry", ForgeRegistries.ENTITIES.getKey(entity.getType()), entity.level.dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); }) ); } @@ -155,15 +155,15 @@ private static class TrackResultsBlockEntity { return Commands.literal("te").executes(ctx -> TrackResults.execute(ctx.getSource(), TimeTracker.BLOCK_ENTITY_UPDATE, data -> { - BlockEntity te = data.getObject().get(); - if (te == null) - return new TranslatableComponent("commands.forge.tracking.invalid"); + BlockEntity be = data.getObject().get(); + if (be == null) + return Component.translatable("commands.forge.tracking.invalid"); - BlockPos pos = te.getBlockPos(); + BlockPos pos = be.getBlockPos(); double averageTimings = data.getAverageTimings(); String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms"); - return new TranslatableComponent("commands.forge.tracking.timing_entry", te.getType().getRegistryName(), te.getLevel().dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); + return Component.translatable("commands.forge.tracking.timing_entry", ForgeRegistries.BLOCK_ENTITIES.getKey(be.getType()), be.getLevel().dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); }) ); } diff --git a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java index 322d8019787..047715ab16a 100644 --- a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java +++ b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java @@ -20,8 +20,8 @@ import net.minecraftforge.server.permission.nodes.PermissionNode; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; import java.util.Map; diff --git a/src/main/java/net/minecraftforge/server/permission/nodes/PermissionNode.java b/src/main/java/net/minecraftforge/server/permission/nodes/PermissionNode.java index b795b089c5e..a4333076812 100644 --- a/src/main/java/net/minecraftforge/server/permission/nodes/PermissionNode.java +++ b/src/main/java/net/minecraftforge/server/permission/nodes/PermissionNode.java @@ -11,9 +11,9 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.server.permission.events.PermissionGatherEvent; import net.minecraftforge.server.permission.handler.IPermissionHandler; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Objects; import java.util.UUID; @@ -40,7 +40,7 @@ * See the above link for more information.

* *

Each node should be registered via the {@link PermissionGatherEvent.Nodes} and stored statically in a field. - * That instance should then be reused every-time a permission check needs to be performed via {@link net.minecraftforge.server.permission.PermissionAPI#getPermissions(ServerPlayer, PermissionNode, PermissionDynamicContext[])}.

+ * That instance should then be reused every-time a permission check needs to be performed via {@link net.minecraftforge.server.permission.PermissionAPI#getPermission(ServerPlayer, PermissionNode, PermissionDynamicContext[])}.

*/ public final class PermissionNode { @@ -88,20 +88,20 @@ private PermissionNode(String nodeName, PermissionType type, PermissionResolv } /** - * Allows you to set a human-readable name & description for your Permission. + * Allows you to set a human-readable name and description for your Permission. * *

Note: Even though not used by Default, PermissionHandlers may display this information in game, - * or provide it to the user by other means.
- * You may use {@link net.minecraft.network.chat.TranslatableComponent}, but you'll need 2 language files. - * One inside the data directory for the server and one inside assets for the client.

+ * or provide it to the user by other means.
+ * You may use {@link net.minecraft.network.chat.Component#translatable(String) translatable components}, but you'll + * need 2 language files. One inside the data directory for the server and one inside assets for the client.

* * @param readableName an easier to read name for the PermissionNode, - * when using TranslatableComponent, key should be of format "permission.name." + * when using TranslatableComponent, key should be of format {@code "permission.name."} * @param description description for the PermissionNode - * when using TranslatableComponent, key should be of format "permission.desc." + * when using TranslatableComponent, key should be of format {@code "permission.desc."} * @return itself with the new information set. */ - public PermissionNode setInformation(@Nonnull Component readableName, @Nonnull Component description) + public PermissionNode setInformation(@NotNull Component readableName, @NotNull Component description) { Preconditions.checkNotNull(readableName, "Readable name for PermissionNodes must not be null %s", this.nodeName); Preconditions.checkNotNull(description, "Description for PermissionNodes must not be null %s", this.nodeName); diff --git a/src/main/java/net/minecraftforge/server/permission/nodes/PermissionTypes.java b/src/main/java/net/minecraftforge/server/permission/nodes/PermissionTypes.java index 3128dab8939..311a33292d0 100644 --- a/src/main/java/net/minecraftforge/server/permission/nodes/PermissionTypes.java +++ b/src/main/java/net/minecraftforge/server/permission/nodes/PermissionTypes.java @@ -6,8 +6,7 @@ package net.minecraftforge.server.permission.nodes; import net.minecraft.network.chat.Component; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Default PermissionTypes, if you need additional ones, please PR it. diff --git a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java index 28f83d09674..330eacc6d02 100644 --- a/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/versions/forge/ForgeVersion.java @@ -11,8 +11,7 @@ import net.minecraftforge.fml.loading.JarVersionLookupHandler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import static net.minecraftforge.fml.Logging.CORE; diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 93f4a4ed808..80ed71a2595 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -68,7 +68,6 @@ protected net.minecraft.client.gui.components.DebugScreenOverlay f_94033_ # liqu public net.minecraft.client.gui.screens.MenuScreens m_96206_(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V # register public net.minecraft.client.gui.screens.MenuScreens$ScreenConstructor public net.minecraft.client.gui.screens.Screen f_169369_ # renderables -public net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent m_101404_(Lnet/minecraft/world/level/levelgen/WorldGenSettings;)V # updateSettings public net.minecraft.client.model.geom.LayerDefinitions f_171106_ # OUTER_ARMOR_DEFORMATION public net.minecraft.client.model.geom.LayerDefinitions f_171107_ # INNER_ARMOR_DEFORMATION public net.minecraft.client.multiplayer.ClientPacketListener f_104899_ # commands @@ -149,8 +148,6 @@ protected net.minecraft.core.IdMapper f_122655_ # idToT - internal index list public net.minecraft.core.particles.ParticleType (ZLnet/minecraft/core/particles/ParticleOptions$Deserializer;)V # constructor public net.minecraft.core.particles.SimpleParticleType (Z)V # constructor protected net.minecraft.data.loot.BlockLoot m_124126_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createSingleItemTable -protected net.minecraft.data.loot.BlockLoot m_124131_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/storage/loot/functions/FunctionUserBuilder;)Ljava/lang/Object; # applyExplosionDecay -protected net.minecraft.data.loot.BlockLoot m_124134_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/storage/loot/predicates/ConditionUserBuilder;)Ljava/lang/Object; # applyExplosionCondition protected net.minecraft.data.loot.BlockLoot m_124139_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createOreDrop protected net.minecraft.data.loot.BlockLoot m_124142_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition$Builder;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createCropDrops protected net.minecraft.data.loot.BlockLoot m_124157_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;[F)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createLeavesDrops @@ -184,13 +181,15 @@ protected net.minecraft.data.loot.BlockLoot m_176046_(Lnet/minecraft/world/level protected net.minecraft.data.loot.BlockLoot m_176048_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createLapisOreDrops protected net.minecraft.data.loot.BlockLoot m_176050_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createRedstoneOreDrops protected net.minecraft.data.loot.BlockLoot m_176052_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createCaveVinesDrop -protected net.minecraft.data.loot.BlockLoot m_176054_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createGlowLichenDrops protected net.minecraft.data.loot.BlockLoot m_176056_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createCandleDrops protected net.minecraft.data.loot.BlockLoot m_176058_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createCandleCakeDrops +protected net.minecraft.data.loot.BlockLoot m_236221_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/storage/loot/functions/FunctionUserBuilder;)Lnet/minecraft/world/level/storage/loot/functions/FunctionUserBuilder; # applyExplosionDecay +protected net.minecraft.data.loot.BlockLoot m_236224_(Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/storage/loot/predicates/ConditionUserBuilder;)Lnet/minecraft/world/level/storage/loot/predicates/ConditionUserBuilder; # applyExplosionCondition +protected net.minecraft.data.loot.BlockLoot m_236227_(Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition$Builder;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createMultifaceBlockDrops +protected net.minecraft.data.loot.BlockLoot m_236248_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder; # createMangroveLeavesDrops protected net.minecraft.data.loot.EntityLoot f_124366_ # ENTITY_ON_FIRE protected net.minecraft.data.loot.EntityLoot m_124371_(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/storage/loot/LootTable$Builder;)V # add protected net.minecraft.data.loot.EntityLoot m_124380_(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/world/level/storage/loot/LootTable$Builder;)V # add -protected net.minecraft.data.recipes.RecipeProvider f_125970_ # generator protected net.minecraft.data.recipes.RecipeProvider f_176505_ # COAL_SMELTABLES protected net.minecraft.data.recipes.RecipeProvider f_176506_ # IRON_SMELTABLES protected net.minecraft.data.recipes.RecipeProvider f_176507_ # COPPER_SMELTABLES @@ -200,13 +199,14 @@ protected net.minecraft.data.recipes.RecipeProvider f_176510_ # LAPIS_SMELTABLES protected net.minecraft.data.recipes.RecipeProvider f_176511_ # REDSTONE_SMELTABLES protected net.minecraft.data.recipes.RecipeProvider f_176512_ # EMERALD_SMELTABLES protected net.minecraft.data.recipes.RecipeProvider f_176513_ # shapeBuilders +protected net.minecraft.data.recipes.RecipeProvider f_236355_ # recipePathProvider +protected net.minecraft.data.recipes.RecipeProvider f_236356_ # advancementPathProvider protected net.minecraft.data.recipes.RecipeProvider m_125977_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # has protected net.minecraft.data.recipes.RecipeProvider m_125979_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/advancements/critereon/EnterBlockTrigger$TriggerInstance; # insideOf protected net.minecraft.data.recipes.RecipeProvider m_125994_(Ljava/util/function/Consumer;Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/Item;)V # netheriteSmithing protected net.minecraft.data.recipes.RecipeProvider m_126002_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;)V # woodFromLogs protected net.minecraft.data.recipes.RecipeProvider m_126006_(Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/world/item/crafting/SimpleCookingSerializer;I)V # cookRecipes protected net.minecraft.data.recipes.RecipeProvider m_126011_([Lnet/minecraft/advancements/critereon/ItemPredicate;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # inventoryTrigger -protected net.minecraft.data.recipes.RecipeProvider m_126013_(Lnet/minecraft/data/HashCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V # saveAdvancement protected net.minecraft.data.recipes.RecipeProvider m_126021_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;)V # woodenBoat protected net.minecraft.data.recipes.RecipeProvider m_126061_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;)V # coloredWoolFromWhiteWoolAndDye protected net.minecraft.data.recipes.RecipeProvider m_126069_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/world/level/ItemLike;)V # coloredCarpetFromWhiteCarpetAndDye @@ -257,9 +257,10 @@ protected net.minecraft.data.recipes.RecipeProvider m_176743_(Ljava/util/functio protected net.minecraft.data.recipes.RecipeProvider m_206406_(Lnet/minecraft/tags/TagKey;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # has protected net.minecraft.data.recipes.RecipeProvider m_206408_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/tags/TagKey;)V # planksFromLog protected net.minecraft.data.recipes.RecipeProvider m_206412_(Ljava/util/function/Consumer;Lnet/minecraft/world/level/ItemLike;Lnet/minecraft/tags/TagKey;)V # planksFromLogs +protected net.minecraft.data.recipes.RecipeProvider m_236367_(Lnet/minecraft/data/CachedOutput;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V # saveAdvancement public net.minecraft.data.recipes.ShapedRecipeBuilder$Result protected net.minecraft.data.tags.TagsProvider f_126543_ # builders -protected net.minecraft.data.tags.TagsProvider m_6648_(Lnet/minecraft/resources/ResourceLocation;)Ljava/nio/file/Path; # getPath +public-f net.minecraft.data.tags.TagsProvider m_6055_()Ljava/lang/String; # getName public net.minecraft.data.tags.TagsProvider$TagAppender f_126569_ # registry public net.minecraft.gametest.framework.GameTestServer (Ljava/lang/Thread;Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/WorldStem;Ljava/util/Collection;Lnet/minecraft/core/BlockPos;)V # constructor public net.minecraft.network.protocol.status.ClientboundStatusResponsePacket f_134885_ # GSON @@ -275,11 +276,6 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl f_10021_ # gam public net.minecraft.server.packs.AbstractPackResources f_10203_ # file public net.minecraft.server.packs.PackType f_143750_ # bridgeType public net.minecraft.server.packs.resources.FallbackResourceManager f_10599_ # fallbacks -public net.minecraft.tags.Tag$BuilderEntry (Lnet/minecraft/tags/Tag$Entry;Ljava/lang/String;)V # constructor -public net.minecraft.tags.Tag$ElementEntry -public net.minecraft.tags.Tag$OptionalElementEntry -public net.minecraft.tags.Tag$OptionalTagEntry -public net.minecraft.tags.Tag$TagEntry public net.minecraft.util.datafix.fixes.StructuresBecomeConfiguredFix$Conversion public net.minecraft.util.thread.BlockableEventLoop m_18689_(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # submitAsync #group public net.minecraft.world.damagesource.DamageSource *() #All methods public, most are already @@ -298,15 +294,11 @@ public net.minecraft.world.entity.Mob f_21346_ # targetSelector public net.minecraft.world.entity.SpawnPlacements m_21754_(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/entity/SpawnPlacements$Type;Lnet/minecraft/world/level/levelgen/Heightmap$Types;Lnet/minecraft/world/entity/SpawnPlacements$SpawnPredicate;)V # register public net.minecraft.world.entity.ai.memory.MemoryModuleType (Ljava/util/Optional;)V # constructor public net.minecraft.world.entity.ai.sensing.SensorType (Ljava/util/function/Supplier;)V # constructor -public net.minecraft.world.entity.ai.village.poi.PoiType (Ljava/lang/String;Ljava/util/Set;II)V # constructor -public net.minecraft.world.entity.ai.village.poi.PoiType (Ljava/lang/String;Ljava/util/Set;ILjava/util/function/Predicate;I)V # constructor -public net.minecraft.world.entity.ai.village.poi.PoiType m_27372_(Lnet/minecraft/world/level/block/Block;)Ljava/util/Set; # getBlockStates protected net.minecraft.world.entity.item.PrimedTnt m_32103_()V # explode - make it easier to extend TNTEntity with custom explosion logic protected net.minecraft.world.entity.monster.AbstractSkeleton m_7878_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.world.entity.monster.Skeleton m_7878_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.world.entity.monster.Stray m_7878_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.world.entity.monster.WitherSkeleton m_7878_()Lnet/minecraft/sounds/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable -public net.minecraft.world.entity.npc.VillagerProfession (Ljava/lang/String;Lnet/minecraft/world/entity/ai/village/poi/PoiType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/sounds/SoundEvent;)V # constructor public net.minecraft.world.entity.player.Player m_6915_()V # closeContainer protected net.minecraft.world.entity.projectile.Projectile (Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;)V # constructor private-f net.minecraft.world.entity.raid.Raid$RaiderType f_37813_ # VALUES @@ -342,14 +334,23 @@ public net.minecraft.world.level.Level f_46438_ # rainLevel public net.minecraft.world.level.Level f_46439_ # oThunderLevel public net.minecraft.world.level.Level f_46440_ # thunderLevel public net.minecraft.world.level.biome.Biome$ClimateSettings -public net.minecraft.world.level.biome.Biome$ClimateSettings (Lnet/minecraft/world/level/biome/Biome$Precipitation;FLnet/minecraft/world/level/biome/Biome$TemperatureModifier;F)V # constructor -public net.minecraft.world.level.biome.Biome$ClimateSettings f_47680_ # precipitation -public net.minecraft.world.level.biome.Biome$ClimateSettings f_47681_ # temperature -public net.minecraft.world.level.biome.Biome$ClimateSettings f_47682_ # temperatureModifier -public net.minecraft.world.level.biome.Biome$ClimateSettings f_47683_ # downfall protected net.minecraft.world.level.biome.BiomeGenerationSettings$Builder f_47827_ # carvers protected net.minecraft.world.level.biome.BiomeGenerationSettings$Builder f_47828_ # features protected net.minecraft.world.level.biome.BiomeGenerationSettings$Builder m_47832_(I)V # addFeatureStepsUpTo +#group protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder * +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48005_ # fogColor +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48006_ # waterColor +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48007_ # waterFogColor +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48008_ # skyColor +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48009_ # foliageColorOverride +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48010_ # grassColorOverride +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48011_ # grassColorModifier +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48012_ # ambientParticle +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48013_ # ambientLoopSoundEvent +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48014_ # ambientMoodSettings +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48015_ # ambientAdditionsSettings +protected net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_48016_ # backgroundMusic +#endgroup protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48362_ # spawners protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48363_ # mobSpawnCosts protected net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48364_ # creatureGenerationProbability @@ -407,6 +408,7 @@ public net.minecraft.world.level.block.LecternBlock (Lnet/minecraft/world/ public net.minecraft.world.level.block.LeverBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.LiquidBlock (Lnet/minecraft/world/level/material/FlowingFluid;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.LoomBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor +public net.minecraft.world.level.block.MangroveRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.MelonBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.NetherWartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.NyliumBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor @@ -453,9 +455,8 @@ public net.minecraft.world.level.block.WoodButtonBlock (Lnet/minecraft/wor public net.minecraft.world.level.block.WoolCarpetBlock (Lnet/minecraft/world/item/DyeColor;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor #endgroup public net.minecraft.world.level.block.Block m_49805_(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;I)V # popExperience -public net.minecraft.world.level.block.FireBlock m_53492_(Lnet/minecraft/world/level/block/state/BlockState;)I # getBurnOdd -public net.minecraft.world.level.block.FireBlock m_53494_(Lnet/minecraft/world/level/block/state/BlockState;)I # getFlameOdds -public net.minecraft.world.level.block.entity.BannerPattern f_58530_ # hasPatternItem +public net.minecraft.world.level.block.FireBlock m_221164_(Lnet/minecraft/world/level/block/state/BlockState;)I # getBurnOdds +public net.minecraft.world.level.block.FireBlock m_221166_(Lnet/minecraft/world/level/block/state/BlockState;)I # getIgniteOdds public net.minecraft.world.level.block.entity.BlockEntityType$BlockEntitySupplier public net.minecraft.world.level.block.entity.HopperBlockEntity m_59395_(I)V # setCooldown public net.minecraft.world.level.block.entity.HopperBlockEntity m_59409_()Z # isOnCustomCooldown @@ -476,26 +477,22 @@ protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158027_ protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158039_(I)I # gridX protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158045_(I)I # gridY protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer m_158047_(I)I # gridZ -protected net.minecraft.world.level.levelgen.Beardifier f_158063_ # rigids -protected net.minecraft.world.level.levelgen.Beardifier f_158064_ # junctions protected net.minecraft.world.level.levelgen.Beardifier f_158065_ # pieceIterator protected net.minecraft.world.level.levelgen.Beardifier f_158066_ # junctionIterator protected net.minecraft.world.level.levelgen.Beardifier m_158083_(III)D # getBuryContribution -protected net.minecraft.world.level.levelgen.Beardifier m_158087_(III)D # getBeardContribution +protected net.minecraft.world.level.levelgen.Beardifier m_223925_(IIII)D # getBeardContribution private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64114_ # ALL_BLOCKS private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64115_ # GRID_WIDTH private-f net.minecraft.world.level.levelgen.DebugLevelSource f_64116_ # GRID_HEIGHT public-f net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator -protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator f_158382_ # sampler -protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator f_64333_ # seed -protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_158413_(II[Lnet/minecraft/world/level/block/state/BlockState;Ljava/util/function/Predicate;II)Ljava/util/OptionalInt; # iterateNoiseColumn +protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_224239_(Lnet/minecraft/world/level/LevelHeightAccessor;Lnet/minecraft/world/level/levelgen/RandomState;IILorg/apache/commons/lang3/mutable/MutableObject;Ljava/util/function/Predicate;)Ljava/util/OptionalInt; # iterateNoiseColumn #group public net.minecraft.world.level.levelgen.NoiseGeneratorSettings *() -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198262_(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings;)V # register public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198265_(ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # overworld public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198268_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # end public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198269_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # nether public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198270_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # caves public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198271_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # floatingIslands +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_224385_(Lnet/minecraft/core/Registry;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings;)Lnet/minecraft/core/Holder; # register public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_64474_(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App; # lambda$static$0 #endgroup public net.minecraft.world.level.levelgen.WorldGenSettings (JZZLnet/minecraft/core/Registry;Ljava/util/Optional;)V # constructor diff --git a/src/main/resources/META-INF/coremods.json b/src/main/resources/META-INF/coremods.json index cdba3b48877..bc26fe0f09e 100644 --- a/src/main/resources/META-INF/coremods.json +++ b/src/main/resources/META-INF/coremods.json @@ -1,6 +1,5 @@ { "field_to_method": "coremods/field_to_method.js", "field_to_instanceof": "coremods/field_to_instanceof.js", - "add_bouncer_method": "coremods/add_bouncer_method.js", - "registry_object_binary_compat": "coremods/registry_object_binary_compat.js" + "add_bouncer_method": "coremods/add_bouncer_method.js" } diff --git a/src/main/resources/coremods/field_to_method.js b/src/main/resources/coremods/field_to_method.js index dd60c6be30f..6c0082806df 100644 --- a/src/main/resources/coremods/field_to_method.js +++ b/src/main/resources/coremods/field_to_method.js @@ -2,6 +2,17 @@ var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI') function initializeCoreMod() { return { + 'biome': { + 'target': { + 'type': 'CLASS', + 'name': 'net.minecraft.world.level.biome.Biome' + }, + 'transformer': function(classNode) { + ASMAPI.redirectFieldToMethod(classNode, ASMAPI.mapField('f_47437_'), 'getModifiedClimateSettings') + ASMAPI.redirectFieldToMethod(classNode, ASMAPI.mapField('f_47443_'), 'getModifiedSpecialEffects') + return classNode; + } + }, 'potion': { 'target': { 'type': 'CLASS', diff --git a/src/main/resources/coremods/registry_object_binary_compat.js b/src/main/resources/coremods/registry_object_binary_compat.js deleted file mode 100644 index c73e118241e..00000000000 --- a/src/main/resources/coremods/registry_object_binary_compat.js +++ /dev/null @@ -1,61 +0,0 @@ -var Opcodes = Java.type('org.objectweb.asm.Opcodes') -var MethodNode = Java.type('org.objectweb.asm.tree.MethodNode') -var VarInsnNode = Java.type('org.objectweb.asm.tree.VarInsnNode') -var MethodInsnNode = Java.type('org.objectweb.asm.tree.MethodInsnNode') -var TypeInsnNode = Java.type('org.objectweb.asm.tree.TypeInsnNode') -var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode') - -// TODO 1.19: Delete this whole coremod. We won't need to maintain binary compatibility then. -// This coremod exists purely because of Java limitations - 2 methods with the same parameters and name but different return types are not allowed. -// However, this restriction does not exist in the JVM. -// The bounds of RegistryObject's T generic parameter were changed to no longer require IForgeRegistryEntry. -// This changes the erased type of the T parameter to just Object instead of IForgeRegistryEntry. -// This coremod was made to maintain compatibility with mods compiled on old forge in the least invasive way. -// It adds runtime methods for the 4 methods in RegistryObject that return type T to allow calling them with the erased bound of IForgeRegistryEntry. -// The ASM methods just delegate to the original methods and return with a cast. -function initializeCoreMod() { - return { - 'registry_object_binary_compat': { - 'target': { - 'type': 'CLASS', - 'name': 'net.minecraftforge.registries.RegistryObject' - }, - 'transformer': function (classNode) { - var getNode = new MethodNode(Opcodes.ACC_PUBLIC, 'get', '()Lnet/minecraftforge/registries/IForgeRegistryEntry;', null, null) - getNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)) - getNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 'net/minecraftforge/registries/RegistryObject', 'get', '()Ljava/lang/Object;')) - getNode.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, 'net/minecraftforge/registries/IForgeRegistryEntry')) - getNode.instructions.add(new InsnNode(Opcodes.ARETURN)) - - var orElseNode = new MethodNode(Opcodes.ACC_PUBLIC, 'orElse', '(Lnet/minecraftforge/registries/IForgeRegistryEntry;)Lnet/minecraftforge/registries/IForgeRegistryEntry;', null, null) - orElseNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)) - orElseNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)) - orElseNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 'net/minecraftforge/registries/RegistryObject', 'orElse', '(Ljava/lang/Object;)Ljava/lang/Object;')) - orElseNode.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, 'net/minecraftforge/registries/IForgeRegistryEntry')) - orElseNode.instructions.add(new InsnNode(Opcodes.ARETURN)) - - var orElseGetNode = new MethodNode(Opcodes.ACC_PUBLIC, 'orElseGet', '(Ljava/util/function/Supplier;)Lnet/minecraftforge/registries/IForgeRegistryEntry;', '(Ljava/util/function/Supplier<+TT;>;)Lnet/minecraftforge/registries/IForgeRegistryEntry;', null) - orElseGetNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)) - orElseGetNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)) - orElseGetNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 'net/minecraftforge/registries/RegistryObject', 'orElseGet', '(Ljava/util/function/Supplier;)Ljava/lang/Object;')) - orElseGetNode.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, 'net/minecraftforge/registries/IForgeRegistryEntry')) - orElseGetNode.instructions.add(new InsnNode(Opcodes.ARETURN)) - - // orElseThrow - var orElseThrowNode = new MethodNode(Opcodes.ACC_PUBLIC, 'orElseThrow', '(Ljava/util/function/Supplier;)Lnet/minecraftforge/registries/IForgeRegistryEntry;', '\<\X:Ljava/lang/Throwable;>(Ljava/util/function/Supplier<+TX;>;)Lnet/minecraftforge/registries/IForgeRegistryEntry;^TX;', ['java/lang/Throwable']) - orElseThrowNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)) - orElseThrowNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)) - orElseThrowNode.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 'net/minecraftforge/registries/RegistryObject', 'orElseThrow', '(Ljava/util/function/Supplier;)Ljava/lang/Object;')) - orElseThrowNode.instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, 'net/minecraftforge/registries/IForgeRegistryEntry')) - orElseThrowNode.instructions.add(new InsnNode(Opcodes.ARETURN)) - - classNode.methods.add(getNode) - classNode.methods.add(orElseNode) - classNode.methods.add(orElseGetNode) - classNode.methods.add(orElseThrowNode) - - return classNode - } - } - } -} \ No newline at end of file diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 817f827c382..f2c46d9066b 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -1,10 +1,11 @@ net/minecraft/advancements/Advancement$Builder.fromJson(Lcom/google/gson/JsonObject;Lnet/minecraft/advancements/critereon/DeserializationContext;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/advancements/Advancement$Builder;=|p_138381_,p_138382_,context -net/minecraft/client/Minecraft.doLoadLevel(Ljava/lang/String;Ljava/util/function/Function;Ljava/util/function/Function;ZLnet/minecraft/client/Minecraft$ExperimentalDialogType;Z)V=|p_205206_,p_205207_,p_205208_,p_205209_,p_205210_,creating net/minecraft/client/gui/screens/MenuScreens.getScreenFactory(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/network/chat/Component;)Ljava/util/Optional;=|p_96202_,p_96203_,p_96204_,p_96205_ -net/minecraft/client/renderer/FogRenderer.setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V=|p_109025_,p_109026_,p_109027_,p_109028_,partialTicks net/minecraft/client/renderer/ScreenEffectRenderer.getOverlayBlock(Lnet/minecraft/world/entity/player/Player;)Lorg/apache/commons/lang3/tuple/Pair;=|p_110717_ net/minecraft/client/renderer/ShaderInstance.(Lnet/minecraft/server/packs/resources/ResourceProvider;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/blaze3d/vertex/VertexFormat;)V=|p_173336_,shaderLocation,p_173338_ net/minecraft/client/renderer/block/BlockModelShaper.getTexture(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;=|p_110883_,level,pos +net/minecraft/client/renderer/block/BlockRenderDispatcher.renderBatched(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/IModelData;)V=|p_234356_,p_234357_,p_234358_,p_234359_,p_234360_,p_234361_,p_234362_,modelData +net/minecraft/client/renderer/block/BlockRenderDispatcher.renderBreakingTexture(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraftforge/client/model/data/IModelData;)V=|p_110919_,p_110920_,p_110921_,p_110922_,p_110923_,modelData +net/minecraft/client/renderer/block/BlockRenderDispatcher.renderSingleBlock(Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IILnet/minecraftforge/client/model/data/IModelData;)V=|p_110913_,p_110914_,p_110915_,p_110916_,p_110917_,modelData net/minecraft/client/renderer/block/model/BlockModel.bakeVanilla(Lnet/minecraft/client/resources/model/ModelBakery;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;Z)Lnet/minecraft/client/resources/model/BakedModel;=|p_111450_,p_111451_,p_111452_,p_111453_,p_111454_,p_111455_ net/minecraft/client/renderer/block/model/ItemTransforms.(Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lnet/minecraft/client/renderer/block/model/ItemTransform;Lcom/google/common/collect/ImmutableMap;)V=|p_111798_,p_111799_,p_111800_,p_111801_,p_111802_,p_111803_,p_111804_,p_111805_,moddedTransforms net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ChunkCompileTask.(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DZ)V=|p_194422_,pos,p_194423_,p_194424_ @@ -13,23 +14,26 @@ net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ResortTran net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.(Lnet/minecraft/client/multiplayer/ClientLevel;Lnet/minecraft/client/renderer/LevelRenderer;Ljava/util/concurrent/Executor;ZLnet/minecraft/client/renderer/ChunkBufferBuilderPack;I)V=|p_194405_,p_194406_,p_194407_,p_194408_,p_194409_,countRenderBuilders net/minecraft/client/resources/model/ModelBakery.(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/client/color/block/BlockColors;Z)V=|p_119247_,p_119248_,vanillaBakery net/minecraft/client/resources/model/ModelBakery.processLoading(Lnet/minecraft/util/profiling/ProfilerFiller;I)V=|p_119249_,p_119250_ -net/minecraft/client/resources/model/MultiPartBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_119465_,p_119466_,p_119467_,modelData -net/minecraft/client/resources/model/WeightedBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_119547_,p_119548_,p_119549_,modelData +net/minecraft/client/resources/model/MultiPartBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_235050_,p_235051_,p_235052_,modelData +net/minecraft/client/resources/model/WeightedBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_235058_,p_235059_,p_235060_,modelData +net/minecraft/data/tags/BannerPatternTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236411_,modId,existingFileHelper net/minecraft/data/tags/BiomeTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_211094_,modId,existingFileHelper net/minecraft/data/tags/BlockTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_126511_,modId,existingFileHelper -net/minecraft/data/tags/ConfiguredStructureTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_211098_,modId,existingFileHelper +net/minecraft/data/tags/CatVariantTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236420_,modId,existingFileHelper net/minecraft/data/tags/EntityTypeTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_126517_,modId,existingFileHelper +net/minecraft/data/tags/FlatLevelGeneratorPresetTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236423_,modId,existingFileHelper net/minecraft/data/tags/FluidTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_126523_,modId,existingFileHelper net/minecraft/data/tags/GameEventTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_176826_,modId,existingFileHelper +net/minecraft/data/tags/InstrumentTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236428_,modId,existingFileHelper net/minecraft/data/tags/ItemTagsProvider.(Lnet/minecraft/data/DataGenerator;Lnet/minecraft/data/tags/BlockTagsProvider;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_126530_,p_126531_,modId,existingFileHelper +net/minecraft/data/tags/PaintingVariantTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236431_,modId,existingFileHelper +net/minecraft/data/tags/PoiTypeTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236434_,modId,existingFileHelper +net/minecraft/data/tags/StructureTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236437_,modId,existingFileHelper net/minecraft/data/tags/TagsProvider.(Lnet/minecraft/data/DataGenerator;Lnet/minecraft/core/Registry;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_126546_,p_126547_,modId,existingFileHelper +net/minecraft/data/tags/WorldPresetTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_236457_,modId,existingFileHelper net/minecraft/gametest/framework/GameTestRegistry.register(Ljava/lang/reflect/Method;Ljava/util/Set;)V=|p_177504_,allowedNamespaces net/minecraft/network/FriendlyByteBuf.writeItemStack(Lnet/minecraft/world/item/ItemStack;Z)Lnet/minecraft/network/FriendlyByteBuf;=|p_130056_,limitedTag net/minecraft/server/ServerAdvancementManager.(Lnet/minecraft/world/level/storage/loot/PredicateManager;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|p_136027_,context -net/minecraft/server/dedicated/DedicatedServer.sendMessage(Lnet/minecraft/network/chat/Component;Ljava/util/UUID;)V=|message,p_108776_ -net/minecraft/server/level/ServerLevel.removeEntity(Lnet/minecraft/world/entity/Entity;Z)V=|p_8868_,keepData -net/minecraft/server/level/ServerLevel.removeEntityComplete(Lnet/minecraft/world/entity/Entity;Z)V=|p_8865_,keepData -net/minecraft/server/level/ServerLevel.removePlayer(Lnet/minecraft/server/level/ServerPlayer;Z)V=|p_8850_,keepData net/minecraft/server/level/ServerPlayer.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_9180_,teleporter net/minecraft/server/level/ServerPlayerGameMode.removeBlock(Lnet/minecraft/core/BlockPos;Z)Z=|p_180235_1_,canHarvest net/minecraft/server/level/Ticket.(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;Z)V=|p_9425_,p_9426_,p_9427_,forceTicks @@ -49,15 +53,14 @@ net/minecraft/world/item/ItemStack.(Lnet/minecraft/world/level/ItemLike;IL net/minecraft/world/item/ItemStack.onItemUse(Lnet/minecraft/world/item/context/UseOnContext;Ljava/util/function/Function;)Lnet/minecraft/world/InteractionResult;=|p_41662_,callback net/minecraft/world/item/ItemStack.onItemUseFirst(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;=|p_41662_ net/minecraft/world/item/MapItem.getCustomMapData(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/level/saveddata/maps/MapItemSavedData;=|p_42910_,p_42911_ -net/minecraft/world/item/alchemy/PotionBrewing$Mix.(Lnet/minecraftforge/registries/ForgeRegistryEntry;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraftforge/registries/ForgeRegistryEntry;)V=|p_43536_,p_43537_,p_43538_ +net/minecraft/world/item/alchemy/PotionBrewing$Mix.(Lnet/minecraftforge/registries/IForgeRegistry;Ljava/lang/Object;Lnet/minecraft/world/item/crafting/Ingredient;Ljava/lang/Object;)V=|registry,p_43536_,p_43537_,p_43538_ net/minecraft/world/item/crafting/RecipeManager.(Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|context net/minecraft/world/item/crafting/RecipeManager.fromJson(Lnet/minecraft/resources/ResourceLocation;Lcom/google/gson/JsonObject;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/world/item/crafting/Recipe;=|p_44046_,p_44047_,context net/minecraft/world/level/Level.markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V=|p_46605_,levelchunk,blockstate,p_46606_,p_46607_,p_46608_ net/minecraft/world/level/LevelSettings.(Ljava/lang/String;Lnet/minecraft/world/level/GameType;ZLnet/minecraft/world/Difficulty;ZLnet/minecraft/world/level/GameRules;Lnet/minecraft/world/level/DataPackConfig;Lcom/mojang/serialization/Lifecycle;)V=|p_46910_,p_46911_,p_46912_,p_46913_,p_46914_,p_46915_,p_46916_,lifecycle -net/minecraft/world/level/block/FireBlock.tryCatchFire(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;ILjava/util/Random;ILnet/minecraft/core/Direction;)V=|p_53432_,p_53433_,p_53434_,p_53435_,p_53436_,face +net/minecraft/world/level/block/FireBlock.tryCatchFire(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;ILnet/minecraft/util/RandomSource;ILnet/minecraft/core/Direction;)V=|p_53432_,p_53433_,p_53434_,p_53435_,p_53436_,face net/minecraft/world/level/block/FlowerPotBlock.(Ljava/util/function/Supplier;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|emptyPot,p_53528_,properties net/minecraft/world/level/block/LiquidBlock.(Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|p_54694_,p_54695_ -net/minecraft/world/level/dimension/LevelStem.(Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/chunk/ChunkGenerator;Z)V=|p_204519_,p_204520_,useServerSeed net/minecraft/world/level/entity/PersistentEntitySectionManager.addEntityWithoutEvent(Lnet/minecraft/world/level/entity/EntityAccess;Z)Z=|p_157539_,p_157540_ net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.processEntityInfos(Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/List;)Ljava/util/List;=|template,p_215387_0_,p_215387_1_,p_215387_2_,p_215387_3_ net/minecraft/world/level/storage/loot/LootPool.([Lnet/minecraft/world/level/storage/loot/entries/LootPoolEntryContainer;[Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition;[Lnet/minecraft/world/level/storage/loot/functions/LootItemFunction;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Ljava/lang/String;)V=|p_165128_,p_165129_,p_165130_,p_165131_,p_165132_,name \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 3f0f28e031d..f24cb685744 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "pack_format": 8, "description": "Forge resource pack", - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } } diff --git a/src/test/java/net/minecraftforge/debug/AddPackFinderEventTest.java b/src/test/java/net/minecraftforge/debug/AddPackFinderEventTest.java index 962f6a47117..991b9be50d5 100644 --- a/src/test/java/net/minecraftforge/debug/AddPackFinderEventTest.java +++ b/src/test/java/net/minecraftforge/debug/AddPackFinderEventTest.java @@ -5,7 +5,7 @@ package net.minecraftforge.debug; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.server.packs.repository.Pack; @@ -38,7 +38,7 @@ public static void addPackFinders(AddPackFindersEvent event) { event.addRepositorySource((packConsumer, packConstructor) -> packConsumer.accept(packConstructor.create( - "builtin/add_pack_finders_test", new TextComponent("display name"), false, + "builtin/add_pack_finders_test", Component.literal("display name"), false, () -> pack, metadataSection, Pack.Position.BOTTOM, PackSource.BUILT_IN, false))); } } diff --git a/src/test/java/net/minecraftforge/debug/CapabilitiesTest.java b/src/test/java/net/minecraftforge/debug/CapabilitiesTest.java index ec8fc9eb2c1..1afe9d9027d 100644 --- a/src/test/java/net/minecraftforge/debug/CapabilitiesTest.java +++ b/src/test/java/net/minecraftforge/debug/CapabilitiesTest.java @@ -8,10 +8,11 @@ import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; @@ -31,6 +32,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Locale; +import java.util.Objects; import java.util.concurrent.ConcurrentLinkedQueue; @Mod(CapabilitiesTest.MODID) @@ -122,11 +124,12 @@ public static class ClientEvents @SubscribeEvent public static void clientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) + if (event.phase == TickEvent.Phase.END && Minecraft.getInstance().level != null) { while(messages.size() > 0) { - Minecraft.getInstance().gui.handleChat(ChatType.SYSTEM, new TextComponent(messages.poll()), Util.NIL_UUID); + final ChatType system = Minecraft.getInstance().level.registryAccess().registryOrThrow(Registry.CHAT_TYPE_REGISTRY).getOrThrow(ChatType.SYSTEM); + Minecraft.getInstance().gui.handleSystemChat(system, Component.literal(Objects.requireNonNull(messages.poll()))); } } } diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index 3dd8df101cf..d925acdba55 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -29,10 +29,11 @@ import com.google.gson.JsonPrimitive; import net.minecraft.Util; import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.data.CachedOutput; import net.minecraft.data.advancements.AdvancementProvider; import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.ItemStack; @@ -48,6 +49,7 @@ import net.minecraftforge.common.crafting.NBTIngredient; import net.minecraftforge.common.data.SoundDefinition; import net.minecraftforge.common.data.SoundDefinitionsProvider; +import net.minecraftforge.registries.ForgeRegistries; import org.apache.commons.lang3.tuple.Triple; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -87,7 +89,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ItemModelProvider; @@ -140,21 +141,16 @@ public static void gatherData(GatherDataEvent event) DataGenerator gen = event.getGenerator(); - if (event.includeClient()) - { - gen.addProvider(new Lang(gen)); - // Let blockstate provider see generated item models by passing its existing file helper - ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper()); - gen.addProvider(itemModels); - gen.addProvider(new BlockStates(gen, itemModels.existingFileHelper)); - gen.addProvider(new SoundDefinitions(gen, event.getExistingFileHelper())); - } - if (event.includeServer()) - { - gen.addProvider(new Recipes(gen)); - gen.addProvider(new Tags(gen, event.getExistingFileHelper())); - gen.addProvider(new Advancements(gen, event.getExistingFileHelper())); - } + gen.addProvider(event.includeClient(), new Lang(gen)); + // Let blockstate provider see generated item models by passing its existing file helper + ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper()); + gen.addProvider(event.includeClient(), itemModels); + gen.addProvider(event.includeClient(), new BlockStates(gen, itemModels.existingFileHelper)); + gen.addProvider(event.includeClient(), new SoundDefinitions(gen, event.getExistingFileHelper())); + + gen.addProvider(event.includeServer(), new Recipes(gen)); + gen.addProvider(event.includeServer(), new Tags(gen, event.getExistingFileHelper())); + gen.addProvider(event.includeServer(), new Advancements(gen, event.getExistingFileHelper())); } public static class Recipes extends RecipeProvider implements IConditionBuilder @@ -201,8 +197,8 @@ protected void buildCraftingRecipes(Consumer consumer) Advancement.Builder.advancement() .parent(new ResourceLocation("minecraft", "root")) .display(Blocks.DIAMOND_BLOCK, - new TextComponent("Dirt2Diamonds"), - new TextComponent("The BEST crafting recipe in the game!"), + Component.literal("Dirt2Diamonds"), + Component.literal("The BEST crafting recipe in the game!"), null, FrameType.TASK, false, false, false ) .rewards(AdvancementRewards.Builder.recipe(ID)) @@ -413,7 +409,7 @@ public void registerSounds() } @Override - public void run(HashCache cache) throws IOException + public void run(CachedOutput cache) throws IOException { super.run(cache); test(); @@ -431,7 +427,7 @@ private void test() throws IOException throw new RuntimeException("Unable to test for errors due to reflection error", e); } final JsonObject actual = GSON.fromJson( - new InputStreamReader(this.helper.getResource(new ResourceLocation("sounds.json"), PackType.CLIENT_RESOURCES).getInputStream()), + this.helper.getResource(new ResourceLocation("sounds.json"), PackType.CLIENT_RESOURCES).openAsReader(), JsonObject.class ); @@ -659,7 +655,7 @@ protected void registerModels() ); @Override - public void run(HashCache cache) throws IOException + public void run(CachedOutput cache) throws IOException { super.run(cache); List errors = testModelResults(this.generatedModels, existingFileHelper, IGNORED_MODELS.stream().map(s -> new ResourceLocation(MODID, folder + "/" + s)).collect(Collectors.toSet())); @@ -796,20 +792,22 @@ protected void registerStatesAndModels() ModelFile barrel = models().cubeBottomTop("barrel", mcLoc("block/barrel_side"), mcLoc("block/barrel_bottom"), mcLoc("block/barrel_top")); ModelFile barrelOpen = models().cubeBottomTop("barrel_open", mcLoc("block/barrel_side"), mcLoc("block/barrel_bottom"), mcLoc("block/barrel_top_open")); directionalBlock(Blocks.BARREL, state -> state.getValue(BarrelBlock.OPEN) ? barrelOpen : barrel); // Testing custom state interpreter - + logBlock((RotatedPillarBlock) Blocks.ACACIA_LOG); stairsBlock((StairBlock) Blocks.ACACIA_STAIRS, "acacia", mcLoc("block/acacia_planks")); - slabBlock((SlabBlock) Blocks.ACACIA_SLAB, Blocks.ACACIA_PLANKS.getRegistryName(), mcLoc("block/acacia_planks")); + slabBlock((SlabBlock) Blocks.ACACIA_SLAB, ForgeRegistries.BLOCKS.getKey(Blocks.ACACIA_PLANKS), mcLoc("block/acacia_planks")); - fenceBlock((FenceBlock) Blocks.ACACIA_FENCE, "acacia", mcLoc("block/acacia_planks")); + // TODO 1.19: fix fenceBlock, wallBlock, doorBlock, and co -SS + // fenceBlock((FenceBlock) Blocks.ACACIA_FENCE, "acacia", mcLoc("block/acacia_planks")); fenceGateBlock((FenceGateBlock) Blocks.ACACIA_FENCE_GATE, "acacia", mcLoc("block/acacia_planks")); - wallBlock((WallBlock) Blocks.COBBLESTONE_WALL, "cobblestone", mcLoc("block/cobblestone")); + // wallBlock((WallBlock) Blocks.COBBLESTONE_WALL, "cobblestone", mcLoc("block/cobblestone")); paneBlock((IronBarsBlock) Blocks.GLASS_PANE, "glass", mcLoc("block/glass"), mcLoc("block/glass_pane_top")); - doorBlock((DoorBlock) Blocks.ACACIA_DOOR, "acacia", mcLoc("block/acacia_door_bottom"), mcLoc("block/acacia_door_top")); + + // doorBlock((DoorBlock) Blocks.ACACIA_DOOR, "acacia", mcLoc("block/acacia_door_bottom"), mcLoc("block/acacia_door_top")); trapdoorBlock((TrapDoorBlock) Blocks.ACACIA_TRAPDOOR, "acacia", mcLoc("block/acacia_trapdoor"), true); trapdoorBlock((TrapDoorBlock) Blocks.OAK_TRAPDOOR, "oak", mcLoc("block/oak_trapdoor"), false); // Test a non-orientable trapdoor @@ -838,7 +836,7 @@ protected void registerStatesAndModels() private List errors = new ArrayList<>(); @Override - public void run(HashCache cache) throws IOException + public void run(CachedOutput cache) throws IOException { super.run(cache); this.errors.addAll(testModelResults(models().generatedModels, models().existingFileHelper, Sets.union(IGNORED_MODELS, CUSTOM_MODELS))); @@ -846,8 +844,8 @@ public void run(HashCache cache) throws IOException if (IGNORED_BLOCKS.contains(block)) return; JsonObject generated = state.toJson(); try { - Resource vanillaResource = models().existingFileHelper.getResource(block.getRegistryName(), PackType.CLIENT_RESOURCES, ".json", "blockstates"); - JsonObject existing = GSON.fromJson(new InputStreamReader(vanillaResource.getInputStream()), JsonObject.class); + Resource vanillaResource = models().existingFileHelper.getResource(ForgeRegistries.BLOCKS.getKey(block), PackType.CLIENT_RESOURCES, ".json", "blockstates"); + JsonObject existing = GSON.fromJson(vanillaResource.openAsReader(), JsonObject.class); if (state instanceof VariantBlockStateBuilder) { compareVariantBlockstates(block, generated, existing); } else if (state instanceof MultiPartBlockStateBuilder) { @@ -1027,8 +1025,8 @@ public Advancements(DataGenerator generatorIn, ExistingFileHelper fileHelper) protected void registerAdvancements(Consumer consumer, ExistingFileHelper fileHelper) { Advancement.Builder.advancement().display(Items.DIRT, - new TranslatableComponent(Items.DIRT.getDescriptionId()), - new TranslatableComponent("dirt_description"), + Component.translatable(Items.DIRT.getDescriptionId()), + Component.translatable("dirt_description"), new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, true, @@ -1038,8 +1036,8 @@ protected void registerAdvancements(Consumer consumer, ExistingFile .save(consumer, new ResourceLocation(MODID, "obtain_dirt"), fileHelper); Advancement.Builder.advancement().display(Items.DIAMOND_BLOCK, - new TranslatableComponent(Items.DIAMOND_BLOCK.getDescriptionId()), - new TextComponent("You obtained a DiamondBlock"), + Component.translatable(Items.DIAMOND_BLOCK.getDescriptionId()), + Component.literal("You obtained a DiamondBlock"), new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.CHALLENGE, true, @@ -1050,8 +1048,8 @@ protected void registerAdvancements(Consumer consumer, ExistingFile Advancement.Builder.advancement() .display(Blocks.GRASS_BLOCK, - new TranslatableComponent("advancements.story.root.title"), - new TextComponent("Changed Description"), + Component.translatable("advancements.story.root.title"), + Component.literal("Changed Description"), new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, false, @@ -1074,8 +1072,8 @@ protected void registerAdvancements(Consumer consumer, ExistingFile .save(consumer, new ResourceLocation("illegal_parent"), fileHelper);*/ Advancement.Builder.advancement().display(Blocks.COBBLESTONE, - new TranslatableComponent(Items.COBBLESTONE.getDescriptionId()), - new TextComponent("You got cobblestone"), + Component.translatable(Items.COBBLESTONE.getDescriptionId()), + Component.literal("You got cobblestone"), new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, false, @@ -1097,7 +1095,7 @@ private static > List testModelResults(Map ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); private static final DeferredRegister CUSTOMS = DeferredRegister.create(new ResourceLocation(MODID, "test_registry"), MODID); private static final DeferredRegister DOESNT_EXIST_REG = DeferredRegister.createOptional(new ResourceLocation(MODID, "doesnt_exist"), MODID); + private static final DeferredRegister> RECIPE_TYPES = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, MODID); // Vanilla Registry - filled directly after all RegistryEvent.Register events are fired - private static final DeferredRegister> RECIPE_TYPES = DeferredRegister.create(Registry.RECIPE_TYPE_REGISTRY, MODID); + private static final DeferredRegister> POS_RULE_TEST_TYPES = DeferredRegister.create(Registry.POS_RULE_TEST_REGISTRY, MODID); // Vanilla Builtin Registry - filled directly after all RegistryEvent.Register events are fired private static final DeferredRegister PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, MODID); @@ -61,12 +62,13 @@ public class DeferredRegistryTest { // Should never be created as the registry doesn't exist - this should silently fail and remain empty private static final RegistryObject DOESNT_EXIST = DOESNT_EXIST_REG.register("test", Object::new); private static final RegistryObject> RECIPE_TYPE = RECIPE_TYPES.register("test", () -> new RecipeType<>() {}); + private static final RegistryObject> POS_RULE_TEST_TYPE = POS_RULE_TEST_TYPES.register("test", () -> () -> null); private static final RegistryObject PLACED_FEATURE = PLACED_FEATURES.register("test", () -> new PlacedFeature(Holder.hackyErase(OreFeatures.ORE_DIORITE), List.of())); private static final TagKey CUSTOM_TAG_KEY = CUSTOMS.createOptionalTagKey("test_tag", Set.of(CUSTOM)); - private static final Supplier> CUSTOM_REG = CUSTOMS.makeRegistry(Custom.class, () -> + private static final Supplier> CUSTOM_REG = CUSTOMS.makeRegistry(() -> new RegistryBuilder().disableSaving().setMaxID(Integer.MAX_VALUE - 1).hasTags() - .onAdd((owner, stage, id, obj, old) -> LOGGER.info("Custom Added: " + id + " " + obj.foo())) + .onAdd((owner, stage, id, key, obj, old) -> LOGGER.info("Custom Added: " + id + " " + obj.foo())) ); public DeferredRegistryTest() { @@ -75,6 +77,7 @@ public DeferredRegistryTest() { ITEMS.register(modBus); CUSTOMS.register(modBus); RECIPE_TYPES.register(modBus); + POS_RULE_TEST_TYPES.register(modBus); PLACED_FEATURES.register(modBus); modBus.addListener(this::gatherData); @@ -90,25 +93,24 @@ public void serverStarted(ServerStartedEvent event) if (DOESNT_EXIST.isPresent()) throw new IllegalStateException("DeferredRegistryTest#DOESNT_EXIST should not be present!"); RECIPE_TYPE.get(); + POS_RULE_TEST_TYPE.get(); PLACED_FEATURE.get(); } public void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if (event.includeClient()) { - gen.addProvider(new BlockStateProvider(gen, MODID, event.getExistingFileHelper()) { - @Override - protected void registerStatesAndModels() { - ModelFile model = models().cubeAll(BLOCK.get().getRegistryName().getPath(), mcLoc("block/furnace_top")); - simpleBlock(BLOCK.get(), model); - simpleBlockItem(BLOCK.get(), model); - } - }); - } + gen.addProvider(event.includeClient(), new BlockStateProvider(gen, MODID, event.getExistingFileHelper()) { + @Override + protected void registerStatesAndModels() { + ModelFile model = models().cubeAll(BLOCK.getId().getPath(), mcLoc("block/furnace_top")); + simpleBlock(BLOCK.get(), model); + simpleBlockItem(BLOCK.get(), model); + } + }); } - public static class Custom extends ForgeRegistryEntry { + public static class Custom { public String foo() { return this.getClass().getName(); } diff --git a/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java b/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java index bf9c1230acb..e45adfd726e 100644 --- a/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java +++ b/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Tests that the values for defaulted optional tags defined in multiple places are combined. @@ -37,8 +38,12 @@ public class DuplicateOptionalTagTest static final String MODID = "duplicate_optional_tag_test"; private static final ResourceLocation TAG_NAME = new ResourceLocation(MODID, "test_optional_tag"); - private static final Set> TAG_A_DEFAULTS = Set.of(Blocks.BEDROCK.delegate); - private static final Set> TAG_B_DEFAULTS = Set.of(Blocks.WHITE_WOOL.delegate); + private static final Set> TAG_A_DEFAULTS = Stream.of(Blocks.BEDROCK) + .map(ForgeRegistries.BLOCKS::getDelegateOrThrow) + .collect(Collectors.toUnmodifiableSet()); + private static final Set> TAG_B_DEFAULTS = Stream.of(Blocks.WHITE_WOOL) + .map(ForgeRegistries.BLOCKS::getDelegateOrThrow) + .collect(Collectors.toUnmodifiableSet()); private static final TagKey TAG_A = ForgeRegistries.BLOCKS.tags().createOptionalTagKey(TAG_NAME, TAG_A_DEFAULTS); private static final TagKey TAG_B = ForgeRegistries.BLOCKS.tags().createOptionalTagKey(TAG_NAME, TAG_B_DEFAULTS); diff --git a/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java b/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java index db1339857c9..59bb33eda03 100644 --- a/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java +++ b/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java @@ -7,7 +7,7 @@ import net.minecraft.Util; import net.minecraft.core.NonNullList; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffectInstance; @@ -131,7 +131,7 @@ else if (heldItem.isEmpty()) var effect = ((MobEffect) ObfuscationReflectionHelper.getPrivateValue(MushroomCow.class, cow, "f_289" + "09_")); if (effect != null) { - event.getPlayer().sendMessage(new TextComponent(String.valueOf(effect.getRegistryName())), Util.NIL_UUID); + event.getPlayer().sendSystemMessage(Component.literal(String.valueOf(ForgeRegistries.MOB_EFFECTS.getKey(effect)))); } } } diff --git a/src/test/java/net/minecraftforge/debug/PermissionTest.java b/src/test/java/net/minecraftforge/debug/PermissionTest.java index 5e401fb3628..d4f5dfd8030 100644 --- a/src/test/java/net/minecraftforge/debug/PermissionTest.java +++ b/src/test/java/net/minecraftforge/debug/PermissionTest.java @@ -8,7 +8,6 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.StringRepresentable; import net.minecraftforge.common.MinecraftForge; @@ -32,7 +31,7 @@ public class PermissionTest private static final PermissionNode boolPerm = new PermissionNode<>("permissiontest", "test.blob", PermissionTypes.BOOLEAN, (player, playerUUID, context) -> true); private static final PermissionNode stringPerm = new PermissionNode<>("permissiontest", "test.blobText", PermissionTypes.STRING, (player, playerUUID, context) -> "Hello World"); private static final PermissionNode intPerm = new PermissionNode<>("permissiontest", "test.blob.integer", PermissionTypes.INTEGER, (player, playerUUID, context) -> 3); - private static final PermissionNode componentPerm = new PermissionNode<>("permissiontest", "test.blob.component", PermissionTypes.COMPONENT, (player, playerUUID, context) -> new TextComponent("This is a component")); + private static final PermissionNode componentPerm = new PermissionNode<>("permissiontest", "test.blob.component", PermissionTypes.COMPONENT, (player, playerUUID, context) -> Component.literal("This is a component")); private static final PermissionNode unregisteredPerm = new PermissionNode<>("permissiontest", "test.unregistered", PermissionTypes.BOOLEAN, (player, playerUUID, context) -> false); @@ -57,9 +56,9 @@ public void registerCommands(RegisterCommandsEvent event) event.getDispatcher().register(Commands.literal("permtest") .requires(src -> canUseCommand(src, boolPerm)) .executes(context -> { - context.getSource().sendSuccess(new TextComponent("Blob"), false); - context.getSource().sendSuccess(new TextComponent("String:" + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), stringPerm)), false); - context.getSource().sendSuccess(new TextComponent("Int: " + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), intPerm)), false); + context.getSource().sendSuccess(Component.literal("Blob"), false); + context.getSource().sendSuccess(Component.literal("String:" + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), stringPerm)), false); + context.getSource().sendSuccess(Component.literal("Int: " + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), intPerm)), false); context.getSource().sendSuccess(PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), componentPerm), false); return 1; @@ -70,7 +69,7 @@ public void registerCommands(RegisterCommandsEvent event) event.getDispatcher().register(Commands.literal("permtesterr") .requires(src -> canUseCommand(src, unregisteredPerm)) .executes(context -> { - context.getSource().sendSuccess(new TextComponent("Blob"), false); + context.getSource().sendSuccess(Component.literal("Blob"), false); return 1; })); } diff --git a/src/test/java/net/minecraftforge/debug/RegistryObjectTest.java b/src/test/java/net/minecraftforge/debug/RegistryObjectTest.java index 07111f08605..23e13bf2ed5 100644 --- a/src/test/java/net/minecraftforge/debug/RegistryObjectTest.java +++ b/src/test/java/net/minecraftforge/debug/RegistryObjectTest.java @@ -41,6 +41,6 @@ public RegistryObjectTest() public void commonSetup(FMLCommonSetupEvent event) { LOGGER.info("Stone 1: {}", RegistryObject.create(new ResourceLocation("minecraft", "stone"), ForgeRegistries.BLOCKS).get()); - LOGGER.info("Stone 2: {}", RegistryObject.create(new ResourceLocation("minecraft", "stone"), ForgeRegistries.BLOCKS.getRegistryKey(), MODID).get()); + LOGGER.info("Stone 2: {}", RegistryObject.create(new ResourceLocation("minecraft", "stone"), ForgeRegistries.Keys.BLOCKS, MODID).get()); } } diff --git a/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java b/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java index cd1719b4c64..cdfb069525b 100644 --- a/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java +++ b/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java @@ -9,7 +9,6 @@ import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; -import net.minecraft.tags.Tag; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -18,6 +17,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; +import net.minecraftforge.registries.ForgeRegistries; @Mod(RemoveTagDatagenTest.MODID) public class RemoveTagDatagenTest @@ -36,15 +36,15 @@ private void onGatherData(GatherDataEvent event) DataGenerator generator = event.getGenerator(); ExistingFileHelper helper = event.getExistingFileHelper(); - generator.addProvider(new BlockTagsProvider(generator, MODID, helper) + generator.addProvider(true, new BlockTagsProvider(generator, MODID, helper) { @SuppressWarnings("unchecked") @Override protected void addTags() { this.tag(TEST_TAG) - .remove(Blocks.DIRT.getRegistryName()) - .remove(Blocks.OAK_DOOR.getRegistryName(), Blocks.DARK_OAK_DOOR.getRegistryName()) + .remove(ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)) + .remove(ForgeRegistries.BLOCKS.getKey(Blocks.OAK_DOOR), ForgeRegistries.BLOCKS.getKey(Blocks.DARK_OAK_DOOR)) .remove(Blocks.ANVIL) .remove(Blocks.BASALT, Blocks.POLISHED_BASALT) .remove(BlockTags.BEEHIVES) diff --git a/src/test/java/net/minecraftforge/debug/block/BannerPatternTest.java b/src/test/java/net/minecraftforge/debug/block/BannerPatternTest.java deleted file mode 100644 index 9afc31f80ff..00000000000 --- a/src/test/java/net/minecraftforge/debug/block/BannerPatternTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Minecraft Forge - Forge Development LLC - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.debug.block; - -import net.minecraft.world.item.BannerPatternItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.entity.BannerPattern; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; - -@Mod("banner_pattern_test") -public class BannerPatternTest -{ - - private static final boolean ENABLED = true; - - public BannerPatternTest() - { - if (!ENABLED) return; - - BannerPattern.create("BANNER_PATTERN_TEST_TEST1", "banner_pattern_test:test1", "bpt:t1"); - var pattern = BannerPattern.create("BANNER_PATTERN_TEST_TEST2", "banner_pattern_test:test2", "bpt:t2", true); - BannerPattern.create("BANNER_PATTERN_TEST_TEST3", "banner_pattern_test:test3", "bpt:t3"); - - var register = DeferredRegister.create(ForgeRegistries.ITEMS, "banner_pattern_test"); - register.register("pattern_item_test", () -> new BannerPatternItem(pattern, new Item.Properties().stacksTo(1).tab(CreativeModeTab.TAB_MISC))); - register.register(FMLJavaModLoadingContext.get().getModEventBus()); - } -} diff --git a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java index 4f13023d828..f2951a69995 100644 --- a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java +++ b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java @@ -25,9 +25,9 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -import javax.annotation.Nullable; import java.util.Locale; @Mod("be_onload_test") diff --git a/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java b/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java index e57bdbbc2b6..de6dde975b2 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java @@ -19,11 +19,12 @@ import net.minecraft.world.level.LevelReader; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.PlantType; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; @Mod(CustomPlantTypeTest.MODID) @Mod.EventBusSubscriber(bus = Bus.MOD) @@ -33,22 +34,29 @@ public class CustomPlantTypeTest private static final String CUSTOM_SOIL_BLOCK = "test_custom_block"; private static final String CUSTOM_PLANT_BLOCK = "test_custom_plant"; - @ObjectHolder(CUSTOM_SOIL_BLOCK) + @ObjectHolder(registryName = "block", value = CUSTOM_SOIL_BLOCK) public static Block CUSTOM_SOIL; - @ObjectHolder(CUSTOM_PLANT_BLOCK) + @ObjectHolder(registryName = "block", value = CUSTOM_PLANT_BLOCK) public static Block CUSTOM_PLANT; @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) + public static void registerBlocks(RegisterEvent event) { - event.getRegistry().registerAll(new CustomBlock(), new CustomPlantBlock()); + event.register(ForgeRegistries.Keys.BLOCKS, helper -> + { + helper.register(CUSTOM_SOIL_BLOCK, new CustomBlock()); + helper.register(CUSTOM_PLANT_BLOCK, new CustomPlantBlock()); + }); } @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) + public static void registerItems(RegisterEvent event) { - event.getRegistry().registerAll(new BlockItem(CUSTOM_SOIL, (new Item.Properties())).setRegistryName(MODID, CUSTOM_SOIL_BLOCK), - new BlockItem(CUSTOM_PLANT, (new Item.Properties())).setRegistryName(MODID, CUSTOM_PLANT_BLOCK)); + event.register(ForgeRegistries.Keys.ITEMS, helper -> + { + helper.register(CUSTOM_SOIL_BLOCK, new BlockItem(CUSTOM_SOIL, new Item.Properties())); + helper.register(CUSTOM_PLANT_BLOCK, new BlockItem(CUSTOM_PLANT, new Item.Properties())); + }); } public static class CustomBlock extends Block @@ -56,7 +64,6 @@ public static class CustomBlock extends Block public CustomBlock() { super(Properties.of(Material.STONE)); - this.setRegistryName(MODID, CUSTOM_SOIL_BLOCK); } @Override @@ -78,7 +85,6 @@ public static class CustomPlantBlock extends FlowerBlock implements IPlantable public CustomPlantBlock() { super(MobEffects.WEAKNESS, 9, Properties.of(Material.PLANT).noCollission().sound(SoundType.GRASS)); - this.setRegistryName(MODID, CUSTOM_PLANT_BLOCK); } @Override diff --git a/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java b/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java index b3eb567ae7b..088086f4bfb 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java @@ -28,8 +28,8 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Optional; @Mod(CustomRespawnTest.MODID) diff --git a/src/test/java/net/minecraftforge/debug/block/FlowerPotTest.java b/src/test/java/net/minecraftforge/debug/block/FlowerPotTest.java index 7985548494e..f3ccd8589ff 100644 --- a/src/test/java/net/minecraftforge/debug/block/FlowerPotTest.java +++ b/src/test/java/net/minecraftforge/debug/block/FlowerPotTest.java @@ -10,9 +10,9 @@ import net.minecraft.world.level.block.FlowerPotBlock; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.registries.RegisterEvent; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @@ -30,20 +30,26 @@ public class FlowerPotTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - public static final RegistryObject EMPTY_FLOWER_POT = BLOCKS.register(BLOCK_ID, () -> new FlowerPotBlock(null, Blocks.AIR.delegate, Block.Properties.copy(Blocks.FLOWER_POT))); + public static final RegistryObject EMPTY_FLOWER_POT = BLOCKS.register(BLOCK_ID, () -> new FlowerPotBlock(null, ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.AIR), Block.Properties.copy(Blocks.FLOWER_POT))); public static final RegistryObject OAK_FLOWER_POT = BLOCKS.register( - BLOCK_ID + "_oak", () -> new FlowerPotBlock(EMPTY_FLOWER_POT, Blocks.OAK_SAPLING.delegate, Block.Properties.copy(Blocks.FLOWER_POT))); + BLOCK_ID + "_oak", () -> new FlowerPotBlock(EMPTY_FLOWER_POT, ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.OAK_SAPLING), Block.Properties.copy(Blocks.FLOWER_POT))); - static { + static + { ITEMS.register(BLOCK_ID, () -> new BlockItem(EMPTY_FLOWER_POT.get(), new Item.Properties())); } @SubscribeEvent - public static void onItemRegister(RegistryEvent.Register event) { - EMPTY_FLOWER_POT.get().addPlant(Blocks.OAK_SAPLING.getRegistryName(), OAK_FLOWER_POT); + public static void onItemRegister(RegisterEvent event) + { + if (event.getRegistryKey().equals(ForgeRegistries.Keys.ITEMS)) + { + EMPTY_FLOWER_POT.get().addPlant(ForgeRegistries.BLOCKS.getKey(Blocks.OAK_SAPLING), OAK_FLOWER_POT); + } } - public FlowerPotTest() { + public FlowerPotTest() + { IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(modBus); ITEMS.register(modBus); diff --git a/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java b/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java index f46ad534022..551bb50119b 100644 --- a/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java +++ b/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java @@ -22,6 +22,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.stats.Stats; +import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -50,9 +51,9 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -104,7 +105,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player if (level.getBlockEntity(pos) instanceof DioriteFlowerPotBlockEntity be) { ItemStack stack = player.getItemInHand(hand); - boolean isFlower = stack.getItem() instanceof BlockItem item && ((FlowerPotBlock) Blocks.FLOWER_POT).getFullPotsView().containsKey(item.getRegistryName()); + boolean isFlower = stack.getItem() instanceof BlockItem item && ((FlowerPotBlock) Blocks.FLOWER_POT).getFullPotsView().containsKey(ForgeRegistries.ITEMS.getKey(item)); boolean hasFlower = be.plant != Blocks.AIR; if (isFlower != hasFlower) @@ -227,7 +228,7 @@ public void load(CompoundTag tag) protected void saveAdditional(CompoundTag tag) { //noinspection ConstantConditions - tag.putString("plant", plant.getRegistryName().toString()); + tag.putString("plant", ForgeRegistries.BLOCKS.getKey(plant).toString()); super.saveAdditional(tag); } } @@ -284,9 +285,9 @@ private static class DioritePotModel extends BakedModelWrapper public DioritePotModel(BakedModel wrappedModel) { super(wrappedModel); } - @Nonnull + @NotNull @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) { List quads = new ArrayList<>(originalModel.getQuads(state, side, rand, extraData)); @@ -299,9 +300,9 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction return quads; } - private List getPlantQuads(Block plant, @Nullable Direction face, Random rand) + private List getPlantQuads(Block plant, @Nullable Direction face, RandomSource rand) { - BlockState potState = ((FlowerPotBlock) Blocks.FLOWER_POT).getFullPotsView().getOrDefault(plant.getRegistryName(), Blocks.AIR.delegate).get().defaultBlockState(); + BlockState potState = ((FlowerPotBlock) Blocks.FLOWER_POT).getFullPotsView().getOrDefault(ForgeRegistries.BLOCKS.getKey(plant), ForgeRegistries.BLOCKS.getDelegateOrThrow(Blocks.AIR)).get().defaultBlockState(); BakedModel potModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(potState); return potModel.getQuads(potState, face, rand, EmptyModelData.INSTANCE) diff --git a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java index dab98546a1b..72af1c148d3 100644 --- a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Locale; +import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.Blocks; @@ -22,7 +23,6 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.core.Direction; import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.TextComponent; import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.model.generators.BlockStateProvider; @@ -80,11 +80,11 @@ public static void pistonPre(PistonEvent.Pre event) { if (pistonHelper.resolve()) { - player.sendMessage(new TextComponent(String.format(Locale.ENGLISH, "Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getToPush().size(), pistonHelper.getToDestroy().size())), player.getUUID()); + player.sendSystemMessage(Component.literal(String.format(Locale.ENGLISH, "Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getToPush().size(), pistonHelper.getToDestroy().size()))); } else { - player.sendMessage(new TextComponent("Piston won't extend"), player.getUUID()); + player.sendSystemMessage(Component.literal("Piston won't extend")); } } @@ -125,11 +125,11 @@ public static void pistonPre(PistonEvent.Pre event) BlockPos targetPos = event.getFaceOffsetPos().relative(event.getDirection()); boolean canPush = PistonBaseBlock.isPushable(event.getWorld().getBlockState(targetPos), (Level) event.getWorld(), event.getFaceOffsetPos(), event.getDirection().getOpposite(), false, event.getDirection()); boolean isAir = event.getWorld().isEmptyBlock(targetPos); - player.sendMessage(new TextComponent(String.format(Locale.ENGLISH, "Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUUID()); + player.sendSystemMessage(Component.literal(String.format(Locale.ENGLISH, "Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0))); } else { - player.sendMessage(new TextComponent("Piston will retract"), player.getUUID()); + player.sendSystemMessage(Component.literal("Piston will retract")); } } // Offset twice to see if retraction will pull cobblestone @@ -141,10 +141,7 @@ public void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if (event.includeClient()) - { - gen.addProvider(new BlockStates(gen, event.getExistingFileHelper())); - } + gen.addProvider(event.includeClient(), new BlockStates(gen, event.getExistingFileHelper())); } private class BlockStates extends BlockStateProvider @@ -157,7 +154,7 @@ public BlockStates(DataGenerator gen, ExistingFileHelper exFileHelper) @Override protected void registerStatesAndModels() { - ModelFile model = models().cubeAll(shiftOnMove.get().getRegistryName().getPath(), mcLoc("block/furnace_top")); + ModelFile model = models().cubeAll(shiftOnMove.getId().getPath(), mcLoc("block/furnace_top")); simpleBlock(shiftOnMove.get(), model); simpleBlockItem(shiftOnMove.get(), model); } diff --git a/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java b/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java index 836954f8d39..957c2862f4c 100644 --- a/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java +++ b/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java @@ -22,8 +22,7 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; @Mod(RedstoneSidedConnectivityTest.MODID) public class RedstoneSidedConnectivityTest diff --git a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java index 8e4ab75f5db..2ad582b60c8 100644 --- a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java +++ b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java @@ -55,7 +55,7 @@ public ScaffoldingTest() private void gatherData(final GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if(event.includeClient()) gen.addProvider(new ScaffoldingBlockState(gen, MODID, event.getExistingFileHelper())); + gen.addProvider(event.includeClient(), new ScaffoldingBlockState(gen, MODID, event.getExistingFileHelper())); } static class ScaffoldingBlockState extends BlockStateProvider diff --git a/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java b/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java index 74a365e1b6d..b8f998e969c 100644 --- a/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java +++ b/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java @@ -14,11 +14,12 @@ import net.minecraft.world.item.Item; import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.registries.RegisterEvent; @Mod(SlipperinessTest.MOD_ID) @EventBusSubscriber @@ -27,26 +28,26 @@ public class SlipperinessTest static final String MOD_ID = "slipperiness_test"; static final String BLOCK_ID = "test_block"; - @ObjectHolder(BLOCK_ID) + @ObjectHolder(registryName = "block", value = BLOCK_ID) public static final Block BB_BLOCK = null; @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register e) + public static void registerBlocks(RegisterEvent e) { - e.getRegistry().register((new Block(Block.Properties.of(Material.ICE_SOLID)) + e.register(ForgeRegistries.Keys.BLOCKS, helper -> helper.register(BLOCK_ID, new Block(Block.Properties.of(Material.ICE_SOLID)) { @Override public float getFriction(BlockState state, LevelReader level, BlockPos pos, Entity entity) { return entity instanceof Boat ? 2 : super.getFriction(state, level, pos, entity); } - }).setRegistryName(MOD_ID, BLOCK_ID)); + })); } @SubscribeEvent - public static void registerItems(RegistryEvent.Register e) + public static void registerItems(RegisterEvent e) { - e.getRegistry().register(new BlockItem(BB_BLOCK, new Item.Properties()).setRegistryName(BB_BLOCK.getRegistryName())); + e.register(ForgeRegistries.Keys.ITEMS, helper -> helper.register(BLOCK_ID, new BlockItem(BB_BLOCK, new Item.Properties()))); } /* diff --git a/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java b/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java index 3f68639472e..fd862cd5333 100644 --- a/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java +++ b/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java @@ -10,11 +10,12 @@ import net.minecraft.world.level.material.Material; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; @Mod(StickyBlockTest.MODID) @Mod.EventBusSubscriber(bus = Bus.MOD) @@ -23,25 +24,25 @@ public class StickyBlockTest static final String MODID = "custom_slime_block_test"; static final String BLOCK_ID = "test_block"; - @ObjectHolder(BLOCK_ID) + @ObjectHolder(registryName = "block", value = BLOCK_ID) public static Block BLUE_BLOCK; @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) + public static void registerBlocks(RegisterEvent event) { - event.getRegistry().register((new Block(Block.Properties.of(Material.STONE)) + event.register(ForgeRegistries.Keys.BLOCKS, helper -> helper.register(BLOCK_ID, new Block(Block.Properties.of(Material.STONE)) { @Override public boolean isStickyBlock(BlockState state) { return true; } - }).setRegistryName(MODID, BLOCK_ID)); + })); } @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) + public static void registerItems(RegisterEvent event) { - event.getRegistry().register(new BlockItem(BLUE_BLOCK, new Item.Properties()).setRegistryName(MODID, BLOCK_ID)); + event.register(ForgeRegistries.Keys.ITEMS, helper -> helper.register(BLOCK_ID, new BlockItem(BLUE_BLOCK, new Item.Properties()))); } } diff --git a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java index 0d2e5b64737..85b0b4d3b0c 100644 --- a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java @@ -15,7 +15,7 @@ import net.minecraft.commands.arguments.TeamArgument; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.commands.synchronization.SuggestionProviders; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.client.event.RegisterClientCommandsEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; @@ -49,21 +49,21 @@ private void init(RegisterClientCommandsEvent event) .then(Commands.literal("server") .executes((context) -> { context.getSource().getServer(); - context.getSource().sendSuccess(new TextComponent("Successfully called getServer should have errored"), false); + context.getSource().sendSuccess(Component.literal("Successfully called getServer should have errored"), false); return 1; })) // Used for checking if attempting to get the server level on the client side errors .then(Commands.literal("level") .executes((context) -> { context.getSource().getLevel(); - context.getSource().sendSuccess(new TextComponent("Successfully called getLevel should have errored"), false); + context.getSource().sendSuccess(Component.literal("Successfully called getLevel should have errored"), false); return 1; })) // Used for checking if getting a known objective argument works on the client side .then(Commands.literal("get_objective") .then(Commands.argument("objective", ObjectiveArgument.objective()) .executes((context) -> { - context.getSource().sendSuccess(new TextComponent("Regular: ") + context.getSource().sendSuccess(Component.literal("Regular: ") .append(ObjectiveArgument.getObjective(context, "objective").getFormattedDisplayName()), false); return 1; }))) @@ -95,14 +95,14 @@ private void init(RegisterClientCommandsEvent event) .then(Commands.argument("blockpos", BlockPosArgument.blockPos()) .executes((context) -> { context.getSource() - .sendSuccess(new TextComponent(BlockPosArgument.getLoadedBlockPos(context, "blockpos").toString()), false); + .sendSuccess(Component.literal(BlockPosArgument.getLoadedBlockPos(context, "blockpos").toString()), false); return 1; }))) // Used for checking if a command can have a requirement .then(Commands.literal("requires") .requires((source) -> false) .executes((context) -> { - context.getSource().sendSuccess(new TextComponent("Executed command"), false); + context.getSource().sendSuccess(Component.literal("Executed command"), false); return 1; }))); @@ -110,7 +110,7 @@ private void init(RegisterClientCommandsEvent event) LiteralArgumentBuilder fork = Commands.literal("clientcommandfork"); fork.fork(event.getDispatcher().getRoot(), (context) -> List.of(context.getSource(), context.getSource())) .executes((context) -> { - context.getSource().sendSuccess(new TextComponent("Executing forked command"), false); + context.getSource().sendSuccess(Component.literal("Executing forked command"), false); return 1; }); event.getDispatcher().register(fork); @@ -118,12 +118,12 @@ private void init(RegisterClientCommandsEvent event) private int testCommand(CommandContext context) { - context.getSource().sendSuccess(new TextComponent("Input: " + ResourceLocationArgument.getId(context, "block")), false); - context.getSource().sendSuccess(new TextComponent("Teams: " + context.getSource().getAllTeams()), false); - context.getSource().sendSuccess(new TextComponent("Players: " + context.getSource().getOnlinePlayerNames()), false); - context.getSource().sendSuccess(new TextComponent("First recipe: " + context.getSource().getRecipeNames().findFirst().get()), false); - context.getSource().sendSuccess(new TextComponent("Levels: " + context.getSource().levels()), false); - context.getSource().sendSuccess(new TextComponent("Registry Access: " + context.getSource().registryAccess()), false); + context.getSource().sendSuccess(Component.literal("Input: " + ResourceLocationArgument.getId(context, "block")), false); + context.getSource().sendSuccess(Component.literal("Teams: " + context.getSource().getAllTeams()), false); + context.getSource().sendSuccess(Component.literal("Players: " + context.getSource().getOnlinePlayerNames()), false); + context.getSource().sendSuccess(Component.literal("First recipe: " + context.getSource().getRecipeNames().findFirst().get()), false); + context.getSource().sendSuccess(Component.literal("Levels: " + context.getSource().levels()), false); + context.getSource().sendSuccess(Component.literal("Registry Access: " + context.getSource().registryAccess()), false); return 0; } } diff --git a/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java b/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java index 6211a5b940f..4fbcb03c324 100644 --- a/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/CommandEventTest.java @@ -9,7 +9,7 @@ import com.mojang.brigadier.context.ParsedCommandNode; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -42,7 +42,7 @@ public static void onCommand(CommandEvent event) if (nodes.size() > 0 && nodes.get(0).getNode() == dispatcher.getRoot().getChild("give")) { String msg = source.getTextName() + " used the give command: " + event.getParseResults().getReader().getString(); - source.getServer().getPlayerList().getPlayers().forEach(player -> player.sendMessage(new TextComponent(msg), player.getUUID())); + source.getServer().getPlayerList().getPlayers().forEach(player -> player.sendSystemMessage(Component.literal(msg))); return; } diff --git a/src/test/java/net/minecraftforge/debug/chat/EntitySelectorTest.java b/src/test/java/net/minecraftforge/debug/chat/EntitySelectorTest.java index a8f0b257a8a..ef8a6ec4873 100644 --- a/src/test/java/net/minecraftforge/debug/chat/EntitySelectorTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/EntitySelectorTest.java @@ -13,7 +13,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.common.command.EntitySelectorManager; import net.minecraftforge.common.command.IEntitySelectorType; import net.minecraftforge.fml.common.Mod; @@ -30,7 +29,7 @@ public EntitySelectorTest() public void setup(FMLCommonSetupEvent event) { - EntitySelectorOptions.register("health", this::healthArgument, parser -> true, new TextComponent("Selects entities based on their current health.")); + EntitySelectorOptions.register("health", this::healthArgument, parser -> true, Component.literal("Selects entities based on their current health.")); EntitySelectorManager.register("er", new ExampleCustomSelector()); } @@ -76,7 +75,7 @@ public EntitySelector build(EntitySelectorParser parser) throws CommandSyntaxExc @Override public Component getSuggestionTooltip() { - return new TextComponent("Example: Selects a random entity"); + return Component.literal("Example: Selects a random entity"); } } } diff --git a/src/test/java/net/minecraftforge/debug/client/AudioStreamTest.java b/src/test/java/net/minecraftforge/debug/client/AudioStreamTest.java index f9a0990f899..86f2fc58a82 100644 --- a/src/test/java/net/minecraftforge/debug/client/AudioStreamTest.java +++ b/src/test/java/net/minecraftforge/debug/client/AudioStreamTest.java @@ -62,7 +62,7 @@ public static class SineSound extends AbstractSoundInstance { protected SineSound(Vec3 position) { - super(new ResourceLocation(MOD_ID, "sine_wave"), SoundSource.BLOCKS); + super(new ResourceLocation(MOD_ID, "sine_wave"), SoundSource.BLOCKS, SoundInstance.createUnseededRandom()); x = position.x; y = position.y; z = position.z; diff --git a/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java b/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java index 5515333b12e..f317ec06fb1 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java @@ -8,7 +8,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.Minecraft; -import net.minecraft.client.model.EndermanModel; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayers; @@ -35,7 +34,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.function.Consumer; import java.util.function.Function; @@ -68,7 +66,7 @@ public void initializeClient(Consumer consumer) { consumer.accept(new IItemRenderProperties() { - @Override @Nonnull + @Override @NotNull public Model getBaseArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { TintedArmorModel.INSTANCE.base = _default; @@ -118,7 +116,7 @@ private TintedArmorModel(Function renderTypeFunctio } @Override - public void renderToBuffer(@Nonnull PoseStack poseStack, @Nonnull VertexConsumer consumer, int light, int overlay, float red, float green, float blue, float alpha) + public void renderToBuffer(@NotNull PoseStack poseStack, @NotNull VertexConsumer consumer, int light, int overlay, float red, float green, float blue, float alpha) { if (base != null) { diff --git a/src/test/java/net/minecraftforge/debug/client/CustomTASTest.java b/src/test/java/net/minecraftforge/debug/client/CustomTASTest.java index b33f9a87934..05d04d0b9ef 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomTASTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomTASTest.java @@ -7,8 +7,6 @@ import java.util.Random; -import javax.annotation.Nonnull; - import com.mojang.blaze3d.platform.NativeImage; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -26,6 +24,7 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; @Mod(CustomTASTest.MOD_ID) public class CustomTASTest @@ -55,7 +54,7 @@ private void clientSetup(FMLClientSetupEvent event) private static class TasLoader implements ITextureAtlasSpriteLoader { @Override - @Nonnull + @NotNull public TextureAtlasSprite load(TextureAtlas atlas, ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo, Resource resource, int atlasWidth, int atlasHeight, int spriteX, int spriteY, int mipmapLevel, NativeImage image) { return new TextureAtlasSprite( diff --git a/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java b/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java index 90e0a74981c..1ddef2e6515 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java @@ -19,7 +19,6 @@ import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -44,8 +43,8 @@ import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -113,7 +112,7 @@ public CustomItemWithTooltip(Properties properties) public void appendHoverText(ItemStack stack, @Nullable Level level, List components, TooltipFlag flag) { super.appendHoverText(stack, level, components, flag); - components.add(new TextComponent("This is a very very very very very very long hover text that should really really be split across multiple lines.").withStyle(ChatFormatting.YELLOW)); + components.add(Component.literal("This is a very very very very very very long hover text that should really really be split across multiple lines.").withStyle(ChatFormatting.YELLOW)); } @Override @@ -192,7 +191,7 @@ static class TooltipTestScreen extends Screen protected TooltipTestScreen() { - super(new TextComponent("TooltipMethodTest")); + super(Component.literal("TooltipMethodTest")); } static void show() @@ -210,14 +209,14 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic @Override protected void init() { - addRenderableWidget(new Button(10, 10, 200, 20, new TextComponent("Toggle Stack: EMPTY"), button -> { + addRenderableWidget(new Button(10, 10, 200, 20, Component.literal("Toggle Stack: EMPTY"), button -> { this.testStack = this.testStack.isEmpty() ? new ItemStack(Items.APPLE) : ItemStack.EMPTY; - button.setMessage(new TextComponent("Toggle Stack: " + (testStack.isEmpty() ? "EMPTY" : "Apple"))); + button.setMessage(Component.literal("Toggle Stack: " + (testStack.isEmpty() ? "EMPTY" : "Apple"))); })); - addRenderableWidget(new Button(220, 10, 200, 20, new TextComponent("Toggle Font: null"), button -> { + addRenderableWidget(new Button(220, 10, 200, 20, Component.literal("Toggle Font: null"), button -> { this.testFont = this.testFont == null ? ClientModBusEventHandler.customFont : null; - button.setMessage(new TextComponent("Toggle Font: " + (testFont == null ? "null" : "customFont"))); + button.setMessage(Component.literal("Toggle Font: " + (testFont == null ? "null" : "customFont"))); })); // * must have stack context @@ -242,7 +241,7 @@ protected void init() int y = 50; for (var test : tooltipTests) { - addRenderableWidget(new Button(x, y, 100, 20, new TextComponent(test.getKey()), button -> {}, test.getValue())); + addRenderableWidget(new Button(x, y, 100, 20, Component.literal(test.getKey()), button -> {}, test.getValue())); y+= 22; if (y >= height - 50) { @@ -260,72 +259,72 @@ private void test1(Button button, PoseStack poseStack, int mouseX, int mouseY) // renderTooltip with List and all combinations of ItemStack/Font private void test2(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test")), Optional.empty(), mouseX, mouseY, this.testStack); + renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testStack); } private void test3(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test")), Optional.empty(), mouseX, mouseY, this.testFont); + renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testFont); } private void test4(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test")), Optional.empty(), mouseX, mouseY, this.testFont, this.testStack); + renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testFont, this.testStack); } private void test5(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test")), Optional.empty(), mouseX, mouseY); + renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY); } // renderTooltip with just Component private void test6(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, new TextComponent("test"), mouseX, mouseY); + renderTooltip(poseStack, Component.literal("test"), mouseX, mouseY); } // renderComponentTooltip with all combinations of ItemStack/Font private void test7(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(new TextComponent("test")), mouseX, mouseY, this.testStack); + renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testStack); } private void test8(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(new TextComponent("test")), mouseX, mouseY, this.testFont); + renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont); } private void test9(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(new TextComponent("test")), mouseX, mouseY, this.testFont, this.testStack); + renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont, this.testStack); } private void test10(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(new TextComponent("test")), mouseX, mouseY); + renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY); } // renderTooltip with list of FormattedCharSequence private void test11(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test").getVisualOrderText()), mouseX, mouseY); + renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY); } // renderTooltip with list of FormattedCharSequence and Font private void test12(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test").getVisualOrderText()), mouseX, mouseY, this.testFont); + renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY, this.testFont); } // legacy ToolTip methods private void test13(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(new TextComponent("test").getVisualOrderText()), mouseX, mouseY, this.testFont); + renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY, this.testFont); } private void test14(Button button, PoseStack poseStack, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(new TextComponent("test")), mouseX, mouseY, this.testFont, ItemStack.EMPTY); + renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont, ItemStack.EMPTY); } } diff --git a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java index b6a67ffd252..8f65621bb24 100644 --- a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java +++ b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java @@ -11,7 +11,6 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -33,11 +32,11 @@ public static void guiOpen(ScreenEvent.InitScreenEvent event) { if (event.getScreen() instanceof AbstractContainerScreen) { - event.addListener(new Button(2, 2, 150, 20, new TextComponent("Test Gui Layering"), btn -> { - Minecraft.getInstance().pushGuiLayer(new TestLayer(new TextComponent("LayerScreen"))); + event.addListener(new Button(2, 2, 150, 20, Component.literal("Test Gui Layering"), btn -> { + Minecraft.getInstance().pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); })); - event.addListener(new Button(2, 25, 150, 20, new TextComponent("Test Gui Normal"), btn -> { - Minecraft.getInstance().setScreen(new TestLayer(new TextComponent("LayerScreen"))); + event.addListener(new Button(2, 25, 150, 20, Component.literal("Test Gui Normal"), btn -> { + Minecraft.getInstance().setScreen(new TestLayer(Component.literal("LayerScreen"))); })); } } @@ -73,9 +72,9 @@ protected void init() xoff = RANDOM.nextInt(xoff); yoff = RANDOM.nextInt(yoff); - this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, new TextComponent("Push New Layer"), this::pushLayerButton)); - this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, new TextComponent("Pop Current Layer"), this::popLayerButton)); - this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, new TextComponent("Close entire stack"), this::closeStack)); + this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, Component.literal("Push New Layer"), this::pushLayerButton)); + this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, Component.literal("Pop Current Layer"), this::popLayerButton)); + this.addRenderableWidget(new Button(xoff, yoff + buttonSpacing * (cnt++), buttonWidth, buttonHeight, Component.literal("Close entire stack"), this::closeStack)); } private void closeStack(Button button) @@ -90,7 +89,7 @@ private void popLayerButton(Button button) private void pushLayerButton(Button button) { - this.minecraft.pushGuiLayer(new TestLayer(new TextComponent("LayerScreen"))); + this.minecraft.pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); } } } diff --git a/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java index 7cbada78e71..a832adb927e 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java @@ -28,8 +28,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; @Mod(CompositeModelTest.MODID) public class CompositeModelTest diff --git a/src/test/java/net/minecraftforge/debug/client/model/CustomTransformTypeTest.java b/src/test/java/net/minecraftforge/debug/client/model/CustomTransformTypeTest.java index d71d6002306..527eaf3705a 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/CustomTransformTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/CustomTransformTypeTest.java @@ -113,7 +113,7 @@ public void render(ItemHangerBlockEntity blocken, float partialTicks, PoseStack public static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, MODID); public static final RegistryObject - ITEM_HANGER_BLOCK = BLOCKS.register("item_hanger", () -> new ItemHangerBlock(BlockBehaviour.Properties.of(Material.WOOL).noCollission().noOcclusion().noDrops())); + ITEM_HANGER_BLOCK = BLOCKS.register("item_hanger", () -> new ItemHangerBlock(BlockBehaviour.Properties.of(Material.WOOL).noCollission().noOcclusion().noLootTable())); public static final RegistryObject> ITEM_HANGER_BE = BLOCK_ENTITY_TYPES.register("item_hanger", () -> BlockEntityType.Builder.of(ItemHangerBlockEntity::new, ITEM_HANGER_BLOCK.get()).build(null)); public static final RegistryObject @@ -132,11 +132,8 @@ public void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if (event.includeClient()) - { - gen.addProvider(new ItemModels(gen, event.getExistingFileHelper())); - gen.addProvider(new BlockStateModels(gen, event.getExistingFileHelper())); - } + gen.addProvider(event.includeClient(), new ItemModels(gen, event.getExistingFileHelper())); + gen.addProvider(event.includeClient(), new BlockStateModels(gen, event.getExistingFileHelper())); } public static class BlockStateModels extends BlockStateProvider diff --git a/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java index 7a1a3275d44..d487ddae58d 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java @@ -13,10 +13,12 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; @Mod(MultiLayerModelTest.MODID) public class MultiLayerModelTest @@ -27,33 +29,29 @@ public class MultiLayerModelTest private static final String blockName = "test_layer_block"; private static final ResourceLocation blockId = new ResourceLocation(MODID, blockName); - @ObjectHolder(blockName) + @ObjectHolder(registryName = "block", value = blockName) public static final Block TEST_BLOCK = null; @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public static class Registration { - @net.minecraftforge.eventbus.api.SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) + @SubscribeEvent + public static void registerBlocks(RegisterEvent event) { - if (!ENABLED) + if (!ENABLED || !event.getRegistryKey().equals(ForgeRegistries.Keys.BLOCKS)) return; - event.getRegistry().register( - new Block(Block.Properties.of(Material.WOOD).noOcclusion()) - { - }.setRegistryName(blockId) - ); + event.register(ForgeRegistries.Keys.BLOCKS, blockId, () -> new Block(Block.Properties.of(Material.WOOD).noOcclusion())); } - @net.minecraftforge.eventbus.api.SubscribeEvent - public static void registerItems(RegistryEvent.Register event) + @SubscribeEvent + public static void registerItems(RegisterEvent event) { - if (!ENABLED) + if (!ENABLED || !event.getRegistryKey().equals(ForgeRegistries.Keys.ITEMS)) return; - event.getRegistry().register(new BlockItem(TEST_BLOCK, new Item.Properties().tab(CreativeModeTab.TAB_MISC)).setRegistryName(TEST_BLOCK.getRegistryName())); + event.register(ForgeRegistries.Keys.ITEMS, blockId, () -> new BlockItem(TEST_BLOCK, new Item.Properties().tab(CreativeModeTab.TAB_MISC))); } - @net.minecraftforge.eventbus.api.SubscribeEvent + @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { if (!ENABLED) diff --git a/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java index 0db35000ee3..c5cff8cad69 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java @@ -50,7 +50,6 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; import java.util.Set; @@ -65,6 +64,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; +import org.jetbrains.annotations.Nullable; @Mod(NewModelLoaderTest.MODID) public class NewModelLoaderTest @@ -215,13 +215,10 @@ private void datagen(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); - if (event.includeClient()) - { - // Let blockstate provider see generated item models by passing its existing file helper - ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper()); - gen.addProvider(itemModels); - gen.addProvider(new BlockStates(gen, itemModels.existingFileHelper)); - } + // Let blockstate provider see generated item models by passing its existing file helper + ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper()); + gen.addProvider(event.includeClient(), itemModels); + gen.addProvider(event.includeClient(), new BlockStates(gen, itemModels.existingFileHelper)); } public static class ItemModels extends ItemModelProvider diff --git a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java index ef26586734c..cc4aafd18bb 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java @@ -6,12 +6,10 @@ package net.minecraftforge.debug.client.model; import java.util.List; -import java.util.Random; - -import javax.annotation.Nullable; import com.google.common.collect.ImmutableList; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; @@ -41,6 +39,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.Nullable; @Mod(TRSRTransformerTest.MODID) public class TRSRTransformerTest { @@ -75,7 +74,7 @@ public MyBakedModel(BakedModel base) { } @Override - public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData data) { + public List getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, IModelData data) { ImmutableList.Builder quads = new ImmutableList.Builder<>(); Quaternion rot = TransformationHelper.quatFromXYZ(new Vector3f(0, 45, 0), true); diff --git a/src/test/java/net/minecraftforge/debug/client/rendering/EntityRendererEventsTest.java b/src/test/java/net/minecraftforge/debug/client/rendering/EntityRendererEventsTest.java index 2dd03317d6f..19e32b9a48b 100644 --- a/src/test/java/net/minecraftforge/debug/client/rendering/EntityRendererEventsTest.java +++ b/src/test/java/net/minecraftforge/debug/client/rendering/EntityRendererEventsTest.java @@ -25,11 +25,12 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.entity.EntityAttributeCreationEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; import java.util.Collections; @@ -38,14 +39,17 @@ public class EntityRendererEventsTest { private static final ResourceLocation MY_ENTITY = new ResourceLocation("entity_renderer_events_test", "test_entity"); - - @ObjectHolder("entity_renderer_events_test:test_entity") + + @ObjectHolder(registryName = "entity_type", value = "entity_renderer_events_test:test_entity") public static EntityType MY_ENTITY_TYPE; @SubscribeEvent - public static void entityRegistry(RegistryEvent.Register> event) + public static void entityRegistry(RegisterEvent event) { - event.getRegistry().register(EntityType.Builder.of(MyEntity::new, MobCategory.MONSTER).build("test_entity").setRegistryName("test_entity")); + if (event.getRegistryKey().equals(ForgeRegistries.Keys.ENTITY_TYPES)) + { + event.register(ForgeRegistries.Keys.ENTITY_TYPES, MY_ENTITY, () -> EntityType.Builder.of(MyEntity::new, MobCategory.MONSTER).build("test_entity")); + } } @SubscribeEvent diff --git a/src/test/java/net/minecraftforge/debug/client/rendering/NameplateRenderingEventTest.java b/src/test/java/net/minecraftforge/debug/client/rendering/NameplateRenderingEventTest.java index 9b1c8063d4b..91d40ee8d22 100644 --- a/src/test/java/net/minecraftforge/debug/client/rendering/NameplateRenderingEventTest.java +++ b/src/test/java/net/minecraftforge/debug/client/rendering/NameplateRenderingEventTest.java @@ -5,9 +5,9 @@ package net.minecraftforge.debug.client.rendering; +import net.minecraft.network.chat.Component; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.player.Player; -import net.minecraft.network.chat.TextComponent; import net.minecraft.ChatFormatting; import net.minecraftforge.client.event.RenderNameplateEvent; import net.minecraftforge.eventbus.api.Event; @@ -34,7 +34,7 @@ public static void onNameplateRender(RenderNameplateEvent event) if(event.getEntity() instanceof Cow) { - event.setContent(new TextComponent("Evil Cow").withStyle(ChatFormatting.RED)); + event.setContent(Component.literal("Evil Cow").withStyle(ChatFormatting.RED)); event.setResult(Event.Result.ALLOW); } diff --git a/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java b/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java index 984d511ef42..34477b75935 100644 --- a/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java +++ b/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java @@ -6,7 +6,7 @@ package net.minecraftforge.debug.command; import net.minecraft.commands.Commands; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -32,14 +32,14 @@ public void registerCommands(RegisterCommandsEvent event) event.getDispatcher().register(Commands.literal("enumargumenttest") .then(Commands.argument("string", StringArgumentType.string()) .executes(context -> { - context.getSource().sendSuccess(new TextComponent("string: " + StringArgumentType.getString(context, "string")), false); + context.getSource().sendSuccess(Component.literal("string: " + StringArgumentType.getString(context, "string")), false); return 1; })) .then(Commands.argument("enum", EnumArgument.enumArgument(ExampleEnum.class)) .executes(context -> { context.getSource() - .sendSuccess(new TextComponent("enum: " + context.getArgument("enum", ExampleEnum.class)), false); + .sendSuccess(Component.literal("enum: " + context.getArgument("enum", ExampleEnum.class)), false); return 1; }))); diff --git a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java index bcc1fa80f3a..3c9a0b5f283 100644 --- a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java @@ -12,9 +12,12 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; +import net.minecraft.tags.BiomeTags; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.level.biome.Biome; import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegisterEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -31,10 +34,8 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.server.level.ServerLevel; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -94,7 +95,8 @@ public void worldTick(TickEvent.WorldTickEvent event) for(LivingEntity liv : list) { AttributeInstance grav = liv.getAttribute(ForgeMod.ENTITY_GRAVITY.get()); - boolean inPlains = Biome.getBiomeCategory(liv.level.getBiome(liv.blockPosition())) == BiomeCategory.PLAINS; + + boolean inPlains = liv.level.getBiome(liv.blockPosition()).is(BiomeTags.IS_FOREST); if (inPlains && !grav.hasModifier(REDUCED_GRAVITY)) { logger.info("Granted low gravity to Entity: {}", liv); @@ -112,9 +114,10 @@ else if (!inPlains && grav.hasModifier(REDUCED_GRAVITY)) } @SubscribeEvent - public void registerItems(RegistryEvent.Register event) + public void registerItems(RegisterEvent event) { - event.getRegistry().register(new ItemGravityStick(new Properties().tab(CreativeModeTab.TAB_TOOLS).rarity(Rarity.RARE)).setRegistryName("gravity_attribute_test:gravity_stick")); + event.register(ForgeRegistries.Keys.ITEMS, helper -> helper.register("gravity_stick", + new ItemGravityStick(new Properties().tab(CreativeModeTab.TAB_TOOLS).rarity(Rarity.RARE)))); } public static class ItemGravityStick extends Item diff --git a/src/test/java/net/minecraftforge/debug/entity/PartEntityTest.java b/src/test/java/net/minecraftforge/debug/entity/PartEntityTest.java index a63fb793a2e..c3cf8a28b18 100644 --- a/src/test/java/net/minecraftforge/debug/entity/PartEntityTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/PartEntityTest.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.entity.PigRenderer; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientboundAddMobPacket; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; @@ -64,8 +64,8 @@ public static void onRegisterRenderers(final EntityRenderersEvent.RegisterRender event.registerEntityRenderer(TEST_ENTITY.get(), PigRenderer::new); } } - - private static class TestEntity extends Pig + + private static class TestEntity extends Pig { private final TestEntityPart[] subEntities; public final TestEntityPart head; @@ -76,8 +76,8 @@ private static class TestEntity extends Pig private final TestEntityPart tail3; private final TestEntityPart wing1; private final TestEntityPart wing2; - - public TestEntity(EntityType entity, Level world) + + public TestEntity(EntityType entity, Level world) { super(entity, world); this.head = new TestEntityPart(this, 1.0F, 1.0F); @@ -92,22 +92,22 @@ public TestEntity(EntityType entity, Level world) } @Override - public void aiStep() + public void aiStep() { super.aiStep(); - for (TestEntityPart part : this.subEntities) + for (TestEntityPart part : this.subEntities) { part.setPos(this.getX(), this.getY(), this.getZ()); } - + Vec3[] vec3 = new Vec3[this.subEntities.length]; - for(int j = 0; j < this.subEntities.length; ++j) + for(int j = 0; j < this.subEntities.length; ++j) { vec3[j] = new Vec3(this.subEntities[j].getX(), this.subEntities[j].getY(), this.subEntities[j].getZ()); } - - for(int l = 0; l < this.subEntities.length; ++l) + + for(int l = 0; l < this.subEntities.length; ++l) { this.subEntities[l].xo = vec3[l].x; this.subEntities[l].yo = vec3[l].y; @@ -119,24 +119,24 @@ public void aiStep() } @Override - public boolean isMultipartEntity() + public boolean isMultipartEntity() { return true; } @Override - public PartEntity[] getParts() + public PartEntity[] getParts() { return this.subEntities; } - + @Override - public void recreateFromPacket(ClientboundAddMobPacket packet) + public void recreateFromPacket(ClientboundAddEntityPacket packet) { super.recreateFromPacket(packet); PartEntity[] parts = this.getParts(); - for(int i = 0; i < parts.length; ++i) + for(int i = 0; i < parts.length; ++i) { parts[i].setId(i + packet.getId()); } @@ -144,12 +144,12 @@ public void recreateFromPacket(ClientboundAddMobPacket packet) } } - private static class TestEntityPart extends PartEntity + private static class TestEntityPart extends PartEntity { public final TestEntity parent; private final EntityDimensions size; - public TestEntityPart(TestEntity parent, float width, float height) + public TestEntityPart(TestEntity parent, float width, float height) { super(parent); this.size = EntityDimensions.scalable(width, height); @@ -163,32 +163,32 @@ protected void readAdditionalSaveData(CompoundTag nbt) {} protected void addAdditionalSaveData(CompoundTag nbt) {} - public boolean isPickable() + public boolean isPickable() { return true; } - public boolean hurt(DamageSource source, float amount) + public boolean hurt(DamageSource source, float amount) { return !this.isInvulnerableTo(source) && this.parent.hurt(source, amount); } - public boolean is(Entity entity) + public boolean is(Entity entity) { return this == entity || this.parent == entity; } - public Packet getAddEntityPacket() + public Packet getAddEntityPacket() { throw new UnsupportedOperationException(); } - public EntityDimensions getDimensions(Pose matrix) + public EntityDimensions getDimensions(Pose matrix) { return this.size; } - public boolean shouldBeSaved() + public boolean shouldBeSaved() { return false; } diff --git a/src/test/java/net/minecraftforge/debug/entity/player/PlayerNameEventTest.java b/src/test/java/net/minecraftforge/debug/entity/player/PlayerNameEventTest.java index 55d8c0aadec..33ebf70837d 100644 --- a/src/test/java/net/minecraftforge/debug/entity/player/PlayerNameEventTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/player/PlayerNameEventTest.java @@ -5,7 +5,7 @@ package net.minecraftforge.debug.entity.player; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -20,6 +20,6 @@ public class PlayerNameEventTest public static void onPlayerNameEvent(PlayerEvent.NameFormat event) { if (!ENABLE) return; - event.setDisplayname(new TextComponent("Test Name")); + event.setDisplayname(Component.literal("Test Name")); } } diff --git a/src/test/java/net/minecraftforge/debug/fluid/MilkFluidTest.java b/src/test/java/net/minecraftforge/debug/fluid/MilkFluidTest.java index 0e049b08a56..15b205f4f93 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/MilkFluidTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/MilkFluidTest.java @@ -5,9 +5,9 @@ package net.minecraftforge.debug.fluid; +import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -34,7 +34,7 @@ private static void useMilk(PlayerInteractEvent event) ItemStack stack = event.getItemStack(); if (stack.getItem() == Items.MILK_BUCKET) { - FluidUtil.getFluidContained(stack).ifPresent((fluid) -> event.getPlayer().displayClientMessage(new TextComponent("Contains ").append(fluid.getDisplayName()), true)); + FluidUtil.getFluidContained(stack).ifPresent((fluid) -> event.getPlayer().displayClientMessage(Component.literal("Contains ").append(fluid.getDisplayName()), true)); } } } diff --git a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java index 60cb2c41613..e97a70a1d48 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java @@ -74,7 +74,7 @@ private static ForgeFlowingFluid.Properties makeProperties() ); public static RegistryObject test_fluid_block = BLOCKS.register("test_fluid_block", () -> - new LiquidBlock(test_fluid, Properties.of(Material.WATER).noCollission().strength(100.0F).noDrops()) + new LiquidBlock(test_fluid, Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable()) ); public static RegistryObject test_fluid_bucket = ITEMS.register("test_fluid_bucket", () -> new BucketItem(test_fluid, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1).tab(CreativeModeTab.TAB_MISC)) @@ -82,7 +82,7 @@ private static ForgeFlowingFluid.Properties makeProperties() // WARNING: this doesn't allow "any fluid", only the fluid from this test mod! public static RegistryObject fluidloggable_block = BLOCKS.register("fluidloggable_block", () -> - new FluidloggableBlock(Properties.of(Material.WOOD).noCollission().strength(100.0F).noDrops()) + new FluidloggableBlock(Properties.of(Material.WOOD).noCollission().strength(100.0F).noLootTable()) ); public static RegistryObject fluidloggable_blockitem = ITEMS.register("fluidloggable_block", () -> new BlockItem(fluidloggable_block.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)) diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java index 83ec71aa72c..dae7fc90b95 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java @@ -7,6 +7,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -46,8 +47,8 @@ import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -81,7 +82,7 @@ public static class EventHandlers { public static void runData(GatherDataEvent event) { if(ENABLE) - event.getGenerator().addProvider(new DataProvider(event.getGenerator(), MODID)); + event.getGenerator().addProvider(event.includeServer(), new DataProvider(event.getGenerator(), MODID)); } } @@ -133,10 +134,10 @@ public SmeltingEnchantmentModifier(LootItemCondition[] conditionsIn) { super(conditionsIn); } - @Nonnull + @NotNull @Override - public List doApply(List generatedLoot, LootContext context) { - ArrayList ret = new ArrayList(); + public ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { + ObjectArrayList ret = new ObjectArrayList(); generatedLoot.forEach((stack) -> ret.add(smelt(stack, context))); return ret; } @@ -171,9 +172,9 @@ public SilkTouchTestModifier(LootItemCondition[] conditionsIn) { super(conditionsIn); } - @Nonnull + @NotNull @Override - public List doApply(List generatedLoot, LootContext context) { + public ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { ItemStack ctxTool = context.getParamOrNull(LootContextParams.TOOL); //return early if silk-touch is already applied (otherwise we'll get stuck in an infinite loop). if(EnchantmentHelper.getEnchantments(ctxTool).containsKey(Enchantments.SILK_TOUCH)) return generatedLoot; @@ -215,9 +216,9 @@ public WheatSeedsConverterModifier(LootItemCondition[] conditionsIn, int numSeed itemReward = reward; } - @Nonnull + @NotNull @Override - public List doApply(List generatedLoot, LootContext context) { + public ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { // // Additional conditions can be checked, though as much as possible should be parameterized via JSON data. // It is better to write a new ILootCondition implementation than to do things here. @@ -271,11 +272,11 @@ public DungeonLootEnhancerModifier(final LootItemCondition[] conditionsIn) { } @Override - protected List doApply(List generatedLoot, LootContext context) { + protected ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { return generatedLoot.stream() .map(ItemStack::copy) .peek(stack -> stack.setCount(Math.min(stack.getMaxStackSize(), stack.getCount() * this.multiplicationFactor))) - .collect(Collectors.toList()); + .collect(Collectors.toCollection(ObjectArrayList::new)); } private static class Serializer extends GlobalLootModifierSerializer { diff --git a/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java b/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java index b3396299064..185d20b69a5 100644 --- a/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java +++ b/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java @@ -27,14 +27,13 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import javax.annotation.Nullable; - import net.minecraft.world.item.Item.Properties; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; @Mod(CustomElytraTest.MOD_ID) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = CustomElytraTest.MOD_ID) @@ -100,7 +99,7 @@ public boolean elytraFlightTick(ItemStack stack, LivingEntity entity, int flight { stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(EquipmentSlot.CHEST)); } - entity.gameEvent(GameEvent.ELYTRA_FREE_FALL); + entity.gameEvent(GameEvent.ELYTRA_GLIDE); } } return true; diff --git a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java index 8f2eb796533..6bf9b096358 100644 --- a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java +++ b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java @@ -110,73 +110,67 @@ public void gatherData(GatherDataEvent event) DataGenerator gen = event.getGenerator(); ExistingFileHelper existing = event.getExistingFileHelper(); - if (event.includeServer()) + gen.addProvider(event.includeServer(), new BlockTagsProvider(gen, MODID, existing) { - gen.addProvider(new BlockTagsProvider(gen, MODID, existing) + @Override + protected void addTags() { - @Override - protected void addTags() - { - this.tag(MINEABLE_TAG).add(STONE.get()); - this.tag(REQUIRES_TAG).add(STONE.get()); - } - }); + this.tag(MINEABLE_TAG).add(STONE.get()); + this.tag(REQUIRES_TAG).add(STONE.get()); + } + }); - gen.addProvider(new LootTableProvider(gen) + gen.addProvider(event.includeServer(), new LootTableProvider(gen) + { + @Override + protected void validate(Map map, ValidationContext validationtracker) { - @Override - protected void validate(Map map, ValidationContext validationtracker) - { - map.forEach((name, table) -> LootTables.validate(validationtracker, name, table)); - } + map.forEach((name, table) -> LootTables.validate(validationtracker, name, table)); + } - @Override - protected List>>, LootContextParamSet>> getTables() + @Override + protected List>>, LootContextParamSet>> getTables() + { + return ImmutableList.of(Pair.of(() -> { - return ImmutableList.of(Pair.of(() -> + return new BlockLoot() { - return new BlockLoot() + + @Override + protected Iterable getKnownBlocks() { + return BLOCKS.getEntries().stream().map(Supplier::get).collect(Collectors.toList()); + } - @Override - protected Iterable getKnownBlocks() - { - return BLOCKS.getEntries().stream().map(Supplier::get).collect(Collectors.toList()); - } - - @Override - protected void addTables() - { - this.dropSelf(STONE.get()); - } - }; - }, LootContextParamSets.BLOCK)); - } - }); - } - - if (event.includeClient()) + @Override + protected void addTables() + { + this.dropSelf(STONE.get()); + } + }; + }, LootContextParamSets.BLOCK)); + } + }); + + gen.addProvider(event.includeClient(), new BlockStateProvider(gen, MODID, existing) { - gen.addProvider(new BlockStateProvider(gen, MODID, existing) + @Override + protected void registerStatesAndModels() { - @Override - protected void registerStatesAndModels() - { - ModelFile model = models().cubeAll(STONE.get().getRegistryName().getPath(), mcLoc("block/debug")); - simpleBlock(STONE.get(), model); - simpleBlockItem(STONE.get(), model); - } - }); - gen.addProvider(new ItemModelProvider(gen, MODID, existing) + ModelFile model = models().cubeAll(STONE.getId().getPath(), mcLoc("block/debug")); + simpleBlock(STONE.get(), model); + simpleBlockItem(STONE.get(), model); + } + }); + gen.addProvider(event.includeClient(), new ItemModelProvider(gen, MODID, existing) + { + @Override + protected void registerModels() { - @Override - protected void registerModels() - { - getBuilder(TOOL.get().getRegistryName().getPath()) - .parent(new UncheckedModelFile("item/generated")) - .texture("layer0", mcLoc("item/wooden_pickaxe")); - } - }); - } + getBuilder(TOOL.getId().getPath()) + .parent(new UncheckedModelFile("item/generated")) + .texture("layer0", mcLoc("item/wooden_pickaxe")); + } + }); } } diff --git a/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java b/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java index 3e41331b18a..d1687a39298 100644 --- a/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java @@ -22,31 +22,31 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.InteractionHand; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.extensions.IForgeMenuType; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; @Mod("containertypetest") public class ContainerTypeTest { - @ObjectHolder("containertypetest:container") + @ObjectHolder(registryName = "menu", value = "containertypetest:container") public static final MenuType TYPE = null; public class TestContainer extends AbstractContainerMenu { private final String text; - + protected TestContainer(int windowId, Inventory playerInv, FriendlyByteBuf extraData) { this(windowId, new SimpleContainer(9), extraData.readUtf(128)); } - + public TestContainer(int windowId, SimpleContainer inv, String text) { super(TYPE, windowId); @@ -57,13 +57,19 @@ public TestContainer(int windowId, SimpleContainer inv, String text) } } + @Override + public ItemStack quickMoveStack(Player p_38941_, int p_38942_) + { + return ItemStack.EMPTY; + } + @Override public boolean stillValid(Player playerIn) { return true; } } - + public class TestGui extends AbstractContainerScreen { public TestGui(TestContainer container, Inventory inv, Component name) @@ -80,21 +86,21 @@ protected void renderBg(PoseStack poseStack, float partialTick, int mouseX, int public ContainerTypeTest() { - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(MenuType.class, this::registerContainers); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerContainers); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); MinecraftForge.EVENT_BUS.addListener(this::onRightClick); } - private void registerContainers(final RegistryEvent.Register> event) + private void registerContainers(final RegisterEvent event) { - event.getRegistry().register(IForgeMenuType.create(TestContainer::new).setRegistryName("container")); + event.register(ForgeRegistries.Keys.CONTAINER_TYPES, helper -> helper.register("container", IForgeMenuType.create(TestContainer::new))); } - + private void setup(FMLClientSetupEvent event) { MenuScreens.register(TYPE, TestGui::new); } - + private void onRightClick(PlayerInteractEvent.RightClickBlock event) { if (!event.getWorld().isClientSide && event.getHand() == InteractionHand.MAIN_HAND) @@ -114,11 +120,11 @@ public AbstractContainerMenu createMenu(int p_createMenu_1_, Inventory p_createM } return new TestContainer(p_createMenu_1_, inv, text); } - + @Override public Component getDisplayName() { - return new TextComponent("Test"); + return Component.literal("Test"); } }, extraData -> { extraData.writeUtf(text); diff --git a/src/test/java/net/minecraftforge/debug/misc/DataPackRegistriesTest.java b/src/test/java/net/minecraftforge/debug/misc/DataPackRegistriesTest.java index c9a95670c82..639db702d34 100644 --- a/src/test/java/net/minecraftforge/debug/misc/DataPackRegistriesTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/DataPackRegistriesTest.java @@ -9,6 +9,7 @@ import java.nio.file.Path; import java.util.Locale; +import net.minecraft.data.CachedOutput; import org.slf4j.Logger; import com.google.gson.Gson; @@ -42,7 +43,6 @@ import net.minecraftforge.fml.util.thread.EffectiveSide; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistryEntry; import net.minecraftforge.registries.RegistryBuilder; import net.minecraftforge.registries.RegistryObject; @@ -65,7 +65,7 @@ public class DataPackRegistriesTest public static final String MODID = "data_pack_registries_test"; private static final Logger LOGGER = LogUtils.getLogger(); private static final ResourceLocation TEST_RL = new ResourceLocation(MODID, "test"); - + private final RegistryObject datagenTestObject; public DataPackRegistriesTest() @@ -75,40 +75,36 @@ public DataPackRegistriesTest() final IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); final IEventBus forgeBus = MinecraftForge.EVENT_BUS; - + // Deferred Registers can be created for datapack registries in static init or mod constructor. // (We'll do it in mod constructor, as when doing the ENABLED check it's less verbose than static init.) // As with static registries, any mod can make a Deferred Register for a given datapack registry, // but only one mod can register the internal registry with makeRegistry. final DeferredRegister unsyncables = DeferredRegister.create(Unsyncable.REGISTRY_KEY, MODID); final DeferredRegister syncables = DeferredRegister.create(Syncable.REGISTRY_KEY, MODID); - + // RegistryBuilder#dataPackRegistry marks the registry as a datapack registry rather than a static registry. - unsyncables.makeRegistry(Unsyncable.class, - () -> new RegistryBuilder().disableSaving().dataPackRegistry(Unsyncable.DIRECT_CODEC)); + unsyncables.makeRegistry(() -> new RegistryBuilder().disableSaving().dataPackRegistry(Unsyncable.DIRECT_CODEC)); // The overload of #dataPackRegistry that takes a second codec marks the datapack registry as syncable. - syncables.makeRegistry(Syncable.class, - () -> new RegistryBuilder().disableSaving().dataPackRegistry(Syncable.DIRECT_CODEC, Syncable.DIRECT_CODEC)); - + syncables.makeRegistry(() -> new RegistryBuilder().disableSaving().dataPackRegistry(Syncable.DIRECT_CODEC, Syncable.DIRECT_CODEC)); + // Datapack registry elements can be datagenerated, but they must be registered as builtin objects first. this.datagenTestObject = unsyncables.register("datagen_test", () -> new Unsyncable("Datagen Success")); - + unsyncables.register(modBus); syncables.register(modBus); - + modBus.addListener(this::onGatherData); forgeBus.addListener(this::onServerStarting); - + if (FMLEnvironment.dist == Dist.CLIENT) { ClientEvents.subscribeClientEvents(); } } - + private void onGatherData(final GatherDataEvent event) { - if (!event.includeServer()) - return; // Example of how to datagen datapack registry objects. // Objects to be datagenerated must be registered (e.g. via DeferredRegister above). // This outputs to data/data_pack_registries_test/data_pack_registries_test/unsyncable/datagen_test.json @@ -121,10 +117,11 @@ private void onGatherData(final GatherDataEvent event) final Unsyncable element = this.datagenTestObject.get(); final String pathString = String.join("/", PackType.SERVER_DATA.getDirectory(), id.getNamespace(), registryId.getNamespace(), registryId.getPath(), id.getPath()+".json"); final Path path = outputFolder.resolve(pathString); - generator.addProvider(new DataProvider() + + generator.addProvider(event.includeServer(), new DataProvider() { @Override - public void run(final HashCache cache) throws IOException + public void run(final CachedOutput cache) throws IOException { Unsyncable.DIRECT_CODEC.encodeStart(ops, element) .resultOrPartial(msg -> LOGGER.error("Failed to encode {}: {}", path, msg)) // Log error on encode failure. @@ -132,7 +129,7 @@ public void run(final HashCache cache) throws IOException { try { - DataProvider.save(gson, cache, json, path); + DataProvider.saveStable(cache, json, path); } catch (IOException e) // The throws can't deal with this exception, because we're inside the ifPresent. { @@ -148,7 +145,7 @@ public String getName() } }); } - + private void onServerStarting(final ServerStartingEvent event) { // Assert existence of json objects and tags. @@ -162,17 +159,17 @@ private void onServerStarting(final ServerStartingEvent event) final TagKey tag = TagKey.create(Unsyncable.REGISTRY_KEY, TEST_RL); if (!registry.getTag(tag).get().contains(holder)) throw new IllegalStateException(String.format(Locale.ENGLISH, "Tag %s does not contain %s", tag, TEST_RL)); - + LOGGER.info("DataPackRegistriesTest server data loaded successfully!"); } - + public static class ClientEvents { private static void subscribeClientEvents() { MinecraftForge.EVENT_BUS.addListener(ClientEvents::onClientTagsUpdated); } - + private static void onClientTagsUpdated(final TagsUpdatedEvent event) { // We want to check whether tags have been synced after the player logs in. @@ -196,12 +193,12 @@ private static void onClientTagsUpdated(final TagsUpdatedEvent event) final TagKey tag = TagKey.create(Syncable.REGISTRY_KEY, TEST_RL); if (!registry.getTag(tag).get().contains(holder)) throw new IllegalStateException(String.format(Locale.ENGLISH, "Tag %s does not contain %s", tag, TEST_RL)); - + LOGGER.info("DataPackRegistriesTest client data synced successfully!"); } } - public static class Unsyncable extends ForgeRegistryEntry + public static class Unsyncable { public static final ResourceKey> REGISTRY_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MODID, "unsyncable")); public static final Codec DIRECT_CODEC = Codec.STRING.fieldOf("value").codec().xmap(Unsyncable::new, Unsyncable::value); @@ -218,19 +215,19 @@ public String value() return this.value; } } - - public static class Syncable extends ForgeRegistryEntry + + public static class Syncable { public static final ResourceKey> REGISTRY_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MODID, "syncable")); public static final Codec DIRECT_CODEC = Codec.STRING.fieldOf("value").codec().xmap(Syncable::new, Syncable::value); - + private final String value; - + public Syncable(final String value) { this.value = value; } - + public String value() { return this.value; diff --git a/src/test/java/net/minecraftforge/debug/misc/RegistryCodecTest.java b/src/test/java/net/minecraftforge/debug/misc/RegistryCodecTest.java index f02e7fccdc2..996143fa407 100644 --- a/src/test/java/net/minecraftforge/debug/misc/RegistryCodecTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/RegistryCodecTest.java @@ -25,12 +25,11 @@ import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.IForgeRegistryEntry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** - * This test mod show a few example usages of {@link IForgeRegistry#getCodec()} to serialize and deserialize {@link IForgeRegistryEntry} to json or nbt. + * This test mod show a few example usages of {@link IForgeRegistry#getCodec()} to serialize and deserialize registry entries to JSON or NBT. * There are 4 tested cases : * 1. json -> Pair * 2. Pair -> nbt diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionClientHelper.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionClientHelper.java index 2f805b9122e..ca0fbe5875a 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionClientHelper.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionClientHelper.java @@ -25,7 +25,7 @@ public static void init() { RecipeBookRegistry.addCategoriesToType(RecipeBookExtensionTest.TEST_TYPE, ImmutableList.of(TESTING_SEARCH.get(), TESTING_CAT_1.get(), TESTING_CAT_2.get())); RecipeBookRegistry.addAggregateCategories(TESTING_SEARCH.get(), ImmutableList.of(TESTING_CAT_1.get(), TESTING_CAT_2.get())); - RecipeBookRegistry.addCategoriesFinder(RecipeBookTestRecipe.TYPE.get(), r -> + RecipeBookRegistry.addCategoriesFinder(RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(), r -> { if (r.getResultItem().getItem() == Items.DIAMOND_BLOCK) return TESTING_CAT_1.get(); diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionTest.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionTest.java index a85540bbc28..7c43c4c3571 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionTest.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookExtensionTest.java @@ -6,7 +6,7 @@ package net.minecraftforge.debug.recipe.recipebook; import net.minecraft.client.gui.screens.MenuScreens; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.SimpleContainer; @@ -14,19 +14,18 @@ import net.minecraft.world.inventory.ContainerLevelAccess; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.RecipeBookType; +import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.crafting.conditions.ICondition; -import net.minecraftforge.common.crafting.conditions.IConditionSerializer; import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.registries.DeferredRegister; @@ -49,22 +48,20 @@ public class RecipeBookExtensionTest public static final RegistryObject> RECIPE_BOOK_TEST_MENU_TYPE = MENU_TYPE.register("test_recipe_menu", () -> IForgeMenuType.create(RecipeBookTestMenu::new)); + public static final DeferredRegister> RECIPE_TYPE = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, MOD_ID); + public static final RegistryObject> RECIPE_BOOK_TEST_RECIPE_TYPE = registerRecipeType("test_recipe"); + public RecipeBookExtensionTest() { if (!ENABLED) return; - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); - RECIPE_SERIALIZER.register(FMLJavaModLoadingContext.get().getModEventBus()); - MENU_TYPE.register(FMLJavaModLoadingContext.get().getModEventBus()); - MinecraftForge.EVENT_BUS.addListener(this::onRightClick); - } - private void commonSetup(FMLCommonSetupEvent event) - { - event.enqueueWork(() -> - { - RecipeType.register(getId("test_recipe").toString()); - }); + IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); + RECIPE_SERIALIZER.register(modBus); + MENU_TYPE.register(modBus); + RECIPE_TYPE.register(modBus); + + MinecraftForge.EVENT_BUS.addListener(this::onRightClick); } private void onRightClick(PlayerInteractEvent.RightClickBlock event) @@ -72,7 +69,7 @@ private void onRightClick(PlayerInteractEvent.RightClickBlock event) if (event.getWorld().isClientSide) return; if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.GRASS_BLOCK) - NetworkHooks.openGui((ServerPlayer) event.getPlayer(), new SimpleMenuProvider((id, inv, p) -> new RecipeBookTestMenu(id, inv, ContainerLevelAccess.create(event.getWorld(), event.getPos())), new TextComponent("Test"))); + NetworkHooks.openGui((ServerPlayer) event.getPlayer(), new SimpleMenuProvider((id, inv, p) -> new RecipeBookTestMenu(id, inv, ContainerLevelAccess.create(event.getWorld(), event.getPos())), Component.literal("Test"))); } public static ResourceLocation getId(String name) @@ -80,6 +77,18 @@ public static ResourceLocation getId(String name) return new ResourceLocation(MOD_ID, name); } + private static > RegistryObject> registerRecipeType(String name) { + String id = getId(name).toString(); + return RECIPE_TYPE.register(name, () -> new RecipeType<>() + { + @Override + public String toString() + { + return id; + } + }); + } + @Mod.EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) public static class ClientHandler { diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java index 8fccf7017ce..159803882f9 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java @@ -7,7 +7,6 @@ import net.minecraft.core.NonNullList; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.recipebook.ServerPlaceRecipe; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; @@ -59,7 +58,7 @@ public void onTake(Player player, ItemStack stack) { this.checkTakeAchievements(stack); Container craftingContainer = RecipeBookTestMenu.this.container; - NonNullList remainders = player.level.getRecipeManager().getRemainingItemsFor(RecipeBookTestRecipe.TYPE.get(), RecipeBookTestMenu.this.container, player.level); + NonNullList remainders = player.level.getRecipeManager().getRemainingItemsFor(RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(), RecipeBookTestMenu.this.container, player.level); for (int i = 0; i < remainders.size(); ++i) { ItemStack toRemove = craftingContainer.getItem(i); @@ -163,7 +162,7 @@ public void slotsChanged(Container container) if (container == this.container) { Optional recipe = level.getRecipeManager() - .getRecipeFor(RecipeBookTestRecipe.TYPE.get(), this.container, level); + .getRecipeFor(RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(), this.container, level); if (recipe.isEmpty()) this.resultContainer.setItem(0, ItemStack.EMPTY); else if (player instanceof ServerPlayer sp && this.resultContainer.setRecipeUsed(level, sp, recipe.get())) { diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java index edce814ba06..b94fbaa13df 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java @@ -5,7 +5,6 @@ package net.minecraftforge.debug.recipe.recipebook; -import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.mojang.serialization.Codec; @@ -14,7 +13,6 @@ import com.mojang.serialization.JsonOps; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.NonNullList; -import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -33,9 +31,6 @@ public class RecipeBookTestRecipe implements Recipe { - @SuppressWarnings("unchecked") - public static final Supplier> TYPE = Suppliers.memoize(() -> (RecipeType) Registry.RECIPE_TYPE.get(RecipeBookExtensionTest.getId("test_recipe"))); - public final ResourceLocation id; public final Ingredients ingredients; private final int width; @@ -132,7 +127,7 @@ public RecipeSerializer getSerializer() @Override public RecipeType getType() { - return TYPE.get(); + return RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(); } @Override diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipeSerializer.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipeSerializer.java index 1dda46fae0b..a7874ad8a96 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipeSerializer.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipeSerializer.java @@ -11,11 +11,9 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraftforge.debug.recipe.recipebook.RecipeBookTestRecipe.Ingredients; -import net.minecraftforge.registries.ForgeRegistryEntry; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; - -public class RecipeBookTestRecipeSerializer extends ForgeRegistryEntry> implements RecipeSerializer +public class RecipeBookTestRecipeSerializer implements RecipeSerializer { @Override public RecipeBookTestRecipe fromJson(ResourceLocation id, JsonObject json) diff --git a/src/test/java/net/minecraftforge/debug/world/BiomeLoadingEventTest.java b/src/test/java/net/minecraftforge/debug/world/BiomeLoadingEventTest.java deleted file mode 100644 index ef722bc40d8..00000000000 --- a/src/test/java/net/minecraftforge/debug/world/BiomeLoadingEventTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.debug.world; - -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.BiomeLoadingEvent; -import net.minecraftforge.fml.common.Mod; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.Locale; - -@Mod(BiomeLoadingEventTest.MODID) -public class BiomeLoadingEventTest { - static final String MODID = "biome_loading_event_test"; - private static final Logger LOGGER = LogManager.getLogger(MODID); - private static final boolean ENABLED = false; - public BiomeLoadingEventTest(){ - if(ENABLED) { - MinecraftForge.EVENT_BUS.addListener(this::onBiomeLoading); - } - } - public void onBiomeLoading(BiomeLoadingEvent event){ - ResourceLocation biome = event.getName(); - LOGGER.info("Biome loaded: {}", biome); - } -} diff --git a/src/test/java/net/minecraftforge/debug/world/BiomeModifierTest.java b/src/test/java/net/minecraftforge/debug/world/BiomeModifierTest.java new file mode 100644 index 00000000000..425fd2e4fef --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/world/BiomeModifierTest.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.debug.world; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; + +import net.minecraft.data.CachedOutput; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.JsonOps; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DataProvider; +import net.minecraft.data.worldgen.features.NetherFeatures; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackType; +import net.minecraft.tags.BiomeTags; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.Precipitation; +import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; +import net.minecraft.world.level.levelgen.GenerationStep.Decoration; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.BiomeFilter; +import net.minecraft.world.level.levelgen.placement.CountOnEveryLayerPlacement; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder; +import net.minecraftforge.common.world.BiomeModifier; +import net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo.Builder; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +/** + *

This tests the following features and requirements of biome modifier jsons::

+ *
    + *
  • A biome modifier json is created via datagen.
  • + *
  • The biome modifier modifies all four modifiable fields in biomes, to ensure patches and coremods apply correctly (generation, spawns, climate, and client effects).
  • + *
  • The biome modifier uses a biome tag to determine which biomes to modify.
  • + *
  • The biome modifier adds json feature to modified biomes, to ensure json features are usable in biome modifiers.
  • + *
+ *

If the biome modifier is applied correctly, then badlands biomes should generate large basalt columns, + * spawn magma cubes, have red-colored water, and be snowy.

+ */ +@Mod(BiomeModifierTest.MODID) +public class BiomeModifierTest +{ + public static final Logger LOGGER = LogManager.getLogger(); + public static final String MODID = "biome_modifiers_test"; + public static final boolean ENABLED = true; + public static final String BASALT_PILLARS = "large_basalt_columns"; + public static final ResourceLocation BASALT_PILLARS_RL = new ResourceLocation(MODID, BASALT_PILLARS); + public static final String TEST = "test"; + public static final ResourceLocation ADD_FEATURES_TO_BIOMES_RL = new ResourceLocation(MODID, TEST); + public static final String MODIFY_BADLANDS = "modify_badlands"; + + @SuppressWarnings("unchecked") + public BiomeModifierTest() + { + if (!ENABLED) + return; + + IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); + + // Serializer types can be registered via deferred register. + final DeferredRegister> serializers = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID); + serializers.register(modBus); + serializers.register(TEST, TestModifier::makeCodec); + + // Biome modifiers don't need to be registered when defined in json, but they do need to be registered if we are to datagenerate the jsons. + // We'll also datagenerate a placedfeature json (using our own placedfeature avoids feature cycle problems when we add it to biomes). + final DeferredRegister placedFeatures = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, MODID); + placedFeatures.register(modBus); + placedFeatures.register(BASALT_PILLARS, + () -> new PlacedFeature((Holder>) (Holder>)NetherFeatures.LARGE_BASALT_COLUMNS, + List.of(CountOnEveryLayerPlacement.of(1), BiomeFilter.biome()))); + + modBus.addListener(this::onGatherData); + } + + private void onGatherData(GatherDataEvent event) + { + // Example of how to datagen datapack registry objects. + // Datapack registry objects referred to by other datapack registry objects must be registered first. + DataGenerator generator = event.getGenerator(); + final Path outputFolder = generator.getOutputFolder(); + final RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, RegistryAccess.BUILTIN.get()); + final Gson gson = new GsonBuilder().setPrettyPrinting().create(); + final String directory = PackType.SERVER_DATA.getDirectory(); + Registry placedFeatures = ops.registry(Registry.PLACED_FEATURE_REGISTRY).get(); + + // prepare to datagenerate our placed feature + final String featurePathString = String.join("/", directory, MODID, Registry.PLACED_FEATURE_REGISTRY.location().getPath(), BASALT_PILLARS + ".json"); + final Path featurePath = outputFolder.resolve(featurePathString); + final PlacedFeature feature = placedFeatures.get(BASALT_PILLARS_RL); + + // prepare to datagenerate our biome modifier + final ResourceLocation biomeModifiersRegistryID = ForgeRegistries.Keys.BIOME_MODIFIERS.location(); + final String biomeModifierPathString = String.join("/", directory, MODID, biomeModifiersRegistryID.getNamespace(), biomeModifiersRegistryID.getPath(), MODIFY_BADLANDS + ".json"); + final Path biomeModifierPath = outputFolder.resolve(biomeModifierPathString); + final BiomeModifier biomeModifier = new TestModifier( + new HolderSet.Named<>(ops.registry(Registry.BIOME_REGISTRY).get(), BiomeTags.IS_BADLANDS), + Decoration.TOP_LAYER_MODIFICATION, + HolderSet.direct(placedFeatures.getOrCreateHolderOrThrow(ResourceKey.create(Registry.PLACED_FEATURE_REGISTRY, BASALT_PILLARS_RL))), + new SpawnerData(EntityType.MAGMA_CUBE, 100, 1, 4), + Precipitation.SNOW, + 0xFF0000 + ); + + generator.addProvider(event.includeServer(), new DataProvider() + { + @Override + public void run(final CachedOutput cache) throws IOException + { + PlacedFeature.DIRECT_CODEC.encodeStart(ops, feature) + .resultOrPartial(msg -> LOGGER.error("Failed to encode {}: {}", featurePathString, msg)) // Log error on encode failure. + .ifPresent(json -> // Output to file on encode success. + { + try + { + DataProvider.saveStable(cache, json, featurePath); + } + catch (IOException e) // The throws can't deal with this exception, because we're inside the ifPresent. + { + LOGGER.error("Failed to save " + featurePathString, e); + } + }); + + BiomeModifier.DIRECT_CODEC.encodeStart(ops, biomeModifier) + .resultOrPartial(msg -> LOGGER.error("Failed to encode {}: {}", biomeModifierPathString, msg)) // Log error on encode failure. + .ifPresent(json -> // Output to file on encode success. + { + try + { + DataProvider.saveStable(cache, json, biomeModifierPath); + } + catch (IOException e) // The throws can't deal with this exception, because we're inside the ifPresent. + { + LOGGER.error("Failed to save " + biomeModifierPathString, e); + } + }); + } + + @Override + public String getName() + { + return MODID + " data provider"; + } + }); + } + + public record TestModifier(HolderSet biomes, Decoration generationStage, HolderSet features, SpawnerData spawn, Precipitation precipitation, int waterColor) + implements BiomeModifier + { + private static final RegistryObject> SERIALIZER = RegistryObject.create(ADD_FEATURES_TO_BIOMES_RL, ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID); + + @Override + public void modify(Holder biome, Phase phase, Builder builder) + { + if (phase == Phase.ADD && this.biomes.contains(biome)) + { + BiomeGenerationSettingsBuilder generation = builder.getGenerationSettings(); + this.features.forEach(holder -> generation.addFeature(this.generationStage, holder)); + builder.getMobSpawnSettings().addSpawn(this.spawn.type.getCategory(), this.spawn); + } + else if (phase == Phase.MODIFY && this.biomes.contains(biome)) + { + builder.getClimateSettings().setPrecipitation(this.precipitation); + builder.getEffects().waterColor(this.waterColor); + if (this.precipitation == Precipitation.SNOW) + builder.getClimateSettings().setTemperature(0F); + } + } + + @Override + public Codec codec() + { + return SERIALIZER.get(); + } + + private static Codec makeCodec() + { + return RecordCodecBuilder.create(builder -> builder.group( + Biome.LIST_CODEC.fieldOf("biomes").forGetter(TestModifier::biomes), + Codec.STRING.comapFlatMap(TestModifier::generationStageFromString, Decoration::toString).fieldOf("generation_stage").forGetter(TestModifier::generationStage), + PlacedFeature.LIST_CODEC.fieldOf("features").forGetter(TestModifier::features), + SpawnerData.CODEC.fieldOf("spawn").forGetter(TestModifier::spawn), + Precipitation.CODEC.fieldOf("precipitation").forGetter(TestModifier::precipitation), + Codec.INT.fieldOf("water_color").forGetter(TestModifier::waterColor) + ).apply(builder, TestModifier::new)); + } + + private static DataResult generationStageFromString(String name) + { + try + { + return DataResult.success(Decoration.valueOf(name)); + } + catch (Exception e) + { + return DataResult.error("Not a decoration stage: " + name); + } + } + } +} diff --git a/src/test/java/net/minecraftforge/debug/world/ChunkWatchEventTest.java b/src/test/java/net/minecraftforge/debug/world/ChunkWatchEventTest.java index febb6ef2e40..b99e6dcb91f 100644 --- a/src/test/java/net/minecraftforge/debug/world/ChunkWatchEventTest.java +++ b/src/test/java/net/minecraftforge/debug/world/ChunkWatchEventTest.java @@ -15,8 +15,8 @@ import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.UUID; @Mod(ChunkWatchEventTest.MODID) diff --git a/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java b/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java index 1acc982650b..97b7bf678af 100644 --- a/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java +++ b/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java @@ -9,7 +9,6 @@ import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; -import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; diff --git a/src/test/java/net/minecraftforge/debug/world/ForgeWorldTypeTest.java b/src/test/java/net/minecraftforge/debug/world/ForgeWorldTypeTest.java index 14ce9807081..dfc2484b0ad 100644 --- a/src/test/java/net/minecraftforge/debug/world/ForgeWorldTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/world/ForgeWorldTypeTest.java @@ -8,68 +8,64 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.ForgeWorldPresetScreens; import net.minecraftforge.common.world.ForgeWorldPreset; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; @Mod("forge_world_type_test") public class ForgeWorldTypeTest { - @ObjectHolder("forge_world_type_test:test_world_type") - public static ForgeWorldPreset testWorldType; - - public ForgeWorldTypeTest() - { - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(ForgeWorldPreset.class, this::registerWorldTypes); - } - - private void registerWorldTypes(RegistryEvent.Register event) - { - event.getRegistry().registerAll( - new ForgeWorldPreset(WorldGenSettings::makeDefaultOverworld).setRegistryName("test_world_type") - ); - event.getRegistry().registerAll( - new ForgeWorldPreset(this::createChunkGenerator).setRegistryName("test_world_type2") - ); - } - - private ChunkGenerator createChunkGenerator(RegistryAccess registry, long seed, String settings) - { - return WorldGenSettings.makeDefaultOverworld(registry, seed); - } - - @Mod.EventBusSubscriber(modid="forge_world_type_test", value=Dist.CLIENT, bus=Bus.MOD) - public static class ForgeWorldTypeTestClientModEvents - { - @SubscribeEvent - public static void registerWorldTypeScreenFactories(FMLClientSetupEvent event) - { - ForgeWorldPresetScreens.registerPresetEditor(testWorldType, (returnTo, dimensionGeneratorSettings) -> new Screen(testWorldType.getDisplayName()) - { - @Override - protected void init() - { - super.init(); - - addRenderableWidget(new Button(0, 0, 120, 20, new TextComponent("close"), btn -> { - Minecraft.getInstance().setScreen(returnTo); - })); - } - }); - } - } + // TODO-PATCHING: find what changed to world loading to see what gets passed to ForgeWorldPreset -sci +// @ObjectHolder(registryName = "forge:world_types", value = "forge_world_type_test:test_world_type") +// public static ForgeWorldPreset testWorldType; +// +// public ForgeWorldTypeTest() +// { +// FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerWorldTypes); +// } +// +// private void registerWorldTypes(RegisterEvent event) +// { +// event.register(ForgeRegistries.Keys.WORLD_TYPES, helper -> +// { +// helper.register("test_world_type", new ForgeWorldPreset(WorldGenSettings::makeDefaultOverworld)); +// helper.register("test_world_type2", new ForgeWorldPreset(this::createChunkGenerator)); +// }); +// } +// +// private ChunkGenerator createChunkGenerator(RegistryAccess registry, long seed, String settings) +// { +// return WorldGenSettings.makeDefaultOverworld(registry, seed); +// } +// +// @Mod.EventBusSubscriber(modid="forge_world_type_test", value=Dist.CLIENT, bus=Bus.MOD) +// public static class ForgeWorldTypeTestClientModEvents +// { +// @SubscribeEvent +// public static void registerWorldTypeScreenFactories(FMLClientSetupEvent event) +// { +// // ForgeWorldPresetScreens.registerPresetEditor(testWorldType, (returnTo, dimensionGeneratorSettings) -> new Screen(testWorldType.getDisplayName()) +// // { +// // @Override +// // protected void init() +// // { +// // super.init(); +// // +// // addRenderableWidget(new Button(0, 0, 120, 20, Component.literal("close"), btn -> { +// // Minecraft.getInstance().setScreen(returnTo); +// // })); +// // } +// // }); +// } +// } } diff --git a/src/test/java/net/minecraftforge/debug/world/StructureSpawnListGatherEventTest.java b/src/test/java/net/minecraftforge/debug/world/StructureSpawnListGatherEventTest.java index c5bba0913d4..8553b66dae2 100644 --- a/src/test/java/net/minecraftforge/debug/world/StructureSpawnListGatherEventTest.java +++ b/src/test/java/net/minecraftforge/debug/world/StructureSpawnListGatherEventTest.java @@ -5,10 +5,11 @@ package net.minecraftforge.debug.world; +import net.minecraft.data.worldgen.Structures; +import net.minecraft.tags.StructureTags; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.biome.MobSpawnSettings; -import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.StructureSpawnListGatherEvent; import net.minecraftforge.eventbus.api.EventPriority; @@ -30,12 +31,13 @@ public StructureSpawnListGatherEventTest() private void onStructureSpawnListGather(StructureSpawnListGatherEvent event) { - if (event.getStructure() == StructureFeature.STRONGHOLD) + // TODO-PATCHING: we likely want to get registry access here, so we can resolve tags instead of hardcoding structure objects + if (Structures.STRONGHOLD.get() == event.getStructure()) { event.addEntitySpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.WITHER_SKELETON, 100, 5, 15)); LOGGER.info("Adding wither skeleton spawns to strong holds"); } - else if (event.getStructure() == StructureFeature.SHIPWRECK) + else if (Structures.SHIPWRECK.get() == event.getStructure()) { event.setInsideOnly(false); event.addEntitySpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(EntityType.GUARDIAN, 100, 5, 15)); diff --git a/src/test/java/net/minecraftforge/eventtest/internal/EventTest.java b/src/test/java/net/minecraftforge/eventtest/internal/EventTest.java new file mode 100644 index 00000000000..8f06b113cda --- /dev/null +++ b/src/test/java/net/minecraftforge/eventtest/internal/EventTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.eventtest.internal; + +/** + * The basis of the Event regression testing framework. + * Allows each bootstrap event to be queried in turn to see whether the event passed. + * For gameplay events, a callback is set for when the respective event is fired. + * + * Test cases should be in a subclass of this, annotated with TestHolder. + * If the test is for an event that fires in Bootstrap, set the field in constructor. + * Register the event handler in the registerEvents method, which will be fired automatically. + * + * Use the pass / fail / error methods in this class to tell the Framework what the result of the test is. + * + * @author Curle + */ +public abstract class EventTest { + protected Result testResult = Result.NOT_PROCESSED; + protected String errorDetail = "Event not processed"; + protected boolean bootstrap; // true for events that fire when the game is loading to the main menu. false for events that fire after the game has loaded. + + /** + * A summarised view of the test result. + * For passes: "PASS" + * For failures: "FAIL - ($errorDetail)" + * @return test result + */ + public String getTestResult() { + return (testResult.passed() ? "PASS" : "FAIL; ") + (testResult.failed() ? getEnhancedDetail() : ""); + } + + /** + * Provide extra detail about the error. + * Pass-through of errorDetail is default, but some events require something more robust. + * @return information to be shown in case of a test failure + */ + protected String getEnhancedDetail() { return errorDetail; } + + /** + * @return whether or not this event should be monitored while the game is loading to the main menu. + */ + public boolean isBootstrap() { return bootstrap; } + + /** + * Register event handlers for this event. + * Trade-off between "magic annotations" and verbosity should be evaluated. + */ + public abstract void registerEvents(); + + /** + * Helper method - combines setting failure state with detail message. + * @param reason extra detail about why the failure occurred + */ + protected void fail(String reason) { + testResult = Result.FAIL; + errorDetail = reason; + + TestFramework.testChangedState(this); + } + + /** + * Helper method - sets the test pass flag. + */ + protected void pass() { + testResult = Result.PASS; + + TestFramework.testChangedState(this); + } + + /** + * Helper method - combines setting error state with detail message. + * @param reason extra detail about why the error occured. + */ + protected void error(String reason) { + testResult = Result.TESTFAIL; + errorDetail = reason; + + TestFramework.testChangedState(this); + } + + /** + * Encodes information about how the test progressed. + */ + public enum Result { + PASS, // The test passed with no errors + FAIL, // The code being tested failed to meet the requirements + TESTFAIL, // The test threw an error when trying to evaluate the requirements + NOT_PROCESSED; // The test was not fired, or did not return a result. + + /** + * @return whether the test passed. + */ + public boolean passed() { + return this == PASS; + } + + /** + * @return whether the test or the code being tested failed. + */ + public boolean failed() { + return this != PASS; + } + + /** + * @return whether the test encountered an error + */ + public boolean errored() { + return this == TESTFAIL; + } + }; + +} \ No newline at end of file diff --git a/src/test/java/net/minecraftforge/eventtest/internal/TestFramework.java b/src/test/java/net/minecraftforge/eventtest/internal/TestFramework.java new file mode 100644 index 00000000000..8ee06d3a803 --- /dev/null +++ b/src/test/java/net/minecraftforge/eventtest/internal/TestFramework.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.eventtest.internal; + +import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraftforge.client.event.ScreenOpenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.GameShuttingDownEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.loading.LoadingModList; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender; +import org.apache.logging.log4j.core.appender.rolling.OnStartupTriggeringPolicy; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.LoggerConfig; +import org.apache.logging.log4j.core.layout.PatternLayout; +import org.jetbrains.annotations.NotNull; +import org.objectweb.asm.Type; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The backend of the "curletest" event testing framework. + * All tests are registered to this class, and are set up according to the needs they declare. + * + * All bootstrap tests will be summed up into a log file when the main menu loads. + * All gameplay events will be printed to the console when they fire, and written to the above log. + * + * To register a new event test, simply create the class in the events package and add it to the list here. + */ +@Mod(TestFramework.MODID) +public class TestFramework { + public static final String MODID = "eventtests"; + + final List tests; + final static Map testNames = new HashMap<>(); + final static Logger LOGGER = LogManager.getLogger(); + final static Type CURLETEST_ANNOTATION = Type.getType(TestHolder.class); + + boolean bootstrapHandled = false; + + /** + * Pre-initialize the framework and all events. + */ + public TestFramework() { + prepareLogger(); + + LOGGER.info("Preparing all event tests."); + + tests = gatherEvents(); + // Let each event set up + tests.forEach(EventTest::registerEvents); + + // Register the screen opened listener. + // The main menu signals the end of the bootstrap tests. + MinecraftForge.EVENT_BUS.addListener(this::collectBootstrapTests); + + // Register the game shutting down listener. + // If there are any unhandled tests after shutdown, notify of an event not fired. + MinecraftForge.EVENT_BUS.addListener(this::collectMissedTests); + } + + /** + * Gameplay events require to be able to notify the framework when their task is completed. + * Bootstrap events are ignored when updates occur. + */ + public static void testChangedState(EventTest test) { + if(test.isBootstrap()) return; + + LOGGER.info("Test " + testNames.get(test) + ": " + test.getTestResult()); + } + + /** + * Enumerate all tests that should be ran with the framework. + * All classes with the @TestHolder annotation are resolved and instantiated as tests. + * + * @return all tests to run + */ + private List gatherEvents() { + var tests = new ArrayList(); + + // Search all annotations in the current mod, filter for @CurleTest, and condense to a list. + var anns = LoadingModList.get().getModFileById(MODID).getFile().getScanResult().getAnnotations() + .stream() + .filter(ann -> CURLETEST_ANNOTATION.equals(ann.annotationType())) + .toList(); + + // For each instance of the annotation, resolve the class it's attached to, create a new instance, and add it to the list. + anns.forEach(annotationData -> { + Class clazz; + try { + clazz = Class.forName(annotationData.clazz().getClassName()); + EventTest instance = (EventTest) clazz.getDeclaredConstructor().newInstance(); + tests.add(instance); + testNames.put(instance, (String) annotationData.annotationData().get("value")); + } catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) { + e.printStackTrace(); + } + }); + + return tests; + } + + /** + * At the mark of the end of the bootstrap period, collect and log all test results. + * the ScreenOpenEvent fired by TitleScreen is the last event fired without user interaction, so it is the + * end of the "automatic" bootstrap time. + */ + private void collectBootstrapTests(ScreenOpenEvent event) { + if(!(event.getScreen() instanceof TitleScreen) || bootstrapHandled) + return; + + LOGGER.info("Preparing to run bootstrap tests:"); + tests.forEach(test -> { + if(test.isBootstrap()) { + LOGGER.info(" - " + testNames.get(test) + ": " + test.getTestResult()); + } + }); + LOGGER.info("All bootstrap tests evaluated."); + + bootstrapHandled = true; + } + + /** + * Search for unfired events when the game is shutting down. + * Summarise all test results. + */ + private void collectMissedTests(GameShuttingDownEvent event) { + LOGGER.info("Test summary processing.."); + tests.forEach(test -> { + LOGGER.info("\tTest " + testNames.get(test) + ": "); + LOGGER.info(test.testResult == EventTest.Result.NOT_PROCESSED ? + "\t\tMISSED - Not fired." : + "\t\t" + test.getTestResult() + ); + }); + LOGGER.info("Event Test Framework finished."); + } + + /** + * Set the LOGGER instance in this class to only write to logs/curletest.log. + * Log4J is annoying and requires manual initialization and preparation. + */ + private void prepareLogger() { + final LoggerContext ctx = (LoggerContext) LogManager.getContext(false); + final Configuration config = ctx.getConfiguration(); + final LoggerConfig loggerConfig = getLoggerConfiguration(config, LOGGER.getName()); + + final RollingRandomAccessFileAppender appender = RollingRandomAccessFileAppender.newBuilder() + .setName("EventTestLog") + .withFileName("logs/curletest.log") + .withFilePattern("logs/%d{yyyy-MM-dd}-%i.log.gz") + .setLayout(PatternLayout.newBuilder() + .withPattern("[%d{ddMMMyyyy HH:mm:ss}] [%logger]: %minecraftFormatting{%msg}{strip}%n%xEx") + .build() + ) + .withPolicy( + OnStartupTriggeringPolicy.createPolicy(1) + ) + .build(); + + appender.start(); + + loggerConfig.setParent(null); + loggerConfig.getAppenders().keySet().forEach(loggerConfig::removeAppender); + loggerConfig.addAppender( + appender, + Level.INFO, + null + ); + } + + private static LoggerConfig getLoggerConfiguration(@NotNull final Configuration configuration, @NotNull final String loggerName) + { + final LoggerConfig lc = configuration.getLoggerConfig(loggerName); + if (lc.getName().equals(loggerName)) + { + return lc; + } + else + { + final LoggerConfig nlc = new LoggerConfig(loggerName, lc.getLevel(), lc.isAdditive()); + nlc.setParent(lc); + configuration.addLogger(loggerName, nlc); + configuration.getLoggerContext().updateLoggers(); + + return nlc; + } + } +} \ No newline at end of file diff --git a/src/test/java/net/minecraftforge/eventtest/internal/TestHolder.java b/src/test/java/net/minecraftforge/eventtest/internal/TestHolder.java new file mode 100644 index 00000000000..97f26222763 --- /dev/null +++ b/src/test/java/net/minecraftforge/eventtest/internal/TestHolder.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.eventtest.internal; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * A marker annotation used with the Event Testing Framework. + * Can only be placed on a class, enum or record. + * + * This annotation is used with FML Scan Data to construct and register the test automatically. + * The testName field is used in the output of the test. + * + * @author Curle + */ +@Target({ElementType.TYPE}) +public @interface TestHolder { + String value(); +} diff --git a/src/test/java/net/minecraftforge/eventtest/tests/forge/client/EntityJoinedWorldTest.java b/src/test/java/net/minecraftforge/eventtest/tests/forge/client/EntityJoinedWorldTest.java new file mode 100644 index 00000000000..05050cab9c1 --- /dev/null +++ b/src/test/java/net/minecraftforge/eventtest/tests/forge/client/EntityJoinedWorldTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.eventtest.tests.forge.client; + +import net.minecraft.client.Minecraft; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.eventtest.internal.EventTest; +import net.minecraftforge.eventtest.internal.TestHolder; + +/** + * Test case for the EntityJoinWorldEvent. + * + * Event fires during gameplay. + * Success condition: + * EntityJoinWorldEvent fired for Minecraft.getInstance().player + * Failure info: + * "EntityJoinWorldEvent was not fired" + * + */ + +@TestHolder("EntityJoinWorld") +public class EntityJoinedWorldTest extends EventTest { + + @Override + public void registerEvents() { + MinecraftForge.EVENT_BUS.addListener(this::eventListener); + } + + private void eventListener(EntityJoinWorldEvent event) { + final Entity eventEntity = event.getEntity(); + final Player gamePlayer = Minecraft.getInstance().player; + + final boolean eventFiredForPlayer = eventEntity == gamePlayer; + + if(eventFiredForPlayer) + pass(); + } +} \ No newline at end of file diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index 04ec601c9bd..0c31baa07c2 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -3,232 +3,10 @@ loaderVersion="[28,)" license="LGPL v2.1" [[mods]] - modId="containertypetest" -[[mods]] - modId="potion_event_test" -[[mods]] - modId="base_block_place_event_test" -[[mods]] - modId="farmland_trample_test" -[[mods]] - modId="neighbor_notify_event_test" -[[mods]] - modId="block_place_event_test" -[[mods]] - modId="slipperiness_test" -[[mods]] - modId="vanilla_game_event_test" -[[mods]] - modId="custom_slime_block_test" -[[mods]] - modId="client_chat_event_test" -[[mods]] - modId="command_event_test" -[[mods]] - modId="entity_selector_test" -[[mods]] - modId="gravity_attribute_test" -[[mods]] - modId="new_fluid_test" -[[mods]] - modId="milk_fluid_test" -[[mods]] - modId="data_gen_test" -[[mods]] - modId="piston_event_test" -[[mods]] - modId="flower_pot_test" -[[mods]] - modId="player_xp_event_test" -[[mods]] - modId="new_model_loader_test" -[[mods]] - modId="forgedebugmultilayermodel" -[[mods]] - modId="chunkwatchworldtest" -[[mods]] - modId="trsr_transformer_test" -[[mods]] - modId="nameplate_render_test" -[[mods]] - modId="global_loot_test" -[[dependencies.global_loot_test]] - modId="forge" - mandatory=true - versionRange="[1,)" - ordering="AFTER" - side="BOTH" -[[mods]] - modId="custom_plant_type_test" -[[mods]] - modId="chunk_data_event_save_null_world_test" -[[mods]] - modId="composite_model_test" -[[mods]] - modId="dyn_bucket_model_test" -[[mods]] - modId="music_disc_test" -[[mods]] - modId="stencil_enable_test" -[[mods]] - modId="deferred_registry_test" -[[mods]] - modId="create_entity_classification_test" -[[mods]] - modId="ender_mask_test" -[[mods]] - modId="custom_head_test" -[[mods]] - modId="raid_enum_test" -[[mods]] - modId="player_name_event_test" -[[mods]] - modId="tool_interact_test" -[[mods]] - modId="custom_elytra_test" -[[mods]] - modId="snow_boots_test" -[[mods]] - modId="finite_water_test" -[[mods]] - modId="scaffolding_test" -[[mods]] - modId="biome_loading_event_test" -[[mods]] - modId="forge_chunk_manager_test" -[[mods]] - modId="living_conversion_event_test" -[[mods]] - modId="player_game_mode_event_test" -[[mods]] - modId="structure_spawn_list_event_test" -[[mods]] - modId="forge_codecs_test" -[[mods]] - modId="render_local_player_test" -[[mods]] - modId="forge_world_type_test" -[[mods]] - modId="custom_sound_type_test" -[[mods]] - modId="item_modifier_test" -[[mods]] - modId="custom_signs_test" -[[mods]] - modId="shader_fix_test" -[[mods]] - modId="worldgen_registry_desync_test" -[[mods]] - modId="add_entity_attribute_test" -[[mods]] - modId="enum_argument_test" -[[mods]] - modId="entity_teleport_event_test" -[[mods]] - modId="fake_player_test" -[[mods]] - modId="text_linear_filtering_test" -[[mods]] - modId="ranged_mobs_use_modded_weapons_test" -[[mods]] - modId="fishing_bobber_event_test" -[[mods]] - modId="custom_respawn_test" -[[mods]] - modId="custom_tas_test" -[[mods]] - modId="dimension_settings_test" -[[mods]] - modId="player_attack_knockback_test" -[[mods]] - modId="overlay_layers_test" -[[mods]] - modId="entity_renderer_events_test" -[[mods]] - modId="send_datapacks_to_client" -[[mods]] - modId="remove_tag_datagen_test" -[[mods]] - modId="tag_based_tool_types" -[[mods]] - modId="check_spawn_event_test" -[[mods]] - modId="redstone_sided_connectivity_test" -[[mods]] - modId="permissions_changed_event_test" -[[mods]] - modId="custom_shield_test" -[[mods]] - modId="lazy_capabilities_on_items" -[[mods]] - modId="gui_layer_test" -[[mods]] - modId="add_pack_finders_test" -[[mods]] - modId="be_onload_test" -[[mods]] - modId="forge_spawnegg_test" -[[mods]] - modId="custom_tooltip_test" -[[mods]] - modId="full_pots_accessor_demo" -[[mods]] - modId="permissiontest" -[[mods]] - modId="part_entity_test" -[[mods]] - modId="capabilities_test" -[[mods]] - modId="audio_stream_test" -[[mods]] - modId="custom_mob_bucket_test" -[[mods]] - modId="custom_armor_model_test" -[[mods]] - modId="duplicate_optional_tag_test" -[[mods]] - modId="custom_particle_type_test" -[[mods]] - modId="shield_block_event" -[[mods]] - modId="renderable_test" -[[mods]] - modId="ingredient_invalidation" + modId="eventtests" [[mods]] modId="client_command_test" [[mods]] - modId="registry_codec_test" -[[mods]] - modId="registry_object_test" -[[mods]] - modId="hidden_tooltip_parts" -[[mods]] - modId="gametest_test" -[[mods]] - modId="many_mob_effects_test" -[[mods]] - modId="potion_size_event_test" -[[mods]] - modId="recipe_book_extension_test" -[[mods]] - modId="hide_neighbor_face_test" -[[mods]] - modId="living_get_projectile_event_test" -[[mods]] - modId="server_world_creation_test" -[[mods]] - modId="valid_railshape_test" -[[mods]] - modId="player_negotiation_event_test" -[[mods]] - modId="custom_transformtype_test" -[[mods]] - modId="custom_rarity_test" -[[mods]] - modId="data_pack_registries_test" -[[mods]] - modId="banner_pattern_test" -[[mods]] - modId="mod_mismatch_test" + modId="biome_modifiers_test" # ADD ABOVE THIS LINE diff --git a/src/test/resources/pack.mcmeta b/src/test/resources/pack.mcmeta index 21b561edf1c..54840e39b6d 100644 --- a/src/test/resources/pack.mcmeta +++ b/src/test/resources/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "pack_format": 8, "description": "Forge tests resource pack", - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } } diff --git a/src/test/resources/test_nested_resource_pack/pack.mcmeta b/src/test/resources/test_nested_resource_pack/pack.mcmeta index 9f0961d076f..79454ac7a10 100644 --- a/src/test/resources/test_nested_resource_pack/pack.mcmeta +++ b/src/test/resources/test_nested_resource_pack/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "pack_format": 8, "description": "Nested resource pack", - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } }