From 87f815dcea04a296e1dfdf033efea5232d130837 Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+telepathicgrunt@users.noreply.github.com> Date: Wed, 17 Apr 2024 01:06:08 +0200 Subject: [PATCH] Unify tag namespace and conventions between Neoforge and Fabric for 1.20.5 MC https://github.com/neoforged/NeoForge/pull/135 https://github.com/FabricMC/fabric/pull/3310 --- build.gradle | 36 +- gradle.properties | 14 +- .../blaze3d/pipeline/RenderTarget.java.patch | 4 +- .../blaze3d/systems/RenderSystem.java.patch | 2 +- .../blaze3d/vertex/BufferBuilder.java.patch | 2 +- .../blaze3d/vertex/PoseStack.java.patch | 4 +- .../SheetedDecalTextureGenerator.java.patch | 11 - .../blaze3d/vertex/VertexConsumer.java.patch | 28 +- .../vertex/VertexFormatElement.java.patch | 6 +- .../RealmsAvailability.java.patch | 15 - .../RealmsGenericErrorScreen.java.patch | 2 +- patches/net/minecraft/CrashReport.java.patch | 4 +- .../minecraft/CrashReportCategory.java.patch | 2 +- .../net/minecraft/SharedConstants.java.patch | 6 +- patches/net/minecraft/Util.java.patch | 4 +- .../advancements/Advancement.java.patch | 10 +- .../AdvancementRewards.java.patch | 2 +- .../critereon/EntityPredicate.java.patch | 52 -- .../ItemEnchantmentsPredicate.java.patch | 14 + .../critereon/ItemPredicate.java.patch | 63 -- .../net/minecraft/client/Camera.java.patch | 10 +- .../client/ClientRecipeBook.java.patch | 4 +- .../minecraft/client/KeyMapping.java.patch | 6 +- .../client/KeyboardHandler.java.patch | 12 +- .../net/minecraft/client/Minecraft.java.patch | 114 ++- .../minecraft/client/MouseHandler.java.patch | 46 +- .../net/minecraft/client/Options.java.patch | 26 +- .../client/RecipeBookCategories.java.patch | 3 +- .../client/color/block/BlockColors.java.patch | 10 +- .../client/color/item/ItemColors.java.patch | 12 +- .../net/minecraft/client/gui/Gui.java.patch | 345 ++++++- .../client/gui/GuiGraphics.java.patch | 35 +- .../client/gui/MapRenderer.java.patch | 10 - .../gui/components/AbstractWidget.java.patch | 2 +- .../components/BossHealthOverlay.java.patch | 4 +- .../client/gui/components/Button.java.patch | 4 +- .../components/DebugScreenOverlay.java.patch | 10 +- .../client/gui/screens/ChatScreen.java.patch | 21 +- .../gui/screens/ConnectScreen.java.patch | 2 +- .../client/gui/screens/MenuScreens.java.patch | 26 +- .../gui/screens/OptionsScreen.java.patch | 23 +- .../client/gui/screens/PauseScreen.java.patch | 4 +- .../client/gui/screens/Screen.java.patch | 34 +- .../client/gui/screens/TitleScreen.java.patch | 39 +- .../advancements/AdvancementTab.java.patch | 2 +- .../AdvancementsScreen.java.patch | 53 +- .../screens/controls/KeyBindsList.java.patch | 29 +- .../controls/KeyBindsScreen.java.patch | 8 +- .../AbstractContainerScreen.java.patch | 2 +- .../CreativeModeInventoryScreen.java.patch | 60 +- .../EffectRenderingInventoryScreen.java.patch | 14 +- .../inventory/InventoryScreen.java.patch | 2 +- .../tooltip/ClientTooltipComponent.java.patch | 4 +- .../JoinMultiplayerScreen.java.patch | 14 - .../recipebook/RecipeBookComponent.java.patch | 2 +- .../CreateWorldScreen.java.patch | 8 +- .../WorldCreationUiState.java.patch | 2 +- .../worldselection/WorldOpenFlows.java.patch | 71 +- .../WorldSelectionList.java.patch | 14 +- .../client/model/HumanoidModel.java.patch | 12 +- .../model/geom/LayerDefinitions.java.patch | 2 +- .../client/model/geom/ModelLayers.java.patch | 2 +- .../AccountProfileKeyPairManager.java.patch | 4 +- .../ClientCommonPacketListenerImpl.java.patch | 16 +- ...ConfigurationPacketListenerImpl.java.patch | 46 +- .../client/multiplayer/ClientLevel.java.patch | 20 +- .../ClientPacketListener.java.patch | 84 +- .../CommonListenerCookie.java.patch | 28 +- .../MultiPlayerGameMode.java.patch | 47 +- .../client/multiplayer/ServerData.java.patch | 4 +- .../multiplayer/TagCollector.java.patch | 18 + .../EnchantmentTableParticle.java.patch | 10 - .../particle/FireworkParticles.java.patch | 30 +- .../client/particle/Particle.java.patch | 28 +- .../client/particle/ParticleEngine.java.patch | 35 +- .../particle/ReversePortalParticle.java.patch | 8 +- .../particle/TerrainParticle.java.patch | 20 +- .../client/player/LocalPlayer.java.patch | 32 +- .../client/player/RemotePlayer.java.patch | 2 +- .../client/renderer/EffectInstance.java.patch | 6 +- .../client/renderer/GameRenderer.java.patch | 86 +- .../renderer/ItemBlockRenderTypes.java.patch | 20 +- .../renderer/ItemInHandRenderer.java.patch | 14 +- .../client/renderer/LevelRenderer.java.patch | 146 +-- .../client/renderer/LightTexture.java.patch | 4 +- .../client/renderer/PostChain.java.patch | 6 +- .../client/renderer/RenderBuffers.java.patch | 2 +- .../client/renderer/RenderType.java.patch | 8 +- .../renderer/ScreenEffectRenderer.java.patch | 2 +- .../client/renderer/ShaderInstance.java.patch | 8 +- .../client/renderer/Sheets.java.patch | 4 +- .../block/BlockRenderDispatcher.java.patch | 2 +- .../block/ModelBlockRenderer.java.patch | 12 +- .../block/model/ItemOverrides.java.patch | 10 +- .../block/model/MultiVariant.java.patch | 2 +- .../blockentity/BannerRenderer.java.patch | 4 +- .../blockentity/BeaconRenderer.java.patch | 2 +- .../blockentity/ChestRenderer.java.patch | 6 +- .../DecoratedPotRenderer.java.patch | 2 +- .../EnchantTableRenderer.java.patch | 2 +- .../chunk/SectionRenderDispatcher.java.patch | 14 +- .../entity/EntityRenderDispatcher.java.patch | 6 +- .../renderer/entity/EntityRenderer.java.patch | 16 +- .../entity/FishingHookRenderer.java.patch | 16 +- .../entity/ItemEntityRenderer.java.patch | 73 +- .../entity/ItemFrameRenderer.java.patch | 18 +- .../renderer/entity/ItemRenderer.java.patch | 29 +- .../entity/LivingEntityRenderer.java.patch | 23 +- .../layers/HumanoidArmorLayer.java.patch | 121 +-- .../entity/player/PlayerRenderer.java.patch | 6 +- .../renderer/item/ItemProperties.java.patch | 4 +- .../texture/MipmapGenerator.java.patch | 2 +- .../texture/SpriteContents.java.patch | 10 +- .../renderer/texture/Stitcher.java.patch | 2 +- .../texture/atlas/SpriteSources.java.patch | 2 +- .../resources/model/ModelBakery.java.patch | 4 +- .../model/MultiPartBakedModel.java.patch | 2 +- .../model/WeightedBakedModel.java.patch | 6 +- .../client/server/IntegratedServer.java.patch | 6 +- .../server/LanServerDetection.java.patch | 2 +- .../client/server/LanServerPinger.java.patch | 2 +- .../minecraft/commands/Commands.java.patch | 10 +- .../arguments/EntityArgument.java.patch | 4 +- .../ResourceLocationArgument.java.patch | 4 +- .../selector/EntitySelectorParser.java.patch | 4 +- .../ArgumentTypeInfos.java.patch | 10 +- .../net/minecraft/core/Direction.java.patch | 25 - patches/net/minecraft/core/Holder.java.patch | 47 +- .../minecraft/core/HolderLookup.java.patch | 14 +- .../net/minecraft/core/HolderSet.java.patch | 4 +- .../minecraft/core/MappedRegistry.java.patch | 82 +- .../net/minecraft/core/Registry.java.patch | 9 + .../minecraft/core/RegistryCodecs.java.patch | 12 - .../core/RegistrySetBuilder.java.patch | 14 +- .../core/RegistrySynchronization.java.patch | 11 - .../cauldron/CauldronInteraction.java.patch | 10 - .../component/DataComponentPatch.java.patch | 10 + .../PatchedDataComponentMap.java.patch | 10 + .../dispenser/DispenseItemBehavior.java.patch | 18 +- .../particles/BlockParticleOption.java.patch | 2 +- .../particles/ItemParticleOption.java.patch | 14 +- .../registries/BuiltInRegistries.java.patch | 4 +- .../minecraft/data/DataProvider.java.patch | 2 +- .../net/minecraft/data/HashCache.java.patch | 12 +- patches/net/minecraft/data/Main.java.patch | 6 +- .../AdvancementProvider.java.patch | 8 +- .../data/loot/BlockLootSubProvider.java.patch | 12 +- .../loot/EntityLootSubProvider.java.patch | 8 +- .../data/loot/LootTableProvider.java.patch | 71 +- .../data/recipes/RecipeProvider.java.patch | 41 +- .../SimpleCookingRecipeBuilder.java.patch | 8 +- .../RegistriesDatapackGenerator.java.patch | 18 +- .../registries/VanillaRegistries.java.patch | 8 +- .../tags/GameEventTagsProvider.java.patch | 12 +- .../data/tags/TagsProvider.java.patch | 30 +- ...java.patch => BootstrapContext.java.patch} | 6 +- .../gametest/framework/GameTest.java.patch | 4 +- .../framework/GameTestHelper.java.patch | 12 - .../framework/GameTestInfo.java.patch | 8 +- .../framework/GameTestRegistry.java.patch | 12 +- .../framework/GameTestServer.java.patch | 5 +- .../gametest/framework/TestCommand.java.patch | 28 +- .../net/minecraft/nbt/CompoundTag.java.patch | 2 +- patches/net/minecraft/nbt/NbtIo.java.patch | 2 +- .../minecraft/network/Connection.java.patch | 52 +- .../network/ConnectionProtocol.java.patch | 177 +--- .../network/FriendlyByteBuf.java.patch | 34 +- .../network/PacketBundleUnpacker.java.patch | 16 +- .../network/PacketDecoder.java.patch | 18 +- .../network/PacketEncoder.java.patch | 26 +- .../network/chat/SignableCommand.java.patch | 18 +- .../contents/TranslatableContents.java.patch | 6 +- .../network/codec/ByteBufCodecs.java.patch | 15 + .../network/protocol/BundlePacket.java.patch | 17 +- .../network/protocol/BundlerInfo.java.patch | 23 +- .../network/protocol/PacketFlow.java.patch | 4 +- .../ClientCommonPacketListener.java.patch | 8 +- .../ClientboundCustomPayloadPacket.java.patch | 61 +- .../ServerCommonPacketListener.java.patch | 8 +- .../ServerboundCustomPayloadPacket.java.patch | 67 +- .../custom/CustomPacketPayload.java.patch | 34 + .../ConfigurationProtocols.java.patch | 11 + .../game/ClientboundBundlePacket.java.patch | 11 - .../game/ServerGamePacketListener.java.patch | 8 +- ...ClientboundStatusResponsePacket.java.patch | 13 +- .../protocol/status/ServerStatus.java.patch | 12 +- .../syncher/EntityDataSerializers.java.patch | 10 +- .../syncher/SynchedEntityData.java.patch | 4 +- .../recipebook/PlaceRecipe.java.patch | 16 +- .../resources/HolderSetCodec.java.patch | 31 +- .../resources/RegistryDataLoader.java.patch | 68 +- .../resources/RegistryOps.java.patch | 14 +- .../resources/ResourceKey.java.patch | 10 +- .../resources/ResourceLocation.java.patch | 2 +- .../net/minecraft/server/Bootstrap.java.patch | 4 +- patches/net/minecraft/server/Main.java.patch | 44 +- .../server/MinecraftServer.java.patch | 75 +- .../server/PlayerAdvancements.java.patch | 12 +- .../ReloadableServerResources.java.patch | 102 ++- .../ServerAdvancementManager.java.patch | 17 +- .../commands/DataPackCommand.java.patch | 2 +- .../commands/SpreadPlayersCommand.java.patch | 4 +- .../dedicated/DedicatedServer.java.patch | 16 +- .../dedicated/ServerWatchdog.java.patch | 2 +- .../server/level/ChunkHolder.java.patch | 2 +- .../server/level/ChunkMap.java.patch | 52 +- .../server/level/DistanceManager.java.patch | 10 +- .../server/level/ServerChunkCache.java.patch | 20 +- .../server/level/ServerEntity.java.patch | 19 +- .../server/level/ServerLevel.java.patch | 46 +- .../server/level/ServerPlayer.java.patch | 64 +- .../level/ServerPlayerGameMode.java.patch | 26 +- .../minecraft/server/level/Ticket.java.patch | 16 +- .../server/level/WorldGenRegion.java.patch | 2 +- .../network/CommonListenerCookie.java.patch | 17 +- .../ServerCommonPacketListenerImpl.java.patch | 14 +- ...ConfigurationPacketListenerImpl.java.patch | 46 +- .../ServerConnectionListener.java.patch | 20 +- .../ServerGamePacketListenerImpl.java.patch | 116 +-- .../packs/AbstractPackResources.java.patch | 11 +- .../packs/OverlayMetadataSection.java.patch | 2 +- .../server/packs/PackResources.java.patch | 4 +- .../pack/PackMetadataSection.java.patch | 2 +- .../repository/BuiltInPackSource.java.patch | 8 +- .../server/packs/repository/Pack.java.patch | 92 +- .../repository/PackRepository.java.patch | 22 +- .../repository/ServerPacksSource.java.patch | 2 +- .../server/players/PlayerList.java.patch | 32 +- .../server/rcon/thread/RconClient.java.patch | 2 +- .../stats/RecipeBookSettings.java.patch | 2 +- .../net/minecraft/tags/BlockTags.java.patch | 2 +- .../net/minecraft/tags/ItemTags.java.patch | 2 +- .../net/minecraft/tags/TagLoader.java.patch | 8 +- .../net/minecraft/util/SpawnUtil.java.patch | 2 +- .../datafix/fixes/MobEffectIdFix.java.patch | 20 +- .../StructuresBecomeConfiguredFix.java.patch | 17 +- .../util/thread/BlockableEventLoop.java.patch | 4 +- .../damagesource/CombatTracker.java.patch | 2 +- .../damagesource/DamageEffects.java.patch | 2 +- .../damagesource/DamageScaling.java.patch | 2 +- .../damagesource/DamageSource.java.patch | 2 +- .../damagesource/DeathMessageType.java.patch | 2 +- .../world/effect/MobEffect.java.patch | 47 +- .../world/effect/MobEffectInstance.java.patch | 142 +-- .../world/effect/PoisonMobEffect.java.patch | 8 +- .../minecraft/world/entity/Entity.java.patch | 179 ++-- .../world/entity/EntityType.java.patch | 30 +- .../world/entity/ExperienceOrb.java.patch | 6 +- .../world/entity/LightningBolt.java.patch | 8 +- .../world/entity/LivingEntity.java.patch | 294 +++--- .../net/minecraft/world/entity/Mob.java.patch | 49 +- .../world/entity/SpawnPlacements.java.patch | 38 +- .../world/entity/TamableAnimal.java.patch | 2 +- .../attributes/AttributeSupplier.java.patch | 19 +- .../attributes/DefaultAttributes.java.patch | 2 +- .../ai/behavior/CrossbowAttack.java.patch | 17 +- .../ai/behavior/GiveGiftToHero.java.patch | 10 +- .../ai/behavior/HarvestFarmland.java.patch | 22 +- .../ai/behavior/StartAttacking.java.patch | 2 +- .../world/entity/ai/behavior/Swim.java.patch | 8 +- .../entity/ai/control/MoveControl.java.patch | 11 - .../entity/ai/goal/BreakDoorGoal.java.patch | 12 +- .../entity/ai/goal/EatBlockGoal.java.patch | 4 +- .../entity/ai/goal/MeleeAttackGoal.java.patch | 6 +- .../ai/goal/RangedBowAttackGoal.java.patch | 8 +- .../goal/RangedCrossbowAttackGoal.java.patch | 19 +- .../entity/ai/goal/RemoveBlockGoal.java.patch | 16 +- .../ai/navigation/PathNavigation.java.patch | 2 +- .../entity/ai/village/VillageSiege.java.patch | 2 +- .../world/entity/animal/Animal.java.patch | 2 +- .../world/entity/animal/Bee.java.patch | 4 +- .../world/entity/animal/Cat.java.patch | 38 +- .../world/entity/animal/Fox.java.patch | 10 +- .../entity/animal/MushroomCow.java.patch | 6 +- .../world/entity/animal/Ocelot.java.patch | 2 +- .../world/entity/animal/Parrot.java.patch | 18 +- .../world/entity/animal/Pig.java.patch | 4 +- .../world/entity/animal/Rabbit.java.patch | 2 +- .../world/entity/animal/Sheep.java.patch | 2 +- .../world/entity/animal/SnowGolem.java.patch | 4 +- .../world/entity/animal/Wolf.java.patch | 51 +- .../entity/animal/allay/Allay.java.patch | 2 +- .../entity/animal/frog/Tadpole.java.patch | 8 +- .../animal/horse/AbstractHorse.java.patch | 23 +- .../animal/horse/SkeletonTrapGoal.java.patch | 4 +- .../entity/animal/sniffer/Sniffer.java.patch | 2 +- .../entity/boss/EnderDragonPart.java.patch | 2 +- .../boss/enderdragon/EnderDragon.java.patch | 14 +- .../entity/boss/wither/WitherBoss.java.patch | 30 +- .../entity/decoration/ArmorStand.java.patch | 2 +- .../decoration/HangingEntity.java.patch | 2 +- .../entity/item/FallingBlockEntity.java.patch | 4 +- .../world/entity/item/ItemEntity.java.patch | 45 +- .../monster/AbstractSkeleton.java.patch | 13 +- .../monster/CrossbowAttackMob.java.patch | 9 +- .../world/entity/monster/EnderMan.java.patch | 36 +- .../world/entity/monster/Evoker.java.patch | 2 +- .../world/entity/monster/Husk.java.patch | 2 +- .../entity/monster/Illusioner.java.patch | 2 +- .../world/entity/monster/MagmaCube.java.patch | 2 +- .../world/entity/monster/Pillager.java.patch | 2 +- .../world/entity/monster/Ravager.java.patch | 2 +- .../world/entity/monster/Shulker.java.patch | 2 +- .../entity/monster/Silverfish.java.patch | 4 +- .../world/entity/monster/Skeleton.java.patch | 2 +- .../world/entity/monster/Slime.java.patch | 30 +- .../world/entity/monster/Spider.java.patch | 4 +- .../world/entity/monster/Zombie.java.patch | 22 +- .../entity/monster/ZombieVillager.java.patch | 2 +- .../entity/monster/hoglin/Hoglin.java.patch | 8 +- .../monster/piglin/AbstractPiglin.java.patch | 7 +- .../entity/monster/piglin/Piglin.java.patch | 6 +- .../entity/monster/piglin/PiglinAi.java.patch | 12 +- ...opHoldingItemIfNoLongerAdmiring.java.patch | 16 +- .../entity/npc/AbstractVillager.java.patch | 4 +- .../world/entity/npc/CatSpawner.java.patch | 4 +- .../world/entity/npc/Villager.java.patch | 8 +- .../world/entity/player/Inventory.java.patch | 22 +- .../world/entity/player/Player.java.patch | 249 ++--- .../projectile/AbstractArrow.java.patch | 10 +- .../AbstractHurtingProjectile.java.patch | 4 +- .../FireworkRocketEntity.java.patch | 2 +- .../entity/projectile/FishingHook.java.patch | 12 +- .../entity/projectile/LlamaSpit.java.patch | 4 +- .../entity/projectile/Projectile.java.patch | 14 +- .../projectile/ShulkerBullet.java.patch | 4 +- .../projectile/ThrowableProjectile.java.patch | 2 +- .../world/entity/raid/Raid.java.patch | 4 +- .../vehicle/AbstractMinecart.java.patch | 52 +- .../AbstractMinecartContainer.java.patch | 2 +- .../world/entity/vehicle/Boat.java.patch | 24 +- .../entity/vehicle/ContainerEntity.java.patch | 2 +- .../entity/vehicle/MinecartFurnace.java.patch | 4 +- .../minecraft/world/food/FoodData.java.patch | 20 +- .../world/food/FoodProperties.java.patch | 88 +- .../AbstractContainerMenu.java.patch | 31 +- .../world/inventory/AnvilMenu.java.patch | 34 +- .../world/inventory/BeaconMenu.java.patch | 2 +- .../inventory/BrewingStandMenu.java.patch | 58 +- .../inventory/EnchantmentMenu.java.patch | 30 +- .../inventory/FurnaceResultSlot.java.patch | 2 +- .../world/inventory/GrindstoneMenu.java.patch | 74 +- .../world/inventory/InventoryMenu.java.patch | 2 +- .../world/inventory/MenuType.java.patch | 2 +- .../world/inventory/ResultSlot.java.patch | 6 +- .../minecraft/world/item/ArmorItem.java.patch | 11 - .../minecraft/world/item/ArrowItem.java.patch | 10 +- .../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 | 10 +- .../minecraft/world/item/BowItem.java.patch | 44 +- .../minecraft/world/item/BrushItem.java.patch | 2 +- .../world/item/BucketItem.java.patch | 29 +- .../world/item/BundleItem.java.patch | 10 +- .../world/item/CompassItem.java.patch | 10 - .../world/item/CreativeModeTabs.java.patch | 12 +- .../world/item/CrossbowItem.java.patch | 16 +- .../world/item/DiggerItem.java.patch | 26 - .../minecraft/world/item/DyeColor.java.patch | 8 +- .../item/DyeableHorseArmorItem.java.patch | 10 - .../world/item/ElytraItem.java.patch | 6 +- .../world/item/FireworkRocketItem.java.patch | 40 - .../world/item/FireworkStarItem.java.patch | 11 - .../world/item/FishingRodItem.java.patch | 6 +- .../world/item/FoodOnAStickItem.java.patch | 10 - .../minecraft/world/item/HoeItem.java.patch | 6 +- .../world/item/HorseArmorItem.java.patch | 26 - .../net/minecraft/world/item/Item.java.patch | 156 ++-- .../minecraft/world/item/ItemStack.java.patch | 276 ++---- .../net/minecraft/world/item/Items.java.patch | 4 +- .../minecraft/world/item/MapItem.java.patch | 8 +- .../world/item/MilkBucketItem.java.patch | 4 +- .../world/item/MobBucketItem.java.patch | 26 +- .../world/item/PickaxeItem.java.patch | 4 +- .../item/ProjectileWeaponItem.java.patch | 30 + .../minecraft/world/item/Rarity.java.patch | 54 +- .../world/item/RecordItem.java.patch | 4 +- .../world/item/ShearsItem.java.patch | 6 +- .../world/item/ShieldItem.java.patch | 4 +- .../world/item/ShovelItem.java.patch | 4 +- .../world/item/SpawnEggItem.java.patch | 21 +- .../minecraft/world/item/SwordItem.java.patch | 6 +- .../net/minecraft/world/item/Tier.java.patch | 15 - .../net/minecraft/world/item/Tiers.java.patch | 2 +- .../world/item/TridentItem.java.patch | 6 +- .../item/alchemy/PotionBrewing.java.patch | 102 +++ .../component/FireworkExplosion.java.patch | 40 + .../crafting/BannerDuplicateRecipe.java.patch | 6 +- .../crafting/BookCloningRecipe.java.patch | 12 +- .../crafting/FireworkStarRecipe.java.patch | 11 - .../world/item/crafting/Ingredient.java.patch | 127 ++- .../world/item/crafting/Recipe.java.patch | 12 +- .../item/crafting/RecipeManager.java.patch | 45 +- .../item/crafting/RepairItemRecipe.java.patch | 47 +- .../item/crafting/ShapedRecipe.java.patch | 26 +- .../crafting/ShapedRecipePattern.java.patch | 4 +- .../item/crafting/ShapelessRecipe.java.patch | 27 +- .../crafting/ShulkerBoxColoring.java.patch | 19 +- .../SimpleCookingSerializer.java.patch | 12 +- .../SmithingTransformRecipe.java.patch | 10 +- .../crafting/SmithingTrimRecipe.java.patch | 2 +- .../enchantment/DiggingEnchantment.java.patch | 10 - .../item/enchantment/Enchantment.java.patch | 24 +- .../EnchantmentCategory.java.patch | 32 - .../enchantment/EnchantmentHelper.java.patch | 73 +- .../FrostWalkerEnchantment.java.patch | 2 +- .../item/trading/MerchantOffer.java.patch | 20 - .../world/level/BaseSpawner.java.patch | 16 +- .../world/level/Explosion.java.patch | 4 +- .../level/ForcedChunksSavedData.java.patch | 6 +- .../minecraft/world/level/Level.java.patch | 18 +- .../world/level/NaturalSpawner.java.patch | 59 +- .../block/AbstractCauldronBlock.java.patch | 2 +- .../level/block/BambooSaplingBlock.java.patch | 2 +- .../level/block/BambooStalkBlock.java.patch | 4 +- .../level/block/BaseFireBlock.java.patch | 4 +- .../level/block/BaseRailBlock.java.patch | 8 +- .../world/level/block/BeehiveBlock.java.patch | 14 +- .../world/level/block/Block.java.patch | 24 +- .../world/level/block/Blocks.java.patch | 8 +- .../world/level/block/BushBlock.java.patch | 6 +- .../world/level/block/CactusBlock.java.patch | 4 +- .../level/block/CampfireBlock.java.patch | 2 +- .../level/block/CauldronBlock.java.patch | 2 +- .../world/level/block/ChestBlock.java.patch | 4 +- .../world/level/block/CocoaBlock.java.patch | 2 +- .../level/block/ComparatorBlock.java.patch | 4 +- .../level/block/ComposterBlock.java.patch | 31 +- .../block/ConcretePowderBlock.java.patch | 4 +- .../world/level/block/CoralBlock.java.patch | 2 +- .../world/level/block/CropBlock.java.patch | 6 +- .../block/DropExperienceBlock.java.patch | 2 +- .../world/level/block/DropperBlock.java.patch | 2 +- .../block/EnchantingTableBlock.java.patch | 11 + .../block/EnchantmentTableBlock.java.patch | 11 - .../world/level/block/FarmBlock.java.patch | 2 +- .../level/block/FenceGateBlock.java.patch | 12 +- .../world/level/block/FireBlock.java.patch | 8 +- .../world/level/block/FlowerBlock.java.patch | 40 - .../level/block/FlowerPotBlock.java.patch | 34 +- .../block/GrowingPlantHeadBlock.java.patch | 2 +- .../world/level/block/LiquidBlock.java.patch | 6 +- .../level/block/MushroomBlock.java.patch | 16 +- .../level/block/NetherWartBlock.java.patch | 2 +- .../world/level/block/NoteBlock.java.patch | 20 +- .../block/PointedDripstoneBlock.java.patch | 4 +- .../level/block/PoweredRailBlock.java.patch | 12 +- .../world/level/block/PumpkinBlock.java.patch | 18 +- .../level/block/RedStoneOreBlock.java.patch | 4 +- .../level/block/RedStoneWireBlock.java.patch | 4 +- .../world/level/block/SaplingBlock.java.patch | 2 +- .../level/block/SculkCatalystBlock.java.patch | 2 +- .../level/block/SculkSensorBlock.java.patch | 4 +- .../level/block/SculkShriekerBlock.java.patch | 2 +- .../world/level/block/SoundType.java.patch | 2 +- .../world/level/block/SpawnerBlock.java.patch | 2 +- .../world/level/block/SpongeBlock.java.patch | 2 +- .../block/SpreadingSnowyDirtBlock.java.patch | 2 +- .../world/level/block/StairBlock.java.patch | 16 +- .../world/level/block/StemBlock.java.patch | 2 +- .../level/block/SugarCaneBlock.java.patch | 4 +- .../block/SweetBerryBushBlock.java.patch | 7 +- .../world/level/block/TntBlock.java.patch | 22 +- .../level/block/TrapDoorBlock.java.patch | 2 +- .../level/block/TurtleEggBlock.java.patch | 8 +- .../world/level/block/VineBlock.java.patch | 2 +- .../world/level/block/WebBlock.java.patch | 2 +- .../AbstractFurnaceBlockEntity.java.patch | 94 +- .../block/entity/BeaconBlockEntity.java.patch | 4 +- .../level/block/entity/BlockEntity.java.patch | 29 +- .../block/entity/BlockEntityType.java.patch | 2 +- .../entity/BrewingStandBlockEntity.java.patch | 38 +- .../block/entity/ChestBlockEntity.java.patch | 2 +- .../entity/ConduitBlockEntity.java.patch | 4 +- .../block/entity/HopperBlockEntity.java.patch | 20 +- .../entity/SpawnerBlockEntity.java.patch | 2 +- .../level/block/grower/TreeGrower.java.patch | 8 +- .../block/piston/PistonBaseBlock.java.patch | 18 +- .../piston/PistonMovingBlockEntity.java.patch | 4 +- .../piston/PistonStructureResolver.java.patch | 18 +- .../block/state/BlockBehaviour.java.patch | 71 +- .../level/block/state/BlockState.java.patch | 2 +- .../world/level/chunk/ChunkAccess.java.patch | 22 +- .../level/chunk/ImposterProtoChunk.java.patch | 4 +- .../world/level/chunk/LevelChunk.java.patch | 52 +- .../level/chunk/LevelChunkSection.java.patch | 10 +- .../level/chunk/PalettedContainer.java.patch | 2 +- .../chunk/storage/ChunkSerializer.java.patch | 26 +- .../chunk/storage/EntityStorage.java.patch | 2 +- .../PersistentEntitySectionManager.java.patch | 8 +- .../vibrations/VibrationSystem.java.patch | 33 +- .../level/levelgen/Beardifier.java.patch | 6 +- .../level/levelgen/PhantomSpawner.java.patch | 4 +- .../level/levelgen/WorldDimensions.java.patch | 12 + .../level/levelgen/feature/Feature.java.patch | 11 - .../feature/MonsterRoomFeature.java.patch | 2 +- .../AlterGroundDecorator.java.patch | 12 +- .../EnvironmentScanPlacement.java.patch | 4 +- .../levelgen/structure/Structure.java.patch | 2 +- .../structure/StructurePiece.java.patch | 2 +- .../StructureTemplate.java.patch | 46 +- .../level/lighting/LightEngine.java.patch | 10 +- .../level/material/FlowingFluid.java.patch | 2 +- .../world/level/material/LavaFluid.java.patch | 2 +- .../AmphibiousNodeEvaluator.java.patch | 11 - .../pathfinder/BlockPathTypes.java.patch | 28 - .../pathfinder/PathfindingContext.java.patch | 11 + .../pathfinder/WalkNodeEvaluator.java.patch | 65 +- .../level/portal/PortalForcer.java.patch | 2 +- .../level/saveddata/SavedData.java.patch | 12 +- .../saveddata/maps/MapDecoration.java.patch | 36 +- .../storage/DimensionDataStorage.java.patch | 10 +- .../storage/LevelStorageSource.java.patch | 6 +- .../level/storage/LevelSummary.java.patch | 2 +- .../storage/PlayerDataStorage.java.patch | 23 +- .../level/storage/PrimaryLevelData.java.patch | 8 +- .../level/storage/loot/LootContext.java.patch | 14 +- .../storage/loot/LootDataManager.java.patch | 47 - .../storage/loot/LootDataType.java.patch | 75 +- .../level/storage/loot/LootPool.java.patch | 6 +- .../level/storage/loot/LootTable.java.patch | 28 +- .../LootContextParamSets.java.patch | 4 +- ...andomChanceWithLootingCondition.java.patch | 2 +- .../nbt/ContextNbtProvider.java.patch | 2 +- projects/neoforge/build.gradle | 9 +- settings.gradle | 2 +- .../resources/assets/c/lang/en_us.json | 391 ++++++++ .../resources/data/c/tags/blocks/barrels.json | 9 + .../data/c/tags/blocks/barrels/wooden.json | 9 + .../data/c/tags/blocks/bookshelves.json | 9 + .../data/c/tags/blocks/budding_blocks.json | 5 + .../resources/data/c/tags/blocks/buds.json | 7 + .../resources/data/c/tags/blocks/chains.json | 5 + .../resources/data/c/tags/blocks/chests.json | 11 + .../data/c/tags/blocks/chests/ender.json | 9 + .../data/c/tags/blocks/chests/trapped.json | 9 + .../data/c/tags/blocks/chests/wooden.json | 10 + .../data/c/tags/blocks/clusters.json | 5 + .../data/c/tags/blocks/cobblestones.json | 12 + .../c/tags/blocks/cobblestones/deepslate.json | 9 + .../c/tags/blocks/cobblestones/infested.json | 9 + .../c/tags/blocks/cobblestones/mossy.json | 9 + .../c/tags/blocks/cobblestones/normal.json | 9 + .../resources/data/c/tags/blocks/dyed.json | 20 + .../data/c/tags/blocks/dyed/black.json | 25 + .../data/c/tags/blocks/dyed/blue.json | 25 + .../data/c/tags/blocks/dyed/brown.json | 25 + .../data/c/tags/blocks/dyed/cyan.json | 25 + .../data/c/tags/blocks/dyed/gray.json | 25 + .../data/c/tags/blocks/dyed/green.json | 25 + .../data/c/tags/blocks/dyed/light_blue.json | 25 + .../data/c/tags/blocks/dyed/light_gray.json | 25 + .../data/c/tags/blocks/dyed/lime.json | 25 + .../data/c/tags/blocks/dyed/magenta.json | 33 + .../data/c/tags/blocks/dyed/orange.json | 25 + .../data/c/tags/blocks/dyed/pink.json | 25 + .../data/c/tags/blocks/dyed/purple.json | 25 + .../data/c/tags/blocks/dyed/red.json | 25 + .../data/c/tags/blocks/dyed/white.json | 25 + .../data/c/tags/blocks/dyed/yellow.json | 25 + .../data/c/tags/blocks/end_stones.json | 9 + .../data/c/tags/blocks/fence_gates.json | 9 + .../tags/blocks}/fence_gates/wooden.json | 6 +- .../resources/data/c/tags/blocks/fences.json | 10 + .../c/tags/blocks/fences/nether_brick.json | 9 + .../data/c/tags/blocks/fences/wooden.json | 9 + .../tags/blocks/glass_blocks.json} | 9 +- .../tags/blocks/glass_blocks/cheap.json} | 27 +- .../c/tags/blocks/glass_blocks/colorless.json | 9 + .../c/tags/blocks/glass_blocks/tinted.json | 9 + .../tags/blocks/glass_panes.json} | 1 + .../c/tags/blocks/glass_panes/colorless.json | 9 + .../resources/data/c/tags/blocks/gravel.json | 9 + .../blocks/hidden_from_recipe_viewers.json} | 0 .../data/c/tags/blocks/netherrack.json | 9 + .../data/c/tags/blocks/obsidians.json | 9 + .../blocks/ore_bearing_ground/deepslate.json | 9 + .../blocks/ore_bearing_ground/netherrack.json | 9 + .../tags/blocks/ore_bearing_ground/stone.json | 9 + .../tags/blocks/ore_rates/dense.json | 6 +- .../tags/blocks}/ore_rates/singular.json | 6 +- .../data/c/tags/blocks/ore_rates/sparse.json | 9 + .../resources/data/c/tags/blocks/ores.json | 18 + .../data/c/tags/blocks/ores/coal.json | 9 + .../data/c/tags/blocks/ores/copper.json | 9 + .../data/c/tags/blocks/ores/diamond.json | 9 + .../data/c/tags/blocks/ores/emerald.json | 9 + .../data/c/tags/blocks/ores/gold.json | 9 + .../data/c/tags/blocks/ores/iron.json | 9 + .../data/c/tags/blocks/ores/lapis.json | 9 + .../c/tags/blocks/ores/netherite_scrap.json | 9 + .../data/c/tags/blocks/ores/quartz.json | 9 + .../data/c/tags/blocks/ores/redstone.json | 9 + .../tags/blocks/ores_in_ground/deepslate.json | 6 +- .../blocks/ores_in_ground/netherrack.json | 10 + .../tags/blocks/ores_in_ground/stone.json | 6 +- .../player_workstations/crafting_tables.json | 5 + .../blocks/player_workstations/furnaces.json | 5 + .../tags/blocks/relocation_not_supported.json | 12 + .../resources/data/c/tags/blocks/ropes.json | 3 + .../resources/data/c/tags/blocks/sands.json | 10 + .../data/c/tags/blocks/sands/colorless.json | 9 + .../data/c/tags/blocks/sands/red.json | 9 + .../data/c/tags/blocks/sandstone/blocks.json | 10 + .../tags/blocks/sandstone/red_blocks.json} | 4 - .../c/tags/blocks/sandstone/red_slabs.json | 7 + .../c/tags/blocks/sandstone/red_stairs.json | 6 + .../data/c/tags/blocks/sandstone/slabs.json | 6 + .../data/c/tags/blocks/sandstone/stairs.json | 6 + .../blocks/sandstone/uncolored_blocks.json | 8 + .../blocks/sandstone/uncolored_slabs.json | 7 + .../blocks/sandstone/uncolored_stairs.json | 6 + .../resources/data/c/tags/blocks/skulls.json | 18 + .../resources/data/c/tags/blocks/stones.json | 14 + .../data/c/tags/blocks/storage_blocks.json | 24 + .../tags/blocks/storage_blocks/bone_meal.json | 5 + .../c/tags/blocks/storage_blocks/coal.json | 9 + .../c/tags/blocks/storage_blocks/copper.json | 9 + .../c/tags/blocks/storage_blocks/diamond.json | 9 + .../blocks/storage_blocks/dried_kelp.json | 5 + .../c/tags/blocks/storage_blocks/emerald.json | 9 + .../c/tags/blocks/storage_blocks/gold.json | 9 + .../c/tags/blocks/storage_blocks/iron.json | 9 + .../c/tags/blocks/storage_blocks/lapis.json | 9 + .../tags/blocks/storage_blocks/netherite.json | 9 + .../blocks/storage_blocks/raw_copper.json | 9 + .../tags/blocks/storage_blocks/raw_gold.json | 9 + .../tags/blocks/storage_blocks/raw_iron.json | 9 + .../tags/blocks/storage_blocks/redstone.json | 9 + .../c/tags/blocks/storage_blocks/slime.json | 5 + .../c/tags/blocks/storage_blocks/wheat.json | 5 + .../c/tags/blocks/villager_job_sites.json | 20 + ...ntity_auxiliary_movement_enhancements.json | 6 + .../entity_defense_enhancements.json | 10 + .../entity_speed_enhancements.json | 7 + .../enchantment/increase_block_drops.json | 5 + .../enchantment/increase_entity_drops.json | 5 + .../weapon_damage_enhancements.json | 9 + .../data/c/tags/entity_types/boats.json | 10 + .../data/c/tags/entity_types/bosses.json | 10 + .../entity_types/capturing_not_supported.json | 3 + .../data/c/tags/entity_types/minecarts.json | 15 + .../teleporting_not_supported.json | 3 + .../data/c/tags/fluids/beetroot_soup.json | 8 + .../resources/data/c/tags/fluids/gaseous.json | 8 + .../fluids/hidden_from_recipe_viewers.json | 3 + .../resources/data/c/tags/fluids/honey.json | 8 + .../resources/data/c/tags/fluids/lava.json | 6 + .../data/{forge => c}/tags/fluids/milk.json | 4 + .../data/c/tags/fluids/mushroom_stew.json | 8 + .../resources/data/c/tags/fluids/potion.json | 8 + .../data/c/tags/fluids/rabbit_stew.json | 8 + .../data/c/tags/fluids/suspicious_stew.json | 8 + .../resources/data/c/tags/fluids/water.json | 6 + .../resources/data/c/tags/items/armors.json | 12 + .../resources/data/c/tags/items/barrels.json | 9 + .../data/c/tags/items/barrels/wooden.json | 9 + .../resources/data/c/tags/items/bones.json | 9 + .../data/c/tags/items/bookshelves.json | 9 + .../resources/data/c/tags/items/bricks.json | 6 + .../data/c/tags/items/bricks/nether.json | 9 + .../data/c/tags/items/bricks/normal.json | 9 + .../data/c/tags/items/budding_blocks.json | 5 + .../resources/data/c/tags/items/buds.json | 7 + .../resources/data/c/tags/items/chains.json | 5 + .../resources/data/c/tags/items/chests.json | 11 + .../data/c/tags/items/chests/ender.json | 9 + .../data/c/tags/items/chests/trapped.json | 9 + .../data/c/tags/items/chests/wooden.json | 10 + .../resources/data/c/tags/items/clusters.json | 5 + .../data/c/tags/items/cobblestones.json | 12 + .../c/tags/items/cobblestones/deepslate.json | 9 + .../c/tags/items/cobblestones/infested.json | 9 + .../data/c/tags/items/cobblestones/mossy.json | 9 + .../c/tags/items/cobblestones/normal.json | 9 + .../resources/data/c/tags/items/crops.json | 13 + .../data/c/tags/items/crops/beetroot.json | 9 + .../data/c/tags/items/crops/carrot.json | 9 + .../data/c/tags/items/crops/nether_wart.json | 9 + .../data/c/tags/items/crops/potato.json | 9 + .../data/c/tags/items/crops/wheat.json | 9 + .../resources/data/c/tags/items/dusts.json | 10 + .../data/c/tags/items/dusts/glowstone.json | 9 + .../data/c/tags/items/dusts/redstone.json | 9 + .../resources/data/c/tags/items/dyed.json | 20 + .../data/c/tags/items/dyed/black.json | 24 + .../data/c/tags/items/dyed/blue.json | 24 + .../data/c/tags/items/dyed/brown.json | 24 + .../data/c/tags/items/dyed/cyan.json | 24 + .../data/c/tags/items/dyed/gray.json | 24 + .../data/c/tags/items/dyed/green.json | 24 + .../data/c/tags/items/dyed/light_blue.json | 24 + .../data/c/tags/items/dyed/light_gray.json | 24 + .../data/c/tags/items/dyed/lime.json | 24 + .../data/c/tags/items/dyed/magenta.json | 32 + .../data/c/tags/items/dyed/orange.json | 24 + .../data/c/tags/items/dyed/pink.json | 24 + .../data/c/tags/items/dyed/purple.json | 24 + .../resources/data/c/tags/items/dyed/red.json | 24 + .../data/c/tags/items/dyed/white.json | 24 + .../data/c/tags/items/dyed/yellow.json | 24 + .../resources/data/c/tags/items/dyes.json | 20 + .../data/c/tags/items/dyes/black.json | 9 + .../data/c/tags/items/dyes/blue.json | 9 + .../data/c/tags/items/dyes/brown.json | 9 + .../data/c/tags/items/dyes/cyan.json | 9 + .../data/c/tags/items/dyes/gray.json | 9 + .../data/c/tags/items/dyes/green.json | 9 + .../data/c/tags/items/dyes/light_blue.json | 9 + .../data/c/tags/items/dyes/light_gray.json | 9 + .../data/c/tags/items/dyes/lime.json | 9 + .../data/c/tags/items/dyes/magenta.json | 9 + .../data/c/tags/items/dyes/orange.json | 9 + .../data/c/tags/items/dyes/pink.json | 9 + .../data/c/tags/items/dyes/purple.json | 9 + .../resources/data/c/tags/items/dyes/red.json | 9 + .../data/c/tags/items/dyes/white.json | 9 + .../data/c/tags/items/dyes/yellow.json | 9 + .../data/{forge => c}/tags/items/eggs.json | 0 .../data/c/tags/items/enchantables.json | 20 + .../data/c/tags/items/end_stones.json | 9 + .../data/c/tags/items/ender_pearls.json | 9 + .../resources/data/c/tags/items/feathers.json | 9 + .../data/c/tags/items/fence_gates.json | 9 + .../tags/items}/fence_gates/wooden.json | 6 +- .../resources/data/c/tags/items/fences.json | 10 + .../c/tags/items/fences/nether_brick.json | 9 + .../data/c/tags/items/fences/wooden.json | 9 + .../resources/data/c/tags/items/foods.json | 22 + .../data/c/tags/items/foods/berries.json | 6 + .../data/c/tags/items/foods/breads.json | 5 + .../data/c/tags/items/foods/candies.json | 3 + .../c/tags/items/foods/cooked_fishes.json | 6 + .../data/c/tags/items/foods/cooked_meats.json | 8 + .../data/c/tags/items/foods/cookies.json | 5 + .../tags/items/foods/edible_when_placed.json} | 2 +- .../c/tags/items/foods/food_poisoning.json | 9 + .../data/c/tags/items/foods/fruits.json | 7 + .../data/c/tags/items/foods/raw_fishes.json | 8 + .../data/c/tags/items/foods/raw_meats.json | 8 + .../data/c/tags/items/foods/soups.json | 8 + .../data/c/tags/items/foods/vegetables.json | 9 + .../resources/data/c/tags/items/gems.json | 14 + .../data/c/tags/items/gems/amethyst.json | 9 + .../data/c/tags/items/gems/diamond.json | 9 + .../data/c/tags/items/gems/emerald.json | 9 + .../data/c/tags/items/gems/lapis.json | 9 + .../data/c/tags/items/gems/prismarine.json | 9 + .../data/c/tags/items/gems/quartz.json | 9 + .../tags/items/glass_blocks.json} | 9 +- .../tags/items/glass_blocks/cheap.json} | 27 +- .../c/tags/items/glass_blocks/colorless.json | 9 + .../c/tags/items/glass_blocks/tinted.json | 9 + .../tags/items/glass_panes.json} | 1 + .../c/tags/items/glass_panes/colorless.json | 9 + .../resources/data/c/tags/items/gravel.json | 9 + .../data/c/tags/items/gunpowder.json | 9 + .../items/hidden_from_recipe_viewers.json | 3 + .../resources/data/c/tags/items/ingots.json | 12 + .../data/c/tags/items/ingots/copper.json | 9 + .../data/c/tags/items/ingots/gold.json | 9 + .../data/c/tags/items/ingots/iron.json | 9 + .../data/c/tags/items/ingots/netherite.json | 9 + .../resources/data/c/tags/items/leather.json | 9 + .../data/c/tags/items/mushrooms.json | 10 + .../data/c/tags/items/nether_stars.json | 9 + .../data/c/tags/items/netherrack.json | 9 + .../resources/data/c/tags/items/nuggets.json | 10 + .../data/c/tags/items/nuggets/gold.json | 9 + .../data/c/tags/items/nuggets/iron.json | 9 + .../data/c/tags/items/obsidians.json | 9 + .../items/ore_bearing_ground/deepslate.json | 9 + .../items/ore_bearing_ground/netherrack.json | 9 + .../tags/items/ore_bearing_ground/stone.json | 9 + .../tags/items/ore_rates/dense.json | 6 +- .../tags/items}/ore_rates/singular.json | 6 +- .../data/c/tags/items/ore_rates/sparse.json | 9 + .../resources/data/c/tags/items/ores.json | 18 + .../data/c/tags/items/ores/coal.json | 9 + .../data/c/tags/items/ores/copper.json | 9 + .../data/c/tags/items/ores/diamond.json | 9 + .../data/c/tags/items/ores/emerald.json | 9 + .../data/c/tags/items/ores/gold.json | 9 + .../data/c/tags/items/ores/iron.json | 9 + .../data/c/tags/items/ores/lapis.json | 9 + .../c/tags/items/ores/netherite_scrap.json | 9 + .../data/c/tags/items/ores/quartz.json | 9 + .../data/c/tags/items/ores/redstone.json | 9 + .../tags/items/ores_in_ground/deepslate.json | 6 +- .../tags/items/ores_in_ground/netherrack.json | 10 + .../tags/items/ores_in_ground/stone.json | 6 +- .../player_workstations/crafting_tables.json | 5 + .../items/player_workstations/furnaces.json | 5 + .../data/c/tags/items/raw_blocks.json | 7 + .../tags/items/raw_blocks/copper.json} | 0 .../tags/items/raw_blocks/gold.json} | 0 .../tags/items/raw_blocks/iron.json} | 0 .../data/c/tags/items/raw_materials.json | 11 + .../c/tags/items/raw_materials/copper.json | 9 + .../data/c/tags/items/raw_materials/gold.json | 9 + .../data/c/tags/items/raw_materials/iron.json | 9 + .../resources/data/c/tags/items/rods.json | 11 + .../data/c/tags/items/rods/blaze.json | 9 + .../data/c/tags/items/rods/breeze.json | 5 + .../data/c/tags/items/rods/wooden.json | 9 + .../resources/data/c/tags/items/ropes.json | 3 + .../resources/data/c/tags/items/sands.json | 10 + .../data/c/tags/items/sands/colorless.json | 9 + .../data/c/tags/items/sands/red.json | 9 + .../data/c/tags/items/sandstone/blocks.json | 10 + .../tags/items/sandstone/red_blocks.json} | 4 - .../c/tags/items/sandstone/red_slabs.json | 7 + .../c/tags/items/sandstone/red_stairs.json | 6 + .../data/c/tags/items/sandstone/slabs.json | 6 + .../data/c/tags/items/sandstone/stairs.json | 6 + .../items/sandstone/uncolored_blocks.json | 8 + .../tags/items/sandstone/uncolored_slabs.json | 7 + .../items/sandstone/uncolored_stairs.json | 6 + .../resources/data/c/tags/items/seeds.json | 12 + .../data/c/tags/items/seeds/beetroot.json | 9 + .../data/c/tags/items/seeds/melon.json | 9 + .../data/c/tags/items/seeds/pumpkin.json | 9 + .../data/c/tags/items/seeds/wheat.json | 9 + .../data/c/tags/items/slimeballs.json | 9 + .../resources/data/c/tags/items/stones.json | 14 + .../data/c/tags/items/storage_blocks.json | 24 + .../tags/items/storage_blocks/bone_meal.json | 5 + .../c/tags/items/storage_blocks/coal.json | 9 + .../c/tags/items/storage_blocks/copper.json | 9 + .../c/tags/items/storage_blocks/diamond.json | 9 + .../tags/items/storage_blocks/dried_kelp.json | 5 + .../c/tags/items/storage_blocks/emerald.json | 9 + .../c/tags/items/storage_blocks/gold.json | 9 + .../c/tags/items/storage_blocks/iron.json | 9 + .../c/tags/items/storage_blocks/lapis.json | 9 + .../tags/items/storage_blocks/netherite.json | 9 + .../tags/items/storage_blocks/raw_copper.json | 9 + .../c/tags/items/storage_blocks/raw_gold.json | 9 + .../c/tags/items/storage_blocks/raw_iron.json | 9 + .../c/tags/items/storage_blocks/redstone.json | 9 + .../c/tags/items/storage_blocks/slime.json | 5 + .../c/tags/items/storage_blocks/wheat.json | 5 + .../resources/data/c/tags/items/strings.json | 9 + .../resources/data/c/tags/items/tools.json | 20 + .../data/c/tags/items/tools/bows.json | 9 + .../data/c/tags/items/tools/brushes.json | 5 + .../data/c/tags/items/tools/crossbows.json | 9 + .../data/c/tags/items/tools/fishing_rods.json | 9 + .../data/c/tags/items/tools/shears.json | 9 + .../data/c/tags/items/tools/shields.json | 9 + .../data/c/tags/items/tools/spears.json | 9 + .../data/c/tags/items/villager_job_sites.json | 17 + .../biome/hidden_from_locator_selection.json | 3 + .../c/tags/worldgen/biome/is_aquatic.json | 10 + .../c/tags/worldgen/biome/is_aquatic_icy.json | 7 + .../c/tags/worldgen/biome/is_badlands.json | 5 + .../data/c/tags/worldgen/biome/is_beach.json | 5 + .../tags/worldgen/biome/is_birch_forest.json | 6 + .../data/c/tags/worldgen/biome/is_cave.json | 11 + .../data/c/tags/worldgen/biome/is_cold.json | 14 + .../c/tags/worldgen/biome/is_cold/end.json | 13 + .../tags/worldgen/biome/is_cold/nether.json} | 4 +- .../worldgen/biome/is_cold/overworld.json | 16 +- .../data/c/tags/worldgen/biome/is_dead.json | 8 + .../c/tags/worldgen/biome/is_deep_ocean.json | 5 + .../worldgen/biome/is_dense_vegetation.json | 17 + .../biome/is_dense_vegetation/end.json | 8 + .../biome/is_dense_vegetation/nether.json | 8 + .../biome/is_dense_vegetation/overworld.json | 12 + .../data/c/tags/worldgen/biome/is_desert.json | 9 + .../data/c/tags/worldgen/biome/is_dry.json | 11 + .../tags/worldgen/biome/is_dry/end.json | 6 +- .../tags/worldgen/biome/is_dry}/nether.json | 8 +- .../tags/worldgen/biome/is_dry/overworld.json | 15 + .../data/c/tags/worldgen/biome/is_end.json | 9 + .../data/c/tags/worldgen/biome/is_floral.json | 12 + .../tags/worldgen/biome/is_flower_forest.json | 5 + .../data/c/tags/worldgen/biome/is_forest.json | 5 + .../data/c/tags/worldgen/biome/is_hill.json | 5 + .../data/c/tags/worldgen/biome/is_hot.json | 14 + .../tags/worldgen/biome/is_hot/end.json} | 2 - .../tags/worldgen/biome/is_hot}/nether.json | 8 +- .../tags/worldgen/biome/is_hot/overworld.json | 15 +- .../data/c/tags/worldgen/biome/is_icy.json | 6 + .../data/c/tags/worldgen/biome/is_jungle.json | 5 + .../data/c/tags/worldgen/biome/is_lush.json | 9 + .../c/tags/worldgen/biome/is_magical.json | 8 + .../c/tags/worldgen/biome/is_modified.json | 8 + .../c/tags/worldgen/biome/is_mountain.json | 11 + .../tags/worldgen/biome/is_mountain/peak.json | 11 + .../worldgen/biome/is_mountain/slope.json | 12 + .../c/tags/worldgen/biome/is_mushroom.json | 9 + .../data/c/tags/worldgen/biome/is_nether.json | 9 + .../tags/worldgen/biome/is_nether_forest.json | 6 + .../data/c/tags/worldgen/biome/is_ocean.json | 7 + .../tags/worldgen/biome/is_old_growth.json} | 3 +- .../worldgen/biome/is_outer_end_island.json} | 4 +- .../c/tags/worldgen/biome/is_overworld.json | 9 + .../data/c/tags/worldgen/biome/is_plains.json | 10 + .../tags/worldgen/biome/is_plateau.json} | 9 +- .../tags/worldgen/biome/is_rare.json | 20 +- .../tags/worldgen/biome/is_river.json} | 1 - .../data/c/tags/worldgen/biome/is_sandy.json | 13 + .../c/tags/worldgen/biome/is_savanna.json | 5 + .../tags/worldgen/biome/is_shallow_ocean.json | 9 + .../tags/worldgen/biome/is_snowy.json | 10 +- .../tags/worldgen/biome/is_snowy_plains.json} | 0 .../worldgen/biome/is_sparse_vegetation.json | 21 + .../biome/is_sparse_vegetation/end.json | 12 + .../biome/is_sparse_vegetation/nether.json} | 5 +- .../is_sparse_vegetation}/overworld.json | 20 +- .../data/c/tags/worldgen/biome/is_spooky.json | 10 + .../tags/worldgen/biome/is_stony_shores.json | 5 + .../data/c/tags/worldgen/biome/is_swamp.json | 10 + .../data/c/tags/worldgen/biome/is_taiga.json | 5 + .../worldgen/biome/is_tree/coniferous.json | 10 + .../worldgen/biome/is_tree/deciduous.json | 10 + .../tags/worldgen/biome/is_tree/jungle.json} | 2 +- .../tags/worldgen/biome/is_tree/savanna.json} | 2 +- .../tags/worldgen/biome/is_underground.json | 2 +- .../data/c/tags/worldgen/biome/is_void.json | 9 + .../c/tags/worldgen/biome/is_wasteland.json | 8 + .../data/c/tags/worldgen/biome/is_wet.json | 17 + .../tags/worldgen/biome/is_wet/end.json} | 5 +- .../c/tags/worldgen/biome/is_wet/nether.json | 8 + .../tags/worldgen/biome/is_wet/overworld.json | 9 +- .../c/tags/worldgen/biome/is_windswept.json | 8 + .../worldgen/biome/no_default_monsters.json} | 2 +- .../structure/hidden_from_displayers.json | 3 + .../hidden_from_locator_selection.json | 3 + .../data/forge/tags/blocks/barrels.json | 5 - .../forge/tags/blocks/barrels/wooden.json | 5 - .../data/forge/tags/blocks/bookshelves.json | 5 - .../data/forge/tags/blocks/chests.json | 7 - .../data/forge/tags/blocks/chests/ender.json | 5 - .../forge/tags/blocks/chests/trapped.json | 5 - .../data/forge/tags/blocks/chests/wooden.json | 6 - .../data/forge/tags/blocks/cobblestone.json | 8 - .../tags/blocks/cobblestone/infested.json | 5 - .../forge/tags/blocks/cobblestone/mossy.json | 5 - .../forge/tags/blocks/cobblestone/normal.json | 5 - .../data/forge/tags/blocks/end_stones.json | 5 - .../data/forge/tags/blocks/fence_gates.json | 5 - .../data/forge/tags/blocks/fences.json | 6 - .../tags/blocks/fences/nether_brick.json | 5 - .../data/forge/tags/blocks/fences/wooden.json | 5 - .../data/forge/tags/blocks/glass.json | 7 - .../data/forge/tags/blocks/glass/black.json | 5 - .../data/forge/tags/blocks/glass/blue.json | 5 - .../data/forge/tags/blocks/glass/brown.json | 5 - .../forge/tags/blocks/glass/colorless.json | 5 - .../data/forge/tags/blocks/glass/cyan.json | 5 - .../data/forge/tags/blocks/glass/gray.json | 5 - .../data/forge/tags/blocks/glass/green.json | 5 - .../forge/tags/blocks/glass/light_blue.json | 5 - .../forge/tags/blocks/glass/light_gray.json | 5 - .../data/forge/tags/blocks/glass/lime.json | 5 - .../data/forge/tags/blocks/glass/magenta.json | 5 - .../data/forge/tags/blocks/glass/orange.json | 5 - .../data/forge/tags/blocks/glass/pink.json | 5 - .../data/forge/tags/blocks/glass/purple.json | 5 - .../data/forge/tags/blocks/glass/red.json | 5 - .../data/forge/tags/blocks/glass/tinted.json | 5 - .../data/forge/tags/blocks/glass/white.json | 5 - .../data/forge/tags/blocks/glass/yellow.json | 5 - .../data/forge/tags/blocks/glass_panes.json | 6 - .../forge/tags/blocks/glass_panes/black.json | 5 - .../forge/tags/blocks/glass_panes/blue.json | 5 - .../forge/tags/blocks/glass_panes/brown.json | 5 - .../tags/blocks/glass_panes/colorless.json | 5 - .../forge/tags/blocks/glass_panes/cyan.json | 5 - .../forge/tags/blocks/glass_panes/gray.json | 5 - .../forge/tags/blocks/glass_panes/green.json | 5 - .../tags/blocks/glass_panes/light_blue.json | 5 - .../tags/blocks/glass_panes/light_gray.json | 5 - .../forge/tags/blocks/glass_panes/lime.json | 5 - .../tags/blocks/glass_panes/magenta.json | 5 - .../forge/tags/blocks/glass_panes/orange.json | 5 - .../forge/tags/blocks/glass_panes/pink.json | 5 - .../forge/tags/blocks/glass_panes/purple.json | 5 - .../forge/tags/blocks/glass_panes/red.json | 5 - .../forge/tags/blocks/glass_panes/white.json | 5 - .../forge/tags/blocks/glass_panes/yellow.json | 5 - .../data/forge/tags/blocks/gravel.json | 5 - .../data/forge/tags/blocks/netherrack.json | 5 - .../data/forge/tags/blocks/obsidian.json | 5 - .../blocks/ore_bearing_ground/deepslate.json | 5 - .../blocks/ore_bearing_ground/netherrack.json | 5 - .../tags/blocks/ore_bearing_ground/stone.json | 5 - .../forge/tags/blocks/ore_rates/sparse.json | 5 - .../data/forge/tags/blocks/ores.json | 14 - .../data/forge/tags/blocks/ores/coal.json | 5 - .../data/forge/tags/blocks/ores/copper.json | 5 - .../data/forge/tags/blocks/ores/diamond.json | 5 - .../data/forge/tags/blocks/ores/emerald.json | 5 - .../data/forge/tags/blocks/ores/gold.json | 5 - .../data/forge/tags/blocks/ores/iron.json | 5 - .../data/forge/tags/blocks/ores/lapis.json | 5 - .../tags/blocks/ores/netherite_scrap.json | 5 - .../data/forge/tags/blocks/ores/quartz.json | 5 - .../data/forge/tags/blocks/ores/redstone.json | 5 - .../blocks/ores_in_ground/netherrack.json | 6 - .../data/forge/tags/blocks/sand.json | 6 - .../data/forge/tags/blocks/sand/red.json | 5 - .../data/forge/tags/blocks/stone.json | 16 - .../forge/tags/blocks/storage_blocks.json | 18 - .../tags/blocks/storage_blocks/amethyst.json | 5 - .../tags/blocks/storage_blocks/coal.json | 5 - .../tags/blocks/storage_blocks/copper.json | 5 - .../tags/blocks/storage_blocks/diamond.json | 5 - .../tags/blocks/storage_blocks/emerald.json | 5 - .../tags/blocks/storage_blocks/gold.json | 5 - .../tags/blocks/storage_blocks/iron.json | 5 - .../tags/blocks/storage_blocks/lapis.json | 5 - .../tags/blocks/storage_blocks/netherite.json | 5 - .../tags/blocks/storage_blocks/quartz.json | 5 - .../tags/blocks/storage_blocks/redstone.json | 5 - .../forge/tags/damage_type/is_poison.json | 5 - .../forge/tags/damage_type/is_technical.json | 7 - .../forge/tags/damage_type/is_wither.json | 6 - .../data/forge/tags/entity_types/bosses.json | 6 - .../data/forge/tags/items/armors.json | 8 - .../data/forge/tags/items/armors/boots.json | 10 - .../forge/tags/items/armors/chestplates.json | 10 - .../data/forge/tags/items/armors/helmets.json | 11 - .../forge/tags/items/armors/leggings.json | 10 - .../data/forge/tags/items/barrels.json | 5 - .../data/forge/tags/items/barrels/wooden.json | 5 - .../data/forge/tags/items/bookshelves.json | 5 - .../data/forge/tags/items/chests.json | 7 - .../data/forge/tags/items/chests/ender.json | 5 - .../data/forge/tags/items/chests/trapped.json | 5 - .../data/forge/tags/items/chests/wooden.json | 6 - .../data/forge/tags/items/cobblestone.json | 8 - .../tags/items/cobblestone/deepslate.json | 5 - .../tags/items/cobblestone/infested.json | 5 - .../forge/tags/items/cobblestone/mossy.json | 5 - .../forge/tags/items/cobblestone/normal.json | 5 - .../data/forge/tags/items/crops.json | 9 - .../data/forge/tags/items/crops/beetroot.json | 5 - .../data/forge/tags/items/crops/carrot.json | 5 - .../forge/tags/items/crops/nether_wart.json | 5 - .../data/forge/tags/items/crops/potato.json | 5 - .../data/forge/tags/items/crops/wheat.json | 5 - .../data/forge/tags/items/dusts.json | 7 - .../forge/tags/items/dusts/glowstone.json | 5 - .../forge/tags/items/dusts/prismarine.json | 5 - .../data/forge/tags/items/dusts/redstone.json | 5 - .../resources/data/forge/tags/items/dyes.json | 20 - .../data/forge/tags/items/dyes/black.json | 5 - .../data/forge/tags/items/dyes/blue.json | 5 - .../data/forge/tags/items/dyes/brown.json | 5 - .../data/forge/tags/items/dyes/cyan.json | 5 - .../data/forge/tags/items/dyes/gray.json | 5 - .../data/forge/tags/items/dyes/green.json | 5 - .../forge/tags/items/dyes/light_blue.json | 5 - .../forge/tags/items/dyes/light_gray.json | 5 - .../data/forge/tags/items/dyes/lime.json | 5 - .../data/forge/tags/items/dyes/magenta.json | 5 - .../data/forge/tags/items/dyes/orange.json | 5 - .../data/forge/tags/items/dyes/pink.json | 5 - .../data/forge/tags/items/dyes/purple.json | 5 - .../data/forge/tags/items/dyes/red.json | 5 - .../data/forge/tags/items/dyes/white.json | 5 - .../data/forge/tags/items/dyes/yellow.json | 5 - .../forge/tags/items/enchanting_fuels.json | 5 - .../data/forge/tags/items/end_stones.json | 5 - .../data/forge/tags/items/ender_pearls.json | 5 - .../data/forge/tags/items/feathers.json | 5 - .../data/forge/tags/items/fence_gates.json | 5 - .../data/forge/tags/items/fences.json | 6 - .../forge/tags/items/fences/nether_brick.json | 5 - .../data/forge/tags/items/fences/wooden.json | 5 - .../resources/data/forge/tags/items/gems.json | 10 - .../data/forge/tags/items/gems/amethyst.json | 5 - .../data/forge/tags/items/gems/diamond.json | 5 - .../data/forge/tags/items/gems/emerald.json | 5 - .../data/forge/tags/items/gems/lapis.json | 5 - .../forge/tags/items/gems/prismarine.json | 5 - .../data/forge/tags/items/gems/quartz.json | 5 - .../data/forge/tags/items/glass.json | 7 - .../data/forge/tags/items/glass/black.json | 5 - .../data/forge/tags/items/glass/blue.json | 5 - .../data/forge/tags/items/glass/brown.json | 5 - .../forge/tags/items/glass/colorless.json | 5 - .../data/forge/tags/items/glass/cyan.json | 5 - .../data/forge/tags/items/glass/gray.json | 5 - .../data/forge/tags/items/glass/green.json | 5 - .../forge/tags/items/glass/light_blue.json | 5 - .../forge/tags/items/glass/light_gray.json | 5 - .../data/forge/tags/items/glass/lime.json | 5 - .../data/forge/tags/items/glass/magenta.json | 5 - .../data/forge/tags/items/glass/orange.json | 5 - .../data/forge/tags/items/glass/pink.json | 5 - .../data/forge/tags/items/glass/purple.json | 5 - .../data/forge/tags/items/glass/red.json | 5 - .../data/forge/tags/items/glass/tinted.json | 5 - .../data/forge/tags/items/glass/white.json | 5 - .../data/forge/tags/items/glass/yellow.json | 5 - .../data/forge/tags/items/glass_panes.json | 6 - .../forge/tags/items/glass_panes/black.json | 5 - .../forge/tags/items/glass_panes/blue.json | 5 - .../forge/tags/items/glass_panes/brown.json | 5 - .../tags/items/glass_panes/colorless.json | 5 - .../forge/tags/items/glass_panes/cyan.json | 5 - .../forge/tags/items/glass_panes/gray.json | 5 - .../forge/tags/items/glass_panes/green.json | 5 - .../tags/items/glass_panes/light_blue.json | 5 - .../tags/items/glass_panes/light_gray.json | 5 - .../forge/tags/items/glass_panes/lime.json | 5 - .../forge/tags/items/glass_panes/magenta.json | 5 - .../forge/tags/items/glass_panes/orange.json | 5 - .../forge/tags/items/glass_panes/pink.json | 5 - .../forge/tags/items/glass_panes/purple.json | 5 - .../forge/tags/items/glass_panes/red.json | 5 - .../forge/tags/items/glass_panes/white.json | 5 - .../forge/tags/items/glass_panes/yellow.json | 5 - .../data/forge/tags/items/gravel.json | 5 - .../data/forge/tags/items/gunpowder.json | 5 - .../data/forge/tags/items/heads.json | 10 - .../data/forge/tags/items/ingots.json | 10 - .../data/forge/tags/items/ingots/brick.json | 5 - .../data/forge/tags/items/ingots/copper.json | 5 - .../data/forge/tags/items/ingots/gold.json | 5 - .../data/forge/tags/items/ingots/iron.json | 5 - .../forge/tags/items/ingots/nether_brick.json | 5 - .../forge/tags/items/ingots/netherite.json | 5 - .../data/forge/tags/items/leather.json | 5 - .../data/forge/tags/items/mushrooms.json | 6 - .../data/forge/tags/items/nether_stars.json | 5 - .../data/forge/tags/items/netherrack.json | 5 - .../data/forge/tags/items/nuggets.json | 6 - .../data/forge/tags/items/nuggets/gold.json | 5 - .../data/forge/tags/items/nuggets/iron.json | 5 - .../data/forge/tags/items/obsidian.json | 5 - .../items/ore_bearing_ground/deepslate.json | 5 - .../items/ore_bearing_ground/netherrack.json | 5 - .../tags/items/ore_bearing_ground/stone.json | 5 - .../forge/tags/items/ore_rates/sparse.json | 5 - .../resources/data/forge/tags/items/ores.json | 14 - .../data/forge/tags/items/ores/coal.json | 5 - .../data/forge/tags/items/ores/copper.json | 5 - .../data/forge/tags/items/ores/diamond.json | 5 - .../data/forge/tags/items/ores/emerald.json | 5 - .../data/forge/tags/items/ores/gold.json | 5 - .../data/forge/tags/items/ores/iron.json | 5 - .../data/forge/tags/items/ores/lapis.json | 5 - .../tags/items/ores/netherite_scrap.json | 5 - .../data/forge/tags/items/ores/quartz.json | 5 - .../data/forge/tags/items/ores/redstone.json | 5 - .../tags/items/ores_in_ground/netherrack.json | 6 - .../data/forge/tags/items/raw_materials.json | 7 - .../tags/items/raw_materials/copper.json | 5 - .../forge/tags/items/raw_materials/gold.json | 5 - .../forge/tags/items/raw_materials/iron.json | 5 - .../resources/data/forge/tags/items/rods.json | 6 - .../data/forge/tags/items/rods/blaze.json | 5 - .../data/forge/tags/items/rods/wooden.json | 5 - .../resources/data/forge/tags/items/sand.json | 6 - .../data/forge/tags/items/sand/red.json | 5 - .../data/forge/tags/items/seeds.json | 8 - .../data/forge/tags/items/seeds/beetroot.json | 5 - .../data/forge/tags/items/seeds/melon.json | 5 - .../data/forge/tags/items/seeds/pumpkin.json | 5 - .../data/forge/tags/items/seeds/wheat.json | 5 - .../data/forge/tags/items/shears.json | 5 - .../data/forge/tags/items/slimeballs.json | 5 - .../data/forge/tags/items/stone.json | 16 - .../data/forge/tags/items/storage_blocks.json | 18 - .../tags/items/storage_blocks/amethyst.json | 5 - .../forge/tags/items/storage_blocks/coal.json | 5 - .../tags/items/storage_blocks/copper.json | 5 - .../tags/items/storage_blocks/diamond.json | 5 - .../tags/items/storage_blocks/emerald.json | 5 - .../forge/tags/items/storage_blocks/gold.json | 5 - .../forge/tags/items/storage_blocks/iron.json | 5 - .../tags/items/storage_blocks/lapis.json | 5 - .../tags/items/storage_blocks/netherite.json | 5 - .../tags/items/storage_blocks/quartz.json | 5 - .../tags/items/storage_blocks/raw_copper.json | 5 - .../tags/items/storage_blocks/raw_gold.json | 5 - .../tags/items/storage_blocks/raw_iron.json | 5 - .../tags/items/storage_blocks/redstone.json | 5 - .../data/forge/tags/items/string.json | 5 - .../data/forge/tags/items/tools.json | 14 - .../forge/tags/items/tools/crossbows.json | 5 - .../forge/tags/items/tools/fishing_rods.json | 5 - .../data/forge/tags/items/tools/shields.json | 5 - .../data/forge/tags/items/tools/tridents.json | 5 - .../forge/tags/worldgen/biome/is_cave.json | 7 - .../tags/worldgen/biome/is_coniferous.json | 8 - .../forge/tags/worldgen/biome/is_dense.json | 13 - .../forge/tags/worldgen/biome/is_desert.json | 5 - .../forge/tags/worldgen/biome/is_dry.json | 7 - .../tags/worldgen/biome/is_dry/overworld.json | 9 - .../forge/tags/worldgen/biome/is_lush.json | 5 - .../tags/worldgen/biome/is_mountain.json | 6 - .../tags/worldgen/biome/is_mushroom.json | 5 - .../forge/tags/worldgen/biome/is_peak.json | 7 - .../forge/tags/worldgen/biome/is_plains.json | 8 - .../forge/tags/worldgen/biome/is_plateau.json | 7 - .../forge/tags/worldgen/biome/is_sandy.json | 8 - .../forge/tags/worldgen/biome/is_swamp.json | 6 - .../forge/tags/worldgen/biome/is_void.json | 5 - .../forge/tags/worldgen/biome/is_wet.json | 13 - .../advancements/husbandry/wax_off.json | 9 +- .../advancements/nether/distract_piglin.json | 17 +- .../loot_tables/blocks/acacia_leaves.json | 32 +- .../loot_tables/blocks/azalea_leaves.json | 32 +- .../loot_tables/blocks/birch_leaves.json | 32 +- .../loot_tables/blocks/cherry_leaves.json | 32 +- .../minecraft/loot_tables/blocks/cobweb.json | 16 +- .../loot_tables/blocks/dark_oak_leaves.json | 48 +- .../blocks/flowering_azalea_leaves.json | 32 +- .../loot_tables/blocks/jungle_leaves.json | 32 +- .../loot_tables/blocks/large_fern.json | 8 +- .../loot_tables/blocks/mangrove_leaves.json | 16 +- .../loot_tables/blocks/oak_leaves.json | 48 +- .../loot_tables/blocks/spruce_leaves.json | 32 +- .../loot_tables/blocks/tall_grass.json | 8 +- .../loot_tables/blocks/twisting_vines.json | 16 +- .../blocks/twisting_vines_plant.json | 16 +- .../loot_tables/blocks/weeping_vines.json | 16 +- .../blocks/weeping_vines_plant.json | 16 +- .../minecraft/recipes/acacia_chest_boat.json | 5 +- .../data/minecraft/recipes/acacia_fence.json | 4 +- .../minecraft/recipes/acacia_fence_gate.json | 5 +- .../data/minecraft/recipes/acacia_sign.json | 4 +- .../minecraft/recipes/activator_rail.json | 6 +- .../data/minecraft/recipes/andesite.json | 4 +- .../data/minecraft/recipes/anvil.json | 5 +- .../data/minecraft/recipes/armor_stand.json | 5 +- .../data/minecraft/recipes/arrow.json | 4 +- .../minecraft/recipes/bamboo_chest_raft.json | 5 +- .../data/minecraft/recipes/bamboo_fence.json | 4 +- .../minecraft/recipes/bamboo_fence_gate.json | 5 +- .../data/minecraft/recipes/bamboo_sign.json | 4 +- .../minecraft/recipes/birch_chest_boat.json | 5 +- .../data/minecraft/recipes/birch_fence.json | 4 +- .../minecraft/recipes/birch_fence_gate.json | 5 +- .../data/minecraft/recipes/birch_sign.json | 4 +- .../data/minecraft/recipes/black_banner.json | 5 +- .../data/minecraft/recipes/blast_furnace.json | 5 +- .../data/minecraft/recipes/blue_banner.json | 5 +- .../resources/data/minecraft/recipes/bow.json | 7 +- .../data/minecraft/recipes/brown_banner.json | 5 +- .../data/minecraft/recipes/brush.json | 7 +- .../data/minecraft/recipes/bucket.json | 5 +- .../recipes/calibrated_sculk_sensor.json | 5 +- .../data/minecraft/recipes/campfire.json | 5 +- .../data/minecraft/recipes/candle.json | 5 +- .../data/minecraft/recipes/cauldron.json | 5 +- .../data/minecraft/recipes/chain.json | 7 +- .../minecraft/recipes/cherry_chest_boat.json | 5 +- .../data/minecraft/recipes/cherry_fence.json | 4 +- .../minecraft/recipes/cherry_fence_gate.json | 5 +- .../data/minecraft/recipes/cherry_sign.json | 4 +- .../minecraft/recipes/chest_minecart.json | 5 +- .../data/minecraft/recipes/clock.json | 5 +- .../coast_armor_trim_smithing_template.json | 6 +- .../data/minecraft/recipes/compass.json | 5 +- .../data/minecraft/recipes/crimson_fence.json | 4 +- .../minecraft/recipes/crimson_fence_gate.json | 5 +- .../data/minecraft/recipes/crimson_sign.json | 4 +- .../data/minecraft/recipes/crossbow.json | 9 +- .../data/minecraft/recipes/cyan_banner.json | 5 +- .../recipes/dark_oak_chest_boat.json | 5 +- .../minecraft/recipes/dark_oak_fence.json | 4 +- .../recipes/dark_oak_fence_gate.json | 5 +- .../data/minecraft/recipes/dark_oak_sign.json | 4 +- .../data/minecraft/recipes/detector_rail.json | 4 +- .../data/minecraft/recipes/diamond_axe.json | 7 +- .../data/minecraft/recipes/diamond_boots.json | 5 +- .../minecraft/recipes/diamond_chestplate.json | 5 +- .../minecraft/recipes/diamond_helmet.json | 5 +- .../data/minecraft/recipes/diamond_hoe.json | 7 +- .../minecraft/recipes/diamond_leggings.json | 5 +- .../minecraft/recipes/diamond_pickaxe.json | 7 +- .../minecraft/recipes/diamond_shovel.json | 7 +- .../data/minecraft/recipes/diamond_sword.json | 7 +- .../data/minecraft/recipes/diorite.json | 4 +- .../data/minecraft/recipes/dispenser.json | 5 +- .../data/minecraft/recipes/dropper.json | 5 +- .../dune_armor_trim_smithing_template.json | 4 +- .../minecraft/recipes/enchanting_table.json | 5 +- .../eye_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/fishing_rod.json | 7 +- .../minecraft/recipes/flint_and_steel.json | 5 +- .../recipes/glistering_melon_slice.json | 5 +- .../recipes/gold_ingot_from_nuggets.json | 5 +- .../data/minecraft/recipes/golden_apple.json | 5 +- .../data/minecraft/recipes/golden_axe.json | 7 +- .../data/minecraft/recipes/golden_boots.json | 5 +- .../data/minecraft/recipes/golden_carrot.json | 5 +- .../minecraft/recipes/golden_chestplate.json | 5 +- .../data/minecraft/recipes/golden_helmet.json | 5 +- .../data/minecraft/recipes/golden_hoe.json | 7 +- .../minecraft/recipes/golden_leggings.json | 5 +- .../minecraft/recipes/golden_pickaxe.json | 7 +- .../data/minecraft/recipes/golden_shovel.json | 7 +- .../data/minecraft/recipes/golden_sword.json | 7 +- .../data/minecraft/recipes/gray_banner.json | 5 +- .../data/minecraft/recipes/green_banner.json | 5 +- .../data/minecraft/recipes/grindstone.json | 5 +- .../heavy_weighted_pressure_plate.json | 5 +- .../data/minecraft/recipes/hopper.json | 7 +- .../host_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/iron_axe.json | 7 +- .../data/minecraft/recipes/iron_bars.json | 4 +- .../data/minecraft/recipes/iron_boots.json | 5 +- .../minecraft/recipes/iron_chestplate.json | 5 +- .../data/minecraft/recipes/iron_door.json | 4 +- .../data/minecraft/recipes/iron_helmet.json | 5 +- .../data/minecraft/recipes/iron_hoe.json | 7 +- .../recipes/iron_ingot_from_nuggets.json | 5 +- .../data/minecraft/recipes/iron_leggings.json | 5 +- .../data/minecraft/recipes/iron_pickaxe.json | 7 +- .../data/minecraft/recipes/iron_shovel.json | 7 +- .../data/minecraft/recipes/iron_sword.json | 7 +- .../data/minecraft/recipes/iron_trapdoor.json | 5 +- .../data/minecraft/recipes/item_frame.json | 5 +- .../data/minecraft/recipes/jukebox.json | 5 +- .../minecraft/recipes/jungle_chest_boat.json | 5 +- .../data/minecraft/recipes/jungle_fence.json | 4 +- .../minecraft/recipes/jungle_fence_gate.json | 5 +- .../data/minecraft/recipes/jungle_sign.json | 4 +- .../data/minecraft/recipes/ladder.json | 4 +- .../data/minecraft/recipes/lantern.json | 5 +- .../data/minecraft/recipes/lead.json | 4 +- .../data/minecraft/recipes/lever.json | 7 +- .../minecraft/recipes/light_blue_banner.json | 5 +- .../minecraft/recipes/light_gray_banner.json | 5 +- .../light_weighted_pressure_plate.json | 5 +- .../data/minecraft/recipes/lightning_rod.json | 5 +- .../data/minecraft/recipes/lime_banner.json | 5 +- .../data/minecraft/recipes/lodestone.json | 5 +- .../data/minecraft/recipes/loom.json | 5 +- .../minecraft/recipes/magenta_banner.json | 5 +- .../recipes/mangrove_chest_boat.json | 5 +- .../minecraft/recipes/mangrove_fence.json | 4 +- .../recipes/mangrove_fence_gate.json | 5 +- .../data/minecraft/recipes/mangrove_sign.json | 4 +- .../data/minecraft/recipes/minecart.json | 5 +- .../mossy_cobblestone_from_moss_block.json | 5 +- .../recipes/mossy_cobblestone_from_vine.json | 5 +- .../minecraft/recipes/netherite_ingot.json | 11 +- .../netherite_upgrade_smithing_template.json | 4 +- .../minecraft/recipes/oak_chest_boat.json | 5 +- .../data/minecraft/recipes/oak_fence.json | 4 +- .../minecraft/recipes/oak_fence_gate.json | 5 +- .../data/minecraft/recipes/oak_sign.json | 4 +- .../data/minecraft/recipes/observer.json | 5 +- .../data/minecraft/recipes/orange_banner.json | 5 +- .../data/minecraft/recipes/painting.json | 5 +- .../data/minecraft/recipes/pink_banner.json | 5 +- .../data/minecraft/recipes/piston.json | 7 +- .../minecraft/recipes/polished_deepslate.json | 4 +- .../data/minecraft/recipes/powered_rail.json | 6 +- .../data/minecraft/recipes/purple_banner.json | 5 +- .../data/minecraft/recipes/rail.json | 6 +- .../raiser_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/red_banner.json | 5 +- .../minecraft/recipes/redstone_torch.json | 5 +- .../rib_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/scaffolding.json | 4 +- .../sentry_armor_trim_smithing_template.json | 6 +- .../shaper_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/shears.json | 5 +- .../data/minecraft/recipes/shield.json | 5 +- .../data/minecraft/recipes/shulker_box.json | 5 +- .../silence_armor_trim_smithing_template.json | 6 +- .../minecraft/recipes/smithing_table.json | 5 +- .../snout_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/soul_campfire.json | 5 +- .../data/minecraft/recipes/soul_lantern.json | 5 +- .../data/minecraft/recipes/soul_torch.json | 4 +- .../spire_armor_trim_smithing_template.json | 4 +- .../minecraft/recipes/spruce_chest_boat.json | 5 +- .../data/minecraft/recipes/spruce_fence.json | 4 +- .../minecraft/recipes/spruce_fence_gate.json | 5 +- .../data/minecraft/recipes/spruce_sign.json | 4 +- .../data/minecraft/recipes/spyglass.json | 7 +- .../data/minecraft/recipes/stone_axe.json | 5 +- .../data/minecraft/recipes/stone_hoe.json | 5 +- .../data/minecraft/recipes/stone_pickaxe.json | 5 +- .../data/minecraft/recipes/stone_shovel.json | 5 +- .../data/minecraft/recipes/stone_sword.json | 5 +- .../data/minecraft/recipes/stonecutter.json | 5 +- .../tide_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/tinted_glass.json | 4 +- .../data/minecraft/recipes/torch.json | 4 +- .../data/minecraft/recipes/trapped_chest.json | 5 +- .../data/minecraft/recipes/tripwire_hook.json | 6 +- .../vex_armor_trim_smithing_template.json | 6 +- .../ward_armor_trim_smithing_template.json | 6 +- .../data/minecraft/recipes/warped_fence.json | 4 +- .../minecraft/recipes/warped_fence_gate.json | 5 +- .../data/minecraft/recipes/warped_sign.json | 4 +- ...ayfinder_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/white_banner.json | 5 +- .../wild_armor_trim_smithing_template.json | 4 +- .../data/minecraft/recipes/wooden_axe.json | 5 +- .../data/minecraft/recipes/wooden_hoe.json | 5 +- .../minecraft/recipes/wooden_pickaxe.json | 5 +- .../data/minecraft/recipes/wooden_shovel.json | 5 +- .../data/minecraft/recipes/wooden_sword.json | 5 +- .../data/minecraft/recipes/yellow_banner.json | 5 +- .../entity_type/parrot_imitations.json | 3 + .../blocks/enderman_place_on_blacklist.json | 8 + .../tags/damage_type/is_environment.json | 6 +- .../tags/damage_type/is_magic.json | 8 +- .../tags/damage_type/is_physical.json | 6 +- .../neoforge/tags/damage_type/is_poison.json | 9 + .../tags/damage_type/is_technical.json | 11 + .../neoforge/tags/damage_type/is_wither.json | 10 + .../neoforge/tags/damage_type/no_flinch.json | 8 + .../tags/items/enchanting_fuels.json} | 2 +- src/generated/resources/pack.mcmeta | 2 +- .../resources/reports/registry_order.json | 8 +- .../neoforge/attachment/AttachmentHolder.java | 21 +- .../attachment/AttachmentInternals.java | 79 +- .../neoforge/attachment/AttachmentType.java | 25 +- .../neoforge/attachment/AttachmentUtils.java | 44 - .../attachment/IAttachmentComparator.java | 4 +- .../attachment/IAttachmentCopyHandler.java | 3 +- .../attachment/IAttachmentSerializer.java | 15 +- .../attachment/LevelAttachmentsSavedData.java | 9 +- .../neoforge/client/ClientHooks.java | 51 +- .../neoforge/client/ConfigScreenHandler.java | 22 - .../client/FireworkShapeFactoryRegistry.java | 8 +- .../CalculateDetachedCameraDistanceEvent.java | 16 +- .../client/event/ClientChatReceivedEvent.java | 11 +- .../client/event/RegisterGuiLayersEvent.java | 110 +++ .../event/RegisterGuiOverlaysEvent.java | 154 ---- .../event/RegisterSpriteSourceTypesEvent.java | 6 +- .../neoforge/client/event/RenderGuiEvent.java | 17 +- ...layEvent.java => RenderGuiLayerEvent.java} | 51 +- .../client/event/RenderLevelStageEvent.java | 17 +- .../IDimensionSpecialEffectsExtension.java | 4 +- .../extensions/IGuiGraphicsExtension.java | 19 + .../common/IClientItemExtensions.java | 18 + .../common/IClientMobEffectExtensions.java | 2 +- .../neoforge/client/gui/GuiLayerManager.java | 85 ++ .../client/gui/IConfigScreenFactory.java | 32 + .../neoforge/client/gui/ModListScreen.java | 17 +- .../gui/TitleScreenModUpdateIndicator.java | 64 -- .../neoforge/client/gui/VanillaGuiLayers.java | 43 + .../client/gui/overlay/ExtendedGui.java | 502 ---------- .../client/gui/overlay/GuiOverlayManager.java | 75 -- .../client/gui/overlay/IGuiOverlay.java | 19 - .../client/gui/overlay/NamedGuiOverlay.java | 22 - .../client/gui/overlay/VanillaGuiOverlay.java | 212 ----- .../client/gui/widget/ModListWidget.java | 8 +- .../client/gui/widget/ModsButton.java | 62 ++ .../client/gui/widget/ScrollPanel.java | 54 +- .../neoforge/client/model/ExtraFaceData.java | 5 +- .../loaders/ItemLayerModelBuilder.java | 2 +- .../client/model/lighting/QuadLighter.java | 2 +- .../model/renderable/CompositeRenderable.java | 2 +- .../neoforge/common/BasicItemListing.java | 10 +- .../neoforge/common/CommonHooks.java | 152 ++- .../neoforge/common/DeferredSpawnEggItem.java | 2 +- .../neoforged/neoforge/common/EffectCure.java | 4 + .../neoforge/common/IExtensibleEnum.java | 12 + .../neoforge/common/NeoForgeConfig.java | 15 +- .../neoforge/common/NeoForgeEventHandler.java | 3 +- .../neoforge/common/NeoForgeMod.java | 149 ++- .../neoforged/neoforge/common/SimpleTier.java | 25 +- .../common/TagConventionLogWarning.java | 521 +++++++++++ .../common/TagConventionLogWarningClient.java | 85 ++ .../net/neoforged/neoforge/common/Tags.java | 867 +++++++++++++----- .../neoforge/common/TierSortingRegistry.java | 329 ------- .../critereon/ICustomEntityPredicate.java | 44 - .../critereon/ICustomItemPredicate.java | 31 - .../PiglinCurrencyItemPredicate.java | 11 +- .../PiglinNeutralArmorEntityPredicate.java | 13 +- .../critereon/ToolActionItemPredicate.java | 11 +- .../common/brewing/BrewingRecipeRegistry.java | 94 +- .../common/brewing/IBrewingRecipe.java | 8 + .../common/brewing/VanillaBrewingRecipe.java | 53 -- .../common/conditions/AndCondition.java | 6 +- .../common/conditions/ConditionContext.java | 2 + .../common/conditions/ConditionalOps.java | 8 - .../common/conditions/FalseCondition.java | 5 +- .../common/conditions/ICondition.java | 8 +- .../conditions/ItemExistsCondition.java | 6 +- .../common/conditions/ModLoadedCondition.java | 5 +- .../common/conditions/NotCondition.java | 6 +- .../common/conditions/OrCondition.java | 6 +- .../common/conditions/TagEmptyCondition.java | 6 +- .../common/conditions/TrueCondition.java | 5 +- .../common/crafting/CompoundIngredient.java | 5 +- .../common/crafting/CraftingHelper.java | 43 +- .../crafting/DataComponentIngredient.java | 156 ++++ .../common/crafting/DifferenceIngredient.java | 6 +- .../common/crafting/IShapedRecipe.java | 4 +- .../common/crafting/IngredientType.java | 8 +- .../crafting/IntersectionIngredient.java | 6 +- .../common/crafting/NBTIngredient.java | 158 ---- .../neoforge/common/data/DataMapProvider.java | 2 +- .../common/data/EnchantmentTagsProvider.java | 22 + .../common/data/ExistingFileHelper.java | 10 +- .../data/GlobalLootModifierProvider.java | 27 +- .../common/data/JsonCodecProvider.java | 4 +- .../common/data/LanguageProvider.java | 22 + .../data/NeoForgeDamageTypeTagsProvider.java | 18 + .../internal/NeoForgeAdvancementProvider.java | 49 +- .../internal/NeoForgeBiomeTagsProvider.java | 281 ++++-- .../internal/NeoForgeBlockTagsProvider.java | 236 ++++- .../internal/NeoForgeDataMapsProvider.java | 11 +- .../NeoForgeEnchantmentTagsProvider.java | 48 + .../NeoForgeEntityTypeTagsProvider.java | 11 + .../internal/NeoForgeFluidTagsProvider.java | 31 + .../internal/NeoForgeItemTagsProvider.java | 293 ++++-- .../internal/NeoForgeLanguageProvider.java | 420 +++++++++ .../internal/NeoForgeLootTableProvider.java | 23 +- .../data/internal/NeoForgeRecipeProvider.java | 13 +- .../NeoForgeStructureTagsProvider.java | 25 + .../extensions/IBlockEntityExtension.java | 30 +- .../common/extensions/IBlockExtension.java | 29 +- .../extensions/IBlockStateExtension.java | 20 +- .../IClientCommonPacketListenerExtension.java | 13 +- .../extensions/IEnchantmentExtension.java | 16 +- .../common/extensions/IEntityExtension.java | 40 +- .../common/extensions/IFluidExtension.java | 6 +- .../extensions/IFluidStateExtension.java | 6 +- .../extensions/IFriendlyByteBufExtension.java | 135 ++- .../common/extensions/IItemExtension.java | 103 +-- .../extensions/IItemStackExtension.java | 43 +- .../extensions/ILivingEntityExtension.java | 4 +- .../common/extensions/IMenuTypeExtension.java | 4 +- .../extensions/IMobEffectExtension.java | 2 +- .../common/extensions/IPlayerExtension.java | 64 +- .../IServerCommonPacketListenerExtension.java | 13 +- .../common/loot/AddTableLootModifier.java | 28 +- .../common/loot/CanToolPerformAction.java | 4 +- .../common/loot/IGlobalLootModifier.java | 5 +- .../neoforge/common/loot/LootModifier.java | 4 +- .../common/loot/LootTableIdCondition.java | 4 +- .../neoforge/common/util/BlockSnapshot.java | 13 +- .../neoforge/common/util/DummySavedData.java | 3 +- .../neoforge/common/util/FakePlayer.java | 12 +- .../common/util/FriendlyByteBufUtil.java | 11 +- .../common/util/INBTSerializable.java | 5 +- .../neoforge/common/world/BiomeModifier.java | 3 +- .../neoforge/common/world/BiomeModifiers.java | 18 +- .../LevelChunkAuxiliaryLightManager.java | 5 +- .../common/world/NoneBiomeModifier.java | 4 +- .../common/world/NoneStructureModifier.java | 4 +- .../common/world/StructureModifier.java | 3 +- .../common/world/StructureModifiers.java | 8 +- .../world/chunk/ForcedChunkManager.java | 16 +- .../neoforge/data/event/GatherDataEvent.java | 13 +- .../neoforge/energy/EnergyStorage.java | 5 +- .../entity/IEntityWithComplexSpawn.java | 6 +- .../event/AddReloadListenerEvent.java | 5 +- .../neoforge/event/AnvilUpdateEvent.java | 10 +- .../neoforged/neoforge/event/EventHooks.java | 40 +- .../event/ItemAttributeModifierEvent.java | 21 +- .../neoforge/event/VanillaGameEvent.java | 7 +- .../brewing/RegisterBrewingRecipesEvent.java | 28 + .../enchanting/GetEnchantmentLevelEvent.java | 8 +- .../EntityAttributeModificationEvent.java | 9 +- .../neoforge/event/entity/EntityEvent.java | 2 +- .../event/entity/EntityJoinLevelEvent.java | 2 +- .../entity/SpawnPlacementRegisterEvent.java | 14 +- .../event/entity/living/MobEffectEvent.java | 7 +- .../event/entity/living/MobSpawnEvent.java | 27 +- .../entity/player/PlayerInteractEvent.java | 95 +- .../entity/player/UseItemOnBlockEvent.java | 40 +- .../neoforge/event/level/BlockEvent.java | 2 +- .../neoforge/event/level/ChunkDataEvent.java | 10 +- .../neoforge/event/level/ChunkEvent.java | 2 +- .../neoforged/neoforge/fluids/FluidStack.java | 612 ++++++++----- .../neoforged/neoforge/fluids/FluidType.java | 16 +- .../neoforged/neoforge/fluids/FluidUtil.java | 4 +- .../neoforge/fluids/SimpleFluidContent.java | 58 ++ .../templates/FluidHandlerItemStack.java | 48 +- .../FluidHandlerItemStackSimple.java | 44 +- .../capability/templates/FluidTank.java | 22 +- .../wrappers/BucketPickupHandlerWrapper.java | 4 +- .../capability/wrappers/CauldronWrapper.java | 2 +- .../wrappers/FluidBlockWrapper.java | 2 +- .../wrappers/FluidBucketWrapper.java | 2 +- .../neoforge/items/ItemHandlerHelper.java | 33 +- .../neoforge/items/ItemStackHandler.java | 10 +- .../wrapper/ShulkerItemStackInvWrapper.java | 31 +- .../neoforge/network/ConfigSync.java | 2 +- .../network/ConfigurationInitialization.java | 26 +- .../neoforge/network/IContainerFactory.java | 4 +- .../network/NetworkInitialization.java | 54 +- .../network/codec/NeoForgeStreamCodecs.java | 135 +++ .../codec}/package-info.java | 2 +- .../RegistryDataMapNegotiation.java | 4 +- .../network/configuration/SyncRegistries.java | 2 +- .../SyncTierSortingRegistry.java | 35 - .../ChannelAwareFriendlyByteBuf.java | 35 + .../filters/GenericPacketSplitter.java | 157 ++-- .../network/filters/NetworkFilters.java | 25 +- .../VanillaConnectionNetworkFilter.java | 2 +- .../handlers/ClientPayloadHandler.java | 21 +- .../handlers/ServerPayloadHandler.java | 6 - .../handling/ConfigurationPayloadContext.java | 14 +- .../network/handling/IPayloadContext.java | 14 +- .../network/handling/PlayPayloadContext.java | 14 +- .../payload/AdvancedAddEntityPayload.java | 44 +- .../AdvancedContainerSetDataPayload.java | 31 +- .../payload/AdvancedOpenScreenPayload.java | 47 +- .../payload/AuxiliaryLightDataPayload.java | 29 +- .../network/payload/ConfigFilePayload.java | 31 +- .../payload/DinnerboneProtocolUtils.java | 11 +- .../payload/FrozenRegistryPayload.java | 23 +- .../FrozenRegistrySyncCompletedPayload.java | 18 +- .../FrozenRegistrySyncStartPayload.java | 21 +- .../payload/KnownRegistryDataMapsPayload.java | 40 +- .../KnownRegistryDataMapsReplyPayload.java | 30 +- .../payload/MinecraftRegisterPayload.java | 17 +- .../payload/MinecraftUnregisterPayload.java | 17 +- .../payload/ModdedNetworkComponent.java | 16 +- .../network/payload/ModdedNetworkPayload.java | 24 +- .../payload/ModdedNetworkQueryComponent.java | 27 +- .../payload/ModdedNetworkQueryPayload.java | 26 +- .../ModdedNetworkSetupFailedPayload.java | 23 +- .../payload/RegistryDataMapSyncPayload.java | 10 +- .../network/payload/SplitPacketPayload.java | 21 +- .../payload/TierSortingRegistryPayload.java | 40 - ...ierSortingRegistrySyncCompletePayload.java | 32 - .../ConfigurationRegistration.java | 12 +- .../registration/IPayloadRegistrar.java | 38 +- ...oddedConfigurationPayloadRegistration.java | 3 +- .../registration/ModdedPacketRegistrar.java | 28 +- .../ModdedPlayPayloadRegistration.java | 5 +- .../network/registration/NetworkRegistry.java | 197 ++-- .../registration/PlayRegistration.java | 14 +- .../registries/ClientRegistryManager.java | 4 +- .../neoforge/registries/DataMapLoader.java | 5 +- .../registries/DataPackRegistriesHooks.java | 23 +- .../neoforge/registries/DeferredHolder.java | 28 +- .../neoforge/registries/GameData.java | 1 + .../registries/NeoForgeRegistries.java | 24 +- .../registries/NeoForgeRegistriesSetup.java | 7 +- .../neoforge/registries/NewRegistryEvent.java | 4 +- .../neoforge/registries/RegistryManager.java | 15 +- .../neoforge/registries/RegistrySnapshot.java | 61 +- .../registries/datamaps/DataMapEntry.java | 7 +- .../registries/datamaps/DataMapFile.java | 4 +- .../datamaps/builtin/Compostable.java | 3 +- .../datamaps/builtin/FurnaceFuel.java | 2 +- .../datamaps/builtin/ParrotImitation.java | 3 +- .../datamaps/builtin/RaidHeroGift.java | 13 +- .../datamaps/builtin/VibrationFrequency.java | 3 +- .../registries/holdersets/AndHolderSet.java | 6 +- .../registries/holdersets/AnyHolderSet.java | 6 +- .../registries/holdersets/HolderSetType.java | 3 +- .../registries/holdersets/NotHolderSet.java | 5 +- .../registries/holdersets/OrHolderSet.java | 6 +- .../resource/ContextAwareReloadListener.java | 32 +- .../neoforge/resource/EmptyPackResources.java | 15 +- .../neoforge/resource/ResourcePackLoader.java | 61 +- .../neoforge/server/command/TagsCommand.java | 5 +- .../command/generation/GenerationTask.java | 8 +- .../resources/META-INF/accesstransformer.cfg | 12 +- .../{mods.toml => neoforge.mods.toml} | 4 +- .../resources/assets/neoforge/lang/en_us.json | 4 - .../resources/coremods/method_redirector.js | 6 +- testframework/build.gradle | 2 +- .../client/FrameworkClientImpl.java | 4 +- .../testframework/client/TestScreen.java | 3 +- .../testframework/client/TestsOverlay.java | 28 +- .../condition/TestEnabledIngredient.java | 5 +- .../condition/TestEnabledLootCondition.java | 3 +- .../gametest/ExtendedGameTestHelper.java | 27 +- .../testframework/gametest/GameTestData.java | 2 +- .../gametest/GameTestPlayer.java | 12 +- .../DefaultMarkdownFileSummaryDumper.java | 2 +- .../impl/FrameworkCollectors.java | 12 +- .../impl/GameTestRegistration.java | 29 +- .../testframework/impl/PlayerTestStore.java | 19 +- .../impl/packet/ChangeEnabledPayload.java | 5 +- .../impl/packet/ChangeStatusPayload.java | 5 +- .../TestFrameworkPayloadInitialization.java | 6 +- .../impl/reg/RegistrationHelperImpl.java | 31 +- .../testframework/impl/test/AbstractTest.java | 11 +- .../summary/FileSummaryDumper.java | 7 +- .../{mods.toml => neoforge.mods.toml} | 0 .../blockstates/destroy_on_piston_move.json | 7 + .../lang/en_us.json | 3 + .../models/block/destroy_on_piston_move.json} | 2 +- .../models/item/destroy_on_piston_move.json | 3 + .../blockstates/destroy_on_piston_move.json | 7 + .../lang/en_us.json | 3 + .../models/block/destroy_on_piston_move.json | 6 + .../models/item/destroy_on_piston_move.json | 3 + .../blockstates/destroy_on_piston_move.json | 7 + .../neotests_player_destroy/lang/en_us.json | 3 + .../models/block/destroy_on_piston_move.json | 6 + .../models/item/destroy_on_piston_move.json | 3 + .../blockstates/push_on_piston_move.json | 7 + .../lang/en_us.json | 3 + .../models/block/push_on_piston_move.json | 6 + .../models/item/push_on_piston_move.json | 3 + .../blockstates/destroy_on_piston_move.json | 7 + .../lang/en_us.json | 3 + .../models/block/destroy_on_piston_move.json | 6 + .../models/item/destroy_on_piston_move.json | 3 + .../blockstates/test_stone.json | 7 - .../models/item/test_stone.json | 3 - .../models/item/test_tool.json | 6 - .../advancements/obtain_dirt.json | 7 +- .../compound_ingredient_custom_types.json | 4 +- .../compound_ingredient_only_vanilla.json | 4 +- .../recipes/building_blocks/conditional.json | 4 +- .../recipes/building_blocks/conditional2.json | 4 +- .../recipes/building_blocks/conditional3.json | 4 +- .../recipes/building_blocks/conditional4.json | 4 +- .../intersection_ingredient.json | 4 +- .../recipes/tools/difference_ingredient.json | 4 +- .../compound_ingredient_custom_types.json | 48 +- .../compound_ingredient_only_vanilla.json | 3 +- .../data_gen_test/recipes/conditional.json | 2 +- .../data_gen_test/recipes/conditional2.json | 2 +- .../data_gen_test/recipes/conditional3.json | 3 +- .../data_gen_test/recipes/conditional4.json | 2 +- .../recipes/difference_ingredient.json | 3 +- .../recipes/intersection_ingredient.json | 3 +- .../data/data_gen_test/tags/blocks/test.json | 2 +- .../minecraft/advancements/good_parent.json | 7 +- .../advancements/obtain_diamond_block.json | 7 +- .../minecraft/advancements/story/root.json | 7 +- .../advancements/named_item.json | 3 +- .../loot_modifiers/wheat_harvest.json | 4 +- .../recipes/misc/test_smithing.json | 34 - .../recipes/test_smithing.json | 15 - .../recipes/misc/test_blasting.json | 34 - .../recipes/misc/test_shaped.json | 34 - .../recipes/misc/test_shapeless.json | 34 - .../recipes/test_blasting.json | 18 - .../recipes/test_shaped.json | 22 - .../recipes/test_shapeless.json | 18 - .../recipes/misc/test_advancement.json | 4 +- .../recipes/misc/partial_attachments.json | 34 - .../recipes/partial_attachments.json | 29 - .../misc/partial_nbt_and_attachments.json | 34 - .../recipes/partial_nbt_and_attachments.json | 29 - .../recipes/misc/partial_nbt.json | 4 +- .../recipes/partial_nbt.json | 11 +- .../recipes/misc/strict_attachments.json | 34 - .../recipes/strict_attachments.json | 23 - .../recipes/misc/strict_attachments.json | 34 - .../recipes/strict_attachments.json | 24 - .../advancements/recipes/misc/strict_nbt.json | 4 +- .../recipes/strict_nbt.json | 13 +- .../loot_tables/blocks/test_stone.json | 21 - .../tags/blocks/minable/my_tool.json | 5 - .../tags/blocks/needs_my_tier_tool.json | 5 - tests/src/generated/resources/pack.mcmeta | 2 +- .../debug/attachment/AttachmentTests.java | 647 +++++++------ .../debug/block/BlockPropertyTests.java | 30 +- .../neoforge/debug/block/BlockTests.java | 8 +- .../capabilities/FluidTemplatesTests.java | 87 ++ .../capabilities/VanillaHandlersTests.java | 10 +- .../neoforge/debug/chat/CommandTests.java | 7 +- .../neoforge/debug/client/GuiTests.java | 61 ++ .../debug/crafting/IngredientTests.java | 425 +++++---- .../debug/damagesource/DamageTypeTests.java | 3 +- .../neoforge/debug/effect/MobEffectTests.java | 14 +- .../enchantment/EnchantmentLevelTests.java | 16 +- .../entity/EntityDataSerializerTest.java | 10 +- .../debug/entity/EntityEventTests.java | 4 +- .../neoforge/debug/entity/EntityTests.java | 29 +- .../entity/living/LivingEntityEventTests.java | 5 +- .../debug/entity/player/AdvancementTests.java | 40 +- .../debug/entity/player/PlayerEventTests.java | 4 +- .../debug/item/ItemComponentTests.java | 62 ++ .../neoforge/debug/item/ItemEventTests.java | 2 +- .../neoforge/debug/item/ItemTests.java | 32 +- .../neoforge/debug/level/LevelEventTests.java | 2 +- .../debug/loot/GlobalLootModifiersTest.java | 56 +- .../neoforge/debug/loot/LootPoolTest.java | 13 +- .../debug/resources/ModDatapackTest.java | 2 +- .../oldtest/AddPackFinderEventTest.java | 6 +- .../neoforge/oldtest/CodecsTest.java | 65 -- .../neoforge/oldtest/DataGeneratorTest.java | 17 +- .../neoforge/oldtest/ManyMobEffectsTest.java | 23 +- .../neoforge/oldtest/PotionEventTest.java | 15 +- .../oldtest/block/FullPotsAccessorDemo.java | 33 +- .../oldtest/client/CustomArmorModelTest.java | 11 +- .../client/CustomPresetEditorTest.java | 4 +- .../client/CustomSpriteSourceTest.java | 4 +- .../oldtest/client/CustomTooltipTest.java | 5 +- .../model/CustomItemDisplayContextTest.java | 26 +- .../oldtest/client/model/MegaModelTest.java | 9 +- .../client/rendering/RenderableTest.java | 6 +- .../conditions/ConditionalCodecTest.java | 2 +- .../oldtest/entity/GravityAttributeTest.java | 124 --- .../oldtest/entity/PartEntityTest.java | 11 +- .../entity/player/ItemUseAnimationTest.java | 2 +- .../neoforge/oldtest/fluid/MilkFluidTest.java | 2 +- .../oldtest/item/CustomElytraTest.java | 2 +- .../item/CustomFluidContainerTest.java | 11 +- .../oldtest/item/HiddenTooltipPartsTest.java | 23 +- .../oldtest/item/ItemStackedOnOtherTest.java | 3 +- .../oldtest/item/MayFlyAttributeTest.java | 15 +- .../item/RangedMobsUseModdedWeaponsTest.java | 11 +- .../oldtest/item/StopUsingItemTest.java | 2 +- .../oldtest/item/TagBasedToolTypesTest.java | 152 --- .../oldtest/misc/ModMismatchTest.java | 19 +- .../recipebook/RecipeBookTestMenu.java | 2 +- .../recipebook/RecipeBookTestRecipe.java | 9 +- .../RecipeBookTestRecipeSerializer.java | 23 +- .../oldtest/world/BiomeModifierTest.java | 7 +- .../oldtest/world/LoginPacketSplitTest.java | 34 +- .../oldtest/world/StructureModifierTest.java | 11 +- .../{mods.toml => neoforge.mods.toml} | 6 - .../recipes/custom_item.json | 4 +- .../neoforge/advancements/dummy_parent.json | 4 +- .../recipes/smelting_multi_output.json | 2 +- 1818 files changed, 16788 insertions(+), 14292 deletions(-) delete mode 100644 patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch delete mode 100644 patches/com/mojang/realmsclient/RealmsAvailability.java.patch delete mode 100644 patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch create mode 100644 patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch delete mode 100644 patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch delete mode 100644 patches/net/minecraft/client/gui/MapRenderer.java.patch delete mode 100644 patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch create mode 100644 patches/net/minecraft/client/multiplayer/TagCollector.java.patch delete mode 100644 patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch delete mode 100644 patches/net/minecraft/core/Direction.java.patch delete mode 100644 patches/net/minecraft/core/RegistryCodecs.java.patch delete mode 100644 patches/net/minecraft/core/RegistrySynchronization.java.patch delete mode 100644 patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch create mode 100644 patches/net/minecraft/core/component/DataComponentPatch.java.patch create mode 100644 patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch rename patches/net/minecraft/data/worldgen/{BootstapContext.java.patch => BootstrapContext.java.patch} (67%) delete mode 100644 patches/net/minecraft/gametest/framework/GameTestHelper.java.patch create mode 100644 patches/net/minecraft/network/codec/ByteBufCodecs.java.patch create mode 100644 patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch create mode 100644 patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch delete mode 100644 patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch delete mode 100644 patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch delete mode 100644 patches/net/minecraft/world/item/ArmorItem.java.patch delete mode 100644 patches/net/minecraft/world/item/BannerItem.java.patch delete mode 100644 patches/net/minecraft/world/item/CompassItem.java.patch delete mode 100644 patches/net/minecraft/world/item/DiggerItem.java.patch delete mode 100644 patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch delete mode 100644 patches/net/minecraft/world/item/FireworkRocketItem.java.patch delete mode 100644 patches/net/minecraft/world/item/FireworkStarItem.java.patch delete mode 100644 patches/net/minecraft/world/item/FoodOnAStickItem.java.patch delete mode 100644 patches/net/minecraft/world/item/HorseArmorItem.java.patch create mode 100644 patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch delete mode 100644 patches/net/minecraft/world/item/Tier.java.patch create mode 100644 patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch create mode 100644 patches/net/minecraft/world/item/component/FireworkExplosion.java.patch delete mode 100644 patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch delete mode 100644 patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch delete mode 100644 patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch delete mode 100644 patches/net/minecraft/world/item/trading/MerchantOffer.java.patch create mode 100644 patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch delete mode 100644 patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch delete mode 100644 patches/net/minecraft/world/level/block/FlowerBlock.java.patch create mode 100644 patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch delete mode 100644 patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch delete mode 100644 patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch delete mode 100644 patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch create mode 100644 patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch delete mode 100644 patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch create mode 100644 src/generated/resources/assets/c/lang/en_us.json create mode 100644 src/generated/resources/data/c/tags/blocks/barrels.json create mode 100644 src/generated/resources/data/c/tags/blocks/barrels/wooden.json create mode 100644 src/generated/resources/data/c/tags/blocks/bookshelves.json create mode 100644 src/generated/resources/data/c/tags/blocks/budding_blocks.json create mode 100644 src/generated/resources/data/c/tags/blocks/buds.json create mode 100644 src/generated/resources/data/c/tags/blocks/chains.json create mode 100644 src/generated/resources/data/c/tags/blocks/chests.json create mode 100644 src/generated/resources/data/c/tags/blocks/chests/ender.json create mode 100644 src/generated/resources/data/c/tags/blocks/chests/trapped.json create mode 100644 src/generated/resources/data/c/tags/blocks/chests/wooden.json create mode 100644 src/generated/resources/data/c/tags/blocks/clusters.json create mode 100644 src/generated/resources/data/c/tags/blocks/cobblestones.json create mode 100644 src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json create mode 100644 src/generated/resources/data/c/tags/blocks/cobblestones/infested.json create mode 100644 src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json create mode 100644 src/generated/resources/data/c/tags/blocks/cobblestones/normal.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/black.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/blue.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/brown.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/cyan.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/gray.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/green.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/light_blue.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/light_gray.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/lime.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/magenta.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/orange.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/pink.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/purple.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/red.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/white.json create mode 100644 src/generated/resources/data/c/tags/blocks/dyed/yellow.json create mode 100644 src/generated/resources/data/c/tags/blocks/end_stones.json create mode 100644 src/generated/resources/data/c/tags/blocks/fence_gates.json rename src/generated/resources/data/{forge/tags/items => c/tags/blocks}/fence_gates/wooden.json (76%) create mode 100644 src/generated/resources/data/c/tags/blocks/fences.json create mode 100644 src/generated/resources/data/c/tags/blocks/fences/nether_brick.json create mode 100644 src/generated/resources/data/c/tags/blocks/fences/wooden.json rename src/generated/resources/data/{forge/tags/items/stained_glass.json => c/tags/blocks/glass_blocks.json} (75%) rename src/generated/resources/data/{forge/tags/items/glass/silica.json => c/tags/blocks/glass_blocks/cheap.json} (80%) create mode 100644 src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json create mode 100644 src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json rename src/generated/resources/data/{forge/tags/blocks/stained_glass_panes.json => c/tags/blocks/glass_panes.json} (95%) create mode 100644 src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json create mode 100644 src/generated/resources/data/c/tags/blocks/gravel.json rename src/generated/resources/data/{forge/tags/blocks/enderman_place_on_blacklist.json => c/tags/blocks/hidden_from_recipe_viewers.json} (100%) create mode 100644 src/generated/resources/data/c/tags/blocks/netherrack.json create mode 100644 src/generated/resources/data/c/tags/blocks/obsidians.json create mode 100644 src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json create mode 100644 src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json create mode 100644 src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json rename src/generated/resources/data/{forge => c}/tags/blocks/ore_rates/dense.json (64%) rename src/generated/resources/data/{forge/tags/items => c/tags/blocks}/ore_rates/singular.json (77%) create mode 100644 src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/coal.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/copper.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/diamond.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/emerald.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/gold.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/iron.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/lapis.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/quartz.json create mode 100644 src/generated/resources/data/c/tags/blocks/ores/redstone.json rename src/generated/resources/data/{forge => c}/tags/blocks/ores_in_ground/deepslate.json (69%) create mode 100644 src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json rename src/generated/resources/data/{forge => c}/tags/blocks/ores_in_ground/stone.json (66%) create mode 100644 src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json create mode 100644 src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json create mode 100644 src/generated/resources/data/c/tags/blocks/relocation_not_supported.json create mode 100644 src/generated/resources/data/c/tags/blocks/ropes.json create mode 100644 src/generated/resources/data/c/tags/blocks/sands.json create mode 100644 src/generated/resources/data/c/tags/blocks/sands/colorless.json create mode 100644 src/generated/resources/data/c/tags/blocks/sands/red.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/blocks.json rename src/generated/resources/data/{forge/tags/blocks/sandstone.json => c/tags/blocks/sandstone/red_blocks.json} (56%) create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/slabs.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/stairs.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json create mode 100644 src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json create mode 100644 src/generated/resources/data/c/tags/blocks/skulls.json create mode 100644 src/generated/resources/data/c/tags/blocks/stones.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json create mode 100644 src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json create mode 100644 src/generated/resources/data/c/tags/blocks/villager_job_sites.json create mode 100644 src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json create mode 100644 src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json create mode 100644 src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json create mode 100644 src/generated/resources/data/c/tags/enchantment/increase_block_drops.json create mode 100644 src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json create mode 100644 src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json create mode 100644 src/generated/resources/data/c/tags/entity_types/boats.json create mode 100644 src/generated/resources/data/c/tags/entity_types/bosses.json create mode 100644 src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json create mode 100644 src/generated/resources/data/c/tags/entity_types/minecarts.json create mode 100644 src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json create mode 100644 src/generated/resources/data/c/tags/fluids/beetroot_soup.json create mode 100644 src/generated/resources/data/c/tags/fluids/gaseous.json create mode 100644 src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json create mode 100644 src/generated/resources/data/c/tags/fluids/honey.json create mode 100644 src/generated/resources/data/c/tags/fluids/lava.json rename src/generated/resources/data/{forge => c}/tags/fluids/milk.json (71%) create mode 100644 src/generated/resources/data/c/tags/fluids/mushroom_stew.json create mode 100644 src/generated/resources/data/c/tags/fluids/potion.json create mode 100644 src/generated/resources/data/c/tags/fluids/rabbit_stew.json create mode 100644 src/generated/resources/data/c/tags/fluids/suspicious_stew.json create mode 100644 src/generated/resources/data/c/tags/fluids/water.json create mode 100644 src/generated/resources/data/c/tags/items/armors.json create mode 100644 src/generated/resources/data/c/tags/items/barrels.json create mode 100644 src/generated/resources/data/c/tags/items/barrels/wooden.json create mode 100644 src/generated/resources/data/c/tags/items/bones.json create mode 100644 src/generated/resources/data/c/tags/items/bookshelves.json create mode 100644 src/generated/resources/data/c/tags/items/bricks.json create mode 100644 src/generated/resources/data/c/tags/items/bricks/nether.json create mode 100644 src/generated/resources/data/c/tags/items/bricks/normal.json create mode 100644 src/generated/resources/data/c/tags/items/budding_blocks.json create mode 100644 src/generated/resources/data/c/tags/items/buds.json create mode 100644 src/generated/resources/data/c/tags/items/chains.json create mode 100644 src/generated/resources/data/c/tags/items/chests.json create mode 100644 src/generated/resources/data/c/tags/items/chests/ender.json create mode 100644 src/generated/resources/data/c/tags/items/chests/trapped.json create mode 100644 src/generated/resources/data/c/tags/items/chests/wooden.json create mode 100644 src/generated/resources/data/c/tags/items/clusters.json create mode 100644 src/generated/resources/data/c/tags/items/cobblestones.json create mode 100644 src/generated/resources/data/c/tags/items/cobblestones/deepslate.json create mode 100644 src/generated/resources/data/c/tags/items/cobblestones/infested.json create mode 100644 src/generated/resources/data/c/tags/items/cobblestones/mossy.json create mode 100644 src/generated/resources/data/c/tags/items/cobblestones/normal.json create mode 100644 src/generated/resources/data/c/tags/items/crops.json create mode 100644 src/generated/resources/data/c/tags/items/crops/beetroot.json create mode 100644 src/generated/resources/data/c/tags/items/crops/carrot.json create mode 100644 src/generated/resources/data/c/tags/items/crops/nether_wart.json create mode 100644 src/generated/resources/data/c/tags/items/crops/potato.json create mode 100644 src/generated/resources/data/c/tags/items/crops/wheat.json create mode 100644 src/generated/resources/data/c/tags/items/dusts.json create mode 100644 src/generated/resources/data/c/tags/items/dusts/glowstone.json create mode 100644 src/generated/resources/data/c/tags/items/dusts/redstone.json create mode 100644 src/generated/resources/data/c/tags/items/dyed.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/black.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/blue.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/brown.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/cyan.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/gray.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/green.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/light_blue.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/light_gray.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/lime.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/magenta.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/orange.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/pink.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/purple.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/red.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/white.json create mode 100644 src/generated/resources/data/c/tags/items/dyed/yellow.json create mode 100644 src/generated/resources/data/c/tags/items/dyes.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/black.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/blue.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/brown.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/cyan.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/gray.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/green.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/light_blue.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/light_gray.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/lime.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/magenta.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/orange.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/pink.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/purple.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/red.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/white.json create mode 100644 src/generated/resources/data/c/tags/items/dyes/yellow.json rename src/generated/resources/data/{forge => c}/tags/items/eggs.json (100%) create mode 100644 src/generated/resources/data/c/tags/items/enchantables.json create mode 100644 src/generated/resources/data/c/tags/items/end_stones.json create mode 100644 src/generated/resources/data/c/tags/items/ender_pearls.json create mode 100644 src/generated/resources/data/c/tags/items/feathers.json create mode 100644 src/generated/resources/data/c/tags/items/fence_gates.json rename src/generated/resources/data/{forge/tags/blocks => c/tags/items}/fence_gates/wooden.json (76%) create mode 100644 src/generated/resources/data/c/tags/items/fences.json create mode 100644 src/generated/resources/data/c/tags/items/fences/nether_brick.json create mode 100644 src/generated/resources/data/c/tags/items/fences/wooden.json create mode 100644 src/generated/resources/data/c/tags/items/foods.json create mode 100644 src/generated/resources/data/c/tags/items/foods/berries.json create mode 100644 src/generated/resources/data/c/tags/items/foods/breads.json create mode 100644 src/generated/resources/data/c/tags/items/foods/candies.json create mode 100644 src/generated/resources/data/c/tags/items/foods/cooked_fishes.json create mode 100644 src/generated/resources/data/c/tags/items/foods/cooked_meats.json create mode 100644 src/generated/resources/data/c/tags/items/foods/cookies.json rename src/generated/resources/data/{forge/tags/blocks/sand/colorless.json => c/tags/items/foods/edible_when_placed.json} (50%) create mode 100644 src/generated/resources/data/c/tags/items/foods/food_poisoning.json create mode 100644 src/generated/resources/data/c/tags/items/foods/fruits.json create mode 100644 src/generated/resources/data/c/tags/items/foods/raw_fishes.json create mode 100644 src/generated/resources/data/c/tags/items/foods/raw_meats.json create mode 100644 src/generated/resources/data/c/tags/items/foods/soups.json create mode 100644 src/generated/resources/data/c/tags/items/foods/vegetables.json create mode 100644 src/generated/resources/data/c/tags/items/gems.json create mode 100644 src/generated/resources/data/c/tags/items/gems/amethyst.json create mode 100644 src/generated/resources/data/c/tags/items/gems/diamond.json create mode 100644 src/generated/resources/data/c/tags/items/gems/emerald.json create mode 100644 src/generated/resources/data/c/tags/items/gems/lapis.json create mode 100644 src/generated/resources/data/c/tags/items/gems/prismarine.json create mode 100644 src/generated/resources/data/c/tags/items/gems/quartz.json rename src/generated/resources/data/{forge/tags/blocks/stained_glass.json => c/tags/items/glass_blocks.json} (75%) rename src/generated/resources/data/{forge/tags/blocks/glass/silica.json => c/tags/items/glass_blocks/cheap.json} (80%) create mode 100644 src/generated/resources/data/c/tags/items/glass_blocks/colorless.json create mode 100644 src/generated/resources/data/c/tags/items/glass_blocks/tinted.json rename src/generated/resources/data/{forge/tags/items/stained_glass_panes.json => c/tags/items/glass_panes.json} (95%) create mode 100644 src/generated/resources/data/c/tags/items/glass_panes/colorless.json create mode 100644 src/generated/resources/data/c/tags/items/gravel.json create mode 100644 src/generated/resources/data/c/tags/items/gunpowder.json create mode 100644 src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json create mode 100644 src/generated/resources/data/c/tags/items/ingots.json create mode 100644 src/generated/resources/data/c/tags/items/ingots/copper.json create mode 100644 src/generated/resources/data/c/tags/items/ingots/gold.json create mode 100644 src/generated/resources/data/c/tags/items/ingots/iron.json create mode 100644 src/generated/resources/data/c/tags/items/ingots/netherite.json create mode 100644 src/generated/resources/data/c/tags/items/leather.json create mode 100644 src/generated/resources/data/c/tags/items/mushrooms.json create mode 100644 src/generated/resources/data/c/tags/items/nether_stars.json create mode 100644 src/generated/resources/data/c/tags/items/netherrack.json create mode 100644 src/generated/resources/data/c/tags/items/nuggets.json create mode 100644 src/generated/resources/data/c/tags/items/nuggets/gold.json create mode 100644 src/generated/resources/data/c/tags/items/nuggets/iron.json create mode 100644 src/generated/resources/data/c/tags/items/obsidians.json create mode 100644 src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json create mode 100644 src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json create mode 100644 src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json rename src/generated/resources/data/{forge => c}/tags/items/ore_rates/dense.json (64%) rename src/generated/resources/data/{forge/tags/blocks => c/tags/items}/ore_rates/singular.json (77%) create mode 100644 src/generated/resources/data/c/tags/items/ore_rates/sparse.json create mode 100644 src/generated/resources/data/c/tags/items/ores.json create mode 100644 src/generated/resources/data/c/tags/items/ores/coal.json create mode 100644 src/generated/resources/data/c/tags/items/ores/copper.json create mode 100644 src/generated/resources/data/c/tags/items/ores/diamond.json create mode 100644 src/generated/resources/data/c/tags/items/ores/emerald.json create mode 100644 src/generated/resources/data/c/tags/items/ores/gold.json create mode 100644 src/generated/resources/data/c/tags/items/ores/iron.json create mode 100644 src/generated/resources/data/c/tags/items/ores/lapis.json create mode 100644 src/generated/resources/data/c/tags/items/ores/netherite_scrap.json create mode 100644 src/generated/resources/data/c/tags/items/ores/quartz.json create mode 100644 src/generated/resources/data/c/tags/items/ores/redstone.json rename src/generated/resources/data/{forge => c}/tags/items/ores_in_ground/deepslate.json (69%) create mode 100644 src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json rename src/generated/resources/data/{forge => c}/tags/items/ores_in_ground/stone.json (66%) create mode 100644 src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json create mode 100644 src/generated/resources/data/c/tags/items/player_workstations/furnaces.json create mode 100644 src/generated/resources/data/c/tags/items/raw_blocks.json rename src/generated/resources/data/{forge/tags/blocks/storage_blocks/raw_copper.json => c/tags/items/raw_blocks/copper.json} (100%) rename src/generated/resources/data/{forge/tags/blocks/storage_blocks/raw_gold.json => c/tags/items/raw_blocks/gold.json} (100%) rename src/generated/resources/data/{forge/tags/blocks/storage_blocks/raw_iron.json => c/tags/items/raw_blocks/iron.json} (100%) create mode 100644 src/generated/resources/data/c/tags/items/raw_materials.json create mode 100644 src/generated/resources/data/c/tags/items/raw_materials/copper.json create mode 100644 src/generated/resources/data/c/tags/items/raw_materials/gold.json create mode 100644 src/generated/resources/data/c/tags/items/raw_materials/iron.json create mode 100644 src/generated/resources/data/c/tags/items/rods.json create mode 100644 src/generated/resources/data/c/tags/items/rods/blaze.json create mode 100644 src/generated/resources/data/c/tags/items/rods/breeze.json create mode 100644 src/generated/resources/data/c/tags/items/rods/wooden.json create mode 100644 src/generated/resources/data/c/tags/items/ropes.json create mode 100644 src/generated/resources/data/c/tags/items/sands.json create mode 100644 src/generated/resources/data/c/tags/items/sands/colorless.json create mode 100644 src/generated/resources/data/c/tags/items/sands/red.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/blocks.json rename src/generated/resources/data/{forge/tags/items/sandstone.json => c/tags/items/sandstone/red_blocks.json} (56%) create mode 100644 src/generated/resources/data/c/tags/items/sandstone/red_slabs.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/red_stairs.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/slabs.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/stairs.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json create mode 100644 src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json create mode 100644 src/generated/resources/data/c/tags/items/seeds.json create mode 100644 src/generated/resources/data/c/tags/items/seeds/beetroot.json create mode 100644 src/generated/resources/data/c/tags/items/seeds/melon.json create mode 100644 src/generated/resources/data/c/tags/items/seeds/pumpkin.json create mode 100644 src/generated/resources/data/c/tags/items/seeds/wheat.json create mode 100644 src/generated/resources/data/c/tags/items/slimeballs.json create mode 100644 src/generated/resources/data/c/tags/items/stones.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/coal.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/copper.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/diamond.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/emerald.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/gold.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/iron.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/lapis.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/netherite.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/redstone.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/slime.json create mode 100644 src/generated/resources/data/c/tags/items/storage_blocks/wheat.json create mode 100644 src/generated/resources/data/c/tags/items/strings.json create mode 100644 src/generated/resources/data/c/tags/items/tools.json create mode 100644 src/generated/resources/data/c/tags/items/tools/bows.json create mode 100644 src/generated/resources/data/c/tags/items/tools/brushes.json create mode 100644 src/generated/resources/data/c/tags/items/tools/crossbows.json create mode 100644 src/generated/resources/data/c/tags/items/tools/fishing_rods.json create mode 100644 src/generated/resources/data/c/tags/items/tools/shears.json create mode 100644 src/generated/resources/data/c/tags/items/tools/shields.json create mode 100644 src/generated/resources/data/c/tags/items/tools/spears.json create mode 100644 src/generated/resources/data/c/tags/items/villager_job_sites.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_beach.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_cave.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_cold.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_cold.json => c/tags/worldgen/biome/is_cold/nether.json} (57%) rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_cold/overworld.json (80%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dead.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_desert.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dry.json rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_dry/end.json (59%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_hot => c/tags/worldgen/biome/is_dry}/nether.json (59%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_end.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_floral.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_forest.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_hill.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_hot.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_hot.json => c/tags/worldgen/biome/is_hot/end.json} (60%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_dry => c/tags/worldgen/biome/is_hot}/nether.json (59%) rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_hot/overworld.json (70%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_icy.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_lush.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_magical.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_modified.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_nether.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_dense/overworld.json => c/tags/worldgen/biome/is_old_growth.json} (65%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_cold/end.json => c/tags/worldgen/biome/is_outer_end_island.json} (64%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_plains.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_slope.json => c/tags/worldgen/biome/is_plateau.json} (52%) rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_rare.json (82%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_water.json => c/tags/worldgen/biome/is_river.json} (63%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_snowy.json (70%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_wasteland.json => c/tags/worldgen/biome/is_snowy_plains.json} (100%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_sparse.json => c/tags/worldgen/biome/is_sparse_vegetation/nether.json} (65%) rename src/generated/resources/data/{forge/tags/worldgen/biome/is_sparse => c/tags/worldgen/biome/is_sparse_vegetation}/overworld.json (63%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json rename src/generated/resources/data/{forge/tags/items/tools/bows.json => c/tags/worldgen/biome/is_tree/jungle.json} (51%) rename src/generated/resources/data/{forge/tags/items/bones.json => c/tags/worldgen/biome/is_tree/savanna.json} (50%) rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_underground.json (50%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_void.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_wet.json rename src/generated/resources/data/{forge/tags/blocks/cobblestone/deepslate.json => c/tags/worldgen/biome/is_wet/end.json} (60%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json rename src/generated/resources/data/{forge => c}/tags/worldgen/biome/is_wet/overworld.json (56%) create mode 100644 src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json rename src/generated/resources/data/{forge/tags/worldgen/biome/is_spooky.json => c/tags/worldgen/biome/no_default_monsters.json} (58%) create mode 100644 src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json create mode 100644 src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/barrels.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/barrels/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/bookshelves.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/chests.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/chests/ender.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/chests/trapped.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/chests/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/cobblestone.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/end_stones.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/fence_gates.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/fences.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/fences/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/black.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/blue.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/brown.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/colorless.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/cyan.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/gray.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/green.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/light_blue.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/light_gray.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/lime.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/magenta.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/orange.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/pink.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/purple.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/red.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/tinted.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/white.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass/yellow.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/black.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/green.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/red.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/white.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/gravel.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/obsidian.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/coal.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/copper.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/diamond.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/emerald.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/gold.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/iron.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/lapis.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/quartz.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores/redstone.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/sand.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/sand/red.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/stone.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json delete mode 100644 src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json delete mode 100644 src/generated/resources/data/forge/tags/damage_type/is_poison.json delete mode 100644 src/generated/resources/data/forge/tags/damage_type/is_technical.json delete mode 100644 src/generated/resources/data/forge/tags/damage_type/is_wither.json delete mode 100644 src/generated/resources/data/forge/tags/entity_types/bosses.json delete mode 100644 src/generated/resources/data/forge/tags/items/armors.json delete mode 100644 src/generated/resources/data/forge/tags/items/armors/boots.json delete mode 100644 src/generated/resources/data/forge/tags/items/armors/chestplates.json delete mode 100644 src/generated/resources/data/forge/tags/items/armors/helmets.json delete mode 100644 src/generated/resources/data/forge/tags/items/armors/leggings.json delete mode 100644 src/generated/resources/data/forge/tags/items/barrels.json delete mode 100644 src/generated/resources/data/forge/tags/items/barrels/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/items/bookshelves.json delete mode 100644 src/generated/resources/data/forge/tags/items/chests.json delete mode 100644 src/generated/resources/data/forge/tags/items/chests/ender.json delete mode 100644 src/generated/resources/data/forge/tags/items/chests/trapped.json delete mode 100644 src/generated/resources/data/forge/tags/items/chests/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/items/cobblestone.json delete mode 100644 src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json delete mode 100644 src/generated/resources/data/forge/tags/items/cobblestone/infested.json delete mode 100644 src/generated/resources/data/forge/tags/items/cobblestone/mossy.json delete mode 100644 src/generated/resources/data/forge/tags/items/cobblestone/normal.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops/beetroot.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops/carrot.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops/nether_wart.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops/potato.json delete mode 100644 src/generated/resources/data/forge/tags/items/crops/wheat.json delete mode 100644 src/generated/resources/data/forge/tags/items/dusts.json delete mode 100644 src/generated/resources/data/forge/tags/items/dusts/glowstone.json delete mode 100644 src/generated/resources/data/forge/tags/items/dusts/prismarine.json delete mode 100644 src/generated/resources/data/forge/tags/items/dusts/redstone.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/black.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/brown.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/cyan.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/green.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/light_blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/light_gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/lime.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/magenta.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/orange.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/pink.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/purple.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/red.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/white.json delete mode 100644 src/generated/resources/data/forge/tags/items/dyes/yellow.json delete mode 100644 src/generated/resources/data/forge/tags/items/enchanting_fuels.json delete mode 100644 src/generated/resources/data/forge/tags/items/end_stones.json delete mode 100644 src/generated/resources/data/forge/tags/items/ender_pearls.json delete mode 100644 src/generated/resources/data/forge/tags/items/feathers.json delete mode 100644 src/generated/resources/data/forge/tags/items/fence_gates.json delete mode 100644 src/generated/resources/data/forge/tags/items/fences.json delete mode 100644 src/generated/resources/data/forge/tags/items/fences/nether_brick.json delete mode 100644 src/generated/resources/data/forge/tags/items/fences/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/amethyst.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/diamond.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/emerald.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/lapis.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/prismarine.json delete mode 100644 src/generated/resources/data/forge/tags/items/gems/quartz.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/black.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/brown.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/colorless.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/cyan.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/green.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/light_blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/light_gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/lime.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/magenta.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/orange.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/pink.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/purple.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/red.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/tinted.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/white.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass/yellow.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/black.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/brown.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/colorless.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/cyan.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/green.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/lime.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/magenta.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/orange.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/pink.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/purple.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/red.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/white.json delete mode 100644 src/generated/resources/data/forge/tags/items/glass_panes/yellow.json delete mode 100644 src/generated/resources/data/forge/tags/items/gravel.json delete mode 100644 src/generated/resources/data/forge/tags/items/gunpowder.json delete mode 100644 src/generated/resources/data/forge/tags/items/heads.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/brick.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/copper.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/nether_brick.json delete mode 100644 src/generated/resources/data/forge/tags/items/ingots/netherite.json delete mode 100644 src/generated/resources/data/forge/tags/items/leather.json delete mode 100644 src/generated/resources/data/forge/tags/items/mushrooms.json delete mode 100644 src/generated/resources/data/forge/tags/items/nether_stars.json delete mode 100644 src/generated/resources/data/forge/tags/items/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/items/nuggets.json delete mode 100644 src/generated/resources/data/forge/tags/items/nuggets/gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/nuggets/iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/obsidian.json delete mode 100644 src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json delete mode 100644 src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json delete mode 100644 src/generated/resources/data/forge/tags/items/ore_rates/sparse.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/coal.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/copper.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/diamond.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/emerald.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/lapis.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/quartz.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores/redstone.json delete mode 100644 src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json delete mode 100644 src/generated/resources/data/forge/tags/items/raw_materials.json delete mode 100644 src/generated/resources/data/forge/tags/items/raw_materials/copper.json delete mode 100644 src/generated/resources/data/forge/tags/items/raw_materials/gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/raw_materials/iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/rods.json delete mode 100644 src/generated/resources/data/forge/tags/items/rods/blaze.json delete mode 100644 src/generated/resources/data/forge/tags/items/rods/wooden.json delete mode 100644 src/generated/resources/data/forge/tags/items/sand.json delete mode 100644 src/generated/resources/data/forge/tags/items/sand/red.json delete mode 100644 src/generated/resources/data/forge/tags/items/seeds.json delete mode 100644 src/generated/resources/data/forge/tags/items/seeds/beetroot.json delete mode 100644 src/generated/resources/data/forge/tags/items/seeds/melon.json delete mode 100644 src/generated/resources/data/forge/tags/items/seeds/pumpkin.json delete mode 100644 src/generated/resources/data/forge/tags/items/seeds/wheat.json delete mode 100644 src/generated/resources/data/forge/tags/items/shears.json delete mode 100644 src/generated/resources/data/forge/tags/items/slimeballs.json delete mode 100644 src/generated/resources/data/forge/tags/items/stone.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/coal.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/copper.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json delete mode 100644 src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json delete mode 100644 src/generated/resources/data/forge/tags/items/string.json delete mode 100644 src/generated/resources/data/forge/tags/items/tools.json delete mode 100644 src/generated/resources/data/forge/tags/items/tools/crossbows.json delete mode 100644 src/generated/resources/data/forge/tags/items/tools/fishing_rods.json delete mode 100644 src/generated/resources/data/forge/tags/items/tools/shields.json delete mode 100644 src/generated/resources/data/forge/tags/items/tools/tridents.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_void.json delete mode 100644 src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json create mode 100644 src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json rename src/generated/resources/data/{forge => neoforge}/tags/damage_type/is_environment.json (83%) rename src/generated/resources/data/{forge => neoforge}/tags/damage_type/is_magic.json (51%) rename src/generated/resources/data/{forge => neoforge}/tags/damage_type/is_physical.json (85%) create mode 100644 src/generated/resources/data/neoforge/tags/damage_type/is_poison.json create mode 100644 src/generated/resources/data/neoforge/tags/damage_type/is_technical.json create mode 100644 src/generated/resources/data/neoforge/tags/damage_type/is_wither.json create mode 100644 src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json rename src/generated/resources/data/{forge/tags/items/sand/colorless.json => neoforge/tags/items/enchanting_fuels.json} (50%) delete mode 100644 src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java create mode 100644 src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java rename src/main/java/net/neoforged/neoforge/client/event/{RenderGuiOverlayEvent.java => RenderGuiLayerEvent.java} (51%) create mode 100644 src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java create mode 100644 src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java create mode 100644 src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java delete mode 100644 src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java create mode 100644 src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java create mode 100644 src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java create mode 100644 src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java delete mode 100644 src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java delete mode 100644 src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java delete mode 100644 src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java delete mode 100644 src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java create mode 100644 src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java delete mode 100644 src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java create mode 100644 src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java create mode 100644 src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java create mode 100644 src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java create mode 100644 src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java create mode 100644 src/main/java/net/neoforged/neoforge/event/brewing/RegisterBrewingRecipesEvent.java create mode 100644 src/main/java/net/neoforged/neoforge/fluids/SimpleFluidContent.java create mode 100644 src/main/java/net/neoforged/neoforge/network/codec/NeoForgeStreamCodecs.java rename src/main/java/net/neoforged/neoforge/{client/gui/overlay => network/codec}/package-info.java (86%) delete mode 100644 src/main/java/net/neoforged/neoforge/network/configuration/SyncTierSortingRegistry.java create mode 100644 src/main/java/net/neoforged/neoforge/network/connection/ChannelAwareFriendlyByteBuf.java delete mode 100644 src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistryPayload.java delete mode 100644 src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistrySyncCompletePayload.java rename src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (94%) rename testframework/src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (100%) create mode 100644 tests/src/generated/resources/assets/neotests_extending_connected_block/blockstates/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_extending_connected_block/lang/en_us.json rename tests/src/generated/resources/assets/{tag_based_tool_types/models/block/test_stone.json => neotests_extending_connected_block/models/block/destroy_on_piston_move.json} (61%) create mode 100644 tests/src/generated/resources/assets/neotests_extending_connected_block/models/item/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_extending_piston_head/blockstates/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_extending_piston_head/lang/en_us.json create mode 100644 tests/src/generated/resources/assets/neotests_extending_piston_head/models/block/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_extending_piston_head/models/item/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_player_destroy/blockstates/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_player_destroy/lang/en_us.json create mode 100644 tests/src/generated/resources/assets/neotests_player_destroy/models/block/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_player_destroy/models/item/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_push_only_reaction/blockstates/push_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_push_only_reaction/lang/en_us.json create mode 100644 tests/src/generated/resources/assets/neotests_push_only_reaction/models/block/push_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_push_only_reaction/models/item/push_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_retracting_connected_block/blockstates/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_retracting_connected_block/lang/en_us.json create mode 100644 tests/src/generated/resources/assets/neotests_retracting_connected_block/models/block/destroy_on_piston_move.json create mode 100644 tests/src/generated/resources/assets/neotests_retracting_connected_block/models/item/destroy_on_piston_move.json delete mode 100644 tests/src/generated/resources/assets/tag_based_tool_types/blockstates/test_stone.json delete mode 100644 tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_stone.json delete mode 100644 tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_tool.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/advancements/recipes/misc/test_smithing.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/recipes/test_smithing.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_blasting.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shaped.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shapeless.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_blasting.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shaped.json delete mode 100644 tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shapeless.json delete mode 100644 tests/src/generated/resources/data/neotests_partial_attachment_ingredient/advancements/recipes/misc/partial_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_partial_attachment_ingredient/recipes/partial_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/advancements/recipes/misc/partial_nbt_and_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/recipes/partial_nbt_and_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_strict_attachment_ingredient/advancements/recipes/misc/strict_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_strict_attachment_ingredient/recipes/strict_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/advancements/recipes/misc/strict_attachments.json delete mode 100644 tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/recipes/strict_attachments.json delete mode 100644 tests/src/generated/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json delete mode 100644 tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json delete mode 100644 tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json create mode 100644 tests/src/main/java/net/neoforged/neoforge/debug/capabilities/FluidTemplatesTests.java create mode 100644 tests/src/main/java/net/neoforged/neoforge/debug/item/ItemComponentTests.java delete mode 100644 tests/src/main/java/net/neoforged/neoforge/oldtest/CodecsTest.java delete mode 100644 tests/src/main/java/net/neoforged/neoforge/oldtest/entity/GravityAttributeTest.java delete mode 100644 tests/src/main/java/net/neoforged/neoforge/oldtest/item/TagBasedToolTypesTest.java rename tests/src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (97%) diff --git a/build.gradle b/build.gradle index 6c8c9f33ec..cd198aacdb 100644 --- a/build.gradle +++ b/build.gradle @@ -9,28 +9,36 @@ plugins { apply plugin: 'net.neoforged.gradleutils' -gradleutils.version { - minecraftVersion project.minecraft_version - versionPrefix = null // Reset version prefix, which is set by prev. line - tags { - label = 'beta' - cleanMarkerLabel = 'stable' +ext.isPreReleaseVersion = project.minecraft_version.contains("w") || project.minecraft_version.contains("-") + +if (isPreReleaseVersion) { + project.version = "${project.neoforge_snapshot_next_stable}.0-alpha.${project.minecraft_version}.${(new Date()).format('yyyyMMdd.HHmmss', TimeZone.getTimeZone('UTC'))}" +} else { + gradleutils.version { + minecraftVersion project.minecraft_version + versionPrefix = null // Reset version prefix, which is set by prev. line + tags { + label = 'beta' + cleanMarkerLabel = 'stable' + } + branches { + suffixBranch = true + } } - branches { - suffixBranch = true + + changelog { + from '20.4' + disableAutomaticPublicationRegistration() } -} -changelog { - from '20.4' - disableAutomaticPublicationRegistration() + project.version = gradleutils.getTagOffsetVersion() } // Print version, generally useful to know - also appears on CI -System.out.println("NeoForge version ${gradleutils.version.toString()}") +System.out.println("NeoForge version ${project.version}") allprojects { - version gradleutils.version.toString() + version rootProject.version group 'net.neoforged' repositories { mavenLocal() diff --git a/gradle.properties b/gradle.properties index d908c24c54..04aacb3301 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,16 +7,18 @@ org.gradle.caching=true org.gradle.configuration-cache=false org.gradle.debug=false -java_version=17 +java_version=21 -minecraft_version=1.20.4 -neoform_version=20231207.154220 +minecraft_version=1.20.5-pre1 +neoform_version=20240410.221336 +# on snapshot versions, used to prefix the version +neoforge_snapshot_next_stable=20.5 mergetool_version=2.0.0 accesstransformers_version=10.0.1 coremods_version=6.0.4 eventbus_version=7.2.0 -modlauncher_version=10.0.9 +modlauncher_version=10.1.10 securejarhandler_version=2.1.24 bootstraplauncher_version=1.1.2 asm_version=9.5 @@ -29,9 +31,9 @@ jetbrains_annotations_version=24.0.1 slf4j_api_version=2.0.7 apache_maven_artifact_version=3.8.5 jarjar_version=0.4.0 -fancy_mod_loader_version=2.0.17 +fancy_mod_loader_version=3.0.10 mojang_logging_version=1.1.1 -log4j_version=2.19.0 +log4j_version=2.22.1 guava_version=31.1.2-jre gson_version=2.10.1 apache_commons_lang3_version=3.13.0 diff --git a/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 003e87a4ce..60dcaed7f3 100644 --- a/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -10,7 +10,7 @@ + GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); } - this.setFilterMode(9728); + this.setFilterMode(9728, true); @@ -117,7 +_,14 @@ GlStateManager._glBindFramebuffer(36160, this.frameBufferId); GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0); @@ -26,7 +26,7 @@ } this.checkStatus(); -@@ -275,4 +_,27 @@ +@@ -281,4 +_,27 @@ public int getDepthTextureId() { return this.depthBufferId; } diff --git a/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch b/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch index bdeaa81d23..cf132da04b 100644 --- a/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch +++ b/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/systems/RenderSystem.java +++ b/com/mojang/blaze3d/systems/RenderSystem.java -@@ -1030,4 +_,14 @@ +@@ -1014,4 +_,14 @@ void accept(it.unimi.dsi.fastutil.ints.IntConsumer p_157488_, int p_157489_); } } diff --git a/patches/com/mojang/blaze3d/vertex/BufferBuilder.java.patch b/patches/com/mojang/blaze3d/vertex/BufferBuilder.java.patch index 30e961d331..6d06bdcd45 100644 --- a/patches/com/mojang/blaze3d/vertex/BufferBuilder.java.patch +++ b/patches/com/mojang/blaze3d/vertex/BufferBuilder.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/BufferBuilder.java +++ b/com/mojang/blaze3d/vertex/BufferBuilder.java -@@ -495,4 +_,14 @@ +@@ -496,4 +_,14 @@ this.sorting = p_277855_; } } diff --git a/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch b/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch index 26e0edbb9a..a21f52da74 100644 --- a/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch +++ b/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch @@ -1,7 +1,7 @@ --- a/com/mojang/blaze3d/vertex/PoseStack.java +++ b/com/mojang/blaze3d/vertex/PoseStack.java -@@ -12,7 +_,7 @@ - import org.joml.Quaternionf; +@@ -13,7 +_,7 @@ + import org.joml.Vector3f; @OnlyIn(Dist.CLIENT) -public class PoseStack { diff --git a/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch b/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch deleted file mode 100644 index 17184211f0..0000000000 --- a/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java -+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java -@@ -47,7 +_,7 @@ - @Override - public void endVertex() { - Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz)); -- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z()); -+ Direction direction = Direction.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z()); - Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F)); - vector4f.rotateY((float) Math.PI); - vector4f.rotateX((float) (-Math.PI / 2)); diff --git a/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch b/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch index b51e2af598..f31d826135 100644 --- a/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch +++ b/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/VertexConsumer.java +++ b/com/mojang/blaze3d/vertex/VertexConsumer.java -@@ -14,7 +_,7 @@ +@@ -13,7 +_,7 @@ import org.lwjgl.system.MemoryStack; @OnlyIn(Dist.CLIENT) @@ -9,30 +9,20 @@ VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_); VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_); -@@ -101,6 +_,10 @@ - int p_86003_, - boolean p_86004_ - ) { -+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_); -+ } -+ -+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) { - float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]}; - int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]}; - int[] aint1 = p_85997_.getVertices(); -@@ -136,11 +_,13 @@ - f5 = afloat[k] * p_86001_; +@@ -139,11 +_,14 @@ + f5 = afloat[k] * p_85992_; } - int l = aint[k]; -+ int l = applyBakedLighting(p_86002_[k], bytebuffer); ++ int l = applyBakedLighting(p_331378_[k], bytebuffer); float f9 = bytebuffer.getFloat(16); float f10 = bytebuffer.getFloat(20); Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F)); -- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); -+ applyBakedNormals(vector3f, bytebuffer, p_85996_.normal()); -+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha; -+ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); +- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, p_331416_, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z()); ++ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal()); ++ // Neo: also apply alpha that's coming from the baked quad ++ float vertexAlpha = p_331268_ ? p_331416_ * (float) (bytebuffer.get(15) & 255) / 255.0F : p_331416_; ++ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z()); } } } diff --git a/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch b/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch index ab30583627..0aeabbbe5e 100644 --- a/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch +++ b/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/VertexFormatElement.java +++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java -@@ -93,6 +_,10 @@ +@@ -91,6 +_,10 @@ this.usage.clearBufferState(this.index, p_166964_); } @@ -11,7 +11,7 @@ @OnlyIn(Dist.CLIENT) public static enum Type { FLOAT(4, "Float", 5126), -@@ -127,7 +_,7 @@ +@@ -125,7 +_,7 @@ } @OnlyIn(Dist.CLIENT) @@ -20,7 +20,7 @@ POSITION("Position", (p_167043_, p_167044_, p_167045_, p_167046_, p_167047_, p_167048_) -> { GlStateManager._enableVertexAttribArray(p_167048_); GlStateManager._vertexAttribPointer(p_167048_, p_167043_, p_167044_, false, p_167045_, p_167046_); -@@ -188,6 +_,10 @@ +@@ -186,6 +_,10 @@ @OnlyIn(Dist.CLIENT) public interface SetupState { void setupBufferState(int p_167053_, int p_167054_, int p_167055_, long p_167056_, int p_167057_, int p_167058_); diff --git a/patches/com/mojang/realmsclient/RealmsAvailability.java.patch b/patches/com/mojang/realmsclient/RealmsAvailability.java.patch deleted file mode 100644 index 0167248963..0000000000 --- a/patches/com/mojang/realmsclient/RealmsAvailability.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/com/mojang/realmsclient/RealmsAvailability.java -+++ b/com/mojang/realmsclient/RealmsAvailability.java -@@ -38,6 +_,12 @@ - private static CompletableFuture check() { - return CompletableFuture.supplyAsync( - () -> { -+ if (!net.neoforged.fml.loading.FMLLoader.isProduction() && net.minecraft.client.Minecraft.getInstance().getUser().getAccessToken().equals("0")) { -+ // Neo: we use '0' in dev, so short-circuit to avoid exception -+ LOGGER.trace("User access token is '0'. Skipping realms availability check."); -+ return new RealmsAvailability.Result(Type.AUTHENTICATION_ERROR); -+ } -+ - RealmsClient realmsclient = RealmsClient.create(); - - try { diff --git a/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index dfd8fde7ac..36f6a45b7d 100644 --- a/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java -@@ -66,6 +_,15 @@ +@@ -69,6 +_,15 @@ } @Override diff --git a/patches/net/minecraft/CrashReport.java.patch b/patches/net/minecraft/CrashReport.java.patch index 0d5c42822f..c04957c468 100644 --- a/patches/net/minecraft/CrashReport.java.patch +++ b/patches/net/minecraft/CrashReport.java.patch @@ -6,7 +6,7 @@ p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); - p_127520_.append("Stacktrace:\n"); - -- for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { +- for (StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { - p_127520_.append("\t").append("at ").append(stacktraceelement); - p_127520_.append("\n"); - } @@ -16,7 +16,7 @@ + p_127520_.append(net.neoforged.neoforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace)); } - for(CrashReportCategory crashreportcategory : this.details) { + for (CrashReportCategory crashreportcategory : this.details) { @@ -74,6 +_,7 @@ p_127520_.append("\n\n"); } diff --git a/patches/net/minecraft/CrashReportCategory.java.patch b/patches/net/minecraft/CrashReportCategory.java.patch index b72249ebb3..50c9e7294b 100644 --- a/patches/net/minecraft/CrashReportCategory.java.patch +++ b/patches/net/minecraft/CrashReportCategory.java.patch @@ -18,7 +18,7 @@ if (this.stackTrace != null && this.stackTrace.length > 0) { p_128169_.append("\nStacktrace:"); - -- for(StackTraceElement stacktraceelement : this.stackTrace) { +- for (StackTraceElement stacktraceelement : this.stackTrace) { - p_128169_.append("\n\tat "); - p_128169_.append(stacktraceelement); - } diff --git a/patches/net/minecraft/SharedConstants.java.patch b/patches/net/minecraft/SharedConstants.java.patch index 46185759ea..7626d97bb9 100644 --- a/patches/net/minecraft/SharedConstants.java.patch +++ b/patches/net/minecraft/SharedConstants.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -122,7 +_,8 @@ - public static final long MAXIMUM_TICK_TIME_NANOS = Duration.ofMillis(300L).toNanos(); +@@ -123,7 +_,8 @@ public static final boolean USE_WORKFLOWS_HOOKS = false; + public static final boolean USE_DEVONLY = false; public static boolean CHECK_DATA_FIXER_SCHEMA = true; - public static boolean IS_RUNNING_IN_IDE; + public static boolean IS_RUNNING_IN_IDE = !net.neoforged.fml.loading.FMLLoader.isProduction(); @@ -10,7 +10,7 @@ public static Set DATA_FIX_TYPES_TO_OPTIMIZE = Set.of(); public static final int WORLD_RESOLUTION = 16; public static final int MAX_CHAT_LENGTH = 256; -@@ -204,6 +_,7 @@ +@@ -181,6 +_,7 @@ } static { diff --git a/patches/net/minecraft/Util.java.patch b/patches/net/minecraft/Util.java.patch index bb35ceb772..632e23e46d 100644 --- a/patches/net/minecraft/Util.java.patch +++ b/patches/net/minecraft/Util.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -261,8 +_,8 @@ +@@ -267,8 +_,8 @@ .getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())) .getChoiceType(p_137552_, p_137553_); } catch (IllegalArgumentException illegalargumentexception) { @@ -11,7 +11,7 @@ throw illegalargumentexception; } } -@@ -438,20 +_,20 @@ +@@ -488,20 +_,20 @@ public static void logAndPauseIfInIde(String p_143786_) { LOGGER.error(p_143786_); diff --git a/patches/net/minecraft/advancements/Advancement.java.patch b/patches/net/minecraft/advancements/Advancement.java.patch index e13d970dfd..8a488857dc 100644 --- a/patches/net/minecraft/advancements/Advancement.java.patch +++ b/patches/net/minecraft/advancements/Advancement.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/advancements/Advancement.java +++ b/net/minecraft/advancements/Advancement.java -@@ -54,6 +_,7 @@ - ), - Advancement::validate - ); +@@ -52,6 +_,7 @@ + ) + .validate(Advancement::validate); + public static final StreamCodec STREAM_CODEC = StreamCodec.ofMember(Advancement::write, Advancement::read); + public static final Codec>> CONDITIONAL_CODEC = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodecWithConditions(CODEC); public Advancement( Optional p_300893_, -@@ -113,7 +_,7 @@ +@@ -111,7 +_,7 @@ }); } diff --git a/patches/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/net/minecraft/advancements/AdvancementRewards.java.patch index 03e638e122..2b4fd0ad19 100644 --- a/patches/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/net/minecraft/advancements/AdvancementRewards.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java -@@ -37,6 +_,7 @@ +@@ -40,6 +_,7 @@ LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel()) .withParameter(LootContextParams.THIS_ENTITY, p_9990_) .withParameter(LootContextParams.ORIGIN, p_9990_.position()) diff --git a/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch b/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch deleted file mode 100644 index 2dc030d0bf..0000000000 --- a/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/net/minecraft/advancements/critereon/EntityPredicate.java -+++ b/net/minecraft/advancements/critereon/EntityPredicate.java -@@ -36,9 +_,10 @@ - Optional vehicle, - Optional passenger, - Optional targetedEntity, -- Optional team -+ Optional team, -+ Optional customLogic - ) { -- public static final Codec CODEC = ExtraCodecs.recursive( -+ public static final Codec VANILLA_CODEC = ExtraCodecs.recursive( - "EntityPredicate", - p_297888_ -> RecordCodecBuilder.create( - p_297890_ -> p_297890_.group( -@@ -59,8 +_,26 @@ - .apply(p_297890_, EntityPredicate::new) - ) - ); -+ public static final Codec CODEC = ExtraCodecs.either( -+ net.neoforged.neoforge.registries.NeoForgeRegistries.ENTITY_PREDICATE_SERIALIZERS.byNameCodec() -+ .dispatch( -+ net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate::codec, -+ java.util.function.Function.identity()), -+ VANILLA_CODEC -+ ).xmap(either -> either.map(EntityPredicate::new, p -> p), -+ // Serialize using dispatch codec if custom logic is present, otherwise use vanilla codec -+ predicate -> predicate.customLogic.>map( -+ com.mojang.datafixers.util.Either::left).orElseGet(() -> com.mojang.datafixers.util.Either.right(predicate))); - public static final Codec ADVANCEMENT_CODEC = ExtraCodecs.withAlternative(ContextAwarePredicate.CODEC, CODEC, EntityPredicate::wrap); - -+ public EntityPredicate(Optional entityType, Optional distanceToPlayer, Optional location, Optional steppingOnLocation, Optional effects, Optional nbt, Optional flags, Optional equipment, Optional subPredicate, Optional vehicle, Optional passenger, Optional targetedEntity, Optional team) { -+ this(entityType, distanceToPlayer, location, steppingOnLocation, effects, nbt, flags, equipment, subPredicate, vehicle, passenger, targetedEntity, team, Optional.empty()); -+ } -+ -+ public EntityPredicate(net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate customLogic) { -+ this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(customLogic)); -+ } -+ - public static ContextAwarePredicate wrap(EntityPredicate.Builder p_298222_) { - return wrap(p_298222_.build()); - } -@@ -83,6 +_,9 @@ - } - - public boolean matches(ServerLevel p_36608_, @Nullable Vec3 p_36609_, @Nullable Entity p_36610_) { -+ if (p_36610_ != null && this.customLogic.isPresent()) { -+ return this.customLogic.get().test(p_36608_, p_36609_, p_36610_); -+ } - if (p_36610_ == null) { - return false; - } else if (this.entityType.isPresent() && !this.entityType.get().matches(p_36610_.getType())) { diff --git a/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch b/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch new file mode 100644 index 0000000000..0ac4af6c6a --- /dev/null +++ b/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java ++++ b/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java +@@ -23,6 +_,11 @@ + return this.enchantments; + } + ++ @Override // NEO: use getAllEnchantments for enchantments ++ public boolean matches(ItemStack p_333958_) { ++ return matches(p_333958_, p_333958_.getAllEnchantments()); ++ } ++ + public boolean matches(ItemStack p_333811_, ItemEnchantments p_334059_) { + for (EnchantmentPredicate enchantmentpredicate : this.enchantments) { + if (!enchantmentpredicate.containedIn(p_334059_)) { diff --git a/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch b/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch deleted file mode 100644 index b83d3c039f..0000000000 --- a/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/net/minecraft/advancements/critereon/ItemPredicate.java -+++ b/net/minecraft/advancements/critereon/ItemPredicate.java -@@ -31,13 +_,14 @@ - List enchantments, - List storedEnchantments, - Optional> potion, -- Optional nbt -+ Optional nbt, -+ Optional customLogic - ) { - private static final Codec> ITEMS_CODEC = BuiltInRegistries.ITEM - .holderByNameCodec() - .listOf() - .xmap(HolderSet::direct, p_297903_ -> p_297903_.stream().toList()); -- public static final Codec CODEC = RecordCodecBuilder.create( -+ public static final Codec VANILLA_CODEC = RecordCodecBuilder.create( - p_297904_ -> p_297904_.group( - ExtraCodecs.strictOptionalField(TagKey.codec(Registries.ITEM), "tag").forGetter(ItemPredicate::tag), - ExtraCodecs.strictOptionalField(ITEMS_CODEC, "items").forGetter(ItemPredicate::items), -@@ -51,8 +_,34 @@ - ) - .apply(p_297904_, ItemPredicate::new) - ); -+ //TODO - 1.20.5: Make this final -+ public static Codec CODEC = ExtraCodecs.either( -+ net.neoforged.neoforge.registries.NeoForgeRegistries.ITEM_PREDICATE_SERIALIZERS.byNameCodec() -+ .dispatch( -+ net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate::codec, -+ java.util.function.Function.identity()), -+ VANILLA_CODEC -+ ).xmap(either -> either.map(ItemPredicate::new, p -> p), predicate -> { -+ // Serialize using dispatch codec if custom logic is present, otherwise use vanilla codec -+ if (predicate.customLogic.isPresent()) { -+ return com.mojang.datafixers.util.Either.left(predicate.customLogic.get()); -+ } else { -+ return com.mojang.datafixers.util.Either.right(predicate); -+ } -+ }); -+ -+ public ItemPredicate(Optional> tag, Optional> items, MinMaxBounds.Ints count, MinMaxBounds.Ints durability, List enchantments, List storedEnchantments, Optional> potion, Optional nbt) { -+ this(tag, items, count, durability, enchantments, storedEnchantments, potion, nbt, Optional.empty()); -+ } -+ -+ public ItemPredicate(net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate customLogic) { -+ this(Optional.empty(), Optional.empty(), MinMaxBounds.Ints.ANY, MinMaxBounds.Ints.ANY, List.of(), List.of(), Optional.empty(), Optional.empty(), Optional.of(customLogic)); -+ } - - public boolean matches(ItemStack p_45050_) { -+ if (this.customLogic.isPresent()) { -+ return this.customLogic.get().test(p_45050_); -+ } - if (this.tag.isPresent() && !p_45050_.is(this.tag.get())) { - return false; - } else if (this.items.isPresent() && !p_45050_.is(this.items.get())) { -@@ -67,7 +_,7 @@ - return false; - } else { - if (!this.enchantments.isEmpty()) { -- Map map = EnchantmentHelper.deserializeEnchantments(p_45050_.getEnchantmentTags()); -+ Map map = p_45050_.getAllEnchantments(); - - for(EnchantmentPredicate enchantmentpredicate : this.enchantments) { - if (!enchantmentpredicate.containedIn(map)) { diff --git a/patches/net/minecraft/client/Camera.java.patch b/patches/net/minecraft/client/Camera.java.patch index 886220ed29..638694e2cb 100644 --- a/patches/net/minecraft/client/Camera.java.patch +++ b/patches/net/minecraft/client/Camera.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/Camera.java +++ b/net/minecraft/client/Camera.java -@@ -56,7 +_,7 @@ - this.setRotation(this.yRot + 180.0F, -this.xRot); +@@ -58,7 +_,7 @@ } -- this.move(-this.getMaxZoom(4.0), 0.0, 0.0); -+ this.move(-this.getMaxZoom(net.neoforged.neoforge.client.ClientHooks.getDetachedCameraDistance(this, p_90579_, 4.0)), 0.0, 0.0); + float f = p_90577_ instanceof LivingEntity livingentity ? livingentity.getScale() : 1.0F; +- this.move(-this.getMaxZoom((double)(4.0F * f)), 0.0, 0.0); ++ this.move(-this.getMaxZoom((double)(net.neoforged.neoforge.client.ClientHooks.getDetachedCameraDistance(this, p_90579_, f, 4.0) * f)), 0.0, 0.0); } else if (p_90577_ instanceof LivingEntity && ((LivingEntity)p_90577_).isSleeping()) { Direction direction = ((LivingEntity)p_90577_).getBedOrientation(); this.setRotation(direction != null ? direction.toYRot() - 180.0F : 0.0F, 0.0F); -@@ -223,6 +_,18 @@ +@@ -225,6 +_,18 @@ public float getPartialTickTime() { return this.partialTickTime; diff --git a/patches/net/minecraft/client/ClientRecipeBook.java.patch b/patches/net/minecraft/client/ClientRecipeBook.java.patch index 6f1be0534e..dd061c36ce 100644 --- a/patches/net/minecraft/client/ClientRecipeBook.java.patch +++ b/patches/net/minecraft/client/ClientRecipeBook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/ClientRecipeBook.java +++ b/net/minecraft/client/ClientRecipeBook.java -@@ -62,7 +_,7 @@ +@@ -65,7 +_,7 @@ Recipe recipe = recipeholder.value(); if (!recipe.isSpecial() && !recipe.isIncomplete()) { RecipeBookCategories recipebookcategories = getCategory(recipeholder); @@ -9,7 +9,7 @@ if (s.isEmpty()) { map.computeIfAbsent(recipebookcategories, p_90645_ -> Lists.newArrayList()).add(ImmutableList.of(recipeholder)); } else { -@@ -122,6 +_,8 @@ +@@ -127,6 +_,8 @@ } else if (recipetype == RecipeType.SMITHING) { return RecipeBookCategories.SMITHING; } else { diff --git a/patches/net/minecraft/client/KeyMapping.java.patch b/patches/net/minecraft/client/KeyMapping.java.patch index 6f41d54074..f0a66100e6 100644 --- a/patches/net/minecraft/client/KeyMapping.java.patch +++ b/patches/net/minecraft/client/KeyMapping.java.patch @@ -19,7 +19,7 @@ - KeyMapping keymapping = MAP.get(p_90836_); + for (KeyMapping keymapping : MAP.getAll(p_90836_)) if (keymapping != null) { - ++keymapping.clickCount; + keymapping.clickCount++; } } @@ -82,7 +82,7 @@ return this.key.equals(p_90851_.key); } -@@ -165,11 +_,13 @@ +@@ -163,11 +_,13 @@ } public Component getTranslatedKeyMessage() { @@ -97,7 +97,7 @@ } public String saveString() { -@@ -179,4 +_,84 @@ +@@ -177,4 +_,84 @@ public void setDown(boolean p_90846_) { this.isDown = p_90846_; } diff --git a/patches/net/minecraft/client/KeyboardHandler.java.patch b/patches/net/minecraft/client/KeyboardHandler.java.patch index bff669ac52..a5352659ea 100644 --- a/patches/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/net/minecraft/client/KeyboardHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/KeyboardHandler.java +++ b/net/minecraft/client/KeyboardHandler.java -@@ -364,7 +_,9 @@ +@@ -367,7 +_,9 @@ } } @@ -11,7 +11,7 @@ if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) { this.minecraft.getWindow().toggleFullScreen(); this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen()); -@@ -382,6 +_,8 @@ +@@ -385,6 +_,8 @@ ); return; } @@ -19,8 +19,8 @@ + ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers. } - if (this.minecraft.getNarrator().isActive() && this.minecraft.options.narratorHotkey().get()) { -@@ -418,9 +_,13 @@ + if (p_90897_ != 0) { +@@ -412,9 +_,13 @@ Screen.wrapScreenError(() -> { if (p_90897_ == 1 || p_90897_ == 2) { screen.afterKeyboardAction(); @@ -36,7 +36,7 @@ } }, "keyPressed event handler", screen.getClass().getCanonicalName()); if (aboolean[0]) { -@@ -490,22 +_,27 @@ +@@ -483,22 +_,27 @@ } } } @@ -59,7 +59,7 @@ + net.neoforged.neoforge.client.ClientHooks.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_); + }, "charTyped event handler", guieventlistener.getClass().getCanonicalName()); } else { - for(char c0 : Character.toChars(p_90891_)) { + for (char c0 : Character.toChars(p_90891_)) { - Screen.wrapScreenError( - () -> guieventlistener.charTyped(c0, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName() - ); diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index a0d749f9a6..bb8cc73225 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -258,7 +_,7 @@ +@@ -260,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) @@ -9,7 +9,7 @@ static Minecraft instance; private static final Logger LOGGER = LogUtils.getLogger(); public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX; -@@ -442,7 +_,6 @@ +@@ -444,7 +_,6 @@ } }, Util.nonCriticalIoPool()); LOGGER.info("Setting user: {}", this.user.getName()); @@ -17,7 +17,7 @@ this.demo = p_91084_.game.demo; this.allowsMultiplayer = !p_91084_.game.disableMultiplayer; this.allowsChat = !p_91084_.game.disableChat; -@@ -484,15 +_,15 @@ +@@ -485,15 +_,15 @@ } this.window.setFramerateLimit(this.options.framerateLimit().get()); @@ -35,7 +35,15 @@ this.resourcePackRepository.reload(); this.options.loadSelectedResourcePacks(this.resourcePackRepository); this.languageManager = new LanguageManager(this.options.languageCode); -@@ -560,10 +_,13 @@ +@@ -558,6 +_,7 @@ + ); + this.resourceManager.registerReloadListener(this.entityRenderDispatcher); + this.particleEngine = new ParticleEngine(this.level, this.textureManager); ++ net.neoforged.neoforge.client.ClientHooks.onRegisterParticleProviders(this.particleEngine); + this.resourceManager.registerReloadListener(this.particleEngine); + this.paintingTextures = new PaintingTextureManager(this.textureManager); + this.resourceManager.registerReloadListener(this.paintingTextures); +@@ -570,13 +_,18 @@ this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers); this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener()); this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers); @@ -45,24 +53,17 @@ + // Forge: We delay this to allow registration of modded creative mode tabs + // this.createSearchTrees(); this.resourceManager.registerReloadListener(this.searchRegistry); - this.particleEngine = new ParticleEngine(this.level, this.textureManager); -+ net.neoforged.neoforge.client.ClientHooks.onRegisterParticleProviders(this.particleEngine); - this.resourceManager.registerReloadListener(this.particleEngine); - this.paintingTextures = new PaintingTextureManager(this.textureManager); - this.resourceManager.registerReloadListener(this.paintingTextures); -@@ -574,7 +_,10 @@ this.gpuWarnlistManager = new GpuWarnlistManager(); this.resourceManager.registerReloadListener(this.gpuWarnlistManager); this.resourceManager.registerReloadListener(this.regionalCompliancies); -- this.gui = new Gui(this, this.itemRenderer); -+ this.gui = new net.neoforged.neoforge.client.gui.overlay.ExtendedGui(this); + this.gui = new Gui(this); + // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them. + this.mouseHandler.setup(this.window.getWindow()); + this.keyboardHandler.setup(this.window.getWindow()); this.debugRenderer = new DebugRenderer(this); RealmsClient realmsclient = RealmsClient.create(this); this.realmsDataFetcher = new RealmsDataFetcher(realmsclient); -@@ -598,6 +_,7 @@ +@@ -600,6 +_,7 @@ this.options.fullscreen().set(this.window.isFullscreen()); } @@ -70,7 +71,7 @@ this.window.updateVsync(this.options.enableVsync().get()); this.window.updateRawMouseInput(this.options.rawMouseInput().get()); this.window.setDefaultErrorCallback(); -@@ -619,16 +_,18 @@ +@@ -620,16 +_,18 @@ GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS); Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay); this.setOverlay( @@ -93,7 +94,7 @@ ); this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path()); } -@@ -668,6 +_,11 @@ +@@ -669,6 +_,11 @@ runnable = () -> this.setScreen(screen); } @@ -105,7 +106,7 @@ return runnable; } -@@ -716,7 +_,7 @@ +@@ -717,7 +_,7 @@ private String createTitle() { StringBuilder stringbuilder = new StringBuilder("Minecraft"); if (checkModStatus().shouldReportAsModified()) { @@ -114,16 +115,7 @@ } stringbuilder.append(" "); -@@ -740,6 +_,8 @@ - } - - private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { -+ if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam. -+ return UserApiService.OFFLINE; - return p_193586_.createUserApiService(p_193587_.user.user.getAccessToken()); - } - -@@ -748,7 +_,7 @@ +@@ -749,7 +_,7 @@ } private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299846_) { @@ -132,7 +124,7 @@ this.clearResourcePacksOnError(p_91240_, null, p_299846_); } else { Util.throwAsRuntime(p_91240_); -@@ -830,9 +_,12 @@ +@@ -831,9 +_,12 @@ } public void createSearchTrees() { @@ -144,9 +136,9 @@ - SearchRegistry.CREATIVE_NAMES, + nameSearchKey, p_231451_ -> new FullTextSearchTree<>( - p_210797_ -> p_210797_.getTooltipLines(null, TooltipFlag.Default.NORMAL.asCreative()) + p_339262_ -> p_339262_.getTooltipLines(Item.TooltipContext.EMPTY, null, TooltipFlag.Default.NORMAL.asCreative()) .stream() -@@ -864,9 +_,14 @@ +@@ -868,9 +_,14 @@ p_302141_ ) ); @@ -164,7 +156,7 @@ }); } -@@ -930,13 +_,13 @@ +@@ -921,13 +_,13 @@ if (p_91333_.getSaveFile() != null) { Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.getSaveFile()); @@ -181,18 +173,18 @@ } } -@@ -1065,10 +_,6 @@ +@@ -1056,9 +_,7 @@ LOGGER.error("setScreen called from non-game thread"); } - if (this.screen != null) { - this.screen.removed(); -- } -- - if (p_91153_ == null && this.clientLevelTeardownInProgress) { - throw new IllegalStateException("Trying to return to in-game GUI during disconnection"); - } else { -@@ -1082,6 +_,19 @@ +- } else { ++ if (this.screen == null) { + this.setLastInputType(InputType.NONE); + } + +@@ -1075,6 +_,19 @@ } } @@ -212,8 +204,8 @@ this.screen = p_91153_; if (this.screen != null) { this.screen.added(); -@@ -1225,9 +_,12 @@ - RenderSystem.enableCull(); +@@ -1221,9 +_,12 @@ + this.mouseHandler.handleAccumulatedMovement(); this.profiler.pop(); if (!this.noRender) { + this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile @@ -225,7 +217,7 @@ } if (this.fpsPieResults != null) { -@@ -1269,6 +_,7 @@ +@@ -1265,6 +_,7 @@ } this.pause = flag1; @@ -233,7 +225,7 @@ } long l = Util.getNanos(); -@@ -1361,10 +_,12 @@ +@@ -1357,10 +_,12 @@ this.window.setGuiScale((double)i); if (this.screen != null) { this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); @@ -246,7 +238,7 @@ this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight()); this.mouseHandler.setIgnoreFirstMove(); } -@@ -1641,6 +_,7 @@ +@@ -1636,6 +_,7 @@ } public void stop() { @@ -254,7 +246,7 @@ this.running = false; } -@@ -1670,9 +_,17 @@ +@@ -1665,9 +_,17 @@ BlockHitResult blockhitresult = (BlockHitResult)this.hitResult; BlockPos blockpos = blockhitresult.getBlockPos(); if (!this.level.getBlockState(blockpos).isAir()) { @@ -274,16 +266,16 @@ this.player.swing(InteractionHand.MAIN_HAND); } } -@@ -1700,6 +_,8 @@ +@@ -1695,6 +_,8 @@ return false; } else { boolean flag = false; + var inputEvent = net.neoforged.neoforge.client.ClientHooks.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND); + if (!inputEvent.isCanceled()) - switch(this.hitResult.getType()) { + switch (this.hitResult.getType()) { case ENTITY: this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity()); -@@ -1720,8 +_,10 @@ +@@ -1715,8 +_,10 @@ } this.player.resetAttackStrengthTicker(); @@ -294,10 +286,10 @@ this.player.swing(InteractionHand.MAIN_HAND); return flag; } -@@ -1737,6 +_,11 @@ +@@ -1732,6 +_,11 @@ } - for(InteractionHand interactionhand : InteractionHand.values()) { + for (InteractionHand interactionhand : InteractionHand.values()) { + var inputEvent = net.neoforged.neoforge.client.ClientHooks.onClickInput(1, this.options.keyUse, interactionhand); + if (inputEvent.isCanceled()) { + if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand); @@ -306,7 +298,7 @@ ItemStack itemstack = this.player.getItemInHand(interactionhand); if (!itemstack.isItemEnabled(this.level.enabledFeatures())) { return; -@@ -1757,7 +_,7 @@ +@@ -1752,7 +_,7 @@ } if (interactionresult.consumesAction()) { @@ -315,7 +307,7 @@ this.player.swing(interactionhand); } -@@ -1769,7 +_,7 @@ +@@ -1764,7 +_,7 @@ int i = itemstack.getCount(); InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult); if (interactionresult1.consumesAction()) { @@ -324,7 +316,7 @@ this.player.swing(interactionhand); if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) { this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand); -@@ -1785,6 +_,9 @@ +@@ -1780,6 +_,9 @@ } } @@ -334,8 +326,8 @@ if (!itemstack.isEmpty()) { InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand); if (interactionresult2.consumesAction()) { -@@ -1815,6 +_,8 @@ - --this.rightClickDelay; +@@ -1810,6 +_,8 @@ + this.rightClickDelay--; } + net.neoforged.neoforge.event.EventHooks.onPreClientTick(); @@ -343,7 +335,7 @@ this.profiler.push("gui"); this.chatListener.tick(); this.gui.tick(this.pause); -@@ -1900,6 +_,7 @@ +@@ -1894,6 +_,7 @@ this.tutorial.tick(); @@ -351,7 +343,7 @@ try { this.level.tick(() -> true); } catch (Throwable throwable) { -@@ -1913,6 +_,7 @@ +@@ -1907,6 +_,7 @@ throw new ReportedException(crashreport); } @@ -359,7 +351,7 @@ } this.profiler.popPush("animateTick"); -@@ -1932,6 +_,8 @@ +@@ -1926,6 +_,8 @@ this.profiler.popPush("keyboard"); this.keyboardHandler.tick(); this.profiler.pop(); @@ -368,7 +360,7 @@ } private boolean isMultiplayerServer() { -@@ -2124,6 +_,7 @@ +@@ -2120,6 +_,7 @@ } public void setLevel(ClientLevel p_91157_) { @@ -376,7 +368,7 @@ ProgressScreen progressscreen = new ProgressScreen(true); progressscreen.progressStartNoAbort(Component.translatable("connect.joining")); this.updateScreenAndTick(progressscreen); -@@ -2157,6 +_,7 @@ +@@ -2159,6 +_,7 @@ IntegratedServer integratedserver = this.singleplayerServer; this.singleplayerServer = null; this.gameRenderer.resetData(); @@ -384,9 +376,9 @@ this.gameMode = null; this.narrator.clear(); this.clientLevelTeardownInProgress = true; -@@ -2164,6 +_,7 @@ +@@ -2166,6 +_,7 @@ try { - this.updateScreenAndTick(p_91321_); + this.updateScreenAndTick(p_320248_); if (this.level != null) { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(this.level)); if (integratedserver != null) { @@ -418,7 +410,7 @@ if (itemstack == null) { return; } -@@ -2900,6 +_,19 @@ +@@ -2887,6 +_,19 @@ public void updateMaxMipLevel(int p_91313_) { this.modelManager.updateMaxMipLevel(p_91313_); diff --git a/patches/net/minecraft/client/MouseHandler.java.patch b/patches/net/minecraft/client/MouseHandler.java.patch index e34d443087..e51da3e308 100644 --- a/patches/net/minecraft/client/MouseHandler.java.patch +++ b/patches/net/minecraft/client/MouseHandler.java.patch @@ -65,38 +65,38 @@ if (this.minecraft.player.isSpectator()) { if (this.minecraft.gui.getSpectatorGui().isMenuActive()) { this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k); -@@ -209,9 +_,11 @@ - double d3 = (p_91564_ - this.ypos) +@@ -224,9 +_,11 @@ + double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight(); - Screen.wrapScreenError( -- () -> screen.mouseDragged(d0, d1, this.activeButton, d2, d3), "mouseDragged event handler", screen.getClass().getCanonicalName() +- () -> screen.mouseDragged(d2, d3, this.activeButton, d4, d5), "mouseDragged event handler", screen.getClass().getCanonicalName() - ); + Screen.wrapScreenError(() -> { -+ if (net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPre(screen, d0, d1, this.activeButton, d2, d3)) return; -+ if (screen.mouseDragged(d0, d1, this.activeButton, d2, d3)) return; -+ net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPost(screen, d0, d1, this.activeButton, d2, d3); ++ if (net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPre(screen, d2, d3, this.activeButton, d4, d5)) return; ++ if (screen.mouseDragged(d2, d3, this.activeButton, d4, d5)) return; ++ net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPost(screen, d2, d3, this.activeButton, d4, d5); + }, "mouseDragged event handler", screen.getClass().getCanonicalName()); } screen.afterMouseMove(); -@@ -235,12 +_,13 @@ - double d1 = d0 - this.lastMouseEventTime; - this.lastMouseEventTime = d0; - if (this.isMouseGrabbed() && this.minecraft.isWindowActive()) { -- double d4 = this.minecraft.options.sensitivity().get() * 0.6F + 0.2F; -+ var event = net.neoforged.neoforge.client.ClientHooks.getTurnPlayerValues(this.minecraft.options.sensitivity().get(), this.minecraft.options.smoothCamera); -+ double d4 = event.getMouseSensitivity() * 0.6F + 0.2F; - double d5 = d4 * d4 * d4; - double d6 = d5 * 8.0; - double d2; - double d3; -- if (this.minecraft.options.smoothCamera) { -+ if (event.getCinematicCameraEnabled()) { - double d7 = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * d6, d1 * d6); - double d8 = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * d6, d1 * d6); - d2 = d7; -@@ -292,6 +_,14 @@ +@@ -242,12 +_,13 @@ + } + + private void turnPlayer(double p_316356_) { +- double d2 = this.minecraft.options.sensitivity().get() * 0.6F + 0.2F; ++ var event = net.neoforged.neoforge.client.ClientHooks.getTurnPlayerValues(this.minecraft.options.sensitivity().get(), this.minecraft.options.smoothCamera); ++ double d2 = event.getMouseSensitivity() * 0.6F + 0.2F; + double d3 = d2 * d2 * d2; + double d4 = d3 * 8.0; + double d0; + double d1; +- if (this.minecraft.options.smoothCamera) { ++ if (event.getCinematicCameraEnabled()) { + double d5 = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * d4, p_316356_ * d4); + double d6 = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * d4, p_316356_ * d4); + d0 = d5; +@@ -293,6 +_,14 @@ public double ypos() { return this.ypos; diff --git a/patches/net/minecraft/client/Options.java.patch b/patches/net/minecraft/client/Options.java.patch index 63c153e988..38220392a9 100644 --- a/patches/net/minecraft/client/Options.java.patch +++ b/patches/net/minecraft/client/Options.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java -@@ -715,9 +_,10 @@ +@@ -726,9 +_,10 @@ } }, new OptionInstance.LazyEnum<>( @@ -12,26 +12,26 @@ && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_), -@@ -787,7 +_,7 @@ +@@ -798,7 +_,7 @@ this.incompatibleResourcePacks.clear(); - for(Pack pack : p_275268_.getSelectedPacks()) { + for (Pack pack : p_275268_.getSelectedPacks()) { - if (!pack.isFixedPosition()) { + if (!pack.isFixedPosition() && !pack.isHidden()) { this.resourcePacks.add(pack.getId()); if (!pack.getCompatibility().isCompatible()) { this.incompatibleResourcePacks.add(pack.getId()); -@@ -1058,6 +_,7 @@ +@@ -1093,6 +_,7 @@ } public Options(Minecraft p_92138_, File p_92139_) { + setForgeKeybindProperties(); this.minecraft = p_92138_; this.optionsFile = new File(p_92139_, "options.txt"); - boolean flag = p_92138_.is64Bit(); -@@ -1191,11 +_,21 @@ - p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra); + boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L; +@@ -1230,11 +_,21 @@ this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility); + p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness); + net.neoforged.neoforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_); + processOptionsForge(p_168428_); @@ -39,7 +39,7 @@ + // FORGE: split off to allow reloading options after mod loading is done + private void processOptionsForge(Options.FieldAccess p_168428_) + { - for(KeyMapping keymapping : this.keyMappings) { + for (KeyMapping keymapping : this.keyMappings) { - String s = keymapping.saveString(); + String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.neoforged.neoforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : ""); String s1 = p_168428_.process("key_" + keymapping.getName(), s); @@ -53,7 +53,7 @@ } } -@@ -1213,6 +_,9 @@ +@@ -1252,6 +_,9 @@ } public void load() { @@ -63,7 +63,7 @@ try { if (!this.optionsFile.exists()) { return; -@@ -1240,7 +_,8 @@ +@@ -1279,7 +_,8 @@ } } @@ -73,15 +73,15 @@ new Options.FieldAccess() { @Nullable private String getValueOrNull(String p_168459_) { -@@ -1412,6 +_,7 @@ +@@ -1454,6 +_,7 @@ } public ClientInformation buildPlayerInformation() { + if (net.neoforged.neoforge.client.loading.ClientModLoader.isLoading()) return ClientInformation.createDefault(); //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. int i = 0; - for(PlayerModelPart playermodelpart : this.modelParts) { -@@ -1487,6 +_,23 @@ + for (PlayerModelPart playermodelpart : this.modelParts) { +@@ -1529,6 +_,23 @@ } p_92146_.setSelected(set); diff --git a/patches/net/minecraft/client/RecipeBookCategories.java.patch b/patches/net/minecraft/client/RecipeBookCategories.java.patch index 8de2ed39c1..5168a95520 100644 --- a/patches/net/minecraft/client/RecipeBookCategories.java.patch +++ b/patches/net/minecraft/client/RecipeBookCategories.java.patch @@ -27,10 +27,11 @@ private final List itemIcons; private RecipeBookCategories(ItemStack... p_92267_) { -@@ -60,10 +_,15 @@ +@@ -60,11 +_,15 @@ case FURNACE -> FURNACE_CATEGORIES; case BLAST_FURNACE -> BLAST_FURNACE_CATEGORIES; case SMOKER -> SMOKER_CATEGORIES; +- default -> throw new MatchException(null, null); + default -> net.neoforged.neoforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_); }; } diff --git a/patches/net/minecraft/client/color/block/BlockColors.java.patch b/patches/net/minecraft/client/color/block/BlockColors.java.patch index 25d4cb17d9..32c2a2e76b 100644 --- a/patches/net/minecraft/client/color/block/BlockColors.java.patch +++ b/patches/net/minecraft/client/color/block/BlockColors.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/color/block/BlockColors.java +++ b/net/minecraft/client/color/block/BlockColors.java -@@ -28,7 +_,8 @@ +@@ -29,7 +_,8 @@ @OnlyIn(Dist.CLIENT) public class BlockColors { private static final int DEFAULT = -1; @@ -10,10 +10,10 @@ private final Map>> coloringStates = Maps.newHashMap(); public static BlockColors createDefault() { -@@ -96,11 +_,12 @@ +@@ -94,11 +_,12 @@ }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); blockcolors.addColoringState(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? 2129968 : 7455580, Blocks.LILY_PAD); + blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? -14647248 : -9321636, Blocks.LILY_PAD); + net.neoforged.neoforge.client.ClientHooks.onBlockColorsInit(blockcolors); return blockcolors; } @@ -24,7 +24,7 @@ if (blockcolor != null) { return blockcolor.getColor(p_92583_, null, null, 0); } else { -@@ -110,13 +_,15 @@ +@@ -108,13 +_,15 @@ } public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) { @@ -36,7 +36,7 @@ + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterColorHandlersEvent.Block} */ + @Deprecated public void register(BlockColor p_92590_, Block... p_92591_) { - for(Block block : p_92591_) { + for (Block block : p_92591_) { - this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block)); + this.blockColors.put(block, p_92590_); } diff --git a/patches/net/minecraft/client/color/item/ItemColors.java.patch b/patches/net/minecraft/client/color/item/ItemColors.java.patch index 40c84b636c..491886484d 100644 --- a/patches/net/minecraft/client/color/item/ItemColors.java.patch +++ b/patches/net/minecraft/client/color/item/ItemColors.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/color/item/ItemColors.java +++ b/net/minecraft/client/color/item/ItemColors.java -@@ -23,7 +_,8 @@ +@@ -26,7 +_,8 @@ @OnlyIn(Dist.CLIENT) public class ItemColors { private static final int DEFAULT = -1; @@ -10,10 +10,10 @@ public static ItemColors createDefault(BlockColors p_92684_) { ItemColors itemcolors = new ItemColors(); -@@ -94,17 +_,20 @@ - itemcolors.register((p_92696_, p_92697_) -> FoliageColor.getMangroveColor(), Blocks.MANGROVE_LEAVES); - itemcolors.register((p_92693_, p_92694_) -> p_92694_ == 0 ? PotionUtils.getColor(p_92693_) : -1, Items.TIPPED_ARROW); - itemcolors.register((p_232352_, p_232353_) -> p_232353_ == 0 ? -1 : MapItem.getColor(p_232352_), Items.FILLED_MAP); +@@ -105,17 +_,20 @@ + : FastColor.ARGB32.opaque(p_329710_.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()), + Items.FILLED_MAP + ); + net.neoforged.neoforge.client.ClientHooks.onItemColorsInit(itemcolors, p_92684_); return itemcolors; } @@ -27,7 +27,7 @@ + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterColorHandlersEvent.Item} */ + @Deprecated public void register(ItemColor p_92690_, ItemLike... p_92691_) { - for(ItemLike itemlike : p_92691_) { + for (ItemLike itemlike : p_92691_) { - this.itemColors.addMapping(p_92690_, Item.getId(itemlike.asItem())); + this.itemColors.put(itemlike.asItem(), p_92690_); } diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index 28bbd9914e..0c098bc4ce 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -1,26 +1,204 @@ --- a/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java -@@ -456,6 +_,8 @@ +@@ -68,6 +_,9 @@ + import net.neoforged.api.distmarker.OnlyIn; + import org.joml.Matrix4fStack; - for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { - MobEffect mobeffect = mobeffectinstance.getEffect(); ++// Neo: Exceptionally add a static wildcard import to make the patch bearable, and comments to avoid the detection by spotless rules. ++/* space for import change */ import static net.neoforged.neoforge.client.gui.VanillaGuiLayers.* /* space for wildcard import */; ++ + @OnlyIn(Dist.CLIENT) + public class Gui { + protected static final ResourceLocation CROSSHAIR_SPRITE = new ResourceLocation("hud/crosshair"); +@@ -150,9 +_,21 @@ + protected long healthBlinkTime; + protected float autosaveIndicatorValue; + protected float lastAutosaveIndicatorValue; ++ /** Neo: This is empty and unused, rendering goes through {@link #layerManager} instead. */ ++ @Deprecated + private final LayeredDraw layers = new LayeredDraw(); ++ private final net.neoforged.neoforge.client.gui.GuiLayerManager layerManager = new net.neoforged.neoforge.client.gui.GuiLayerManager(); + protected float scopeScale; + ++ /** ++ * Neo: This variable controls the height of overlays on the left of the hotbar (e.g. health, armor). ++ */ ++ public int leftHeight; ++ /** ++ * Neo: This variable controls the height of overlays on the right of the hotbar (e.g. food, vehicle health, air). ++ */ ++ public int rightHeight; ++ + public Gui(Minecraft p_232355_) { + this.minecraft = p_232355_; + this.debugOverlay = new DebugScreenOverlay(p_232355_); +@@ -162,27 +_,40 @@ + this.bossOverlay = new BossHealthOverlay(p_232355_); + this.subtitleOverlay = new SubtitleOverlay(p_232355_); + this.resetTitleTimes(); +- LayeredDraw layereddraw = new LayeredDraw() +- .add(this::renderCameraOverlays) +- .add(this::renderCrosshair) +- .add(this::renderHotbarAndDecorations) +- .add(this::renderExperienceLevel) +- .add(this::renderEffects) +- .add((p_315814_, p_315815_) -> this.bossOverlay.render(p_315814_)); +- LayeredDraw layereddraw1 = new LayeredDraw() +- .add(this::renderDemoOverlay) +- .add((p_315812_, p_315813_) -> { ++ var playerHealthComponents = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(PLAYER_HEALTH, (guiGraphics, partialTick) -> renderHealthLevel(guiGraphics)) ++ .add(ARMOR_LEVEL, (guiGraphics, partialTick) -> renderArmorLevel(guiGraphics)) ++ .add(FOOD_LEVEL, (guiGraphics, partialTick) -> renderFoodLevel(guiGraphics)); ++ var layereddraw = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(CAMERA_OVERLAYS, this::renderCameraOverlays) ++ .add(CROSSHAIR, this::renderCrosshair) ++ .add(HOTBAR, this::renderHotbar) ++ .add(JUMP_METER, this::maybeRenderJumpMeter) ++ .add(EXPERIENCE_BAR, this::maybeRenderExperienceBar) ++ .add(playerHealthComponents, () -> this.minecraft.gameMode.canHurtPlayer()) ++ .add(VEHICLE_HEALTH, this::maybeRenderVehicleHealth) ++ // Air goes above vehicle health, it must render after it for `rightHeight` to work! ++ .add(AIR_LEVEL, (guiGraphics, partialTick) -> { if (this.minecraft.gameMode.canHurtPlayer()) renderAirLevel(guiGraphics); }) ++ .add(SELECTED_ITEM_NAME, this::maybeRenderSelectedItemName) ++ .add(SPECTATOR_TOOLTIP, this::maybeRenderSpectatorTooltip) ++ .add(EXPERIENCE_LEVEL, this::renderExperienceLevel) ++ .add(EFFECTS, this::renderEffects) ++ .add(BOSS_OVERLAY, (p_315814_, p_315815_) -> this.bossOverlay.render(p_315814_)); ++ var layereddraw1 = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(DEMO_OVERLAY, this::renderDemoOverlay) ++ .add(DEBUG_OVERLAY, (p_315812_, p_315813_) -> { + if (this.debugOverlay.showDebugScreen()) { + this.debugOverlay.render(p_315812_); + } + }) +- .add(this::renderScoreboardSidebar) +- .add(this::renderOverlayMessage) +- .add(this::renderTitle) +- .add(this::renderChat) +- .add(this::renderTabList) +- .add((p_315816_, p_315817_) -> this.subtitleOverlay.render(p_315816_)); +- this.layers.add(layereddraw, () -> !p_232355_.options.hideGui).add(this::renderSleepOverlay).add(layereddraw1, () -> !p_232355_.options.hideGui); ++ .add(SCOREBOARD_SIDEBAR, this::renderScoreboardSidebar) ++ .add(OVERLAY_MESSAGE, this::renderOverlayMessage) ++ .add(TITLE, this::renderTitle) ++ .add(CHAT, this::renderChat) ++ .add(TAB_LIST, this::renderTabList) ++ .add(SUBTITLE_OVERLAY, (p_315816_, p_315817_) -> this.subtitleOverlay.render(p_315816_)) ++ .add(SAVING_INDICATOR, this::renderSavingIndicator); ++ this.layerManager.add(layereddraw, () -> !p_232355_.options.hideGui).add(SLEEP_OVERLAY, this::renderSleepOverlay).add(layereddraw1, () -> !p_232355_.options.hideGui); + } + + public void resetTitleTimes() { +@@ -193,7 +_,9 @@ + + public void render(GuiGraphics p_282884_, float p_282611_) { + RenderSystem.enableDepthTest(); +- this.layers.render(p_282884_, p_282611_); ++ leftHeight = 39; ++ rightHeight = 39; ++ this.layerManager.render(p_282884_, p_282611_); + RenderSystem.disableDepthTest(); + } + +@@ -252,8 +_,12 @@ + } + + if (i > 8) { ++ //Include a shift based on the bar height plus the difference between the height that renderSelectedItemName ++ // renders at (59) and the height that the overlay/status bar renders at (68) by default ++ int yShift = Math.max(leftHeight, rightHeight) + (68 - 59); + p_316291_.pose().pushPose(); +- p_316291_.pose().translate((float)(p_316291_.guiWidth() / 2), (float)(p_316291_.guiHeight() - 68), 0.0F); ++ //If y shift is smaller less than the default y level, just render it at the base y level ++ p_316291_.pose().translate((float)(p_316291_.guiWidth() / 2), (float)(p_316291_.guiHeight() - Math.max(yShift, 68)), 0.0F); + int j = 16777215; + if (this.animateOverlayMessageColor) { + j = Mth.hsvToRgb(f / 50.0F, 0.7F, 0.6F) & 16777215; +@@ -441,6 +_,8 @@ + List list = Lists.newArrayListWithExpectedSize(collection.size()); + + for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (!renderer.isVisibleInGui(mobeffectinstance)) continue; + Holder holder = mobeffectinstance.getEffect(); if (mobeffectinstance.showIcon()) { - int i = this.screenWidth; - int j = 1; -@@ -485,6 +_,7 @@ + int i = p_282812_.guiWidth(); +@@ -471,6 +_,7 @@ } } + if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue; - TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect); + TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder); + int l1 = i; int i1 = j; - float f1 = f; -@@ -604,18 +_,23 @@ +@@ -488,29 +_,59 @@ + } } - public void renderSelectedItemName(GuiGraphics p_283501_) { ++ @Deprecated // Neo: Split up into different layers + private void renderHotbarAndDecorations(GuiGraphics p_316628_, float p_316765_) { ++ renderHotbar(p_316628_, p_316765_); ++ maybeRenderJumpMeter(p_316628_, p_316765_); ++ maybeRenderExperienceBar(p_316628_, p_316765_); ++ maybeRenderPlayerHealth(p_316628_, p_316765_); ++ maybeRenderVehicleHealth(p_316628_, p_316765_); ++ maybeRenderSelectedItemName(p_316628_, p_316765_); ++ maybeRenderSpectatorTooltip(p_316628_, p_316765_); ++ } ++ ++ private void renderHotbar(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR) { + this.spectatorGui.renderHotbar(p_316628_); + } else { + this.renderItemHotbar(p_316628_, p_316765_); + } ++ } + ++ private void maybeRenderJumpMeter(GuiGraphics p_316628_, float p_316765_) { + int i = p_316628_.guiWidth() / 2 - 91; + PlayerRideableJumping playerrideablejumping = this.minecraft.player.jumpableVehicle(); + if (playerrideablejumping != null) { + this.renderJumpMeter(playerrideablejumping, p_316628_, i); +- } else if (this.isExperienceBarVisible()) { ++ } ++ ++ } ++ ++ private void maybeRenderExperienceBar(GuiGraphics p_316628_, float p_316765_) { ++ int i = p_316628_.guiWidth() / 2 - 91; ++ if (this.minecraft.player.jumpableVehicle() == null && this.isExperienceBarVisible()) { + this.renderExperienceBar(p_316628_, i); + } ++ } + ++ private void maybeRenderPlayerHealth(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.canHurtPlayer()) { + this.renderPlayerHealth(p_316628_); + } ++ } + ++ private void maybeRenderVehicleHealth(GuiGraphics p_316628_, float p_316765_) { + this.renderVehicleHealth(p_316628_); ++ } ++ ++ private void maybeRenderSelectedItemName(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.getPlayerMode() != GameType.SPECTATOR) { +- this.renderSelectedItemName(p_316628_); +- } else if (this.minecraft.player.isSpectator()) { ++ this.renderSelectedItemName(p_316628_, Math.max(this.leftHeight, this.rightHeight)); ++ } ++ } ++ ++ private void maybeRenderSpectatorTooltip(GuiGraphics p_316628_, float p_316765_) { ++ if (this.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR && this.minecraft.player.isSpectator()) { + this.spectatorGui.renderTooltip(p_316628_); + } + } +@@ -633,18 +_,23 @@ + } + + private void renderSelectedItemName(GuiGraphics p_283501_) { + renderSelectedItemName(p_283501_, 0); + } + @@ -29,22 +207,22 @@ if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) { MutableComponent mutablecomponent = Component.empty() .append(this.lastToolHighlight.getHoverName()) -- .withStyle(this.lastToolHighlight.getRarity().color); +- .withStyle(this.lastToolHighlight.getRarity().color()); + .withStyle(this.lastToolHighlight.getRarity().getStyleModifier()); - if (this.lastToolHighlight.hasCustomHoverName()) { + if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) { mutablecomponent.withStyle(ChatFormatting.ITALIC); } - int i = this.getFont().width(mutablecomponent); + Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent); + int i = this.getFont().width(highlightTip); - int j = (this.screenWidth - i) / 2; -- int k = this.screenHeight - 59; -+ int k = this.screenHeight - Math.max(yShift, 59); + int j = (p_283501_.guiWidth() - i) / 2; +- int k = p_283501_.guiHeight() - 59; ++ int k = p_283501_.guiHeight() - Math.max(yShift, 59); if (!this.minecraft.gameMode.canHurtPlayer()) { k += 14; } -@@ -627,7 +_,13 @@ +@@ -656,7 +_,13 @@ if (l > 0) { p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0)); @@ -53,18 +231,145 @@ + if (font == null) { + p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24)); + } else { -+ j = (this.screenWidth - font.width(highlightTip)) / 2; ++ j = (p_283501_.guiWidth() - font.width(highlightTip)) / 2; + p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24)); + } } } -@@ -1102,7 +_,7 @@ +@@ -777,7 +_,15 @@ + return (int)Math.ceil((double)p_93013_ / 10.0); + } + ++ @Deprecated // Neo: Split up into different layers + private void renderPlayerHealth(GuiGraphics p_283143_) { ++ renderHealthLevel(p_283143_); ++ renderArmorLevel(p_283143_); ++ renderFoodLevel(p_283143_); ++ renderAirLevel(p_283143_); ++ } ++ ++ private void renderHealthLevel(GuiGraphics p_283143_) { + Player player = this.getCameraPlayer(); + if (player != null) { + int i = Mth.ceil(player.getHealth()); +@@ -802,35 +_,62 @@ + this.random.setSeed((long)(this.tickCount * 312871)); + int l = p_283143_.guiWidth() / 2 - 91; + int i1 = p_283143_.guiWidth() / 2 + 91; +- int j1 = p_283143_.guiHeight() - 39; ++ int j1 = p_283143_.guiHeight() - leftHeight; + float f = Math.max((float)player.getAttributeValue(Attributes.MAX_HEALTH), (float)Math.max(k, i)); + int k1 = Mth.ceil(player.getAbsorptionAmount()); + int l1 = Mth.ceil((f + (float)k1) / 2.0F / 10.0F); + int i2 = Math.max(10 - (l1 - 2), 3); + int j2 = j1 - 10; ++ leftHeight += (l1 - 1) * i2 + 10; + int k2 = -1; + if (player.hasEffect(MobEffects.REGENERATION)) { + k2 = this.tickCount % Mth.ceil(f + 5.0F); + } +- +- this.minecraft.getProfiler().push("armor"); +- renderArmor(p_283143_, player, j1, l1, i2, l); +- this.minecraft.getProfiler().popPush("health"); ++ this.minecraft.getProfiler().push("health"); + this.renderHearts(p_283143_, player, l, j1, i2, k2, f, i, k, k1, flag); ++ this.minecraft.getProfiler().pop(); ++ } ++ } ++ ++ private void renderArmorLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { ++ int l = p_283143_.guiWidth() / 2 - 91; ++ this.minecraft.getProfiler().push("armor"); ++ renderArmor(p_283143_, player, p_283143_.guiHeight() - leftHeight + 10, 1, 0, l); ++ this.minecraft.getProfiler().pop(); ++ if (player.getArmorValue() > 0) { ++ leftHeight += 10; ++ } ++ } ++ } ++ ++ private void renderFoodLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { + LivingEntity livingentity = this.getPlayerVehicleWithHealth(); + int l2 = this.getVehicleMaxHearts(livingentity); + if (l2 == 0) { +- this.minecraft.getProfiler().popPush("food"); ++ this.minecraft.getProfiler().push("food"); ++ int i1 = p_283143_.guiWidth() / 2 + 91; ++ int j1 = p_283143_.guiHeight() - rightHeight; + this.renderFood(p_283143_, player, j1, i1); +- j2 -= 10; ++ rightHeight += 10; ++ this.minecraft.getProfiler().pop(); + } +- +- this.minecraft.getProfiler().popPush("air"); ++ } ++ } ++ ++ private void renderAirLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { ++ int i1 = p_283143_.guiWidth() / 2 + 91; ++ ++ this.minecraft.getProfiler().push("air"); + int i3 = player.getMaxAirSupply(); + int j3 = Math.min(player.getAirSupply(), i3); + if (player.isEyeInFluid(FluidTags.WATER) || j3 < i3) { +- int k3 = this.getVisibleVehicleHeartRows(l2) - 1; +- j2 -= k3 * 10; ++ int j2 = p_283143_.guiHeight() - rightHeight; + int l3 = Mth.ceil((double)(j3 - 2) * 10.0 / (double)i3); + int i4 = Mth.ceil((double)j3 * 10.0 / (double)i3) - l3; + RenderSystem.enableBlend(); +@@ -844,6 +_,7 @@ + } + + RenderSystem.disableBlend(); ++ rightHeight += 10; + } + + this.minecraft.getProfiler().pop(); +@@ -983,7 +_,7 @@ + if (i != 0) { + int j = (int)Math.ceil((double)livingentity.getHealth()); + this.minecraft.getProfiler().popPush("mountHealth"); +- int k = p_283368_.guiHeight() - 39; ++ int k = p_283368_.guiHeight() - rightHeight; + int l = p_283368_.guiWidth() / 2 + 91; + int i1 = k; + int j1 = 0; +@@ -1006,6 +_,7 @@ + } + + i1 -= 10; ++ rightHeight += 10; + j1 += 20; + } + +@@ -1162,7 +_,7 @@ this.toolHighlightTimer = 0; } else if (this.lastToolHighlight.isEmpty() || !itemstack.is(this.lastToolHighlight.getItem()) - || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) { -+ || (!itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) || !itemstack.getHighlightTip(itemstack.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName())))) { ++ || (!itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) || !itemstack.getHighlightTip(itemstack.getHoverName()).equals(this.lastToolHighlight.getHighlightTip(this.lastToolHighlight.getHoverName())))) { this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get()); } else if (this.toolHighlightTimer > 0) { - --this.toolHighlightTimer; + this.toolHighlightTimer--; +@@ -1287,6 +_,11 @@ + p_282761_.drawString(font, SAVING_TEXT, p_282761_.guiWidth() - j - 10, p_282761_.guiHeight() - 15, k); + } + } ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public void initModdedOverlays() { ++ this.layerManager.initModdedLayers(); + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/gui/GuiGraphics.java.patch b/patches/net/minecraft/client/gui/GuiGraphics.java.patch index 3bffce7aec..e71afe0d19 100644 --- a/patches/net/minecraft/client/gui/GuiGraphics.java.patch +++ b/patches/net/minecraft/client/gui/GuiGraphics.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/GuiGraphics.java +++ b/net/minecraft/client/gui/GuiGraphics.java -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ import org.joml.Vector2ic; @OnlyIn(Dist.CLIENT) @@ -9,7 +9,7 @@ public static final float MAX_GUI_Z = 10000.0F; public static final float MIN_GUI_Z = -10000.0F; private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2; -@@ -265,6 +_,11 @@ +@@ -280,6 +_,11 @@ } public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) { @@ -21,7 +21,7 @@ if (p_281896_ == null) { return 0; } else { -@@ -291,6 +_,11 @@ +@@ -306,6 +_,11 @@ } public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) { @@ -33,16 +33,7 @@ int i = p_282636_.drawInBatch( p_281596_, (float)p_281586_, -@@ -824,7 +_,7 @@ - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered"); -- crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem())); -+ crashreportcategory.setDetail("Item Type / Registry Name", () -> String.valueOf(p_281675_.getItem())); - crashreportcategory.setDetail("Item Damage", () -> String.valueOf(p_281675_.getDamageValue())); - crashreportcategory.setDetail("Item NBT", () -> String.valueOf(p_281675_.getTag())); - crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil())); -@@ -866,19 +_,26 @@ +@@ -879,19 +_,26 @@ } this.pose.popPose(); @@ -68,13 +59,13 @@ - List list = p_282716_.stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) -- .collect(Collectors.toList()); -- p_281682_.ifPresent(p_282969_ -> list.add(1, ClientTooltipComponent.create(p_282969_))); +- .collect(Util.toMutableList()); +- p_281682_.ifPresent(p_337410_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_337410_))); + List list = net.neoforged.neoforge.client.ClientHooks.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, guiWidth(), guiHeight(), p_283128_); this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE); } -@@ -887,7 +_,15 @@ +@@ -900,7 +_,15 @@ } public void renderComponentTooltip(Font p_282739_, List p_281832_, int p_282191_, int p_282446_) { @@ -91,7 +82,7 @@ } public void renderTooltip(Font p_282192_, List p_282297_, int p_281680_, int p_283325_) { -@@ -908,11 +_,13 @@ +@@ -921,11 +_,13 @@ private void renderTooltipInternal(Font p_282675_, List p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) { if (!p_282615_.isEmpty()) { @@ -100,13 +91,13 @@ int i = 0; int j = p_282615_.size() == 1 ? -2 : 0; - for(ClientTooltipComponent clienttooltipcomponent : p_282615_) { + for (ClientTooltipComponent clienttooltipcomponent : p_282615_) { - int k = clienttooltipcomponent.getWidth(p_282675_); + int k = clienttooltipcomponent.getWidth(preEvent.getFont()); if (k > i) { i = k; } -@@ -922,18 +_,19 @@ +@@ -935,18 +_,19 @@ int i2 = i; int j2 = j; @@ -122,16 +113,16 @@ this.pose.translate(0.0F, 0.0F, 400.0F); int k1 = i1; - for(int l1 = 0; l1 < p_282615_.size(); ++l1) { + for (int l1 = 0; l1 < p_282615_.size(); l1++) { ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1); - clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource); + clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource); k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0); } -@@ -941,7 +_,7 @@ +@@ -954,7 +_,7 @@ - for(int k2 = 0; k2 < p_282615_.size(); ++k2) { + for (int k2 = 0; k2 < p_282615_.size(); k2++) { ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2); - clienttooltipcomponent2.renderImage(p_282675_, l, k1, this); + clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, this); diff --git a/patches/net/minecraft/client/gui/MapRenderer.java.patch b/patches/net/minecraft/client/gui/MapRenderer.java.patch deleted file mode 100644 index c99d811d98..0000000000 --- a/patches/net/minecraft/client/gui/MapRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/gui/MapRenderer.java -+++ b/net/minecraft/client/gui/MapRenderer.java -@@ -119,6 +_,7 @@ - - for(MapDecoration mapdecoration : this.data.getDecorations()) { - if (!p_93294_ || mapdecoration.renderOnFrame()) { -+ if (mapdecoration.render(k)) { k++; continue; } - p_93292_.pushPose(); - p_93292_.translate(0.0F + (float)mapdecoration.x() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.y() / 2.0F + 64.0F, -0.02F); - p_93292_.mulPose(Axis.ZP.rotationDegrees((float)(mapdecoration.rot() * 360) / 16.0F)); diff --git a/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch b/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch index d101d26ce4..0f5ac718d8 100644 --- a/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/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 -@@ -24,7 +_,7 @@ +@@ -25,7 +_,7 @@ import net.neoforged.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch b/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch index bb6aee71cc..4bc398fffe 100644 --- a/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch +++ b/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/components/BossHealthOverlay.java +++ b/net/minecraft/client/gui/components/BossHealthOverlay.java -@@ -62,13 +_,16 @@ +@@ -63,13 +_,16 @@ - for(LerpingBossEvent lerpingbossevent : this.events.values()) { + for (LerpingBossEvent lerpingbossevent : this.events.values()) { int k = i / 2 - 91; + var event = net.neoforged.neoforge.client.ClientHooks.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight); + if (!event.isCanceled()) { diff --git a/patches/net/minecraft/client/gui/components/Button.java.patch b/patches/net/minecraft/client/gui/components/Button.java.patch index 77030cca41..c15f1bbcb6 100644 --- a/patches/net/minecraft/client/gui/components/Button.java.patch +++ b/patches/net/minecraft/client/gui/components/Button.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/Button.java +++ b/net/minecraft/client/gui/components/Button.java -@@ -30,6 +_,11 @@ +@@ -31,6 +_,11 @@ this.createNarration = p_259552_; } @@ -12,7 +12,7 @@ @Override public void onPress() { this.onPress.onPress(this); -@@ -94,9 +_,11 @@ +@@ -95,9 +_,11 @@ } public Button build() { diff --git a/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch b/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch index ccb756ec40..7369f754b3 100644 --- a/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch +++ b/patches/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 -@@ -134,8 +_,13 @@ +@@ -135,8 +_,13 @@ this.block = entity.pick(20.0, 0.0F, false); this.liquid = entity.pick(20.0, 0.0F, true); p_281427_.drawManaged(() -> { @@ -16,7 +16,7 @@ if (this.renderFpsCharts) { int i = p_281427_.guiWidth(); int j = i / 2; -@@ -160,7 +_,7 @@ +@@ -161,7 +_,7 @@ this.minecraft.getProfiler().pop(); } @@ -25,7 +25,7 @@ List list = this.getGameInformation(); list.add(""); boolean flag = this.minecraft.getSingleplayerServer() != null; -@@ -175,11 +_,13 @@ +@@ -176,11 +_,13 @@ + (this.renderNetworkCharts ? " visible" : " hidden") ); list.add("For help: press F3 + Q"); @@ -40,7 +40,7 @@ this.renderLines(p_281261_, list, false); } -@@ -508,6 +_,13 @@ +@@ -509,6 +_,13 @@ GlUtil.getRenderer(), GlUtil.getOpenGLVersion() ); @@ -54,7 +54,7 @@ if (this.minecraft.showOnlyReducedInfo()) { return list; } else { -@@ -544,6 +_,7 @@ +@@ -545,6 +_,7 @@ list.add(""); list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()))); diff --git a/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch b/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch index c9c9357bea..d6be9f9fb5 100644 --- a/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch @@ -1,11 +1,14 @@ --- a/net/minecraft/client/gui/screens/ChatScreen.java +++ b/net/minecraft/client/gui/screens/ChatScreen.java -@@ -232,7 +_,7 @@ - this.minecraft.player.connection.sendChat(p_242400_); - } - -- return true; -+ return minecraft.screen == this; // FORGE: Prevent closing the screen if another screen has been opened. - } - } - +@@ -89,7 +_,10 @@ + return true; + } else if (p_95591_ == 257 || p_95591_ == 335) { + this.handleChatInput(this.input.getValue(), true); +- this.minecraft.setScreen(null); ++ // FORGE: Prevent closing the screen if another screen has been opened. ++ if (minecraft.screen == this) { ++ this.minecraft.setScreen(null); ++ } + return true; + } else if (p_95591_ == 265) { + this.moveInHistory(-1); diff --git a/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch b/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch index 4192f448b9..4427113c7f 100644 --- a/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/ConnectScreen.java +++ b/net/minecraft/client/gui/screens/ConnectScreen.java -@@ -85,6 +_,8 @@ +@@ -102,6 +_,8 @@ } if (optional.isEmpty()) { diff --git a/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch b/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch index 1fb4c35f41..263138b9c6 100644 --- a/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch +++ b/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch @@ -1,29 +1,25 @@ --- a/net/minecraft/client/gui/screens/MenuScreens.java +++ b/net/minecraft/client/gui/screens/MenuScreens.java -@@ -41,6 +_,10 @@ +@@ -41,12 +_,17 @@ private static final Map, MenuScreens.ScreenConstructor> SCREENS = Maps.newHashMap(); - public static void create(@Nullable MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { -+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_)); + public static void create(MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { ++ getScreenFactory(p_96202_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_)); + } + -+ public static java.util.Optional> getScreenFactory(@Nullable MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { - if (p_96202_ == null) { - LOGGER.warn("Trying to open invalid screen with name: {}", p_96205_.getString()); ++ public static java.util.Optional> getScreenFactory(MenuType p_96202_) { + MenuScreens.ScreenConstructor screenconstructor = getConstructor(p_96202_); + if (screenconstructor == null) { + LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(p_96202_)); } else { -@@ -48,9 +_,10 @@ - if (screenconstructor == null) { - LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(p_96202_)); - } else { -- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_); -+ return java.util.Optional.of(screenconstructor); - } +- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_); ++ return java.util.Optional.of(screenconstructor); } + return java.util.Optional.empty(); } @Nullable -@@ -58,6 +_,11 @@ +@@ -54,6 +_,11 @@ return (MenuScreens.ScreenConstructor)SCREENS.get(p_96200_); } @@ -35,7 +31,7 @@ public static > void register( MenuType p_96207_, MenuScreens.ScreenConstructor p_96208_ ) { -@@ -65,6 +_,12 @@ +@@ -61,6 +_,12 @@ if (screenconstructor != null) { throw new IllegalStateException("Duplicate registration for " + BuiltInRegistries.MENU.getKey(p_96207_)); } diff --git a/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch b/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch index cdc8c1ad5e..c14b66a7a9 100644 --- a/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch @@ -1,17 +1,14 @@ --- a/net/minecraft/client/gui/screens/OptionsScreen.java +++ b/net/minecraft/client/gui/screens/OptionsScreen.java -@@ -164,6 +_,14 @@ - p_283520_.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); - } +@@ -104,7 +_,10 @@ -+ @Override -+ public void onClose() { -+ // We need to consider 2 potential parent screens here: -+ // 1. From the main menu, in which case display the main menu -+ // 2. From the pause menu, in which case exit back to game -+ this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen); -+ } -+ - private Button openScreenButton(Component p_261565_, Supplier p_262119_) { - return Button.builder(p_261565_, p_280808_ -> this.minecraft.setScreen(p_262119_.get())).build(); + @Override + public void onClose() { +- this.minecraft.setScreen(this.lastScreen); ++ // We need to consider 2 potential parent screens here: ++ // 1. From the main menu, in which case display the main menu ++ // 2. From the pause menu, in which case exit back to game ++ this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen); } + + private void applyPacks(PackRepository p_275714_) { diff --git a/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch b/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch index bbab6f045c..e95ad0d6f2 100644 --- a/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/screens/PauseScreen.java +++ b/net/minecraft/client/gui/screens/PauseScreen.java -@@ -87,6 +_,7 @@ +@@ -89,6 +_,7 @@ } else { - gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, SocialInteractionsScreen::new)); + gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this))); } + gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2); diff --git a/patches/net/minecraft/client/gui/screens/Screen.java.patch b/patches/net/minecraft/client/gui/screens/Screen.java.patch index 63f69e0d52..19ab329c65 100644 --- a/patches/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/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 -@@ -110,6 +_,7 @@ +@@ -118,6 +_,7 @@ } } @@ -8,7 +8,7 @@ @Override public void render(GuiGraphics p_281549_, int p_281550_, int p_282878_, float p_282465_) { this.renderBackground(p_281549_, p_281550_, p_282878_, p_282465_); -@@ -185,7 +_,7 @@ +@@ -203,7 +_,7 @@ } public void onClose() { @@ -17,45 +17,39 @@ } protected T addRenderableWidget(T p_169406_) { -@@ -297,7 +_,10 @@ +@@ -319,8 +_,11 @@ this.width = p_96608_; this.height = p_96609_; if (!this.initialized) { + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)).isCanceled()) { this.init(); + this.setInitialFocus(); + } + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget)); } else { this.repositionElements(); } -@@ -310,7 +_,10 @@ +@@ -333,8 +_,11 @@ protected void rebuildWidgets() { this.clearWidgets(); this.clearFocus(); + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)).isCanceled()) { this.init(); + this.setInitialFocus(); + } + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget)); } @Override -@@ -333,6 +_,7 @@ - public void renderBackground(GuiGraphics p_283688_, int p_296369_, int p_296477_, float p_294317_) { - if (this.minecraft.level != null) { - this.renderTransparentBackground(p_283688_); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_)); - } else { - this.renderDirtBackground(p_283688_); - } -@@ -347,6 +_,7 @@ - int i = 32; - p_282281_.blit(BACKGROUND_LOCATION, 0, 0, 0, 0.0F, 0.0F, this.width, this.height, 32, 32); - p_282281_.setColor(1.0F, 1.0F, 1.0F, 1.0F); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_282281_)); +@@ -361,6 +_,7 @@ + + this.renderBlurredBackground(p_294317_); + this.renderMenuBackground(p_283688_); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_)); } - public boolean isPauseScreen() { -@@ -443,6 +_,10 @@ + protected void renderBlurredBackground(float p_330683_) { +@@ -487,6 +_,10 @@ public void onFilesDrop(List p_96591_) { } @@ -66,7 +60,7 @@ private void scheduleNarration(long p_169381_, boolean p_169382_) { this.nextNarrationTime = Util.getMillis() + p_169381_; if (p_169382_) { -@@ -612,5 +_,13 @@ +@@ -653,5 +_,13 @@ this.index = p_169425_; this.priority = p_169426_; } diff --git a/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch index 208213373d..dc7090d094 100644 --- a/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java -@@ -63,6 +_,7 @@ - @Nullable - private TitleScreen.WarningLabel warningLabel; - private final LogoRenderer logoRenderer; -+ private net.neoforged.neoforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification; - - public TitleScreen() { - this(false); -@@ -120,11 +_,15 @@ +@@ -116,10 +_,13 @@ int j = this.width - i - 2; int k = 24; int l = this.height / 4 + 48; @@ -17,23 +9,21 @@ this.createDemoMenuOptions(l, 24); } else { this.createNormalMenuOptions(l, 24); -+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))) -+ .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20).build()); ++ modButton = this.addRenderableWidget(new net.neoforged.neoforge.client.gui.widget.ModsButton(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))) ++ .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20))); } -+ modUpdateNotification = net.neoforged.neoforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton); SpriteIconButton spriteiconbutton = this.addRenderableWidget( - CommonButtons.language( -@@ -179,7 +_,7 @@ +@@ -169,7 +_,7 @@ }).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag; this.addRenderableWidget( - Button.builder(Component.translatable("menu.online"), p_210872_ -> this.realmsButtonClicked()) + Button.builder(Component.translatable("menu.online"), p_315821_ -> this.minecraft.setScreen(new RealmsMainScreen(this))) - .bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20) + .bounds(this.width / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20) .tooltip(tooltip) .build() ) -@@ -294,6 +_,7 @@ +@@ -290,6 +_,7 @@ this.warningLabel.render(p_282860_, i); } @@ -41,27 +31,18 @@ if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) { this.splash.render(p_282860_, this.width, this.font, i); } -@@ -309,7 +_,13 @@ +@@ -305,7 +_,13 @@ s = s + I18n.get("menu.modded"); } - p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i); + net.neoforged.neoforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) -> -+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i) ++ p_282860_.drawString(this.font, brd, 2, this.height - (10 + brdline * (this.font.lineHeight + 1)), 16777215 | i) + ); + + net.neoforged.neoforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) -> -+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i) ++ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * (this.font.lineHeight + 1)), 16777215 | i) + ); - - for(GuiEventListener guieventlistener : this.children()) { - if (guieventlistener instanceof AbstractWidget) { -@@ -322,6 +_,8 @@ + if (this.realmsNotificationsEnabled() && f >= 1.0F) { RenderSystem.enableDepthTest(); this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_); - } -+ if (f1 >= 1.0f) modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_); -+ - } - } - diff --git a/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch b/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch index 3574087cf3..01da559bba 100644 --- a/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch +++ b/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch @@ -27,7 +27,7 @@ @@ -146,8 +_,8 @@ return null; } else { - for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { + for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) { - if (p_97173_ < advancementtabtype.getMax()) { - return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_301072_, optional.get()); + if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) { diff --git a/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch b/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch index 7c74f0d03d..3e9f5ae794 100644 --- a/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch @@ -1,46 +1,43 @@ --- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java -@@ -42,6 +_,7 @@ +@@ -49,6 +_,7 @@ @Nullable private AdvancementTab selectedTab; private boolean isScrolling; + private static int tabPage, maxPages; public AdvancementsScreen(ClientAdvancements p_97340_) { - super(GameNarrator.NO_TITLE); -@@ -59,6 +_,15 @@ - } else { + this(p_97340_, null); +@@ -73,6 +_,16 @@ this.advancements.setSelectedTab(this.selectedTab == null ? null : this.selectedTab.getRootNode().holder(), true); } -+ if (this.tabs.size() > AdvancementTabType.MAX_TABS) { -+ int guiLeft = (this.width - 252) / 2; -+ int guiTop = (this.height - 140) / 2; -+ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> tabPage = Math.max(tabPage - 1, 0 )) -+ .pos(guiLeft, guiTop - 50).size(20, 20).build()); -+ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)) -+ .pos(guiLeft + WINDOW_WIDTH - 20, guiTop - 50).size(20, 20).build()); -+ maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS; -+ } - } - @Override -@@ -77,7 +_,7 @@ ++ if (this.tabs.size() > AdvancementTabType.MAX_TABS) { ++ int guiLeft = (this.width - 252) / 2; ++ int guiTop = (this.height - 140) / 2; ++ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> tabPage = Math.max(tabPage - 1, 0 )) ++ .pos(guiLeft, guiTop - 50).size(20, 20).build()); ++ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)) ++ .pos(guiLeft + WINDOW_WIDTH - 20, guiTop - 50).size(20, 20).build()); ++ maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS; ++ } ++ + this.layout.addToFooter(Button.builder(CommonComponents.GUI_DONE, p_331557_ -> this.onClose()).width(200).build()); + this.layout.visitWidgets(p_332019_ -> { + AbstractWidget abstractwidget = this.addRenderableWidget(p_332019_); +@@ -106,7 +_,7 @@ int j = (this.height - 140) / 2; - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { - if (advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) { this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true); break; } -@@ -100,9 +_,14 @@ - - @Override - public void render(GuiGraphics p_282589_, int p_282255_, int p_283354_, float p_283123_) { -+ super.render(p_282589_, p_282255_, p_283354_, p_283123_); +@@ -132,6 +_,11 @@ + super.render(p_282589_, p_282255_, p_283354_, p_283123_); int i = (this.width - 252) / 2; int j = (this.height - 140) / 2; -- this.renderBackground(p_282589_, p_282255_, p_283354_, p_283123_); + if (maxPages != 0) { + net.minecraft.network.chat.Component page = Component.literal(String.format("%d / %d", tabPage + 1, maxPages + 1)); + int width = this.font.width(page); @@ -49,23 +46,23 @@ this.renderInside(p_282589_, p_282255_, p_283354_, i, j); this.renderWindow(p_282589_, i, j); this.renderTooltips(p_282589_, p_282255_, p_283354_, i, j); -@@ -151,10 +_,12 @@ +@@ -180,10 +_,12 @@ p_283395_.blit(WINDOW_LOCATION, p_281890_, p_282532_, 0, 0, 252, 140); if (this.tabs.size() > 1) { - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { + if (advancementtab.getPage() == tabPage) advancementtab.drawTab(p_283395_, p_281890_, p_282532_, advancementtab == this.selectedTab); } - for(AdvancementTab advancementtab1 : this.tabs.values()) { + for (AdvancementTab advancementtab1 : this.tabs.values()) { + if (advancementtab1.getPage() == tabPage) advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_); } } -@@ -174,7 +_,7 @@ +@@ -203,7 +_,7 @@ if (this.tabs.size() > 1) { - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { - if (advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { p_282784_.renderTooltip(this.font, advancementtab.getTitle(), p_283556_, p_282458_); diff --git a/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch b/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch index c532d3adfd..b09f7225b7 100644 --- a/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch +++ b/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch @@ -1,29 +1,26 @@ --- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java -@@ -165,6 +_,7 @@ +@@ -158,6 +_,7 @@ ) .build(); - this.resetButton = Button.builder(Component.translatable("controls.reset"), p_269616_ -> { + this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_329729_ -> { + this.key.setToDefault(); KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey()); KeyBindsList.this.resetMappingAndUpdateButtons(); }).bounds(0, 0, 50, 20).createNarration(p_253313_ -> Component.translatable("narrator.controls.reset", p_193917_)).build(); -@@ -184,8 +_,9 @@ - boolean p_282605_, - float p_281432_ - ) { -- int k = p_281373_ + 90 - KeyBindsList.this.maxNameWidth; -- p_281805_.drawString(KeyBindsList.this.minecraft.font, this.name, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false); -+ int textMaxWidth = p_281805_.guiWidth() / 2; -+ int k = p_281373_ + 90 - Math.min(KeyBindsList.this.maxNameWidth, textMaxWidth - 40); -+ net.minecraft.client.gui.components.AbstractWidget.renderScrollingString(p_281805_, KeyBindsList.this.minecraft.font, this.name, k, k, p_282357_ + p_281932_ / 2 - 9 / 2, textMaxWidth, p_282357_ + p_281932_ / 2 - 9 / 2 + 16, 16777215); // Neo: Makes descriptions start scrolling if too long - this.resetButton.setX(p_281373_ + 190); - this.resetButton.setY(p_282357_); - this.resetButton.render(p_281805_, p_282224_, p_282053_, p_281432_); -@@ -218,7 +_,7 @@ +@@ -184,7 +_,7 @@ + int k = i - 5 - this.changeButton.getWidth(); + this.changeButton.setPosition(k, j); + this.changeButton.render(p_281805_, p_282224_, p_282053_, p_281432_); +- p_281805_.drawString(KeyBindsList.this.minecraft.font, this.name, p_281373_, p_282357_ + p_281932_ / 2 - 9 / 2, -1); ++ p_281805_.drawScrollingString(KeyBindsList.this.minecraft.font, this.name, p_281373_, k - 9, p_282357_ + p_281932_ / 2 - 9 / 2, -1); // Neo: Makes descriptions start scrolling if too long + if (this.hasCollision) { + int l = 3; + int i1 = this.changeButton.getX() - 6; +@@ -210,7 +_,7 @@ MutableComponent mutablecomponent = Component.empty(); if (!this.key.isUnbound()) { - for(KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) { + for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) { - if (keymapping != this.key && this.key.same(keymapping)) { + if ((keymapping != this.key && this.key.same(keymapping)) || keymapping.hasKeyModifierConflict(this.key)) { // Neo: gracefully handle conflicts like SHIFT vs SHIFT+G if (this.hasCollision) { diff --git a/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch b/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch index d0c438d6f0..a3fc5368fa 100644 --- a/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java -@@ -31,7 +_,7 @@ +@@ -33,7 +_,7 @@ this.keyBindsList = this.addRenderableWidget(new KeyBindsList(this, this.minecraft)); - this.resetButton = this.addRenderableWidget(Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> { - for(KeyMapping keymapping : this.options.keyMappings) { + this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> { + for (KeyMapping keymapping : this.options.keyMappings) { - keymapping.setKey(keymapping.getDefaultKey()); + keymapping.setToDefault(); } this.keyBindsList.resetMappingAndUpdateButtons(); -@@ -59,11 +_,14 @@ +@@ -70,11 +_,14 @@ public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) { if (this.selectedKey != null) { if (p_193987_ == 256) { diff --git a/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 42d1f18d9c..8b04523a99 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -192,7 +192,7 @@ return true; } - for(int i = 0; i < 9; ++i) { + for (int i = 0; i < 9; i++) { - if (this.minecraft.options.keyHotbarSlots[i].matches(p_97806_, p_97807_)) { + if (this.minecraft.options.keyHotbarSlots[i].isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) { this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP); diff --git a/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 5acc534228..f5b9b06335 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/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 -@@ -110,6 +_,8 @@ +@@ -112,6 +_,8 @@ private boolean hasClickedOutside; private final Set> visibleTags = new HashSet<>(); private final boolean displayOperatorCreativeTab; @@ -9,7 +9,7 @@ public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) { super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY); -@@ -142,7 +_,7 @@ +@@ -144,7 +_,7 @@ private void refreshCurrentTabContents(Collection p_261591_) { int i = this.menu.getRowIndexForScroll(this.scrollOffs); this.menu.items.clear(); @@ -18,7 +18,7 @@ this.refreshSearchResults(); } else { this.menu.items.addAll(p_261591_); -@@ -309,6 +_,34 @@ +@@ -311,6 +_,34 @@ protected void init() { if (this.minecraft.gameMode.hasInfiniteItems()) { super.init(); @@ -53,7 +53,7 @@ this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search")); this.searchBox.setMaxLength(50); this.searchBox.setBordered(false); -@@ -355,7 +_,7 @@ +@@ -357,7 +_,7 @@ public boolean charTyped(char p_98521_, int p_98522_) { if (this.ignoreTextInput) { return false; @@ -62,7 +62,7 @@ return false; } else { String s = this.searchBox.getValue(); -@@ -374,7 +_,7 @@ +@@ -376,7 +_,7 @@ @Override public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) { this.ignoreTextInput = false; @@ -71,7 +71,7 @@ if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) { this.ignoreTextInput = true; this.selectTab(CreativeModeTabs.searchTab()); -@@ -410,6 +_,7 @@ +@@ -412,6 +_,7 @@ } private void refreshSearchResults() { @@ -79,7 +79,7 @@ this.menu.items.clear(); this.visibleTags.clear(); String s = this.searchBox.getValue(); -@@ -419,10 +_,10 @@ +@@ -421,10 +_,10 @@ SearchTree searchtree; if (s.startsWith("#")) { s = s.substring(1); @@ -92,7 +92,7 @@ } this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT))); -@@ -449,7 +_,8 @@ +@@ -451,7 +_,8 @@ @Override protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) { if (selectedTab.showTitle()) { @@ -102,25 +102,25 @@ } } -@@ -459,7 +_,7 @@ +@@ -461,7 +_,7 @@ double d0 = p_98531_ - (double)this.leftPos; double d1 = p_98532_ - (double)this.topPos; -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabClicked(creativemodetab, d0, d1)) { return true; } -@@ -481,7 +_,7 @@ +@@ -483,7 +_,7 @@ double d1 = p_98623_ - (double)this.topPos; this.scrolling = false; -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabClicked(creativemodetab, d0, d1)) { this.selectTab(creativemodetab); return true; -@@ -499,6 +_,7 @@ +@@ -501,6 +_,7 @@ private void selectTab(CreativeModeTab p_98561_) { CreativeModeTab creativemodetab = selectedTab; selectedTab = p_98561_; @@ -128,7 +128,7 @@ this.quickCraftSlots.clear(); this.menu.items.clear(); this.clearDraggingState(); -@@ -575,13 +_,15 @@ +@@ -577,13 +_,15 @@ this.originalSlots = null; } @@ -145,16 +145,16 @@ this.refreshSearchResults(); } else { -@@ -644,7 +_,7 @@ +@@ -646,7 +_,7 @@ public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) { super.render(p_283000_, p_281317_, p_282770_, p_281295_); -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) { break; } -@@ -656,6 +_,15 @@ +@@ -658,6 +_,15 @@ p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_); } @@ -170,7 +170,7 @@ this.renderTooltip(p_283000_, p_281317_, p_282770_); } -@@ -663,7 +_,7 @@ +@@ -665,7 +_,7 @@ public List getTooltipFromContainerItem(ItemStack p_281769_) { boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot; boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY; @@ -178,21 +178,21 @@ + boolean flag2 = selectedTab.hasSearchBar(); TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default; - List list = p_281769_.getTooltipLines(this.minecraft.player, tooltipflag); -@@ -682,7 +_,7 @@ + List list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag); +@@ -684,7 +_,7 @@ int i = 1; - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { - if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) { + if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) { list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE)); } } -@@ -693,14 +_,14 @@ +@@ -695,14 +_,14 @@ @Override protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) { -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (creativemodetab != selectedTab) { this.renderTabButton(p_282663_, creativemodetab); @@ -205,7 +205,7 @@ this.leftPos, this.topPos, 0, -@@ -713,10 +_,11 @@ +@@ -715,10 +_,11 @@ int k = this.topPos + 18; int i = k + 112; if (selectedTab.canScroll()) { @@ -218,7 +218,7 @@ this.renderTabButton(p_282663_, selectedTab); if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { InventoryScreen.renderEntityInInventoryFollowsMouse( -@@ -735,7 +_,7 @@ +@@ -737,7 +_,7 @@ } private int getTabX(CreativeModeTab p_260136_) { @@ -227,7 +227,7 @@ int j = 27; int k = 27 * i; if (p_260136_.isAlignedRight()) { -@@ -747,7 +_,7 @@ +@@ -749,7 +_,7 @@ private int getTabY(CreativeModeTab p_260181_) { int i = 0; @@ -236,7 +236,7 @@ i -= 32; } else { i += this.imageHeight; -@@ -775,8 +_,8 @@ +@@ -777,8 +_,8 @@ protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) { boolean flag = p_283489_ == selectedTab; @@ -247,7 +247,7 @@ int j = this.leftPos + this.getTabX(p_283489_); int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4)); ResourceLocation[] aresourcelocation; -@@ -786,6 +_,7 @@ +@@ -788,6 +_,7 @@ aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS; } @@ -255,7 +255,7 @@ p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32); p_283590_.pose().pushPose(); p_283590_.pose().translate(0.0F, 0.0F, 100.0F); -@@ -828,6 +_,14 @@ +@@ -829,6 +_,14 @@ } } @@ -270,7 +270,7 @@ @OnlyIn(Dist.CLIENT) static class CustomCreativeSlot extends Slot { public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) { -@@ -1014,6 +_,22 @@ +@@ -1013,6 +_,22 @@ @Override public boolean mayPickup(Player p_98665_) { return this.target.mayPickup(p_98665_); diff --git a/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch index 4ec18822d9..1a68a57177 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch +++ b/patches/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 -@@ -46,12 +_,17 @@ +@@ -47,12 +_,17 @@ Collection collection = this.minecraft.player.getActiveEffects(); if (!collection.isEmpty() && j >= 32) { boolean flag = j >= 120; @@ -19,22 +19,22 @@ this.renderBackgrounds(p_281945_, i, k, iterable, flag); this.renderIcons(p_281945_, i, k, iterable, flag); if (flag) { -@@ -98,6 +_,11 @@ +@@ -99,6 +_,11 @@ int i = this.topPos; - for(MobEffectInstance mobeffectinstance : p_282642_) { + for (MobEffectInstance mobeffectinstance : p_282642_) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (renderer.renderInventoryIcon(mobeffectinstance, this, p_282745_, p_282521_ + (p_281536_ ? 6 : 7), i, 0)) { + i += p_282291_; + continue; + } - MobEffect mobeffect = mobeffectinstance.getEffect(); - TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect); + Holder holder = mobeffectinstance.getEffect(); + TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder); p_282745_.blit(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite); -@@ -109,6 +_,11 @@ +@@ -110,6 +_,11 @@ int i = this.topPos; - for(MobEffectInstance mobeffectinstance : p_281986_) { + for (MobEffectInstance mobeffectinstance : p_281986_) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (renderer.renderInventoryText(mobeffectinstance, this, p_281462_, p_283484_, i, 0)) { + i += p_282057_; diff --git a/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch index aba01cbabc..f6a01bfeda 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java -@@ -120,9 +_,29 @@ +@@ -118,9 +_,29 @@ ) { float f = (float)(p_275688_ + p_275535_) / 2.0F; float f1 = (float)(p_275245_ + p_294406_) / 2.0F; diff --git a/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch b/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch index 46ee5f420d..dadea02e45 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java @@ -20,6 +_,8 @@ - if (p_169951_ instanceof BundleTooltip) { - return new ClientBundleTooltip((BundleTooltip)p_169951_); + if (p_169951_ instanceof BundleTooltip bundletooltip) { + return new ClientBundleTooltip(bundletooltip.contents()); } else { + ClientTooltipComponent result = net.neoforged.neoforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_); + if (result != null) return result; diff --git a/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch b/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch deleted file mode 100644 index c469fb8c94..0000000000 --- a/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java -+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java -@@ -280,6 +_,11 @@ - } - } - -+ @Override -+ public void onClose() { -+ this.minecraft.setScreen(this.lastScreen); -+ } -+ - public ServerStatusPinger getPinger() { - return this.pinger; - } diff --git a/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch b/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch index befbcccd3a..5cf9b50a9d 100644 --- a/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch +++ b/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch @@ -4,7 +4,7 @@ this.initFilterButtonTextures(); this.tabButtons.clear(); -- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { +- for (RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { + for(RecipeBookCategories recipebookcategories : this.menu.getRecipeBookCategories()) { this.tabButtons.add(new RecipeBookTabButton(recipebookcategories)); } diff --git a/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index 657f3b2590..9c13541628 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java -@@ -122,6 +_,7 @@ +@@ -118,6 +_,7 @@ public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) { queueLoadScreen(p_232897_, PREPARING_WORLD_DATA); PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator())); @@ -8,7 +8,7 @@ WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT); CompletableFuture completablefuture = WorldLoader.load( worldloader$initconfig, -@@ -248,6 +_,10 @@ +@@ -243,6 +_,10 @@ WorldCreationContext worldcreationcontext = this.uiState.getSettings(); LevelSettings levelsettings = this.createLevelSettings(flag); WorldData worlddata = new PrimaryLevelData(levelsettings, worldcreationcontext.options(), p_250577_, p_249994_); @@ -19,7 +19,7 @@ this.minecraft .createWorldOpenFlows() .createLevelFromExistingSettings(optional.get(), worldcreationcontext.dataPackResources(), p_249152_, worlddata); -@@ -427,7 +_,7 @@ +@@ -424,7 +_,7 @@ if (p_269627_) { p_270552_.accept(this.uiState.getSettings().dataConfiguration()); } else { @@ -28,7 +28,7 @@ } }, Component.translatable("dataPack.validation.failed"), -@@ -545,6 +_,7 @@ +@@ -542,6 +_,7 @@ if (path != null) { if (this.tempDataPackRepository == null) { this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch index 5e72d6ac60..b1747f20d9 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java -@@ -227,7 +_,7 @@ +@@ -225,7 +_,7 @@ @Nullable public PresetEditor getPresetEditor() { Holder holder = this.getWorldType().preset(); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch index 41ee20a0cc..9f778dfc50 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java -@@ -64,7 +_,7 @@ +@@ -65,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) @@ -9,48 +9,37 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final UUID WORLD_PACK_ID = UUID.fromString("640a6a92-b6cb-48a0-b391-831586500359"); private final Minecraft minecraft; -@@ -338,12 +_,21 @@ - } - - private void loadLevel(LevelStorageSource.LevelStorageAccess p_307362_, Dynamic p_307494_, boolean p_307298_, boolean p_307581_, Runnable p_307336_) { -+ // NEOFORGE: Patch in overload to reduce further patching -+ loadLevel(p_307362_, p_307494_, p_307298_, p_307581_, p_307336_, false); -+ } -+ private void loadLevel(LevelStorageSource.LevelStorageAccess p_307362_, Dynamic p_307494_, boolean p_307298_, boolean p_307581_, Runnable p_307336_, boolean confirmExperimentalWarning) { - this.minecraft.forceSetScreen(new GenericDirtMessageScreen(Component.translatable("selectWorld.resource_load"))); - PackRepository packrepository = ServerPacksSource.createPackRepository(p_307362_); +@@ -210,7 +_,10 @@ + component1 = Component.translatable("selectWorld.backupWarning.customized"); + } else { + component = Component.translatable("selectWorld.backupQuestion.experimental"); +- component1 = Component.translatable("selectWorld.backupWarning.experimental"); ++ // Neo: Add a line saying that the message won't show again. ++ component1 = Component.translatable("selectWorld.backupWarning.experimental") ++ .append("\n\n") ++ .append(Component.translatable("neoforge.selectWorld.backupWarning.experimental.additional")); + } - WorldStem worldstem; - try { -+ p_307362_.readAdditionalLevelSaveData(false); // Read extra (e.g. modded) data from the world before creating it - worldstem = this.loadWorldStem(p_307494_, p_307298_, packrepository); -+ // Forge: Skip confirmation if it has been done already for this world -+ if (confirmExperimentalWarning && worldstem.worldData() instanceof PrimaryLevelData pld) { -+ pld.withConfirmedWarning(true); -+ } - } catch (Exception exception) { - LOGGER.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception); - if (!p_307298_) { -@@ -371,7 +_,8 @@ - WorldData worlddata = worldstem.worldData(); + this.minecraft.setScreen(new BackupConfirmScreen(p_307323_, (p_307085_, p_307086_) -> { +@@ -373,10 +_,19 @@ + WorldData worlddata = p_330774_.worldData(); boolean flag = worlddata.worldGenOptions().isOldCustomizedWorld(); boolean flag1 = worlddata.worldGenSettingsLifecycle() != Lifecycle.stable(); -- if (!p_307581_ || !flag && !flag1) { +- if (!flag && !flag1) { + boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning(); -+ if (skipConfirmation || !p_307581_ || !flag && !flag1) { - DownloadedPackSource downloadedpacksource = this.minecraft.getDownloadedPackSource(); - this.loadBundledResourcePack(downloadedpacksource, p_307362_).thenApply(p_233177_ -> true).exceptionallyComposeAsync(p_233183_ -> { - LOGGER.warn("Failed to load pack: ", p_233183_); -@@ -390,10 +_,12 @@ - return null; - }); ++ if (skipConfirmation || (!flag && !flag1)) { + this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_); } else { -+ if (flag) // Forge: For legacy world options, let vanilla handle it. - this.askForBackup(p_307362_, flag, () -> this.loadLevel(p_307362_, p_307494_, p_307298_, false, p_307336_), () -> { - p_307362_.safeClose(); - p_307336_.run(); - }); -+ else net.neoforged.neoforge.client.ClientHooks.createWorldConfirmationScreen(() -> this.loadLevel(p_307362_, p_307494_, p_307298_, false, p_307336_, true)); - worldstem.close(); - } - } +- this.askForBackup(p_331469_, flag, () -> this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_), () -> { ++ this.askForBackup(p_331469_, flag, () -> { ++ if (!flag) { ++ // Neo: Prevent the message from showing again ++ if (p_330774_.worldData() instanceof PrimaryLevelData pld) { ++ pld.withConfirmedWarning(true); ++ } ++ } ++ this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_); ++ }, () -> { + p_330774_.close(); + p_331469_.safeClose(); + p_332128_.run(); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch index 196df42e27..8726aad60c 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java -@@ -76,6 +_,7 @@ +@@ -74,6 +_,7 @@ + static final ResourceLocation WARNING_SPRITE = new ResourceLocation("world_list/warning"); + static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = new ResourceLocation("world_list/join_highlighted"); static final ResourceLocation JOIN_SPRITE = new ResourceLocation("world_list/join"); - static final Logger LOGGER = LogUtils.getLogger(); - private static final ResourceLocation ICON_MISSING = new ResourceLocation("textures/misc/unknown_server.png"); + private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("neoforge","textures/gui/experimental_warning.png"); + static final Logger LOGGER = LogUtils.getLogger(); static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED); static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED); - static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD); -@@ -411,6 +_,7 @@ +@@ -405,6 +_,7 @@ RenderSystem.enableBlend(); p_281612_.blit(this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32); RenderSystem.disableBlend(); @@ -16,7 +16,7 @@ if (this.minecraft.options.touchscreen().get() || p_283396_) { p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544); int j = p_283204_ - p_282820_; -@@ -516,7 +_,8 @@ +@@ -510,7 +_,8 @@ this.minecraft.setScreen(new ProgressScreen(true)); this.doDeleteWorld(); } @@ -26,7 +26,7 @@ this.minecraft.setScreen(this.screen); }, Component.translatable("selectWorld.deleteQuestion"), -@@ -652,6 +_,19 @@ +@@ -646,6 +_,19 @@ public String getLevelName() { return this.summary.getLevelName(); diff --git a/patches/net/minecraft/client/model/HumanoidModel.java.patch b/patches/net/minecraft/client/model/HumanoidModel.java.patch index de7544cde7..c83c8fe091 100644 --- a/patches/net/minecraft/client/model/HumanoidModel.java.patch +++ b/patches/net/minecraft/client/model/HumanoidModel.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/model/HumanoidModel.java +++ b/net/minecraft/client/model/HumanoidModel.java @@ -306,6 +_,8 @@ - case TOOT_HORN: - this.rightArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F; - this.rightArm.yRot = this.head.yRot - (float) (Math.PI / 6); + case BRUSH: + this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) (Math.PI / 5); + this.rightArm.yRot = 0.0F; + default: + this.rightArmPose.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT); } } @@ -348,6 +_,8 @@ - case TOOT_HORN: - this.leftArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F; - this.leftArm.yRot = this.head.yRot + (float) (Math.PI / 6); + case BRUSH: + this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) (Math.PI / 5); + this.leftArm.yRot = 0.0F; + default: + this.leftArmPose.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT); } diff --git a/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch b/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch index 48389ea423..e83fcc18df 100644 --- a/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch +++ b/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java -@@ -322,6 +_,7 @@ +@@ -328,6 +_,7 @@ WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23)); LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer(); WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24)); diff --git a/patches/net/minecraft/client/model/geom/ModelLayers.java.patch b/patches/net/minecraft/client/model/geom/ModelLayers.java.patch index a8c0c319b1..f1105baa75 100644 --- a/patches/net/minecraft/client/model/geom/ModelLayers.java.patch +++ b/patches/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 -@@ -224,11 +_,13 @@ +@@ -228,11 +_,13 @@ } public static ModelLayerLocation createSignModelName(WoodType p_171292_) { diff --git a/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch b/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch index 20783d2c78..a7b061bb95 100644 --- a/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch +++ b/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java +++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java -@@ -80,6 +_,8 @@ +@@ -76,6 +_,8 @@ this.writeProfileKeyPair(profilekeypair); - return Optional.of(profilekeypair); + return Optional.ofNullable(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.neoforged.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE) diff --git a/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch b/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch index 60f2d8cb06..58519e946b 100644 --- a/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java -@@ -96,17 +_,17 @@ +@@ -98,17 +_,17 @@ public void handleCustomPayload(ClientboundCustomPayloadPacket p_295727_) { CustomPacketPayload custompacketpayload = p_295727_.payload(); if (!(custompacketpayload instanceof DiscardedPayload)) { - PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); if (custompacketpayload instanceof BrandPayload brandpayload) { -+ PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); //Neo: We move this here to ensure that only vanilla packets are handled on the main thread. ++ PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); this.serverBrand = brandpayload.brand(); this.telemetryManager.onServerBrandReceived(brandpayload.brand()); } else { @@ -19,9 +19,9 @@ - protected abstract void handleCustomPayload(CustomPacketPayload p_295776_); + protected abstract void handleCustomPayload(ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_295776_); - protected abstract RegistryAccess.Frozen registryAccess(); - -@@ -189,6 +_,10 @@ + @Override + public void handleResourcePackPush(ClientboundResourcePackPushPacket p_314606_) { +@@ -212,6 +_,10 @@ } public void send(Packet p_295097_) { @@ -32,17 +32,17 @@ this.connection.send(p_295097_); } -@@ -196,6 +_,9 @@ +@@ -219,6 +_,9 @@ public void onDisconnect(Component p_295485_) { this.telemetryManager.onDisconnect(); - this.minecraft.disconnect(this.createDisconnectScreen(p_295485_)); + this.minecraft.disconnect(this.createDisconnectScreen(p_295485_), this.keepResourcePacks); + if (!this.connection.isMemoryConnection()) { + net.neoforged.neoforge.registries.RegistryManager.revertToFrozen(); + } LOGGER.warn("Client disconnected with reason: {}", p_295485_.getString()); } -@@ -315,5 +_,15 @@ +@@ -338,5 +_,15 @@ @OnlyIn(Dist.CLIENT) static record PendingRequest(UUID id, URL url, String hash) { } diff --git a/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch b/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch index 2c22884764..e3c43d0080 100644 --- a/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java -@@ -26,6 +_,9 @@ - private final GameProfile localGameProfile; - private RegistryAccess.Frozen receivedRegistries; - private FeatureFlagSet enabledFeatures; +@@ -44,6 +_,9 @@ + private KnownPacksManager knownPacks; + @Nullable + protected ChatComponent.State chatState; + private net.neoforged.neoforge.network.connection.ConnectionType connectionType = net.neoforged.neoforge.network.connection.ConnectionType.VANILLA; + private boolean initializedConnection = false; + private java.util.Map failureReasons = new java.util.HashMap<>(); public ClientConfigurationPacketListenerImpl(Minecraft p_295262_, Connection p_296339_, CommonListenerCookie p_294706_) { super(p_295262_, p_296339_, p_294706_); -@@ -45,7 +_,41 @@ +@@ -59,7 +_,41 @@ } @Override @@ -53,7 +53,7 @@ this.handleUnknownCustomPayload(p_295411_); } -@@ -69,12 +_,23 @@ +@@ -82,6 +_,11 @@ @Override public void handleEnabledFeatures(ClientboundUpdateEnabledFeaturesPacket p_294410_) { this.enabledFeatures = FeatureFlags.REGISTRY.fromNames(p_294410_.features()); @@ -65,34 +65,26 @@ } @Override - public void handleConfigurationFinished(ClientboundFinishConfigurationPacket p_294585_) { - this.connection.suspendInboundAfterProtocolChange(); - PacketUtils.ensureRunningOnSameThread(p_294585_, this, this.minecraft); -+ -+ if (!this.initializedConnection && !this.connectionType.isNeoForge()) { -+ //Fallback detection for servers with a delayed brand payload (BungeeCord) -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this); -+ } -+ - this.connection - .setListener( - new ClientPacketListener( -@@ -87,11 +_,13 @@ - this.enabledFeatures, - this.serverBrand, +@@ -134,10 +_,17 @@ this.serverData, -- this.postDisconnectScreen -+ this.postDisconnectScreen, + this.postDisconnectScreen, + this.serverCookies, +- this.chatState ++ this.chatState, + this.connectionType ) ) ); - this.connection.resumeInboundAfterProtocolChange(); ++ // Packets can only be sent after the outbound protocol is set up again ++ if (!this.initializedConnection && !this.connectionType.isNeoForge()) { ++ //Fallback detection for servers with a delayed brand payload (BungeeCord) ++ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this); ++ } + net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onConfigurationFinished(this); - this.connection.send(new ServerboundFinishConfigurationPacket()); + this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE); + this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen))); } - -@@ -104,5 +_,18 @@ +@@ -151,5 +_,18 @@ public void onDisconnect(Component p_314649_) { super.onDisconnect(p_314649_); this.minecraft.clearDownloadedResourcePacks(); diff --git a/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch index 4bdfe36250..98300edc43 100644 --- a/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java -@@ -120,6 +_,7 @@ +@@ -121,6 +_,7 @@ p_194170_.put( BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)) ); @@ -8,7 +8,7 @@ } ); private final ClientChunkCache chunkSource; -@@ -127,6 +_,8 @@ +@@ -128,6 +_,8 @@ private int serverSimulationDistance; private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler(); private static final Set MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT); @@ -17,7 +17,7 @@ public void handleBlockChangedAck(int p_233652_) { this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this); -@@ -191,6 +_,7 @@ +@@ -192,6 +_,7 @@ this.serverSimulationDistance = p_205510_; this.updateSkyBrightness(); this.prepareWeather(); @@ -25,15 +25,15 @@ } public void queueLightUpdate(Runnable p_194172_) { -@@ -281,6 +_,7 @@ +@@ -282,6 +_,7 @@ p_104640_.setOldPosAndRot(); - ++p_104640_.tickCount; + p_104640_.tickCount++; this.getProfiler().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString()); + if (p_104640_.canUpdate()) p_104640_.tick(); this.getProfiler().pop(); -@@ -329,8 +_,10 @@ +@@ -330,8 +_,10 @@ } public void addEntity(Entity p_104741_) { @@ -44,7 +44,7 @@ } public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) { -@@ -501,6 +_,13 @@ +@@ -502,6 +_,13 @@ float p_263349_, long p_263408_ ) { @@ -58,7 +58,7 @@ if (p_263381_ == this.minecraft.player) { this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_); } -@@ -510,6 +_,12 @@ +@@ -511,6 +_,12 @@ public void playSeededSound( @Nullable Player p_263514_, Entity p_263536_, Holder p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_ ) { @@ -71,7 +71,7 @@ if (p_263514_ == this.minecraft.player) { this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_)); } -@@ -1054,6 +_,7 @@ +@@ -1033,6 +_,7 @@ } public void setDifficulty(Difficulty p_104852_) { @@ -79,7 +79,7 @@ this.difficulty = p_104852_; } -@@ -1090,14 +_,46 @@ +@@ -1069,14 +_,46 @@ if (p_171712_ instanceof AbstractClientPlayer) { ClientLevel.this.players.add((AbstractClientPlayer)p_171712_); } diff --git a/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 11b533d40a..8fe989ffa2 100644 --- a/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java -@@ -340,6 +_,7 @@ - private MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); +@@ -343,6 +_,7 @@ private final ChunkBatchSizeCalculator chunkBatchSizeCalculator = new ChunkBatchSizeCalculator(); private final PingDebugMonitor pingDebugMonitor; + private final DebugSampleSubscriber debugSampleSubscriber; + private net.neoforged.neoforge.network.connection.ConnectionType connectionType; @Nullable private LevelLoadStatusManager levelLoadStatusManager; - private boolean seenInsecureChatWarning = false; -@@ -353,6 +_,7 @@ - this.advancements = new ClientAdvancements(p_253924_, this.telemetryManager); - this.suggestionsProvider = new ClientSuggestionProvider(this, p_253924_); - this.pingDebugMonitor = new PingDebugMonitor(this, p_253924_.getDebugOverlay().getPingLogger()); + private boolean serverEnforcesSecureChat; +@@ -364,6 +_,7 @@ + p_253924_.gui.getChat().restoreState(p_295121_.chatState()); + } + + this.connectionType = p_295121_.connectionType(); + this.potionBrewing = PotionBrewing.bootstrap(this.enabledFeatures); } - public ClientSuggestionProvider getSuggestionsProvider() { -@@ -416,6 +_,7 @@ +@@ -425,6 +_,7 @@ this.minecraft.debugRenderer.clear(); this.minecraft.player.resetPos(); @@ -24,17 +24,17 @@ this.minecraft.player.setId(p_105030_.playerId()); this.level.addEntity(this.minecraft.player); this.minecraft.player.input = new KeyboardInput(this.minecraft.options); -@@ -801,7 +_,8 @@ - this.enabledFeatures, - this.serverBrand, +@@ -823,7 +_,8 @@ this.serverData, -- this.postDisconnectScreen -+ this.postDisconnectScreen, + this.postDisconnectScreen, + this.serverCookies, +- chatcomponent$state ++ chatcomponent$state, + this.connectionType ) ) ); -@@ -1143,6 +_,7 @@ +@@ -1155,6 +_,7 @@ } localplayer1.resetPos(); @@ -42,19 +42,19 @@ this.level.addEntity(localplayer1); localplayer1.setYRot(-180.0F); localplayer1.input = new KeyboardInput(this.minecraft.options); -@@ -1274,10 +_,7 @@ +@@ -1283,10 +_,7 @@ PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft); BlockPos blockpos = p_104976_.getPos(); - this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_205557_ -> { + this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_337415_ -> { - CompoundTag compoundtag = p_104976_.getTag(); -- if (compoundtag != null) { -- p_205557_.load(compoundtag); +- if (!compoundtag.isEmpty()) { +- p_337415_.loadWithComponents(compoundtag, this.registryAccess); - } -+ p_205557_.onDataPacket(connection, p_104976_); ++ p_337415_.onDataPacket(connection, p_104976_, this.registryAccess); - if (p_205557_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) { + if (p_337415_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) { ((CommandBlockEditScreen)this.minecraft.screen).updateGui(); -@@ -1446,7 +_,9 @@ +@@ -1453,7 +_,9 @@ @Override public void handleCommands(ClientboundCommandsPacket p_104990_) { PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft); @@ -65,7 +65,7 @@ } @Override -@@ -1468,6 +_,7 @@ +@@ -1475,6 +_,7 @@ ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook(); clientrecipebook.setupCollections(this.recipeManager.getRecipes(), this.minecraft.level.registryAccess()); this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections()); @@ -73,17 +73,7 @@ } @Override -@@ -1574,7 +_,8 @@ - Blocks.rebuildCache(); - } - -- CreativeModeTabs.searchTab().rebuildSearchTree(); -+ CreativeModeTabs.allTabs().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::rebuildSearchTree); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(this.registryAccess, true, connection.isMemoryConnection())); - } - - @Override -@@ -1916,7 +_,21 @@ +@@ -1906,7 +_,21 @@ } @Override @@ -106,15 +96,6 @@ if (p_295851_ instanceof PathfindingDebugPayload pathfindingdebugpayload) { this.minecraft .debugRenderer -@@ -2267,7 +_,7 @@ - public void handleBundlePacket(ClientboundBundlePacket p_265195_) { - PacketUtils.ensureRunningOnSameThread(p_265195_, this, this.minecraft); - -- for(Packet packet : p_265195_.subPackets()) { -+ for(Packet packet : p_265195_.subPackets()) { - packet.handle(this); - } - } @@ -2389,6 +_,8 @@ } @@ -129,16 +110,17 @@ public void sendCommand(String p_250092_) { + if (net.neoforged.neoforge.client.ClientCommandHandler.runCommand(p_250092_)) return; - Instant instant = Instant.now(); - long i = Crypt.SaltSupplier.getLong(); - LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate(); -@@ -2463,5 +_,9 @@ + SignableCommand signablecommand = SignableCommand.of(this.parseCommand(p_250092_)); + if (signablecommand.arguments().isEmpty()) { + this.send(new ServerboundChatCommandPacket(p_250092_)); +@@ -2472,6 +_,10 @@ - public boolean isFeatureEnabled(FeatureFlagSet p_250605_) { - return p_250605_.isSubsetOf(this.enabledFeatures()); + public Scoreboard scoreboard() { + return this.scoreboard; + } + + public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { -+ return connectionType; ++ return this.connectionType; } - } + + public PotionBrewing potionBrewing() { diff --git a/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch b/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch index f8d1c04191..899177939d 100644 --- a/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch +++ b/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch @@ -1,19 +1,29 @@ --- a/net/minecraft/client/multiplayer/CommonListenerCookie.java +++ b/net/minecraft/client/multiplayer/CommonListenerCookie.java -@@ -17,6 +_,15 @@ - FeatureFlagSet enabledFeatures, - @Nullable String serverBrand, +@@ -22,6 +_,25 @@ @Nullable ServerData serverData, -- @Nullable Screen postDisconnectScreen -+ @Nullable Screen postDisconnectScreen, + @Nullable Screen postDisconnectScreen, + Map serverCookies, +- @Nullable ChatComponent.State chatState ++ @Nullable ChatComponent.State chatState, + net.neoforged.neoforge.network.connection.ConnectionType connectionType ) { -+ + /** -+ * @deprecated Use {@link #CommonListenerCookie(GameProfile, WorldSessionTelemetryManager, RegistryAccess.Frozen, FeatureFlagSet, String, ServerData, Screen, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. ++ * @deprecated Use {@link #CommonListenerCookie(GameProfile, WorldSessionTelemetryManager, RegistryAccess.Frozen, FeatureFlagSet, String, ServerData, Screen, Map, ChatComponent.State, net.neoforged.neoforge.network.connection.ConnectionType)} ++ * instead,to indicate whether the connection is modded. + */ + @Deprecated -+ public CommonListenerCookie(GameProfile localGameProfile, WorldSessionTelemetryManager telemetryManager, RegistryAccess.Frozen receivedRegistries, FeatureFlagSet enabledFeatures, @Nullable String serverBrand, @Nullable ServerData serverData, @Nullable Screen postDisconnectScreen) { -+ this(localGameProfile, telemetryManager, receivedRegistries, enabledFeatures, serverBrand, serverData, postDisconnectScreen, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); ++ public CommonListenerCookie( ++ GameProfile localGameProfile, ++ WorldSessionTelemetryManager telemetryManager, ++ RegistryAccess.Frozen receivedRegistries, ++ FeatureFlagSet enabledFeatures, ++ @Nullable String serverBrand, ++ @Nullable ServerData serverData, ++ @Nullable Screen postDisconnectScreen, ++ Map serverCookies, ++ @Nullable ChatComponent.State chatState ++ ) { ++ this(localGameProfile, telemetryManager, receivedRegistries, enabledFeatures, serverBrand, serverData, postDisconnectScreen, serverCookies, chatState, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); + } } diff --git a/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index fe92a04792..217d3dd251 100644 --- a/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/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 -@@ -105,6 +_,7 @@ +@@ -106,6 +_,7 @@ } public boolean destroyBlock(BlockPos p_105268_) { @@ -8,7 +8,7 @@ if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) { return false; } else { -@@ -119,9 +_,8 @@ +@@ -120,9 +_,8 @@ } else if (blockstate.isAir()) { return false; } else { @@ -19,7 +19,7 @@ if (flag) { block.destroy(level, p_105268_, blockstate); } -@@ -142,6 +_,7 @@ +@@ -143,6 +_,7 @@ BlockState blockstate = this.minecraft.level.getBlockState(p_105270_); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F); this.startPrediction(this.minecraft.level, p_233757_ -> { @@ -27,7 +27,7 @@ this.destroyBlock(p_105270_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_); }); -@@ -151,15 +_,19 @@ +@@ -152,15 +_,19 @@ this.connection .send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_)); } @@ -47,7 +47,7 @@ if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) { this.destroyBlock(p_105270_); } else { -@@ -171,7 +_,7 @@ +@@ -172,7 +_,7 @@ this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage()); } @@ -56,7 +56,7 @@ }); } -@@ -202,6 +_,7 @@ +@@ -203,6 +_,7 @@ BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F); this.startPrediction(this.minecraft.level, p_233753_ -> { @@ -64,42 +64,33 @@ this.destroyBlock(p_105284_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_); }); -@@ -214,7 +_,7 @@ +@@ -215,7 +_,7 @@ } else { - this.destroyProgress += blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_); + this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_); if (this.destroyTicks % 4.0F == 0.0F) { - SoundType soundtype = blockstate.getSoundType(); + SoundType soundtype = blockstate.getSoundType(this.minecraft.level, p_105284_, this.minecraft.player); this.minecraft .getSoundManager() .play( -@@ -231,6 +_,7 @@ +@@ -232,6 +_,7 @@ - ++this.destroyTicks; + this.destroyTicks++; this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F)); + if (net.neoforged.neoforge.common.CommonHooks.onClientMineHold(this.minecraft.player, p_105284_, p_105285_).getUseItem() == net.neoforged.bus.api.Event.Result.DENY) return true; if (this.destroyProgress >= 1.0F) { this.isDestroying = false; this.startPrediction(this.minecraft.level, p_233739_ -> { -@@ -259,7 +_,7 @@ - } - - public float getPickRange() { -- return Player.getPickRange(this.localPlayerMode.isCreative()); -+ return (float) this.minecraft.player.getBlockReach(); - } - - public void tick() { -@@ -273,7 +_,7 @@ +@@ -270,7 +_,7 @@ private boolean sameDestroyTarget(BlockPos p_105282_) { ItemStack itemstack = this.minecraft.player.getMainHandItem(); -- return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameTags(itemstack, this.destroyingItem); +- return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameComponents(itemstack, this.destroyingItem); + return p_105282_.equals(this.destroyBlockPos) && !destroyingItem.shouldCauseBlockBreakReset(itemstack); } private void ensureHasSentCarriedItem() { -@@ -301,25 +_,38 @@ +@@ -298,12 +_,23 @@ private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) { BlockPos blockpos = p_233749_.getBlockPos(); ItemStack itemstack = p_233747_.getItemInHand(p_233748_); @@ -121,15 +112,11 @@ + boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_); boolean flag1 = p_233747_.isSecondaryUseActive() && flag; - if (!flag1) { ++ if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { BlockState blockstate = this.minecraft.level.getBlockState(blockpos); if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) { return InteractionResult.FAIL; - } - -+ if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { - InteractionResult interactionresult = blockstate.use(this.minecraft.level, p_233747_, p_233748_, p_233749_); - if (interactionresult.consumesAction()) { - return interactionresult; +@@ -324,8 +_,10 @@ } } @@ -142,7 +129,7 @@ InteractionResult interactionresult1; if (this.localPlayerMode.isCreative()) { int i = itemstack.getCount(); -@@ -355,10 +_,17 @@ +@@ -361,10 +_,17 @@ mutableobject.setValue(InteractionResult.PASS); return serverbounduseitempacket; } else { @@ -160,7 +147,7 @@ } mutableobject.setValue(interactionresultholder.getResult()); -@@ -396,6 +_,9 @@ +@@ -402,6 +_,9 @@ this.ensureHasSentCarriedItem(); Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ()); this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3)); diff --git a/patches/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/net/minecraft/client/multiplayer/ServerData.java.patch index bbe6f6d67d..88f40c09d1 100644 --- a/patches/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/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 -@@ -35,6 +_,7 @@ +@@ -34,6 +_,7 @@ private byte[] iconBytes; private ServerData.Type type; - private boolean enforcesSecureChat; + private ServerData.State state = ServerData.State.INITIAL; + public net.neoforged.neoforge.client.ExtendedServerListData neoForgeData = null; public ServerData(String p_105375_, String p_105376_, ServerData.Type p_295587_) { diff --git a/patches/net/minecraft/client/multiplayer/TagCollector.java.patch b/patches/net/minecraft/client/multiplayer/TagCollector.java.patch new file mode 100644 index 0000000000..5bfd056538 --- /dev/null +++ b/patches/net/minecraft/client/multiplayer/TagCollector.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/client/multiplayer/TagCollector.java ++++ b/net/minecraft/client/multiplayer/TagCollector.java +@@ -23,7 +_,7 @@ + } + + private static void refreshCommonTagDependentData() { +- CreativeModeTabs.searchTab().rebuildSearchTree(); ++ CreativeModeTabs.allTabs().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::rebuildSearchTree); + } + + private static void refreshBuiltInTagDependentData() { +@@ -51,5 +_,6 @@ + } + + refreshCommonTagDependentData(); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(p_326147_, true, p_326486_)); + } + } diff --git a/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch b/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch deleted file mode 100644 index 1c3bc85852..0000000000 --- a/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/particle/EnchantmentTableParticle.java -+++ b/net/minecraft/client/particle/EnchantmentTableParticle.java -@@ -77,6 +_,7 @@ - this.x = this.xStart + this.xd * (double)f; - this.y = this.yStart + this.yd * (double)f - (double)(f1 * 1.2F); - this.z = this.zStart + this.zd * (double)f; -+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box - } - } - diff --git a/patches/net/minecraft/client/particle/FireworkParticles.java.patch b/patches/net/minecraft/client/particle/FireworkParticles.java.patch index 88a00aa5e2..709c4d392d 100644 --- a/patches/net/minecraft/client/particle/FireworkParticles.java.patch +++ b/patches/net/minecraft/client/particle/FireworkParticles.java.patch @@ -1,31 +1,13 @@ --- a/net/minecraft/client/particle/FireworkParticles.java +++ b/net/minecraft/client/particle/FireworkParticles.java -@@ -219,7 +_,7 @@ - } else { - for(int i = 0; i < this.explosions.size(); ++i) { - CompoundTag compoundtag = this.explosions.getCompound(i); -- if (FireworkRocketItem.Shape.byId(compoundtag.getByte("Type")) == FireworkRocketItem.Shape.LARGE_BALL) { -+ if (FireworkRocketItem.Shape.getShape(compoundtag) == FireworkRocketItem.Shape.LARGE_BALL) { - flag1 = true; - break; - } -@@ -239,7 +_,7 @@ - if (this.life % 2 == 0 && this.explosions != null && this.life / 2 < this.explosions.size()) { - int k = this.life / 2; - CompoundTag compoundtag1 = this.explosions.getCompound(k); -- FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.byId(compoundtag1.getByte("Type")); -+ FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.getShape(compoundtag1); - boolean flag4 = compoundtag1.getBoolean("Trail"); - boolean flag2 = compoundtag1.getBoolean("Flicker"); - int[] aint = compoundtag1.getIntArray("Colors"); -@@ -248,6 +_,10 @@ - aint = new int[]{DyeColor.BLACK.getFireworkColor()}; +@@ -253,6 +_,10 @@ + intlist = IntList.of(DyeColor.BLACK.getFireworkColor()); } -+ var factory = net.neoforged.neoforge.client.FireworkShapeFactoryRegistry.get(fireworkrocketitem$shape); ++ var factory = net.neoforged.neoforge.client.FireworkShapeFactoryRegistry.get(fireworkexplosion1.shape()); + if (factory != null) -+ factory.build(this, flag4, flag2, aint, aint1); ++ factory.build(this, flag3, flag4, intlist.toIntArray(), intlist1.toIntArray()); + else - switch(fireworkrocketitem$shape) { + switch (fireworkexplosion1.shape()) { case SMALL_BALL: - default: + this.createParticleBall(0.25, 2, intlist, intlist1, flag3, flag4); diff --git a/patches/net/minecraft/client/particle/Particle.java.patch b/patches/net/minecraft/client/particle/Particle.java.patch index d7d7e57e61..b3280b7ed0 100644 --- a/patches/net/minecraft/client/particle/Particle.java.patch +++ b/patches/net/minecraft/client/particle/Particle.java.patch @@ -1,19 +1,21 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java -@@ -244,4 +_,16 @@ - public Optional getParticleGroup() { +@@ -245,6 +_,18 @@ return Optional.empty(); } + ++ /** ++ * Forge added method that controls if a particle should be culled to it's bounding box. ++ * Default behaviour is culling enabled ++ */ ++ public boolean shouldCull() { ++ return true; ++ } + -+ /** -+ * Forge added method that controls if a particle should be culled to it's bounding box. -+ * Default behaviour is culling enabled -+ */ -+ public boolean shouldCull() { -+ return true; -+ } ++ public Vec3 getPos() { ++ return new Vec3(this.x, this.y, this.z); ++ } + -+ public net.minecraft.world.phys.Vec3 getPos() { -+ return new net.minecraft.world.phys.Vec3(this.x, this.y, this.z); -+ } - } + @OnlyIn(Dist.CLIENT) + public static record LifetimeAlpha(float startAlpha, float endAlpha, float startAtNormalizedAge, float endAtNormalizedAge) { + public static final Particle.LifetimeAlpha ALWAYS_OPAQUE = new Particle.LifetimeAlpha(1.0F, 1.0F, 0.0F, 1.0F); diff --git a/patches/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/net/minecraft/client/particle/ParticleEngine.java.patch index aacfeb0a5b..8eee5707c4 100644 --- a/patches/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/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 -@@ -81,11 +_,11 @@ +@@ -79,11 +_,11 @@ ParticleRenderType.CUSTOM ); protected ClientLevel level; @@ -14,8 +14,8 @@ private final Queue particlesToAdd = Queues.newArrayDeque(); private final Map spriteSets = Maps.newHashMap(); private final TextureAtlas textureAtlas; -@@ -208,10 +_,14 @@ - this.register(ParticleTypes.TRIAL_SPAWNER_DETECTION, TrialSpawnerDetectionParticle.Provider::new); +@@ -214,10 +_,14 @@ + this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new); } + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent} */ @@ -30,7 +30,7 @@ public void register(ParticleType p_273423_, ParticleProvider.Sprite p_273134_) { this.register( p_273423_, -@@ -228,10 +_,12 @@ +@@ -234,10 +_,12 @@ ); } @@ -44,46 +44,43 @@ } @Override -@@ -357,7 +_,7 @@ +@@ -363,7 +_,7 @@ private Particle makeParticle( T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_ ) { -- ParticleProvider particleprovider = (ParticleProvider)this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType())); +- ParticleProvider particleprovider = (ParticleProvider)this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType())); + ParticleProvider particleprovider = (ParticleProvider) this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getKey(p_107396_.getType())); return particleprovider == null ? null : particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_); -@@ -433,15 +_,24 @@ +@@ -439,11 +_,21 @@ } } -+ /**@deprecated Forge: use {@link #render(PoseStack, MultiBufferSource.BufferSource, LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter*/ ++ /** @deprecated Neo: use {@link #render(LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter */ + @Deprecated - public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_) { -+ render(p_107337_, p_107338_, p_107339_, p_107340_, p_107341_, null); + public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_) { ++ render(p_107339_, p_107340_, p_107341_, null); + } + -+ public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum clippingHelper) { ++ public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum frustum) { p_107339_.turnOnLightLayer(); RenderSystem.enableDepthTest(); ++ //TODO porting: is this even needed with the particle render order fix??? + RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE2); + RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE0); - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.pushPose(); - posestack.mulPoseMatrix(p_107337_.last().pose()); - RenderSystem.applyModelViewMatrix(); -- for(ParticleRenderType particlerendertype : RENDER_ORDER) { +- for (ParticleRenderType particlerendertype : RENDER_ORDER) { + for(ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's + if (particlerendertype == ParticleRenderType.NO_RENDER) continue; Iterable iterable = this.particles.get(particlerendertype); if (iterable != null) { RenderSystem.setShader(GameRenderer::getParticleShader); -@@ -450,6 +_,7 @@ +@@ -452,6 +_,7 @@ particlerendertype.begin(bufferbuilder, this.textureManager); - for(Particle particle : iterable) { -+ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.isVisible(particle.getBoundingBox().inflate(1.0))) continue; + for (Particle particle : iterable) { ++ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox().inflate(1.0))) continue; try { particle.render(bufferbuilder, p_107340_, p_107341_); } catch (Throwable throwable) { diff --git a/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch b/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch index 7e008c7341..cfae8e8062 100644 --- a/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch +++ b/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/particle/ReversePortalParticle.java +++ b/net/minecraft/client/particle/ReversePortalParticle.java @@ -31,6 +_,7 @@ - this.x += this.xd * (double)f; - this.y += this.yd * (double)f; - this.z += this.zd * (double)f; -+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box + this.x = this.x + this.xd * (double)f; + this.y = this.y + this.yd * (double)f; + this.z = this.z + this.zd * (double)f; ++ this.setPos(this.x, this.y, this.z); // Neo: update the particle's bounding box } } diff --git a/patches/net/minecraft/client/particle/TerrainParticle.java.patch b/patches/net/minecraft/client/particle/TerrainParticle.java.patch index f3489d50d6..ae51665cbd 100644 --- a/patches/net/minecraft/client/particle/TerrainParticle.java.patch +++ b/patches/net/minecraft/client/particle/TerrainParticle.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/TerrainParticle.java +++ b/net/minecraft/client/particle/TerrainParticle.java -@@ -40,7 +_,7 @@ +@@ -41,7 +_,7 @@ this.rCol = 0.6F; this.gCol = 0.6F; this.bCol = 0.6F; @@ -10,18 +10,18 @@ this.rCol *= (float)(i >> 16 & 0xFF) / 255.0F; this.gCol *= (float)(i >> 8 & 0xFF) / 255.0F; @@ -97,8 +_,14 @@ - ) { - BlockState blockstate = p_108304_.getState(); - return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles() -- ? new TerrainParticle(p_108305_, p_108306_, p_108307_, p_108308_, p_108309_, p_108310_, p_108311_, blockstate) -+ ? new TerrainParticle(p_108305_, p_108306_, p_108307_, p_108308_, p_108309_, p_108310_, p_108311_, blockstate).updateSprite(blockstate, p_108304_.getPos()) - : null; - } + ) { + BlockState blockstate = p_338588_.getState(); + return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles() +- ? new TerrainParticle(p_338858_, p_338212_, p_338420_, p_338623_, p_338262_, p_338289_, p_338400_, blockstate) ++ ? new TerrainParticle(p_338858_, p_338212_, p_338420_, p_338623_, p_338262_, p_338289_, p_338400_, blockstate).updateSprite(blockstate, p_338588_.getPos()) + : null; + } + -+ public Particle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. ++ public TerrainParticle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. + if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version + this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getTexture(state, level, pos)); + return this; } - } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/player/LocalPlayer.java.patch b/patches/net/minecraft/client/player/LocalPlayer.java.patch index 99101b0dea..2ce14eeb1e 100644 --- a/patches/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/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 -@@ -158,6 +_,7 @@ +@@ -160,6 +_,7 @@ @Override public boolean hurt(DamageSource p_108662_, float p_108663_) { @@ -8,7 +8,7 @@ return false; } -@@ -294,6 +_,7 @@ +@@ -296,6 +_,7 @@ ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_ ? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS : ServerboundPlayerActionPacket.Action.DROP_ITEM; @@ -16,7 +16,7 @@ ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_); this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN)); return !itemstack.isEmpty(); -@@ -491,7 +_,14 @@ +@@ -493,7 +_,14 @@ @Override public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) { @@ -32,7 +32,7 @@ } @Override -@@ -683,6 +_,7 @@ +@@ -685,6 +_,7 @@ && (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING)); float f = Mth.clamp(0.3F + EnchantmentHelper.getSneakingSpeedBonus(this), 0.0F, 1.0F); this.input.tick(this.isMovingSlowly(), f); @@ -40,7 +40,7 @@ this.minecraft.getTutorial().onInput(this.input); if (this.isUsingItem() && !this.isPassenger()) { this.input.leftImpulse *= 0.2F; -@@ -711,7 +_,7 @@ +@@ -713,7 +_,7 @@ boolean flag4 = this.canStartSprinting(); boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround(); boolean flag6 = !flag1 && !flag2; @@ -49,7 +49,7 @@ if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) { this.sprintTriggerTime = 7; } else { -@@ -719,15 +_,15 @@ +@@ -721,15 +_,15 @@ } } @@ -68,18 +68,18 @@ this.setSprinting(false); } } else if (flag8) { -@@ -736,7 +_,7 @@ +@@ -738,7 +_,7 @@ } boolean flag9 = false; -- if (this.getAbilities().mayfly) { +- if (abilities.mayfly) { + if (this.mayFly()) { if (this.minecraft.gameMode.isAlwaysFlying()) { - if (!this.getAbilities().flying) { - this.getAbilities().flying = true; -@@ -757,14 +_,15 @@ + if (!abilities.flying) { + abilities.flying = true; +@@ -763,14 +_,15 @@ - if (this.input.jumping && !flag9 && !flag && !this.getAbilities().flying && !this.isPassenger() && !this.onClimbable()) { + if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); - if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack) && this.tryToStartFallFlying()) { + if (itemstack.canElytraFly(this) && this.tryToStartFallFlying()) { @@ -96,15 +96,15 @@ } if (this.isEyeInFluid(FluidTags.WATER)) { -@@ -866,6 +_,7 @@ +@@ -872,6 +_,7 @@ @Override public void rideTick() { super.rideTick(); + if (this.wantsToStopRiding() && this.isPassenger()) this.input.shiftKeyDown = false; this.handsBusy = false; - Entity entity = this.getControlledVehicle(); - if (entity instanceof Boat boat) { -@@ -1053,7 +_,7 @@ + if (this.getControlledVehicle() instanceof Boat boat) { + boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down); +@@ -1058,7 +_,7 @@ } private boolean hasEnoughFoodToStartSprinting() { diff --git a/patches/net/minecraft/client/player/RemotePlayer.java.patch b/patches/net/minecraft/client/player/RemotePlayer.java.patch index e9cd84229e..afa4ad0f6c 100644 --- a/patches/net/minecraft/client/player/RemotePlayer.java.patch +++ b/patches/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 -@@ -34,6 +_,7 @@ +@@ -33,6 +_,7 @@ @Override public boolean hurt(DamageSource p_108772_, float p_108773_) { diff --git a/patches/net/minecraft/client/renderer/EffectInstance.java.patch b/patches/net/minecraft/client/renderer/EffectInstance.java.patch index 05d55d24bb..f6e9356876 100644 --- a/patches/net/minecraft/client/renderer/EffectInstance.java.patch +++ b/patches/net/minecraft/client/renderer/EffectInstance.java.patch @@ -3,12 +3,12 @@ @@ -58,7 +_,8 @@ private final EffectProgram fragmentProgram; - public EffectInstance(ResourceManager p_108941_, String p_108942_) throws IOException { + public EffectInstance(ResourceProvider p_331011_, String p_108942_) throws IOException { - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_108942_ + ".json"); + ResourceLocation rl = ResourceLocation.tryParse(p_108942_); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json"); this.name = p_108942_; - Resource resource = p_108941_.getResourceOrThrow(resourcelocation); + Resource resource = p_331011_.getResourceOrThrow(resourcelocation); @@ -150,7 +_,8 @@ } else { @@ -17,6 +17,6 @@ - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.getExtension()); + ResourceLocation rl = ResourceLocation.tryParse(p_172569_); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_172568_.getExtension()); - Resource resource = p_172567_.getResourceOrThrow(resourcelocation); + Resource resource = p_330579_.getResourceOrThrow(resourcelocation); try (InputStream inputstream = resource.open()) { diff --git a/patches/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/net/minecraft/client/renderer/GameRenderer.java.patch index 2251fc4cbf..564f4b7bfb 100644 --- a/patches/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/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 -@@ -334,6 +_,8 @@ +@@ -310,6 +_,8 @@ this.loadEffect(new ResourceLocation("shaders/post/spider.json")); } else if (p_109107_ instanceof EnderMan) { this.loadEffect(new ResourceLocation("shaders/post/invert.json")); @@ -9,51 +9,15 @@ } } -@@ -759,6 +_,7 @@ - p_311462_ -> rendertypeBreezeWindShader = p_311462_ +@@ -735,6 +_,7 @@ ) ); + this.loadBlurEffect(); + net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RegisterShadersEvent(p_250719_, list1)); } catch (IOException ioexception) { list1.forEach(p_172729_ -> p_172729_.getFirst().close()); throw new RuntimeException("could not reload shaders", ioexception); -@@ -834,12 +_,25 @@ - this.minecraft.getProfiler().push("pick"); - this.minecraft.crosshairPickEntity = null; - double d0 = (double)this.minecraft.gameMode.getPickRange(); -+ double entityReach = this.minecraft.player.getEntityReach(); // Note - MC-76493 - We must validate players cannot click-through objects. -+ d0 = Math.max(d0, entityReach); // Calculate hit results with the max of both reach distances, and compare against the individual ones later. This prevents click-through. - this.minecraft.hitResult = entity.pick(d0, p_109088_, false); - Vec3 vec3 = entity.getEyePosition(p_109088_); -+ if (false) { // These flags are unused with attributes. - boolean flag = this.minecraft.gameMode.hasFarPickRange(); - d0 = flag ? 6.0 : d0; - boolean flag1 = !flag; -- double d1 = this.minecraft.hitResult != null ? this.minecraft.hitResult.getLocation().distanceToSqr(vec3) : d0 * d0; -+ } -+ // If we picked a block, we need to ignore entities past that block. Added != MISS check to not truncate on failed picks. -+ // Also fixes MC-250858 -+ // Note: If vanilla ever actually fixes MC-250858 and adds this != MISS check, IPlayerExtension#getEntityReach needs to be updated from +2 to +3. -+ double d1 = this.minecraft.hitResult != null && this.minecraft.hitResult.getType() != HitResult.Type.MISS ? this.minecraft.hitResult.getLocation().distanceToSqr(vec3) : d0 * d0; -+ double blockReach = this.minecraft.player.getBlockReach(); -+ // Discard the block pick result as a miss if it is outside the block reach. -+ if (d1 > blockReach * blockReach) { -+ Vec3 pos = this.minecraft.hitResult.getLocation(); -+ this.minecraft.hitResult = BlockHitResult.miss(pos, Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(pos)); -+ } - Vec3 vec31 = entity.getViewVector(1.0F); - Vec3 vec32 = vec3.add(vec31.x * d0, vec31.y * d0, vec31.z * d0); - float f = 1.0F; -@@ -850,7 +_,7 @@ - if (entityhitresult != null) { - Vec3 vec33 = entityhitresult.getLocation(); - double d2 = vec3.distanceToSqr(vec33); -- if (flag1 && d2 > 9.0) { -+ if (d2 > d1 || d2 > entityReach * entityReach) { // Discard if the result is behind a block, or past the entity reach max. The var "flag" no longer has a use. - this.minecraft.hitResult = BlockHitResult.miss(vec33, Direction.getNearest(vec31.x, vec31.y, vec31.z), BlockPos.containing(vec33)); - } else if (d2 < d1 || this.minecraft.hitResult == null) { - this.minecraft.hitResult = entityhitresult; -@@ -902,7 +_,7 @@ +@@ -893,7 +_,7 @@ d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F); } @@ -62,7 +26,7 @@ } } -@@ -919,6 +_,10 @@ +@@ -909,6 +_,10 @@ return; } @@ -70,10 +34,10 @@ + var lastSrc = livingentity.getLastDamageSource(); + if (lastSrc != null && lastSrc.is(net.neoforged.neoforge.common.Tags.DamageTypes.NO_FLINCH)) return; + - float f3 = f2 / (float)livingentity.hurtDuration; - float f4 = Mth.sin(f3 * f3 * f3 * f3 * (float) Math.PI); - float f5 = livingentity.getHurtDir(); -@@ -1074,13 +_,13 @@ + f2 /= (float)livingentity.hurtDuration; + f2 = Mth.sin(f2 * f2 * f2 * f2 * (float) Math.PI); + float f3 = livingentity.getHurtDir(); +@@ -1058,12 +_,12 @@ (float)((double)window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, @@ -81,15 +45,14 @@ + net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane() ); RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.pushPose(); - posestack.setIdentity(); -- posestack.translate(0.0F, 0.0F, -11000.0F); -+ posestack.translate(0.0D, 0.0D, 10000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane()); + Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack(); + matrix4fstack.pushMatrix(); +- matrix4fstack.translation(0.0F, 0.0F, -11000.0F); ++ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane()); RenderSystem.applyModelViewMatrix(); Lighting.setupFor3DItems(); GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource()); -@@ -1114,7 +_,7 @@ +@@ -1097,7 +_,7 @@ } } else if (flag && this.minecraft.screen != null) { try { @@ -98,22 +61,21 @@ } catch (Throwable throwable1) { CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details"); -@@ -1289,6 +_,9 @@ +@@ -1273,12 +_,16 @@ + } - Matrix4f matrix4f = posestack.last().pose(); this.resetProjectionMatrix(matrix4f); + net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.neoforged.neoforge.client.ClientHooks.onCameraSetup(this, camera, p_109090_); + camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch()); -+ p_109092_.mulPose(Axis.ZP.rotationDegrees(cameraSetup.getRoll())); - p_109092_.mulPose(Axis.XP.rotationDegrees(camera.getXRot())); - p_109092_.mulPose(Axis.YP.rotationDegrees(camera.getYRot() + 180.0F)); - Matrix3f matrix3f = new Matrix3f(p_109092_.last().normal()).invert(); -@@ -1297,6 +_,8 @@ + Matrix4f matrix4f1 = new Matrix4f() +- .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F); ++ .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, cameraSetup.getRoll() * (float) (Math.PI / 180.0)); + this.minecraft .levelRenderer - .prepareCullFrustum(p_109092_, camera.getPosition(), this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue()))); - this.minecraft.levelRenderer.renderLevel(p_109092_, p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f); -+ this.minecraft.getProfiler().popPush("forge_render_last"); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.minecraft.levelRenderer, p_109092_, matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum()); + .prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue()))); + this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f); ++ this.minecraft.getProfiler().popPush("neoforge_render_last"); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.minecraft.levelRenderer, null, matrix4f1, matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum()); this.minecraft.getProfiler().popPush("hand"); if (this.renderHand) { RenderSystem.clear(256, Minecraft.ON_OSX); diff --git a/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch b/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch index 99cf45c6bd..8d7a25e7ae 100644 --- a/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch +++ b/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch @@ -5,18 +5,18 @@ @OnlyIn(Dist.CLIENT) public class ItemBlockRenderTypes { + @Deprecated - private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_311463_ -> { + private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_323062_ -> { RenderType rendertype = RenderType.tripwire(); - p_311463_.put(Blocks.TRIPWIRE, rendertype); -@@ -335,6 +_,7 @@ - p_311463_.put(Blocks.BUBBLE_COLUMN, rendertype3); - p_311463_.put(Blocks.TINTED_GLASS, rendertype3); + p_323062_.put(Blocks.TRIPWIRE, rendertype); +@@ -336,6 +_,7 @@ + p_323062_.put(Blocks.BUBBLE_COLUMN, rendertype3); + p_323062_.put(Blocks.TINTED_GLASS, rendertype3); }); + @Deprecated private static final Map TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> { RenderType rendertype = RenderType.translucent(); p_109290_.put(Fluids.FLOWING_WATER, rendertype); -@@ -342,6 +_,8 @@ +@@ -343,6 +_,8 @@ }); private static boolean renderCutout; @@ -25,7 +25,7 @@ public static RenderType getChunkRenderType(BlockState p_109283_) { Block block = p_109283_.getBlock(); if (block instanceof LeavesBlock) { -@@ -352,6 +_,8 @@ +@@ -353,6 +_,8 @@ } } @@ -34,7 +34,7 @@ public static RenderType getMovingBlockRenderType(BlockState p_109294_) { Block block = p_109294_.getBlock(); if (block instanceof LeavesBlock) { -@@ -366,6 +_,8 @@ +@@ -367,6 +_,8 @@ } } @@ -43,7 +43,7 @@ public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) { RenderType rendertype = getChunkRenderType(p_109285_); if (rendertype == RenderType.translucent()) { -@@ -379,6 +_,8 @@ +@@ -380,6 +_,8 @@ } } @@ -52,7 +52,7 @@ public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) { Item item = p_109280_.getItem(); if (item instanceof BlockItem) { -@@ -392,6 +_,67 @@ +@@ -393,6 +_,67 @@ public static RenderType getRenderLayer(FluidState p_109288_) { RenderType rendertype = TYPE_BY_FLUID.get(p_109288_.getType()); return rendertype != null ? rendertype : RenderType.solid(); diff --git a/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch b/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch index dc20cc69a1..ac3643b3fd 100644 --- a/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ItemInHandRenderer.java +++ b/net/minecraft/client/renderer/ItemInHandRenderer.java -@@ -329,12 +_,14 @@ +@@ -331,12 +_,14 @@ if (iteminhandrenderer$handrenderselection.renderMainHand) { float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F; float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight); @@ -15,7 +15,7 @@ this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_); } -@@ -400,7 +_,7 @@ +@@ -402,7 +_,7 @@ } else { this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_); } @@ -24,20 +24,20 @@ boolean flag1 = CrossbowItem.isCharged(p_109377_); boolean flag2 = humanoidarm == HumanoidArm.RIGHT; int i = flag2 ? 1 : -1; -@@ -450,6 +_,7 @@ +@@ -452,6 +_,7 @@ ); } else { boolean flag3 = humanoidarm == HumanoidArm.RIGHT; + if (!net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(p_109377_).applyForgeHandTransform(p_109379_, minecraft.player, humanoidarm, p_109377_, p_109373_, p_109378_, p_109376_)) // FORGE: Allow items to define custom arm animation if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) { int k = flag3 ? 1 : -1; - switch(p_109377_.getUseAnimation()) { -@@ -564,8 +_,16 @@ + switch (p_109377_.getUseAnimation()) { +@@ -566,8 +_,16 @@ this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F); } else { float f = localplayer.getAttackStrengthScale(1.0F); -- this.mainHandHeight += Mth.clamp((this.mainHandItem == itemstack ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); -- this.offHandHeight += Mth.clamp((float)(this.offHandItem == itemstack1 ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); +- this.mainHandHeight = this.mainHandHeight + Mth.clamp((this.mainHandItem == itemstack ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); +- this.offHandHeight = this.offHandHeight + Mth.clamp((float)(this.offHandItem == itemstack1 ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); + boolean requipM = net.neoforged.neoforge.client.ClientHooks.shouldCauseReequipAnimation(this.mainHandItem, itemstack, localplayer.getInventory().selected); + boolean requipO = net.neoforged.neoforge.client.ClientHooks.shouldCauseReequipAnimation(this.offHandItem, itemstack1, -1); + diff --git a/patches/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/net/minecraft/client/renderer/LevelRenderer.java.patch index bf24207d33..c3446f2dd7 100644 --- a/patches/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/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 -@@ -249,6 +_,8 @@ +@@ -251,6 +_,8 @@ } private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) { @@ -9,7 +9,7 @@ float f = this.minecraft.level.getRainLevel(p_109705_); if (!(f <= 0.0F)) { p_109704_.turnOnLightLayer(); -@@ -403,6 +_,8 @@ +@@ -405,6 +_,8 @@ } public void tickRain(Camera p_109694_) { @@ -18,29 +18,29 @@ float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F); if (!(f <= 0.0F)) { RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L); -@@ -969,9 +_,11 @@ +@@ -966,9 +_,11 @@ RenderSystem.clear(16640, Minecraft.ON_OSX); float f1 = p_109605_.getRenderDistance(); boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog(); + FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_); profilerfiller.popPush("sky"); RenderSystem.setShader(GameRenderer::getPositionShader); - this.renderSky(p_109600_, p_254120_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f)); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); + this.renderSky(p_254120_, p_323920_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f)); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, null, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("fog"); FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f); profilerfiller.popPush("terrain_setup"); -@@ -980,7 +_,9 @@ +@@ -977,7 +_,9 @@ this.compileSections(p_109604_); profilerfiller.popPush("terrain"); - this.renderSectionLayer(RenderType.solid(), p_109600_, d0, d1, d2, p_254120_); -+ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings - this.renderSectionLayer(RenderType.cutoutMipped(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_323920_); ++ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0); // Neo: fix flickering leaves when mods mess up the blurMipmap settings + this.renderSectionLayer(RenderType.cutoutMipped(), d0, d1, d2, p_254120_, p_323920_); + this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap(); - this.renderSectionLayer(RenderType.cutout(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_323920_); if (this.level.effects().constantAmbientLight()) { - Lighting.setupNetherLevel(p_109600_.last().pose()); -@@ -1034,6 +_,9 @@ + Lighting.setupNetherLevel(); +@@ -1036,6 +_,9 @@ int i = entity.getTeamColor(); outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255); } else { @@ -50,142 +50,142 @@ multibuffersource = multibuffersource$buffersource; } -@@ -1049,12 +_,14 @@ +@@ -1051,12 +_,14 @@ multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS)); multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS)); multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS)); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_ENTITIES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_ENTITIES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("blockentities"); - for(SectionRenderDispatcher.RenderSection sectionrenderdispatcher$rendersection : this.visibleSections) { + for (SectionRenderDispatcher.RenderSection sectionrenderdispatcher$rendersection : this.visibleSections) { List list = sectionrenderdispatcher$rendersection.getCompiled().getRenderableBlockEntities(); if (!list.isEmpty()) { - for(BlockEntity blockentity1 : list) { + for (BlockEntity blockentity1 : list) { + if (!net.neoforged.neoforge.client.ClientHooks.isBlockEntityRendererVisible(blockEntityRenderDispatcher, blockentity1, frustum)) continue; BlockPos blockpos4 = blockentity1.getBlockPos(); MultiBufferSource multibuffersource1 = multibuffersource$buffersource; - p_109600_.pushPose(); -@@ -1076,6 +_,9 @@ + posestack.pushPose(); +@@ -1075,6 +_,9 @@ }; } } -+ if (this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering ++ if (this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player)) { // Neo: allow custom outline rendering + flag2 = true; + } - this.blockEntityRenderDispatcher.render(blockentity1, f, p_109600_, multibuffersource1); - p_109600_.popPose(); -@@ -1085,9 +_,13 @@ + this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1); + posestack.popPose(); +@@ -1084,9 +_,13 @@ - synchronized(this.globalBlockEntities) { - for(BlockEntity blockentity : this.globalBlockEntities) { + synchronized (this.globalBlockEntities) { + for (BlockEntity blockentity : this.globalBlockEntities) { + if (!net.neoforged.neoforge.client.ClientHooks.isBlockEntityRendererVisible(blockEntityRenderDispatcher, blockentity, frustum)) continue; BlockPos blockpos3 = blockentity.getBlockPos(); - p_109600_.pushPose(); - p_109600_.translate((double)blockpos3.getX() - d0, (double)blockpos3.getY() - d1, (double)blockpos3.getZ() - d2); -+ if (this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering + posestack.pushPose(); + posestack.translate((double)blockpos3.getX() - d0, (double)blockpos3.getY() - d1, (double)blockpos3.getZ() - d2); ++ if (this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player)) { // Neo: allow custom outline rendering + flag2 = true; + } - this.blockEntityRenderDispatcher.render(blockentity, f, p_109600_, multibuffersource$buffersource); - p_109600_.popPose(); + this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource); + posestack.popPose(); } -@@ -1110,6 +_,7 @@ +@@ -1109,6 +_,7 @@ this.minecraft.getMainRenderTarget().bindWrite(false); } -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("destroyProgress"); - for(Entry> entry : this.destructionProgress.long2ObjectEntrySet()) { -@@ -1130,9 +_,10 @@ - posestack$pose1.normal(), - 1.0F + for (Entry> entry : this.destructionProgress.long2ObjectEntrySet()) { +@@ -1126,9 +_,10 @@ + VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator( + this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F ); + net.neoforged.neoforge.client.model.data.ModelData modelData = level.getModelDataManager().getAtOrEmpty(blockpos2); this.minecraft .getBlockRenderer() -- .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, p_109600_, vertexconsumer1); -+ .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, p_109600_, vertexconsumer1, modelData); - p_109600_.popPose(); +- .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1); ++ .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1, modelData); + posestack.popPose(); } } -@@ -1144,10 +_,13 @@ +@@ -1140,10 +_,13 @@ profilerfiller.popPush("outline"); BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos(); BlockState blockstate = this.level.getBlockState(blockpos1); -+ if (!net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource)) ++ if (!net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource)) if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) { VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines()); - this.renderHitOutline(p_109600_, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate); + this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate); } + } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) { -+ net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource); ++ net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource); } - this.minecraft.debugRenderer.render(p_109600_, multibuffersource$buffersource, d0, d1, d2); -@@ -1179,7 +_,8 @@ + this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2); +@@ -1173,7 +_,8 @@ this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); RenderStateShard.PARTICLES_TARGET.setupRenderState(); profilerfiller.popPush("particles"); -- this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f); -+ this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f, frustum); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); +- this.minecraft.particleEngine.render(p_109606_, p_109604_, f); ++ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); RenderStateShard.PARTICLES_TARGET.clearRenderState(); } else { profilerfiller.popPush("translucent"); -@@ -1193,7 +_,8 @@ +@@ -1187,7 +_,8 @@ profilerfiller.popPush("string"); - this.renderSectionLayer(RenderType.tripwire(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_323920_); profilerfiller.popPush("particles"); -- this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f); -+ this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f, frustum); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); +- this.minecraft.particleEngine.render(p_109606_, p_109604_, f); ++ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); } - posestack.pushPose(); -@@ -1217,6 +_,7 @@ + if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) { +@@ -1203,6 +_,7 @@ RenderStateShard.WEATHER_TARGET.setupRenderState(); profilerfiller.popPush("weather"); this.renderSnowAndRain(p_109606_, f, d0, d1, d2); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); this.renderWorldBorder(p_109604_); RenderStateShard.WEATHER_TARGET.clearRenderState(); this.transparencyChain.process(f); -@@ -1225,6 +_,7 @@ +@@ -1211,6 +_,7 @@ RenderSystem.depthMask(false); profilerfiller.popPush("weather"); this.renderSnowAndRain(p_109606_, f, d0, d1, d2); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); this.renderWorldBorder(p_109604_); RenderSystem.depthMask(true); } -@@ -1379,6 +_,7 @@ +@@ -1365,6 +_,7 @@ shaderinstance.clear(); VertexBuffer.unbind(); this.minecraft.getProfiler().pop(); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(p_294513_, this, p_294924_, p_294782_, this.ticks, this.minecraft.gameRenderer.getMainCamera(), this.getFrustum()); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(p_294513_, this, p_294782_, p_324517_, this.ticks, this.minecraft.gameRenderer.getMainCamera(), this.getFrustum()); p_294513_.clearRenderState(); } -@@ -1639,6 +_,8 @@ +@@ -1625,6 +_,8 @@ } - public void renderSky(PoseStack p_202424_, Matrix4f p_254034_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { -+ if (level.effects().renderSky(level, ticks, p_202426_, p_202424_, p_202427_, p_254034_, p_202428_, p_202429_)) + public void renderSky(Matrix4f p_254034_, Matrix4f p_324386_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { ++ if (level.effects().renderSky(level, ticks, p_202426_, p_254034_, p_202427_, p_324386_, p_202428_, p_202429_)) + return; p_202429_.run(); if (!p_202428_) { FogType fogtype = p_202427_.getFluidInCamera(); -@@ -1765,6 +_,8 @@ +@@ -1749,6 +_,8 @@ } - public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) { -+ if (level.effects().renderClouds(level, ticks, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_)) + public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_324366_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) { ++ if (level.effects().renderClouds(level, ticks, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_, p_324366_)) + return; float f = this.level.effects().getCloudHeight(); if (!Float.isNaN(f)) { - RenderSystem.disableCull(); -@@ -2585,7 +_,32 @@ + float f1 = 12.0F; +@@ -2545,7 +_,32 @@ this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_); } @@ -218,7 +218,7 @@ SoundInstance soundinstance = this.playingRecords.get(p_109516_); if (soundinstance != null) { this.minecraft.getSoundManager().stop(soundinstance); -@@ -2593,7 +_,7 @@ +@@ -2553,7 +_,7 @@ } if (p_109515_ != null) { @@ -227,16 +227,16 @@ if (recorditem != null) { this.minecraft.gui.setNowPlaying(recorditem.getDisplayName()); } -@@ -2784,7 +_,7 @@ +@@ -2746,7 +_,7 @@ + break; case 1010: - Item item = Item.byId(p_234307_); - if (item instanceof RecordItem recorditem) { + if (Item.byId(p_234307_) instanceof RecordItem recorditem) { - this.playStreamingMusic(recorditem.getSound(), p_234306_); + this.playStreamingMusic(recorditem.getSound(), p_234306_, recorditem); } break; case 1011: -@@ -3090,8 +_,8 @@ +@@ -3052,8 +_,8 @@ break; case 2001: BlockState blockstate1 = Block.stateById(p_234307_); @@ -247,7 +247,7 @@ this.level .playLocalSound( p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false -@@ -3477,7 +_,7 @@ +@@ -3542,7 +_,7 @@ } else { int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_); int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_); diff --git a/patches/net/minecraft/client/renderer/LightTexture.java.patch b/patches/net/minecraft/client/renderer/LightTexture.java.patch index 904ae21ff7..72db3bdff6 100644 --- a/patches/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/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 -@@ -135,6 +_,8 @@ +@@ -129,6 +_,8 @@ } } @@ -9,7 +9,7 @@ if (f5 > 0.0F) { float f13 = Math.max(vector3f1.x(), Math.max(vector3f1.y(), vector3f1.z())); if (f13 < 1.0F) { -@@ -192,7 +_,7 @@ +@@ -186,7 +_,7 @@ } public static int block(int p_109884_) { diff --git a/patches/net/minecraft/client/renderer/PostChain.java.patch b/patches/net/minecraft/client/renderer/PostChain.java.patch index f57df3bce1..d48800b6eb 100644 --- a/patches/net/minecraft/client/renderer/PostChain.java.patch +++ b/patches/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 -@@ -155,7 +_,8 @@ +@@ -156,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.tryParse(s4); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png"); - this.resourceManager + this.resourceProvider .getResource(resourcelocation) .orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist")); -@@ -256,6 +_,7 @@ +@@ -257,6 +_,7 @@ public void addTempTarget(String p_110039_, int p_110040_, int p_110041_) { RenderTarget rendertarget = new TextureTarget(p_110040_, p_110041_, true, Minecraft.ON_OSX); rendertarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); diff --git a/patches/net/minecraft/client/renderer/RenderBuffers.java.patch b/patches/net/minecraft/client/renderer/RenderBuffers.java.patch index e3f79951f5..adca81edd3 100644 --- a/patches/net/minecraft/client/renderer/RenderBuffers.java.patch +++ b/patches/net/minecraft/client/renderer/RenderBuffers.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/RenderBuffers.java +++ b/net/minecraft/client/renderer/RenderBuffers.java @@ -39,6 +_,7 @@ - put(p_307112_, RenderType.waterMask()); + put((Object2ObjectLinkedOpenHashMap)p_307112_, RenderType.waterMask()); ModelBakery.DESTROY_TYPES.forEach(p_173062_ -> put(p_307112_, p_173062_)); }); + net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent(sortedmap)); diff --git a/patches/net/minecraft/client/renderer/RenderType.java.patch b/patches/net/minecraft/client/renderer/RenderType.java.patch index f4f8bf6b4c..f8a092fa21 100644 --- a/patches/net/minecraft/client/renderer/RenderType.java.patch +++ b/patches/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 -@@ -970,7 +_,7 @@ +@@ -972,7 +_,7 @@ } public static RenderType text(ResourceLocation p_110498_) { @@ -9,7 +9,7 @@ } public static RenderType textBackground() { -@@ -978,19 +_,19 @@ +@@ -980,19 +_,19 @@ } public static RenderType textIntensity(ResourceLocation p_173238_) { @@ -33,7 +33,7 @@ } public static RenderType textBackgroundSeeThrough() { -@@ -998,7 +_,7 @@ +@@ -1000,7 +_,7 @@ } public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) { @@ -42,7 +42,7 @@ } public static RenderType lightning() { -@@ -1425,4 +_,17 @@ +@@ -1454,4 +_,17 @@ return this.name; } } diff --git a/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index 7e62d562c0..c9e370e121 100644 --- a/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -37,7 +37,7 @@ + private static org.apache.commons.lang3.tuple.Pair getOverlayBlock(Player p_110717_) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int i = 0; i < 8; ++i) { + for (int i = 0; i < 8; i++) { @@ -58,7 +_,7 @@ blockpos$mutableblockpos.set(d0, d1, d2); BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos); diff --git a/patches/net/minecraft/client/renderer/ShaderInstance.java.patch b/patches/net/minecraft/client/renderer/ShaderInstance.java.patch index 5a9430c09c..bd863abb72 100644 --- a/patches/net/minecraft/client/renderer/ShaderInstance.java.patch +++ b/patches/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 -@@ -98,10 +_,14 @@ +@@ -94,10 +_,14 @@ @Nullable public final Uniform CHUNK_OFFSET; @@ -17,7 +17,7 @@ try (Reader reader = p_173336_.openAsReader(resourcelocation)) { JsonObject jsonobject = GsonHelper.parse(reader); -@@ -208,8 +_,10 @@ +@@ -178,8 +_,10 @@ Program program1 = p_173342_.getPrograms().get(p_173343_); Program program; if (program1 == null) { @@ -30,7 +30,7 @@ try (InputStream inputstream = resource.open()) { final String s1 = FileUtil.getFullResourcePath(s); -@@ -218,11 +_,11 @@ +@@ -188,11 +_,11 @@ @Override public String applyImport(boolean p_173374_, String p_173375_) { @@ -45,7 +45,7 @@ try { String s2; -@@ -232,7 +_,8 @@ +@@ -202,7 +_,8 @@ return s2; } catch (IOException ioexception) { diff --git a/patches/net/minecraft/client/renderer/Sheets.java.patch b/patches/net/minecraft/client/renderer/Sheets.java.patch index 848152a2eb..ca6cb16d0b 100644 --- a/patches/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/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 -@@ -172,11 +_,13 @@ +@@ -145,11 +_,13 @@ } private static Material createSignMaterial(WoodType p_173386_) { @@ -16,7 +16,7 @@ } public static Material getSignMaterial(WoodType p_173382_) { -@@ -237,6 +_,23 @@ +@@ -208,6 +_,23 @@ case SINGLE: default: return p_110773_; diff --git a/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch index c2045b7daa..5a277696bb 100644 --- a/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch @@ -78,7 +78,7 @@ + public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.neoforged.neoforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) { RenderShape rendershape = p_110913_.getRenderShape(); if (rendershape != RenderShape.INVISIBLE) { - switch(rendershape) { + switch (rendershape) { @@ -117,22 +_,25 @@ float f = (float)(i >> 16 & 0xFF) / 255.0F; float f1 = (float)(i >> 8 & 0xFF) / 255.0F; diff --git a/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch b/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch index eac90cab61..451d81cfee 100644 --- a/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -80,7 +80,7 @@ ModelBlockRenderer.AmbientOcclusionFace modelblockrenderer$ambientocclusionface = new ModelBlockRenderer.AmbientOcclusionFace(); @@ -90,7 +_,7 @@ - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { p_234398_.setSeed(p_234399_); - List list = p_234392_.getQuads(p_234393_, direction, p_234398_); + List list = p_234392_.getQuads(p_234393_, direction, p_234398_, modelData, renderType); @@ -127,7 +127,7 @@ BitSet bitset = new BitSet(3); BlockPos.MutableBlockPos blockpos$mutableblockpos = p_234405_.mutable(); - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { p_234409_.setSeed(p_234410_); - List list = p_234403_.getQuads(p_234404_, direction, p_234409_); + List list = p_234403_.getQuads(p_234404_, direction, p_234409_, modelData, renderType); @@ -145,13 +145,13 @@ } @@ -158,6 +_,7 @@ ) { - for(BakedQuad bakedquad : p_111018_) { + for (BakedQuad bakedquad : p_111018_) { this.calculateShape(p_111013_, p_111014_, p_111015_, bakedquad.getVertices(), bakedquad.getDirection(), p_111019_, p_111020_); + if (!net.neoforged.neoforge.client.ClientHooks.calculateFaceWithoutAO(p_111013_, p_111014_, p_111015_, bakedquad, p_111020_.get(0), p_111021_.brightness, p_111021_.lightmap)) p_111021_.calculate(p_111013_, p_111014_, p_111015_, bakedquad.getDirection(), p_111019_, p_111020_, bakedquad.isShade()); this.putQuadData( p_111013_, -@@ -322,6 +_,7 @@ +@@ -323,6 +_,7 @@ } } @@ -159,7 +159,7 @@ public void renderModel( PoseStack.Pose p_111068_, VertexConsumer p_111069_, -@@ -333,16 +_,32 @@ +@@ -334,16 +_,32 @@ int p_111075_, int p_111076_ ) { @@ -182,7 +182,7 @@ RandomSource randomsource = RandomSource.create(); long i = 42L; - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { randomsource.setSeed(42L); - renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource), p_111075_, p_111076_); + renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource, modelData, renderType), p_111075_, p_111076_); diff --git a/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch b/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch index ec3aafe546..13a802c111 100644 --- a/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/model/ItemOverrides.java +++ b/net/minecraft/client/renderer/block/model/ItemOverrides.java -@@ -32,7 +_,15 @@ +@@ -31,7 +_,15 @@ this.properties = new ResourceLocation[0]; } @@ -16,16 +16,16 @@ this.properties = p_111743_.stream() .flatMap(ItemOverride::getPredicates) .map(ItemOverride.Predicate::getProperty) -@@ -48,7 +_,7 @@ +@@ -47,7 +_,7 @@ - for(int j = p_111743_.size() - 1; j >= 0; --j) { + for (int j = p_111743_.size() - 1; j >= 0; j--) { ItemOverride itemoverride = p_111743_.get(j); - BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride); + BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride, spriteGetter); ItemOverrides.PropertyMatcher[] aitemoverrides$propertymatcher = itemoverride.getPredicates().map(p_173477_ -> { int k = object2intmap.getInt(p_173477_.getProperty()); return new ItemOverrides.PropertyMatcher(k, p_173477_.getValue()); -@@ -60,9 +_,9 @@ +@@ -59,9 +_,9 @@ } @Nullable @@ -37,7 +37,7 @@ } @Nullable -@@ -95,6 +_,10 @@ +@@ -93,6 +_,10 @@ } return p_173465_; diff --git a/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch b/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch index 0f0ce9e47c..438e617781 100644 --- a/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch @@ -3,7 +3,7 @@ @@ -68,7 +_,7 @@ WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); - for(Variant variant : this.getVariants()) { + for (Variant variant : this.getVariants()) { - BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant); + BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant, p_111851_); weightedbakedmodel$builder.add(bakedmodel, variant.getWeight()); diff --git a/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch index 24c6c1cf43..644d595388 100644 --- a/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/renderer/blockentity/BannerRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BannerRenderer.java @@ -139,4 +_,11 @@ - ); - } + float[] afloat = p_332728_.getTextureDiffuseColors(); + p_332732_.render(p_332737_, p_332704_.buffer(p_332758_, RenderType::entityNoOutline), p_332821_, p_332828_, afloat[0], afloat[1], afloat[2], 1.0F); } + + @Override diff --git a/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch index f3f7a07d91..7879238b33 100644 --- a/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/BeaconRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BeaconRenderer.java -@@ -303,4 +_,10 @@ +@@ -293,4 +_,10 @@ public boolean shouldRender(BeaconBlockEntity p_173531_, Vec3 p_173532_) { return Vec3.atCenterOf(p_173531_.getBlockPos()).multiply(1.0, 0.0, 1.0).closerThan(p_173532_.multiply(1.0, 0.0, 1.0), (double)this.getViewDistance()); } diff --git a/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch index 1b5b8796a1..a79e270319 100644 --- a/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/renderer/blockentity/ChestRenderer.java +++ b/net/minecraft/client/renderer/blockentity/ChestRenderer.java -@@ -133,7 +_,7 @@ +@@ -128,7 +_,7 @@ f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; - int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_); + int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_); - Material material = Sheets.chooseMaterial(p_112363_, chesttype, this.xmasTextures); + Material material = this.getMaterial(p_112363_, chesttype); VertexConsumer vertexconsumer = material.buffer(p_112366_, RenderType::entityCutout); if (flag1) { if (chesttype == ChestType.LEFT) { -@@ -164,5 +_,15 @@ +@@ -159,5 +_,15 @@ p_112372_.render(p_112370_, p_112371_, p_112376_, p_112377_); p_112373_.render(p_112370_, p_112371_, p_112376_, p_112377_); p_112374_.render(p_112370_, p_112371_, p_112376_, p_112377_); diff --git a/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch index d0797364bd..d8ab1868de 100644 --- a/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java +++ b/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java -@@ -148,4 +_,10 @@ +@@ -152,4 +_,10 @@ p_273495_.render(p_272899_, p_273173_.buffer(p_273582_, RenderType::entitySolid), p_273242_, p_273108_); } } diff --git a/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch index 76fb9bace7..c6716d8d5e 100644 --- a/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch @@ -6,7 +6,7 @@ } + + @Override -+ public net.minecraft.world.phys.AABB getRenderBoundingBox(EnchantmentTableBlockEntity blockEntity) { ++ public net.minecraft.world.phys.AABB getRenderBoundingBox(EnchantingTableBlockEntity blockEntity) { + net.minecraft.core.BlockPos pos = blockEntity.getBlockPos(); + return new net.minecraft.world.phys.AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1., pos.getY() + 1.5, pos.getZ() + 1.); + } diff --git a/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch index 30d2e8a6f6..371dd9a2bb 100644 --- a/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java -@@ -431,8 +_,9 @@ +@@ -430,8 +_,9 @@ boolean flag = this.cancelTasks(); BlockPos blockpos = this.origin.immutable(); int i = 1; @@ -11,7 +11,7 @@ ); boolean flag1 = this.compiled.get() == SectionRenderDispatcher.CompiledSection.UNCOMPILED; if (flag1 && flag) { -@@ -440,7 +_,7 @@ +@@ -439,7 +_,7 @@ } this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask( @@ -20,7 +20,7 @@ ); return this.lastRebuildTask; } -@@ -502,10 +_,20 @@ +@@ -501,10 +_,20 @@ class RebuildTask extends SectionRenderDispatcher.RenderSection.CompileTask { @Nullable protected RenderChunkRegion region; @@ -33,7 +33,7 @@ + } + + public RebuildTask(double p_294400_, @Nullable RenderChunkRegion p_294382_, boolean p_295207_, List additionalRenderers) { - super(p_294400_, p_295207_); + super(RenderSection.this, p_294400_, p_295207_); this.region = p_294382_; + var manager = p_294382_ != null ? p_294382_.getModelDataManager() : null; + this.modelData = manager != null ? manager : net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot.EMPTY; @@ -41,7 +41,7 @@ } @Override -@@ -609,7 +_,11 @@ +@@ -608,7 +_,11 @@ } if (blockstate.getRenderShape() != RenderShape.INVISIBLE) { @@ -54,7 +54,7 @@ BufferBuilder bufferbuilder2 = p_294319_.builder(rendertype2); if (set.add(rendertype2)) { RenderSection.this.beginLayer(bufferbuilder2); -@@ -617,10 +_,20 @@ +@@ -616,10 +_,20 @@ posestack.pushPose(); posestack.translate((float)(blockpos2.getX() & 15), (float)(blockpos2.getY() & 15), (float)(blockpos2.getZ() & 15)); @@ -76,7 +76,7 @@ if (set.contains(RenderType.translucent())) { BufferBuilder bufferbuilder1 = p_294319_.builder(RenderType.translucent()); -@@ -651,9 +_,10 @@ +@@ -650,9 +_,10 @@ private void handleBlockEntity(SectionRenderDispatcher.RenderSection.RebuildTask.CompileResults p_294198_, E p_296214_) { BlockEntityRenderer blockentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(p_296214_); if (blockentityrenderer != null) { diff --git a/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch index 2c0c422c15..d9e6dd714c 100644 --- a/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch @@ -10,12 +10,12 @@ double d1 = -Mth.lerp((double)p_114445_, p_114444_.yOld, p_114444_.getY()); double d2 = -Mth.lerp((double)p_114445_, p_114444_.zOld, p_114444_.getZ()); -- for(EnderDragonPart enderdragonpart : ((EnderDragon)p_114444_).getSubEntities()) { +- for (EnderDragonPart enderdragonpart : ((EnderDragon)p_114444_).getSubEntities()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_114444_.getParts()) { p_114442_.pushPose(); double d3 = d0 + Mth.lerp((double)p_114445_, enderdragonpart.xOld, enderdragonpart.getX()); double d4 = d1 + Mth.lerp((double)p_114445_, enderdragonpart.yOld, enderdragonpart.getY()); -@@ -444,6 +_,10 @@ +@@ -438,6 +_,10 @@ return this.itemInHandRenderer; } @@ -26,7 +26,7 @@ @Override public void onResourceManagerReload(ResourceManager p_174004_) { EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context( -@@ -451,5 +_,6 @@ +@@ -445,5 +_,6 @@ ); this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context); this.playerRenderers = EntityRenderers.createPlayerRenderers(entityrendererprovider$context); diff --git a/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch index e2a15d7dc2..f23d1e70fc 100644 --- a/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java -@@ -70,8 +_,10 @@ +@@ -71,8 +_,10 @@ } public void render(T p_114485_, float p_114486_, float p_114487_, PoseStack p_114488_, MultiBufferSource p_114489_, int p_114490_) { - if (this.shouldShowName(p_114485_)) { -- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_); +- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_, p_114487_); + var renderNameTagEvent = new net.neoforged.neoforge.client.event.RenderNameTagEvent(p_114485_, p_114485_.getDisplayName(), this, p_114488_, p_114489_, p_114490_, p_114487_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(renderNameTagEvent); + if (renderNameTagEvent.getResult() != net.neoforged.bus.api.Event.Result.DENY && (renderNameTagEvent.getResult() == net.neoforged.bus.api.Event.Result.ALLOW || this.shouldShowName(p_114485_))) { -+ this.renderNameTag(p_114485_, renderNameTagEvent.getContent(), p_114488_, p_114489_, p_114490_); ++ this.renderNameTag(p_114485_, renderNameTagEvent.getContent(), p_114488_, p_114489_, p_114490_, p_114487_); } } -@@ -87,7 +_,7 @@ +@@ -88,7 +_,7 @@ - protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_) { + protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, float p_316698_) { double d0 = this.entityRenderDispatcher.distanceToSqr(p_114498_); - if (!(d0 > 4096.0)) { + if (net.neoforged.neoforge.client.ClientHooks.isNameplateInRenderDistance(p_114498_, d0)) { - boolean flag = !p_114498_.isDiscrete(); - float f = p_114498_.getNameTagOffsetY(); - int i = "deadmau5".equals(p_114499_.getString()) ? -10 : 0; + Vec3 vec3 = p_114498_.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, p_114498_.getViewYRot(p_316698_)); + if (vec3 != null) { + boolean flag = !p_114498_.isDiscrete(); diff --git a/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch index 37e459fe8e..ab49997372 100644 --- a/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java +++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java -@@ -49,7 +_,7 @@ - p_114708_.popPose(); - int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1; - ItemStack itemstack = player.getMainHandItem(); -- if (!itemstack.is(Items.FISHING_ROD)) { -+ if (!itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.FISHING_ROD_CAST)) { - i = -i; - } +@@ -66,7 +_,7 @@ + private Vec3 getPlayerHandPos(Player p_340935_, float p_340872_, float p_341261_) { + int i = p_340935_.getMainArm() == HumanoidArm.RIGHT ? 1 : -1; + ItemStack itemstack = p_340935_.getMainHandItem(); +- if (!itemstack.is(Items.FISHING_ROD)) { ++ if (!itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.FISHING_ROD_CAST)) { + i = -i; + } diff --git a/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch index c4726042b3..7412c8c3ed 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch @@ -1,69 +1,24 @@ --- a/net/minecraft/client/renderer/entity/ItemEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemEntityRenderer.java -@@ -60,18 +_,15 @@ +@@ -45,7 +_,8 @@ + BakedModel bakedmodel = this.itemRenderer.getModel(itemstack, p_115036_.level(), null, p_115036_.getId()); boolean flag = bakedmodel.isGui3d(); - int j = this.getRenderAmount(itemstack); float f = 0.25F; - float f1 = Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F : 0; ++ boolean shouldBob = net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).shouldBobAsEntity(itemstack); ++ float f1 = shouldBob ? Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F : 0; float f2 = bakedmodel.getTransforms().getTransform(ItemDisplayContext.GROUND).scale.y(); p_115039_.translate(0.0F, f1 + 0.25F * f2, 0.0F); float f3 = p_115036_.getSpin(p_115038_); - p_115039_.mulPose(Axis.YP.rotation(f3)); -- float f4 = bakedmodel.getTransforms().ground.scale.x(); -- float f5 = bakedmodel.getTransforms().ground.scale.y(); -- float f6 = bakedmodel.getTransforms().ground.scale.z(); - if (!flag) { -- float f7 = -0.0F * (float)(j - 1) * 0.5F * f4; -- float f8 = -0.0F * (float)(j - 1) * 0.5F * f5; -- float f9 = -0.09375F * (float)(j - 1) * 0.5F * f6; -+ float f7 = -0.0F * (float)(j - 1) * 0.5F; -+ float f8 = -0.0F * (float)(j - 1) * 0.5F; -+ float f9 = -0.09375F * (float)(j - 1) * 0.5F; - p_115039_.translate(f7, f8, f9); +@@ -100,9 +_,10 @@ + p_323733_.translate(f3, f4, f5); } -@@ -82,18 +_,18 @@ - float f11 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f13 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f10 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; -- p_115039_.translate(f11, f13, f10); -+ p_115039_.translate(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); - } else { - float f12 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - float f14 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; -- p_115039_.translate(f12, f14, 0.0F); -+ p_115039_.translate(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); - } - } - - this.itemRenderer.render(itemstack, ItemDisplayContext.GROUND, false, p_115039_, p_115040_, p_115041_, OverlayTexture.NO_OVERLAY, bakedmodel); - p_115039_.popPose(); - if (!flag) { -- p_115039_.translate(0.0F * f4, 0.0F * f5, 0.09375F * f6); -+ p_115039_.translate(0.0, 0.0, 0.09375F); - } - } - -@@ -104,4 +_,21 @@ - public ResourceLocation getTextureLocation(ItemEntity p_115034_) { - return TextureAtlas.LOCATION_BLOCKS; - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * @return If items should spread out when rendered in 3D -+ */ -+ public boolean shouldSpreadItems() { -+ return true; -+ } -+ -+ /** -+ * @return If items should have a bob effect -+ */ -+ public boolean shouldBob() { -+ return true; -+ } -+ /*==================================== FORGE END =============================================*/ - } ++ boolean shouldSpread = net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(p_323718_).shouldSpreadAsEntity(p_323718_); + for (int j = 0; j < i; j++) { + p_323733_.pushPose(); +- if (j > 0) { ++ if (j > 0 && shouldSpread) { + if (p_324462_) { + float f7 = (p_324565_.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f9 = (p_324565_.nextFloat() * 2.0F - 1.0F) * 0.15F; diff --git a/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch index 09add5e9ee..cc04e224a8 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -83,25 +_,25 @@ +@@ -84,25 +_,25 @@ } if (!itemstack.isEmpty()) { -- OptionalInt optionalint = p_115076_.getFramedMapId(); +- MapId mapid = p_115076_.getFramedMapId(); + MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, p_115076_.level()); if (flag) { p_115079_.translate(0.0F, 0.0F, 0.5F); @@ -12,26 +12,26 @@ p_115079_.translate(0.0F, 0.0F, 0.4375F); } -- int j = optionalint.isPresent() ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); +- int j = mapid != null ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); + int j = mapitemsaveddata != null ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); p_115079_.mulPose(Axis.ZP.rotationDegrees((float)j * 360.0F / 8.0F)); -- if (optionalint.isPresent()) { +- if (mapid != null) { + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.RenderItemInFrameEvent(p_115076_, this, p_115079_, p_115080_, p_115081_)).isCanceled()) { + if (mapitemsaveddata != null) { p_115079_.mulPose(Axis.ZP.rotationDegrees(180.0F)); float f = 0.0078125F; p_115079_.scale(0.0078125F, 0.0078125F, 0.0078125F); p_115079_.translate(-64.0F, -64.0F, 0.0F); -- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(optionalint.getAsInt(), p_115076_.level()); +- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(mapid, p_115076_.level()); p_115079_.translate(0.0F, 0.0F, -1.0F); if (mapitemsaveddata != null) { int i = this.getLightVal(p_115076_, 15728850, p_115081_); -- Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, optionalint.getAsInt(), mapitemsaveddata, true, i); -+ Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, p_115076_.getFramedMapId().getAsInt(), mapitemsaveddata, true, i); +- Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, mapid, mapitemsaveddata, true, i); ++ Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, p_115076_.getFramedMapId(), mapitemsaveddata, true, i); } } else { int k = this.getLightVal(p_115076_, 15728880, p_115081_); -@@ -109,6 +_,7 @@ +@@ -110,6 +_,7 @@ this.itemRenderer .renderStatic(itemstack, ItemDisplayContext.FIXED, k, OverlayTexture.NO_OVERLAY, p_115079_, p_115080_, p_115076_.level(), p_115076_.getId()); } @@ -39,7 +39,7 @@ } p_115079_.popPose(); -@@ -120,7 +_,7 @@ +@@ -121,7 +_,7 @@ private ModelResourceLocation getFrameModelResourceLoc(T p_174213_, ItemStack p_174214_) { boolean flag = p_174213_.getType() == EntityType.GLOW_ITEM_FRAME; diff --git a/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index aaa57bbb42..e78f85f301 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/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 -@@ -67,7 +_,7 @@ +@@ -68,7 +_,7 @@ public ItemRenderer(Minecraft p_266926_, TextureManager p_266774_, ModelManager p_266850_, ItemColors p_267016_, BlockEntityWithoutLevelRenderer p_267049_) { this.minecraft = p_266926_; this.textureManager = p_266774_; @@ -8,8 +8,8 @@ + this.itemModelShaper = new net.neoforged.neoforge.client.model.RegistryAwareItemModelShaper(p_266850_); this.blockEntityRenderer = p_267049_; - for(Item item : BuiltInRegistries.ITEM) { -@@ -117,7 +_,7 @@ + for (Item item : BuiltInRegistries.ITEM) { +@@ -118,7 +_,7 @@ } } @@ -18,18 +18,17 @@ p_115147_.translate(-0.5F, -0.5F, -0.5F); if (!p_115151_.isCustomRenderer() && (!p_115144_.is(Items.TRIDENT) || flag)) { boolean flag1; -@@ -127,8 +_,8 @@ - } else { +@@ -129,7 +_,8 @@ flag1 = true; } -- + - RenderType rendertype = ItemBlockRenderTypes.getRenderType(p_115144_, flag1); + for (var model : p_115151_.getRenderPasses(p_115144_, flag1)) { + for (var rendertype : model.getRenderTypes(p_115144_, flag1)) { VertexConsumer vertexconsumer; if (hasAnimatedTexture(p_115144_) && p_115144_.hasFoil()) { - p_115147_.pushPose(); -@@ -152,9 +_,11 @@ + PoseStack.Pose posestack$pose = p_115147_.last().copy(); +@@ -150,9 +_,11 @@ vertexconsumer = getFoilBuffer(p_115148_, rendertype, true, p_115144_.hasFoil()); } @@ -43,16 +42,16 @@ } p_115147_.popPose(); -@@ -218,7 +_,7 @@ - float f = (float)(i >> 16 & 0xFF) / 255.0F; - float f1 = (float)(i >> 8 & 0xFF) / 255.0F; - float f2 = (float)(i & 0xFF) / 255.0F; -- p_115164_.putBulkData(posestack$pose, bakedquad, f, f1, f2, p_115167_, p_115168_); -+ p_115164_.putBulkData(posestack$pose, bakedquad, f, f1, f2, 1.0F, p_115167_, p_115168_, true); +@@ -215,7 +_,7 @@ + float f1 = (float)FastColor.ARGB32.red(i) / 255.0F; + float f2 = (float)FastColor.ARGB32.green(i) / 255.0F; + float f3 = (float)FastColor.ARGB32.blue(i) / 255.0F; +- p_115164_.putBulkData(posestack$pose, bakedquad, f1, f2, f3, f, p_115167_, p_115168_); ++ p_115164_.putBulkData(posestack$pose, bakedquad, f1, f2, f3, f, p_115167_, p_115168_, true); // Neo: pass readExistingColor=true } } -@@ -271,5 +_,9 @@ +@@ -268,5 +_,9 @@ @Override public void onResourceManagerReload(ResourceManager p_115105_) { this.itemModelShaper.rebuildCache(); diff --git a/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch index 0270c0e154..77ec112179 100644 --- a/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java -@@ -51,14 +_,17 @@ +@@ -50,14 +_,16 @@ } public void render(T p_115308_, float p_115309_, float p_115310_, PoseStack p_115311_, MultiBufferSource p_115312_, int p_115313_) { @@ -8,28 +8,27 @@ p_115311_.pushPose(); this.model.attackTime = this.getAttackAnim(p_115308_, p_115310_); - this.model.riding = p_115308_.isPassenger(); -+ + boolean shouldSit = p_115308_.isPassenger() && (p_115308_.getVehicle() != null && p_115308_.getVehicle().shouldRiderSit()); + this.model.riding = shouldSit; this.model.young = p_115308_.isBaby(); float f = Mth.rotLerp(p_115310_, p_115308_.yBodyRotO, p_115308_.yBodyRot); float f1 = Mth.rotLerp(p_115310_, p_115308_.yHeadRotO, p_115308_.yHeadRot); float f2 = f1 - f; -- if (p_115308_.isPassenger()) { -+ if (shouldSit && p_115308_.getVehicle() instanceof LivingEntity) { - Entity $$14 = p_115308_.getVehicle(); - if ($$14 instanceof LivingEntity livingentity) { - f = Mth.rotLerp(p_115310_, livingentity.yBodyRotO, livingentity.yBodyRot); -@@ -102,7 +_,7 @@ +- if (p_115308_.isPassenger() && p_115308_.getVehicle() instanceof LivingEntity livingentity) { ++ if (shouldSit && p_115308_.getVehicle() instanceof LivingEntity livingentity) { + f = Mth.rotLerp(p_115310_, livingentity.yBodyRotO, livingentity.yBodyRot); + f2 = f1 - f; + float f7 = Mth.wrapDegrees(f2); +@@ -101,7 +_,7 @@ p_115311_.translate(0.0F, -1.501F, 0.0F); - float f8 = 0.0F; float f4 = 0.0F; + float f5 = 0.0F; - if (!p_115308_.isPassenger() && p_115308_.isAlive()) { + if (!shouldSit && p_115308_.isAlive()) { - f8 = p_115308_.walkAnimation.speed(p_115310_); - f4 = p_115308_.walkAnimation.position(p_115310_); + f4 = p_115308_.walkAnimation.speed(p_115310_); + f5 = p_115308_.walkAnimation.position(p_115310_); if (p_115308_.isBaby()) { -@@ -135,6 +_,7 @@ +@@ -134,6 +_,7 @@ p_115311_.popPose(); super.render(p_115308_, p_115309_, p_115310_, p_115311_, p_115312_, p_115313_); diff --git a/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch b/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch index b6145f70ed..fe1bbbde6f 100644 --- a/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch @@ -1,118 +1,85 @@ --- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java -@@ -65,22 +_,24 @@ +@@ -66,6 +_,7 @@ if (armoritem.getEquipmentSlot() == p_117122_) { this.getParentModel().copyPropertiesTo(p_117124_); this.setPartVisibility(p_117124_, p_117122_); + net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_); boolean flag = this.usesInnerModel(p_117122_); -- if (armoritem instanceof DyeableArmorItem dyeablearmoritem) { -+ if (armoritem instanceof net.minecraft.world.item.DyeableLeatherItem dyeablearmoritem) { - int i = dyeablearmoritem.getColor(itemstack); - float f = (float)(i >> 16 & 0xFF) / 255.0F; - float f1 = (float)(i >> 8 & 0xFF) / 255.0F; - float f2 = (float)(i & 0xFF) / 255.0F; -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, null); -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, "overlay"); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay")); - } else { -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, null); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); + ArmorMaterial armormaterial = armoritem.getMaterial().value(); + int i = itemstack.is(ItemTags.DYEABLE) ? DyedItemColor.getOrDefault(itemstack, -6265536) : -1; +@@ -84,16 +_,17 @@ + f2 = 1.0F; + } + +- this.renderModel(p_117119_, p_117120_, p_117123_, p_117124_, f, f1, f2, armormaterial$layer.texture(flag)); ++ var texture = net.neoforged.neoforge.client.ClientHooks.getArmorTexture(p_117121_, itemstack, armormaterial$layer, flag, p_117122_); ++ this.renderModel(p_117119_, p_117120_, p_117123_, model, f, f1, f2, texture); + } + + ArmorTrim armortrim = itemstack.get(DataComponents.TRIM); + if (armortrim != null) { +- this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, p_117124_, flag); ++ this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, model, flag); } - ArmorTrim.getTrim(p_117121_.level().registryAccess(), itemstack, true) -- .ifPresent(p_289638_ -> this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, p_289638_, p_117124_, flag)); -+ .ifPresent(p_289638_ -> this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, p_289638_, model, flag)); -+ if (itemstack.hasFoil()) { - this.renderGlint(p_117119_, p_117120_, p_117123_, p_117124_); + this.renderGlint(p_117119_, p_117120_, p_117123_, model); } } } -@@ -121,13 +_,19 @@ +@@ -132,6 +_,18 @@ float p_289693_, - @Nullable String p_289682_ + ResourceLocation p_324344_ ) { -- VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(this.getArmorLocation(p_289650_, p_289668_, p_289682_))); -+ renderModel(p_289664_, p_289689_, p_289681_, p_289650_, p_289658_, p_289668_, p_289678_, p_289674_, p_289693_, this.getArmorLocation(p_289650_, p_289668_, p_289682_)); ++ renderModel(p_289664_, p_289689_, p_289681_, (net.minecraft.client.model.Model) p_289658_, p_289678_, p_289674_, p_289693_, p_324344_); + } -+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, net.minecraft.client.model.Model p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation armorResource) { -+ VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(armorResource)); ++ private void renderModel( ++ PoseStack p_289664_, ++ MultiBufferSource p_289689_, ++ int p_289681_, ++ net.minecraft.client.model.Model p_289658_, ++ float p_289678_, ++ float p_289674_, ++ float p_289693_, ++ ResourceLocation p_324344_ ++ ) { + VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(p_324344_)); p_289658_.renderToBuffer(p_289664_, vertexconsumer, p_289681_, OverlayTexture.NO_OVERLAY, p_289678_, p_289674_, p_289693_, 1.0F); } - +@@ -139,6 +_,11 @@ private void renderTrim( - ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_ + Holder p_323506_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_ ) { -+ renderTrim(p_289690_, p_289687_, p_289643_, p_289683_, p_289692_, p_289663_, p_289651_); ++ renderTrim(p_323506_, p_289687_, p_289643_, p_289683_, p_289692_, (net.minecraft.client.model.Model) p_289663_, p_289651_); + } -+ private void renderTrim(ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_) { ++ private void renderTrim( ++ Holder p_323506_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_ ++ ) { TextureAtlasSprite textureatlassprite = this.armorTrimAtlas - .getSprite(p_289651_ ? p_289692_.innerTexture(p_289690_) : p_289692_.outerTexture(p_289690_)); + .getSprite(p_289651_ ? p_289692_.innerTexture(p_323506_) : p_289692_.outerTexture(p_323506_)); VertexConsumer vertexconsumer = textureatlassprite.wrap(p_289643_.getBuffer(Sheets.armorTrimsSheet(p_289692_.pattern().value().decal()))); -@@ -135,6 +_,9 @@ +@@ -146,6 +_,9 @@ } private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, A p_289659_) { -+ renderGlint(p_289673_, p_289654_, p_289649_, p_289659_); ++ renderGlint(p_289673_, p_289654_, p_289649_, (net.minecraft.client.model.Model) p_289659_); + } + private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, net.minecraft.client.model.Model p_289659_) { p_289659_.renderToBuffer(p_289673_, p_289654_.getBuffer(RenderType.armorEntityGlint()), p_289649_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } -@@ -146,6 +_,7 @@ - return p_117129_ == EquipmentSlot.LEGS; - } +@@ -155,5 +_,12 @@ -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorLocation(ArmorItem p_117081_, boolean p_117082_, @Nullable String p_117083_) { - String s = "textures/models/armor/" - + p_117081_.getMaterial().getName() -@@ -155,4 +_,45 @@ - + ".png"; - return ARMOR_LOCATION_CACHE.computeIfAbsent(s, ResourceLocation::new); - } -+ -+ /*=================================== FORGE START =========================================*/ + private boolean usesInnerModel(EquipmentSlot p_117129_) { + return p_117129_ == EquipmentSlot.LEGS; ++ } + + /** + * Hook to allow item-sensitive armor model. for HumanoidArmorLayer. + */ + protected net.minecraft.client.model.Model getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlot slot, A model) { + return net.neoforged.neoforge.client.ClientHooks.getArmorModel(entity, itemStack, slot, model); -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.world.entity.Entity entity, ItemStack stack, EquipmentSlot slot, @Nullable String type) { -+ ArmorItem item = (ArmorItem)stack.getItem(); -+ String texture = item.getMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format(java.util.Locale.ROOT, "%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (usesInnerModel(slot) ? 2 : 1), type == null ? "" : String.format(java.util.Locale.ROOT, "_%s", type)); -+ -+ s1 = net.neoforged.neoforge.client.ClientHooks.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = ARMOR_LOCATION_CACHE.get(s1); -+ -+ if (resourcelocation == null) { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_LOCATION_CACHE.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ + } } diff --git a/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch index 0da78b0d70..7f8084039e 100644 --- a/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch @@ -23,7 +23,7 @@ return HumanoidModel.ArmPose.ITEM; } -@@ -182,10 +_,12 @@ +@@ -185,10 +_,12 @@ } public void renderRightHand(PoseStack p_117771_, MultiBufferSource p_117772_, int p_117773_, AbstractClientPlayer p_117774_) { @@ -36,10 +36,10 @@ this.renderHand(p_117814_, p_117815_, p_117816_, p_117817_, this.model.leftArm, this.model.leftSleeve); } -@@ -227,7 +_,7 @@ +@@ -230,7 +_,7 @@ } } else if (f > 0.0F) { - super.setupRotations(p_117802_, p_117803_, p_117804_, p_117805_, p_117806_); + super.setupRotations(p_117802_, p_117803_, p_117804_, p_117805_, p_117806_, p_320048_); - float f4 = p_117802_.isInWater() ? -90.0F - f1 : -90.0F; + float f4 = p_117802_.isInWater() || p_117802_.isInFluidType((fluidType, height) -> p_117802_.canSwimInFluidType(fluidType)) ? -90.0F - p_117802_.getXRot() : -90.0F; float f5 = Mth.lerp(f, 0.0F, f4); diff --git a/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch b/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch index 1e56444a5d..95f1563e80 100644 --- a/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch +++ b/patches/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 -@@ -43,6 +_,9 @@ +@@ -42,6 +_,9 @@ private static final Map> PROPERTIES = Maps.newHashMap(); private static ClampedItemPropertyFunction registerGeneric(ResourceLocation p_174582_, ClampedItemPropertyFunction p_174583_) { @@ -10,7 +10,7 @@ GENERIC_PROPERTIES.put(p_174582_, p_174583_); return p_174583_; } -@@ -52,6 +_,10 @@ +@@ -51,6 +_,10 @@ } private static void register(Item p_174571_, ResourceLocation p_174572_, ClampedItemPropertyFunction p_174573_) { diff --git a/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch b/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch index 19b2f6abbe..5835dfec53 100644 --- a/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch +++ b/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch @@ -5,7 +5,7 @@ boolean flag = hasTransparentPixel(anativeimage[0]); + int maxMipmapLevel = net.neoforged.neoforge.client.ClientHooks.getMaxMipmapLevel(anativeimage[0].getWidth(), anativeimage[0].getHeight()); - for(int i = 1; i <= p_252326_; ++i) { + for (int i = 1; i <= p_252326_; i++) { if (i < p_251300_.length) { anativeimage[i] = p_251300_[i]; } else { diff --git a/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch b/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch index cfb0dffde6..115bee7e58 100644 --- a/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch +++ b/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch @@ -14,7 +14,7 @@ @@ -120,6 +_,10 @@ void upload(int p_248895_, int p_250245_, int p_250458_, int p_251337_, NativeImage[] p_248825_) { - for(int i = 0; i < this.byMipLevel.length; ++i) { + for (int i = 0; i < this.byMipLevel.length; i++) { + // Forge: Skip uploading if the texture would be made invalid by mip level + if ((this.width >> i) <= 0 || (this.height >> i) <= 0) + break; @@ -23,7 +23,7 @@ .upload(i, p_248895_ >> i, p_250245_ >> i, p_250458_ >> i, p_251337_ >> i, this.width >> i, this.height >> i, this.byMipLevel.length > 1, false); } @@ -242,7 +_,8 @@ - for(int i = 0; i < this.activeFrame.length; ++i) { + for (int i = 0; i < this.activeFrame.length; i++) { int j = SpriteContents.this.width >> i; int k = SpriteContents.this.height >> i; - this.activeFrame[i] = new NativeImage(j, k, false); @@ -33,12 +33,12 @@ } @@ -257,6 +_,9 @@ - for(int k = 0; k < this.activeFrame.length; ++k) { + for (int k = 0; k < this.activeFrame.length; k++) { int l = SpriteContents.this.width >> k; int i1 = SpriteContents.this.height >> k; + // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes + if (l < 1 || i1 < 1) + continue; - for(int j1 = 0; j1 < i1; ++j1) { - for(int k1 = 0; k1 < l; ++k1) { + for (int j1 = 0; j1 < i1; j1++) { + for (int k1 = 0; k1 < l; k1++) { diff --git a/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch index 78325c3d79..9eee410753 100644 --- a/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -11,7 +11,7 @@ .thenComparing(p_247945_ -> p_247945_.entry.name()); @@ -48,6 +_,14 @@ - for(Stitcher.Holder holder : list) { + for (Stitcher.Holder holder : list) { if (!this.addToStorage(holder)) { + if (LOGGER.isInfoEnabled()) { + StringBuilder sb = new StringBuilder(); diff --git a/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch b/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch index c812aae9eb..dab382df66 100644 --- a/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch +++ b/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/atlas/SpriteSources.java +++ b/net/minecraft/client/renderer/texture/atlas/SpriteSources.java -@@ -16,7 +_,7 @@ +@@ -17,7 +_,7 @@ @OnlyIn(Dist.CLIENT) public class SpriteSources { diff --git a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch index 526b3a3951..88a7ff5876 100644 --- a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -14,7 +14,7 @@ this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel)); p_252014_.pop(); } -@@ -482,7 +_,17 @@ +@@ -481,7 +_,17 @@ } @Override @@ -32,7 +32,7 @@ ModelBakery.BakedCacheKey modelbakery$bakedcachekey = new ModelBakery.BakedCacheKey(p_252176_, p_249765_.getRotation(), p_249765_.isUvLocked()); BakedModel bakedmodel = ModelBakery.this.bakedCache.get(modelbakery$bakedcachekey); if (bakedmodel != null) { -@@ -491,11 +_,11 @@ +@@ -490,11 +_,11 @@ UnbakedModel unbakedmodel = this.getModel(p_252176_); if (unbakedmodel instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) { return ModelBakery.ITEM_MODEL_GENERATOR diff --git a/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch b/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch index ce1b2b95c0..9d8f15524e 100644 --- a/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch +++ b/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch @@ -53,7 +53,7 @@ + List> list = Lists.newArrayList(); long k = p_235052_.nextLong(); - for(int j = 0; j < bitset.length(); ++j) { + for (int j = 0; j < bitset.length(); j++) { if (bitset.get(j)) { - list.addAll(this.selectors.get(j).getRight().getQuads(p_235050_, p_235051_, RandomSource.create(k))); + var model = this.selectors.get(j).getRight(); diff --git a/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch b/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch index 0157292ca1..5bf0d3ed96 100644 --- a/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch +++ b/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch @@ -17,8 +17,8 @@ + // 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.neoforged.neoforge.client.model.data.ModelData modelData, @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.RenderType renderType) { return WeightedRandom.getWeightedItem(this.list, Math.abs((int)p_235060_.nextLong()) % this.totalWeight) -- .map(p_235065_ -> p_235065_.getData().getQuads(p_235058_, p_235059_, p_235060_)) -+ .map(p_235065_ -> p_235065_.getData().getQuads(p_235058_, p_235059_, p_235060_, modelData, renderType)) +- .map(p_337442_ -> p_337442_.data().getQuads(p_235058_, p_235059_, p_235060_)) ++ .map(p_235065_ -> p_235065_.data().getQuads(p_235058_, p_235059_, p_235060_, modelData, renderType)) .orElse(Collections.emptyList()); } @@ -65,7 +65,7 @@ + @Override // FORGE: Get render types based on the active weighted model + public net.neoforged.neoforge.client.ChunkRenderTypeSet getRenderTypes(@org.jetbrains.annotations.NotNull BlockState state, @org.jetbrains.annotations.NotNull RandomSource rand, @org.jetbrains.annotations.NotNull net.neoforged.neoforge.client.model.data.ModelData data) { + return WeightedRandom.getWeightedItem(this.list, Math.abs((int)rand.nextLong()) % this.totalWeight) -+ .map((p_235065_) -> p_235065_.getData().getRenderTypes(state, rand, data)) ++ .map((p_235065_) -> p_235065_.data().getRenderTypes(state, rand, data)) + .orElse(net.neoforged.neoforge.client.ChunkRenderTypeSet.none()); } diff --git a/patches/net/minecraft/client/server/IntegratedServer.java.patch b/patches/net/minecraft/client/server/IntegratedServer.java.patch index d3b8fef2eb..9d4300a051 100644 --- a/patches/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/net/minecraft/client/server/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java -@@ -69,10 +_,12 @@ +@@ -72,10 +_,12 @@ this.setPvpAllowed(true); this.setFlightAllowed(true); this.initializeKeyPair(); @@ -13,11 +13,11 @@ return true; } -@@ -217,6 +_,7 @@ +@@ -224,6 +_,7 @@ @Override public void halt(boolean p_120053_) { + if (isRunning()) this.executeBlocking(() -> { - for(ServerPlayer serverplayer : Lists.newArrayList(this.getPlayerList().getPlayers())) { + for (ServerPlayer serverplayer : Lists.newArrayList(this.getPlayerList().getPlayers())) { if (!serverplayer.getUUID().equals(this.uuid)) { diff --git a/patches/net/minecraft/client/server/LanServerDetection.java.patch b/patches/net/minecraft/client/server/LanServerDetection.java.patch index dbb046a1ce..40b5077b7f 100644 --- a/patches/net/minecraft/client/server/LanServerDetection.java.patch +++ b/patches/net/minecraft/client/server/LanServerDetection.java.patch @@ -21,4 +21,4 @@ + } boolean flag = false; - for(LanServer lanserver : this.servers) { + for (LanServer lanserver : this.servers) { diff --git a/patches/net/minecraft/client/server/LanServerPinger.java.patch b/patches/net/minecraft/client/server/LanServerPinger.java.patch index 3029c1cd97..1bff6736f8 100644 --- a/patches/net/minecraft/client/server/LanServerPinger.java.patch +++ b/patches/net/minecraft/client/server/LanServerPinger.java.patch @@ -16,7 +16,7 @@ private final String motd; @@ -40,7 +_,7 @@ - while(!this.isInterrupted() && this.isRunning) { + while (!this.isInterrupted() && this.isRunning) { try { - InetAddress inetaddress = InetAddress.getByName("224.0.2.60"); + InetAddress inetaddress = InetAddress.getByName(MULTICAST_GROUP); diff --git a/patches/net/minecraft/commands/Commands.java.patch b/patches/net/minecraft/commands/Commands.java.patch index 2e1818723c..f78bc1e933 100644 --- a/patches/net/minecraft/commands/Commands.java.patch +++ b/patches/net/minecraft/commands/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -213,7 +_,7 @@ +@@ -215,7 +_,7 @@ JfrCommand.register(this.dispatcher); } @@ -8,8 +8,8 @@ + if (net.neoforged.neoforge.gametest.GameTestHooks.isGametestEnabled()) { TestCommand.register(this.dispatcher); ResetChunksCommand.register(this.dispatcher); - RaidCommand.register(this.dispatcher); -@@ -247,6 +_,7 @@ + RaidCommand.register(this.dispatcher, p_230944_); +@@ -250,6 +_,7 @@ if (p_230943_.includeIntegrated) { PublishCommand.register(this.dispatcher); } @@ -17,7 +17,7 @@ this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer()); } -@@ -264,6 +_,16 @@ +@@ -267,6 +_,16 @@ public void performCommand(ParseResults p_242844_, String p_242841_) { CommandSourceStack commandsourcestack = p_242844_.getContext().getSource(); @@ -34,7 +34,7 @@ commandsourcestack.getServer().getProfiler().push(() -> "/" + p_242841_); ContextChain contextchain = finishParsing(p_242844_, p_242841_, commandsourcestack); -@@ -361,7 +_,8 @@ +@@ -364,7 +_,8 @@ Map, CommandNode> map = Maps.newHashMap(); RootCommandNode rootcommandnode = new RootCommandNode<>(); map.put(this.dispatcher.getRoot(), rootcommandnode); diff --git a/patches/net/minecraft/commands/arguments/EntityArgument.java.patch b/patches/net/minecraft/commands/arguments/EntityArgument.java.patch index 766e2cf0f6..f5496e986c 100644 --- a/patches/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/patches/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -120,7 +_,7 @@ - if (s instanceof SharedSuggestionProvider sharedsuggestionprovider) { +@@ -119,7 +_,7 @@ + if (p_91482_.getSource() instanceof SharedSuggestionProvider sharedsuggestionprovider) { StringReader stringreader = new StringReader(p_91483_.getInput()); stringreader.setCursor(p_91483_.getStart()); - EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, sharedsuggestionprovider.hasPermission(2)); diff --git a/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch b/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch index 31806309df..676795818b 100644 --- a/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch +++ b/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/ResourceLocationArgument.java +++ b/net/minecraft/commands/arguments/ResourceLocationArgument.java -@@ -39,7 +_,7 @@ +@@ -29,7 +_,7 @@ public static AdvancementHolder getAdvancement(CommandContext p_106988_, String p_106989_) throws CommandSyntaxException { ResourceLocation resourcelocation = getId(p_106988_, p_106989_); @@ -9,7 +9,7 @@ if (advancementholder == null) { throw ERROR_UNKNOWN_ADVANCEMENT.create(resourcelocation); } else { -@@ -48,7 +_,7 @@ +@@ -38,7 +_,7 @@ } public static RecipeHolder getRecipe(CommandContext p_106995_, String p_106996_) throws CommandSyntaxException { diff --git a/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch b/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch index 8ed92ea7df..df4eba0c27 100644 --- a/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch +++ b/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java -@@ -463,6 +_,9 @@ +@@ -459,6 +_,9 @@ } this.reader.skip(); @@ -10,7 +10,7 @@ this.parseSelector(); } else { this.parseNameOrUUID(); -@@ -478,6 +_,7 @@ +@@ -474,6 +_,7 @@ p_121248_.suggest("@r", Component.translatable("argument.entity.selector.randomPlayer")); p_121248_.suggest("@s", Component.translatable("argument.entity.selector.self")); p_121248_.suggest("@e", Component.translatable("argument.entity.selector.allEntities")); diff --git a/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch b/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch index 8ac5f634ff..84278562e6 100644 --- a/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch +++ b/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/synchronization/ArgumentTypeInfos.java +++ b/net/minecraft/commands/synchronization/ArgumentTypeInfos.java -@@ -66,6 +_,20 @@ +@@ -68,6 +_,20 @@ public class ArgumentTypeInfos { private static final Map, ArgumentTypeInfo> BY_CLASS = Maps.newHashMap(); @@ -21,10 +21,10 @@ private static , T extends ArgumentTypeInfo.Template> ArgumentTypeInfo register( Registry> p_235387_, String p_235388_, Class p_235389_, ArgumentTypeInfo p_235390_ ) { -@@ -123,12 +_,14 @@ - register(p_235385_, "template_mirror", TemplateMirrorArgument.class, SingletonArgumentInfo.contextFree(TemplateMirrorArgument::templateMirror)); - register(p_235385_, "template_rotation", TemplateRotationArgument.class, SingletonArgumentInfo.contextFree(TemplateRotationArgument::templateRotation)); - register(p_235385_, "heightmap", HeightmapTypeArgument.class, SingletonArgumentInfo.contextFree(HeightmapTypeArgument::heightmap)); +@@ -136,12 +_,14 @@ + register( + p_235385_, "loot_modifier", ResourceOrIdArgument.LootModifierArgument.class, SingletonArgumentInfo.contextAware(ResourceOrIdArgument::lootModifier) + ); - if (SharedConstants.IS_RUNNING_IN_IDE) { + // Forge: Register before gametest arguments to provide forge server <-> vanilla client interop and matching int ids + var uuidInfo = register(p_235385_, "uuid", UuidArgument.class, SingletonArgumentInfo.contextFree(UuidArgument::uuid)); diff --git a/patches/net/minecraft/core/Direction.java.patch b/patches/net/minecraft/core/Direction.java.patch deleted file mode 100644 index 71a09eb1ca..0000000000 --- a/patches/net/minecraft/core/Direction.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/core/Direction.java -+++ b/net/minecraft/core/Direction.java -@@ -325,6 +_,22 @@ - return direction; - } - -+ /** NeoForge: Version of {@link #getNearest(float, float, float)} that accounts for potential rounding errors. */ -+ public static Direction getNearestStable(float p_122373_, float p_122374_, float p_122375_) { -+ Direction direction = NORTH; -+ float f = Float.MIN_VALUE; -+ -+ for(Direction direction1 : VALUES) { -+ float f1 = p_122373_ * (float)direction1.normal.getX() + p_122374_ * (float)direction1.normal.getY() + p_122375_ * (float)direction1.normal.getZ(); -+ if (f1 > f + com.mojang.math.Constants.EPSILON) { -+ f = f1; -+ direction = direction1; -+ } -+ } -+ -+ return direction; -+ } -+ - @Override - public String toString() { - return this.name; diff --git a/patches/net/minecraft/core/Holder.java.patch b/patches/net/minecraft/core/Holder.java.patch index 5fd1f47e07..43ab5b2270 100644 --- a/patches/net/minecraft/core/Holder.java.patch +++ b/patches/net/minecraft/core/Holder.java.patch @@ -9,18 +9,53 @@ T value(); boolean isBound(); -@@ -201,6 +_,14 @@ - } else { - this.value = p_249418_; - } -+ } +@@ -41,6 +_,15 @@ + return this.unwrapKey().map(p_316542_ -> p_316542_.location().toString()).orElse("[unregistered]"); + } + ++ /** ++ * {@return the holder that this holder wraps} ++ * ++ * Useful for holders that delegate to another holder. ++ */ ++ default Holder getDelegate() { ++ return this; ++ } + + static Holder direct(T p_205710_) { + return new Holder.Direct<>(p_205710_); + } +@@ -220,6 +_,14 @@ + } + } + + @org.jetbrains.annotations.Nullable + public A getData(net.neoforged.neoforge.registries.datamaps.DataMapType type) { + if (owner instanceof HolderLookup.RegistryLookup lookup) { + return lookup.getData(type, key()); + } + return null; ++ } ++ + public void bindTags(Collection> p_205770_) { + this.tags = Set.copyOf(p_205770_); + } +@@ -232,6 +_,18 @@ + @Override + public String toString() { + return "Reference{" + this.key + "=" + this.value + "}"; ++ } ++ ++ // Neo: Add DeferredHolder-compatible hashCode() and equals() overrides ++ @Override ++ public int hashCode() { ++ return key().hashCode(); ++ } ++ ++ @Override ++ public boolean equals(Object obj) { ++ if (this == obj) return true; ++ return obj instanceof Holder h && h.kind() == Kind.REFERENCE && h.unwrapKey().orElseThrow() == this.key(); } - public void bindTags(Collection> p_205770_) { + public static enum Type { diff --git a/patches/net/minecraft/core/HolderLookup.java.patch b/patches/net/minecraft/core/HolderLookup.java.patch index e23c4ba3d6..56c28b49b5 100644 --- a/patches/net/minecraft/core/HolderLookup.java.patch +++ b/patches/net/minecraft/core/HolderLookup.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/core/HolderLookup.java +++ b/net/minecraft/core/HolderLookup.java -@@ -117,6 +_,11 @@ - : this); +@@ -96,6 +_,11 @@ + }; } + @org.jetbrains.annotations.Nullable @@ -9,18 +9,18 @@ + return null; + } + - public abstract static class Delegate implements HolderLookup.RegistryLookup { - protected abstract HolderLookup.RegistryLookup parent(); + public interface Delegate extends HolderLookup.RegistryLookup { + HolderLookup.RegistryLookup parent(); -@@ -148,6 +_,12 @@ +@@ -127,6 +_,12 @@ @Override - public Stream> listTags() { + default Stream> listTags() { return this.parent().listTags(); + } + + @Override + @org.jetbrains.annotations.Nullable -+ public A getData(net.neoforged.neoforge.registries.datamaps.DataMapType attachment, ResourceKey key) { ++ default A getData(net.neoforged.neoforge.registries.datamaps.DataMapType attachment, ResourceKey key) { + return parent().getData(attachment, key); } } diff --git a/patches/net/minecraft/core/HolderSet.java.patch b/patches/net/minecraft/core/HolderSet.java.patch index 38c6d319f0..8459624a17 100644 --- a/patches/net/minecraft/core/HolderSet.java.patch +++ b/patches/net/minecraft/core/HolderSet.java.patch @@ -9,7 +9,7 @@ Stream> stream(); int size(); -@@ -146,6 +_,9 @@ +@@ -174,6 +_,9 @@ public void bind(List> p_205836_) { this.contents = List.copyOf(p_205836_); @@ -19,7 +19,7 @@ } public TagKey key() { -@@ -180,6 +_,11 @@ +@@ -208,6 +_,11 @@ @Override public boolean canSerializeIn(HolderOwner p_256542_) { return this.owner.canSerializeIn(p_256542_); diff --git a/patches/net/minecraft/core/MappedRegistry.java.patch b/patches/net/minecraft/core/MappedRegistry.java.patch index 4a64933f6c..f4e546b075 100644 --- a/patches/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/net/minecraft/core/MappedRegistry.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -32,7 +_,7 @@ - import org.apache.commons.lang3.Validate; +@@ -31,7 +_,7 @@ + import net.minecraft.util.RandomSource; import org.slf4j.Logger; -public class MappedRegistry implements WritableRegistry { @@ -9,7 +9,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); -@@ -79,6 +_,12 @@ +@@ -75,6 +_,12 @@ public Stream> listTags() { return MappedRegistry.this.getTags().map(Pair::getSecond); } @@ -22,41 +22,45 @@ }; public MappedRegistry(ResourceKey> p_249899_, Lifecycle p_252249_) { -@@ -127,6 +_,9 @@ - this.validateWrite(p_256594_); - Validate.notNull(p_256594_); - Validate.notNull(p_256374_); -+ if (p_256563_ > this.getMaxId()) -+ throw new IllegalStateException(String.format(java.util.Locale.ENGLISH, "Invalid id %d - maximum id range of %d exceeded.", p_256563_, this.getMaxId())); +@@ -113,9 +_,17 @@ + + @Override + public Holder.Reference register(ResourceKey p_256252_, T p_256591_, RegistrationInfo p_326235_) { ++ return register(this.byId.size(), p_256252_, p_256591_, p_326235_); ++ } ++ ++ public Holder.Reference register(int id, ResourceKey p_256252_, T p_256591_, RegistrationInfo p_326235_) { + this.validateWrite(p_256252_); + Objects.requireNonNull(p_256252_); + Objects.requireNonNull(p_256591_); ++ int i = id; ++ if (i > this.getMaxId()) ++ throw new IllegalStateException(String.format(java.util.Locale.ENGLISH, "Invalid id %d - maximum id range of %d exceeded.", i, this.getMaxId())); + - if (this.byLocation.containsKey(p_256594_.location())) { - Util.pauseInIde(new IllegalStateException("Adding duplicate key '" + p_256594_ + "' to registry")); + if (this.byLocation.containsKey(p_256252_.location())) { + Util.pauseInIde(new IllegalStateException("Adding duplicate key '" + p_256252_ + "' to registry")); } -@@ -145,12 +_,14 @@ - reference.bindKey(p_256594_); +@@ -134,16 +_,18 @@ + reference.bindKey(p_256252_); } else { - reference = this.byKey.computeIfAbsent(p_256594_, p_258168_ -> Holder.Reference.createStandAlone(this.holderOwner(), p_258168_)); + reference = this.byKey.computeIfAbsent(p_256252_, p_258168_ -> Holder.Reference.createStandAlone(this.holderOwner(), (ResourceKey)p_258168_)); + // Forge: Bind the value immediately so it can be queried while the registry is not frozen -+ reference.bindValue(p_256374_); ++ reference.bindValue(p_256591_); } - this.byKey.put(p_256594_, reference); - this.byLocation.put(p_256594_.location(), reference); - this.byValue.put(p_256374_, reference); -- this.byId.size(Math.max(this.byId.size(), p_256563_ + 1)); -+ while (this.byId.size() < (p_256563_ + 1)) this.byId.add(null); - this.byId.set(p_256563_, reference); - this.toId.put(p_256374_, p_256563_); - if (this.nextId <= p_256563_) { -@@ -160,6 +_,7 @@ - this.lifecycles.put(p_256374_, p_256469_); - this.registryLifecycle = this.registryLifecycle.add(p_256469_); - this.holdersInOrder = null; -+ this.addCallbacks.forEach(addCallback -> addCallback.onAdd(this, p_256563_, p_256594_, p_256374_)); + this.byKey.put(p_256252_, reference); + this.byLocation.put(p_256252_.location(), reference); + this.byValue.put(p_256591_, reference); +- int i = this.byId.size(); + this.byId.add(reference); + this.toId.put(p_256591_, i); + this.registrationInfos.put(p_256252_, p_326235_); + this.registryLifecycle = this.registryLifecycle.add(p_326235_.lifecycle()); ++ this.addCallbacks.forEach(addCallback -> addCallback.onAdd(this, i, p_256252_, p_256591_)); return reference; } -@@ -188,7 +_,7 @@ +@@ -167,7 +_,7 @@ @Nullable @Override public T get(@Nullable ResourceKey p_122714_) { @@ -65,7 +69,7 @@ } @Nullable -@@ -204,7 +_,7 @@ +@@ -188,7 +_,7 @@ @Override public Optional> getHolder(ResourceKey p_205905_) { @@ -74,7 +78,7 @@ } @Override -@@ -214,7 +_,7 @@ +@@ -198,7 +_,7 @@ } Holder.Reference getOrCreateHolderOrThrow(ResourceKey p_248831_) { @@ -83,7 +87,7 @@ if (this.unregisteredIntrusiveHolders != null) { throw new IllegalStateException("This registry can't create new holders without value"); } else { -@@ -247,7 +_,7 @@ +@@ -231,7 +_,7 @@ @Nullable @Override public T get(@Nullable ResourceLocation p_122739_) { @@ -92,7 +96,7 @@ return getValueFromNullable(reference); } -@@ -323,13 +_,18 @@ +@@ -307,13 +_,18 @@ return this.byKey.containsKey(p_175392_); } @@ -108,11 +112,11 @@ return this; } else { this.frozen = true; -- this.byValue.forEach((p_247989_, p_247990_) -> p_247990_.bindValue(p_247989_)); +- this.byValue.forEach((p_247989_, p_247990_) -> p_247990_.bindValue((T)p_247989_)); List list = this.byKey .entrySet() .stream() -@@ -345,8 +_,10 @@ +@@ -329,8 +_,10 @@ throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); } @@ -124,7 +128,7 @@ return this; } -@@ -441,5 +_,59 @@ +@@ -424,5 +_,53 @@ @Override public HolderLookup.RegistryLookup asLookup() { return this.lookup; @@ -137,14 +141,11 @@ + super.clear(full); + this.byId.clear(); + this.toId.clear(); -+ nextId = 0; -+ if (holdersInOrder != null) holdersInOrder = null; + if (full) { + this.byLocation.clear(); + this.byKey.clear(); + this.byValue.clear(); + this.tags.clear(); -+ this.lifecycles.clear(); + if (unregisteredIntrusiveHolders != null) { + unregisteredIntrusiveHolders.clear(); + unregisteredIntrusiveHolders = null; @@ -160,9 +161,6 @@ + if (0 <= id && id < this.byId.size() && this.byId.get(id) != null) { // Don't use byId() method, it will return the default value if the entry is absent + throw new IllegalStateException("Duplicate id " + id + " for " + key + " and " + this.getKey(this.byId.get(id).value())); + } -+ if (this.nextId <= id) { -+ this.nextId = id + 1; -+ } + var holder = byKey.get(key); + while (this.byId.size() < (id + 1)) this.byId.add(null); + this.byId.set(id, holder); diff --git a/patches/net/minecraft/core/Registry.java.patch b/patches/net/minecraft/core/Registry.java.patch index 6883f61375..7276d4d687 100644 --- a/patches/net/minecraft/core/Registry.java.patch +++ b/patches/net/minecraft/core/Registry.java.patch @@ -9,3 +9,12 @@ ResourceKey> key(); default Codec byNameCodec() { +@@ -48,7 +_,7 @@ + } + + private DataResult> safeCastToReference(Holder p_326365_) { +- return p_326365_ instanceof Holder.Reference reference ++ return p_326365_.getDelegate() instanceof Holder.Reference reference + ? DataResult.success(reference) + : DataResult.error(() -> "Unregistered holder in " + this.key() + ": " + p_326365_); + } diff --git a/patches/net/minecraft/core/RegistryCodecs.java.patch b/patches/net/minecraft/core/RegistryCodecs.java.patch deleted file mode 100644 index ff132ff648..0000000000 --- a/patches/net/minecraft/core/RegistryCodecs.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/core/RegistryCodecs.java -+++ b/net/minecraft/core/RegistryCodecs.java -@@ -48,7 +_,8 @@ - } - - public static Codec> fullCodec(ResourceKey> p_248884_, Lifecycle p_251810_, Codec p_250169_) { -- Codec, E>> codec = Codec.unboundedMap(ResourceKey.codec(p_248884_), p_250169_); -+ // FORGE: Fix MC-197860 -+ Codec, E>> codec = new net.neoforged.neoforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(p_248884_), p_250169_); - return codec.xmap(p_258184_ -> { - WritableRegistry writableregistry = new MappedRegistry<>(p_248884_, p_251810_); - p_258184_.forEach((p_258191_, p_258192_) -> writableregistry.register(p_258191_, p_258192_, p_251810_)); diff --git a/patches/net/minecraft/core/RegistrySetBuilder.java.patch b/patches/net/minecraft/core/RegistrySetBuilder.java.patch index a43236682d..163a1531b2 100644 --- a/patches/net/minecraft/core/RegistrySetBuilder.java.patch +++ b/patches/net/minecraft/core/RegistrySetBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/RegistrySetBuilder.java +++ b/net/minecraft/core/RegistrySetBuilder.java -@@ -79,6 +_,10 @@ +@@ -72,6 +_,10 @@ return this.add(p_256261_, Lifecycle.stable(), p_256010_); } @@ -11,7 +11,7 @@ private RegistrySetBuilder.BuildState createState(RegistryAccess p_256400_) { RegistrySetBuilder.BuildState registrysetbuilder$buildstate = RegistrySetBuilder.BuildState.create( p_256400_, this.entries.stream().map(RegistrySetBuilder.RegistryStub::key) -@@ -145,16 +_,22 @@ +@@ -185,16 +_,22 @@ lazyholder.supplier = () -> cloner.clone((T)p_311483_.value(), p_312115_, p_311797_.getValue()); map.put(resourcekey, lazyholder); }); @@ -40,19 +40,19 @@ + } else { + lifecycle = registrylookup.registryLifecycle(); + } - return lookupFromMap(p_311836_, lifecycle, map); + return lookupFromMap(p_311836_, lifecycle, p_312323_, map); } } -@@ -191,7 +_,7 @@ - RegistrySetBuilder.UniversalLookup registrysetbuilder$universallookup = new RegistrySetBuilder.UniversalLookup(registrysetbuilder$compositeowner); +@@ -236,7 +_,7 @@ + RegistrySetBuilder.UniversalLookup registrysetbuilder$universallookup = new RegistrySetBuilder.UniversalLookup(registrysetbuilder$universalowner); Builder> builder = ImmutableMap.builder(); p_255995_.registries() - .forEach(p_258197_ -> builder.put(p_258197_.key().location(), RegistrySetBuilder.wrapContextLookup(p_258197_.value().asLookup()))); + .forEach(p_258197_ -> builder.put(p_258197_.key().location(), net.neoforged.neoforge.common.CommonHooks.wrapRegistryLookup(p_258197_.value().asLookup()))); p_256495_.forEach(p_256603_ -> builder.put(p_256603_.location(), registrysetbuilder$universallookup)); return new RegistrySetBuilder.BuildState( - registrysetbuilder$compositeowner, registrysetbuilder$universallookup, builder.build(), new HashMap<>(), list -@@ -215,6 +_,11 @@ + registrysetbuilder$universalowner, registrysetbuilder$universallookup, builder.build(), new HashMap<>(), list +@@ -260,6 +_,11 @@ @Override public HolderGetter lookup(ResourceKey> p_255961_) { return (HolderGetter)BuildState.this.registries.getOrDefault(p_255961_.location(), BuildState.this.lookup); diff --git a/patches/net/minecraft/core/RegistrySynchronization.java.patch b/patches/net/minecraft/core/RegistrySynchronization.java.patch deleted file mode 100644 index f5965b8b3b..0000000000 --- a/patches/net/minecraft/core/RegistrySynchronization.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/core/RegistrySynchronization.java -+++ b/net/minecraft/core/RegistrySynchronization.java -@@ -30,7 +_,7 @@ - put(builder, Registries.TRIM_MATERIAL, TrimMaterial.DIRECT_CODEC); - put(builder, Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC); - put(builder, Registries.DAMAGE_TYPE, DamageType.CODEC); -- return builder.build(); -+ return net.neoforged.neoforge.registries.DataPackRegistriesHooks.grabNetworkableRegistries(builder); // FORGE: Keep the map so custom registries can be added later - }); - public static final Codec NETWORK_CODEC = makeNetworkCodec(); - diff --git a/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch b/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch deleted file mode 100644 index 861cdd219f..0000000000 --- a/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/core/cauldron/CauldronInteraction.java -+++ b/net/minecraft/core/cauldron/CauldronInteraction.java -@@ -68,6 +_,7 @@ - if (p_175667_.hasTag()) { - itemstack.setTag(p_175667_.getTag().copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(p_175667_, itemstack); - - p_175665_.setItemInHand(p_175666_, itemstack); - p_175665_.awardStat(Stats.CLEAN_SHULKER_BOX); diff --git a/patches/net/minecraft/core/component/DataComponentPatch.java.patch b/patches/net/minecraft/core/component/DataComponentPatch.java.patch new file mode 100644 index 0000000000..5a40947168 --- /dev/null +++ b/patches/net/minecraft/core/component/DataComponentPatch.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/core/component/DataComponentPatch.java ++++ b/net/minecraft/core/component/DataComponentPatch.java +@@ -238,6 +_,7 @@ + } + + public DataComponentPatch.Builder set(DataComponentType p_332004_, T p_331566_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_331566_); + this.map.put(p_332004_, Optional.of(p_331566_)); + return this; + } diff --git a/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch b/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch new file mode 100644 index 0000000000..55418aec0b --- /dev/null +++ b/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/core/component/PatchedDataComponentMap.java ++++ b/net/minecraft/core/component/PatchedDataComponentMap.java +@@ -64,6 +_,7 @@ + + @Nullable + public T set(DataComponentType p_330791_, @Nullable T p_330369_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_330369_); + this.ensureMapOwnership(); + T t = this.prototype.get((DataComponentType)p_330791_); + Optional optional; diff --git a/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch b/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch index 81236cacfa..95711c0173 100644 --- a/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch +++ b/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -368,7 +_,7 @@ - DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_123562_.getItem(); - BlockPos blockpos = p_302435_.pos().relative(p_302435_.state().getValue(DispenserBlock.FACING)); - Level level = p_302435_.level(); +@@ -231,7 +_,7 @@ + DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_338251_.getItem(); + BlockPos blockpos = p_338850_.pos().relative(p_338850_.state().getValue(DispenserBlock.FACING)); + Level level = p_338850_.level(); - if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null)) { -+ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_123562_)) { - dispensiblecontaineritem.checkExtraContent(null, level, p_123562_, blockpos); ++ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_338251_)) { + dispensiblecontaineritem.checkExtraContent(null, level, p_338251_, blockpos); return new ItemStack(Items.BUCKET); } else { -@@ -431,9 +_,10 @@ +@@ -293,9 +_,10 @@ } else if (CampfireBlock.canLight(blockstate) || CandleBlock.canLight(blockstate) || CandleCakeBlock.canLight(blockstate)) { level.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, Boolean.valueOf(true))); level.gameEvent(null, GameEvent.BLOCK_CHANGE, blockpos); - } else if (blockstate.getBlock() instanceof TntBlock) { - TntBlock.explode(level, blockpos); - level.removeBlock(blockpos, false); -+ } else if (blockstate.isFlammable(level, blockpos, p_302453_.state().getValue(DispenserBlock.FACING).getOpposite())) { -+ blockstate.onCaughtFire(level, blockpos, p_302453_.state().getValue(DispenserBlock.FACING).getOpposite(), null); ++ } else if (blockstate.isFlammable(level, blockpos, p_338494_.state().getValue(DispenserBlock.FACING).getOpposite())) { ++ blockstate.onCaughtFire(level, blockpos, p_338494_.state().getValue(DispenserBlock.FACING).getOpposite(), null); + if (blockstate.getBlock() instanceof TntBlock) + level.removeBlock(blockpos, false); } else { diff --git a/patches/net/minecraft/core/particles/BlockParticleOption.java.patch b/patches/net/minecraft/core/particles/BlockParticleOption.java.patch index 233cf8ecae..992032b695 100644 --- a/patches/net/minecraft/core/particles/BlockParticleOption.java.patch +++ b/patches/net/minecraft/core/particles/BlockParticleOption.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/particles/BlockParticleOption.java +++ b/net/minecraft/core/particles/BlockParticleOption.java -@@ -50,4 +_,15 @@ +@@ -37,4 +_,15 @@ public BlockState getState() { return this.state; } diff --git a/patches/net/minecraft/core/particles/ItemParticleOption.java.patch b/patches/net/minecraft/core/particles/ItemParticleOption.java.patch index f34790fb34..ba30506ce6 100644 --- a/patches/net/minecraft/core/particles/ItemParticleOption.java.patch +++ b/patches/net/minecraft/core/particles/ItemParticleOption.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/particles/ItemParticleOption.java +++ b/net/minecraft/core/particles/ItemParticleOption.java -@@ -31,7 +_,7 @@ - - public ItemParticleOption(ParticleType p_123705_, ItemStack p_123706_) { - this.type = p_123705_; -- this.itemStack = p_123706_; -+ this.itemStack = p_123706_.copy(); //Forge: Fix stack updating after the fact causing particle changes. +@@ -24,7 +_,7 @@ + throw new IllegalArgumentException("Empty stacks are not allowed"); + } else { + this.type = p_123705_; +- this.itemStack = p_123706_; ++ this.itemStack = p_123706_.copy(); //Forge: Fix stack updating after the fact causing particle changes. + } } - @Override diff --git a/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch b/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch index 9c3a8ba12d..6ec146c2fa 100644 --- a/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch +++ b/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java -@@ -346,6 +_,10 @@ +@@ -338,6 +_,10 @@ }); } @@ -10,4 +10,4 @@ + @FunctionalInterface interface RegistryBootstrap { - T run(Registry p_260128_); + Object run(Registry p_260128_); diff --git a/patches/net/minecraft/data/DataProvider.java.patch b/patches/net/minecraft/data/DataProvider.java.patch index 6dbb738d75..aeed3b4140 100644 --- a/patches/net/minecraft/data/DataProvider.java.patch +++ b/patches/net/minecraft/data/DataProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/DataProvider.java +++ b/net/minecraft/data/DataProvider.java -@@ -22,6 +_,8 @@ +@@ -24,6 +_,8 @@ public interface DataProvider { ToIntFunction FIXED_ORDER_FIELDS = Util.make(new Object2IntOpenHashMap<>(), p_236070_ -> { diff --git a/patches/net/minecraft/data/HashCache.java.patch b/patches/net/minecraft/data/HashCache.java.patch index 9d1c1908d0..9ef15576d9 100644 --- a/patches/net/minecraft/data/HashCache.java.patch +++ b/patches/net/minecraft/data/HashCache.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/data/HashCache.java +++ b/net/minecraft/data/HashCache.java -@@ -37,6 +_,7 @@ +@@ -39,6 +_,7 @@ private final Path cacheDir; private final String versionId; private final Map caches; + private final Map originalCaches; private final Set cachesToWrite = new HashSet<>(); - private final Set cachePaths = new HashSet<>(); + final Set cachePaths = new HashSet<>(); private final int initialCount; -@@ -63,6 +_,7 @@ +@@ -65,6 +_,7 @@ } this.caches = map; @@ -16,7 +16,7 @@ this.initialCount = i; } -@@ -104,6 +_,8 @@ +@@ -106,6 +_,8 @@ this.caches.forEach((p_253378_, p_253379_) -> { if (this.cachesToWrite.contains(p_253378_)) { Path path = this.getProviderCachePath(p_253378_); @@ -25,11 +25,11 @@ p_253379_.save(this.rootDir, path, DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(LocalDateTime.now()) + "\t" + p_253378_); } -@@ -219,10 +_,11 @@ +@@ -222,10 +_,11 @@ bufferedwriter.write(p_236145_); bufferedwriter.newLine(); -- for(Entry entry : this.data.entrySet()) { +- for (Entry entry : this.data.entrySet()) { + // Forge: Standardize order of entries + for(Map.Entry entry : this.data.entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) { bufferedwriter.write(entry.getValue().toString()); diff --git a/patches/net/minecraft/data/Main.java.patch b/patches/net/minecraft/data/Main.java.patch index 4b87d8da93..4e6c37a6e7 100644 --- a/patches/net/minecraft/data/Main.java.patch +++ b/patches/net/minecraft/data/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -79,8 +_,15 @@ +@@ -86,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,7 +17,7 @@ Path path = Paths.get(optionspec7.value(optionset)); boolean flag = optionset.has(optionspec6); boolean flag1 = flag || optionset.has(optionspec2); -@@ -88,9 +_,16 @@ +@@ -95,9 +_,16 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); @@ -36,7 +36,7 @@ flag1, flag2, flag3, -@@ -100,6 +_,7 @@ +@@ -107,6 +_,7 @@ true ); datagenerator.run(); diff --git a/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch b/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch index 76e3d3328f..7a109aeaab 100644 --- a/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch +++ b/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch @@ -13,11 +13,11 @@ private final PackOutput.PathProvider pathProvider; private final List subProviders; @@ -36,7 +_,7 @@ - throw new IllegalStateException("Duplicate advancement " + p_311516_.id()); + throw new IllegalStateException("Duplicate advancement " + p_339356_.id()); } else { - Path path = this.pathProvider.json(p_311516_.id()); -- list.add(DataProvider.saveStable(p_254268_, Advancement.CODEC, p_311516_.value(), path)); -+ list.add(DataProvider.saveStable(p_254268_, Advancement.CODEC, p_311516_.value(), path));// TODO: make conditional + Path path = this.pathProvider.json(p_339356_.id()); +- list.add(DataProvider.saveStable(p_254268_, p_323115_, Advancement.CODEC, p_339356_.value(), path)); ++ list.add(DataProvider.saveStable(p_254268_, p_323115_, Advancement.CODEC, p_339356_.value(), path));// TODO: make conditional } }; diff --git a/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch b/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch index f313a60551..3b759606f2 100644 --- a/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch +++ b/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/BlockLootSubProvider.java +++ b/net/minecraft/data/loot/BlockLootSubProvider.java -@@ -611,12 +_,16 @@ +@@ -618,12 +_,16 @@ protected abstract void generate(); @@ -9,12 +9,12 @@ + } + @Override - public void generate(BiConsumer p_249322_) { + public void generate(HolderLookup.Provider p_331472_, BiConsumer, LootTable.Builder> p_249322_) { this.generate(); - Set set = new HashSet<>(); + Set> set = new HashSet<>(); -- for(Block block : BuiltInRegistries.BLOCK) { +- for (Block block : BuiltInRegistries.BLOCK) { + for(Block block : getKnownBlocks()) { if (block.isEnabled(this.enabledFeatures)) { - ResourceLocation resourcelocation = block.getLootTable(); - if (resourcelocation != BuiltInLootTables.EMPTY && set.add(resourcelocation)) { + ResourceKey resourcekey = block.getLootTable(); + if (resourcekey != BuiltInLootTables.EMPTY && set.add(resourcekey)) { diff --git a/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch b/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch index a86c543431..8f15bad49c 100644 --- a/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch +++ b/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/EntityLootSubProvider.java +++ b/net/minecraft/data/loot/EntityLootSubProvider.java -@@ -59,12 +_,16 @@ +@@ -58,12 +_,16 @@ public abstract void generate(); @@ -9,9 +9,9 @@ + } + @Override - public void generate(BiConsumer p_251751_) { + public void generate(HolderLookup.Provider p_331660_, BiConsumer, LootTable.Builder> p_251751_) { this.generate(); - Set set = Sets.newHashSet(); + Set> set = new HashSet<>(); - BuiltInRegistries.ENTITY_TYPE - .holders() + this.getKnownEntityTypes() @@ -19,7 +19,7 @@ .forEach( p_266624_ -> { EntityType entitytype = p_266624_.value(); -@@ -114,7 +_,7 @@ +@@ -113,7 +_,7 @@ } } diff --git a/patches/net/minecraft/data/loot/LootTableProvider.java.patch b/patches/net/minecraft/data/loot/LootTableProvider.java.patch index 920bbd15a5..273b0e7fe5 100644 --- a/patches/net/minecraft/data/loot/LootTableProvider.java.patch +++ b/patches/net/minecraft/data/loot/LootTableProvider.java.patch @@ -1,34 +1,49 @@ --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java -@@ -46,7 +_,7 @@ - public CompletableFuture run(CachedOutput p_254060_) { - final Map map = Maps.newHashMap(); - Map map1 = new Object2ObjectOpenHashMap<>(); -- this.subProviders.forEach(p_288263_ -> p_288263_.provider().get().generate((p_288259_, p_288260_) -> { -+ getTables().forEach(p_288263_ -> p_288263_.provider().get().generate((p_288259_, p_288260_) -> { - ResourceLocation resourcelocation1 = map1.put(RandomSequence.seedForKey(p_288259_), p_288259_); +@@ -62,33 +_,24 @@ + private CompletableFuture run(CachedOutput p_324447_, HolderLookup.Provider p_323978_) { + WritableRegistry writableregistry = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental()); + Map map = new Object2ObjectOpenHashMap<>(); +- this.subProviders.forEach(p_329847_ -> p_329847_.provider().get().generate(p_323978_, (p_339366_, p_339367_) -> { +- ResourceLocation resourcelocation = sequenceIdForLootTable(p_339366_); ++ getTables().forEach(p_329847_ -> p_329847_.provider().get().generate(p_323978_, (p_335199_, p_335200_) -> { ++ ResourceLocation resourcelocation = sequenceIdForLootTable(p_335199_); + ResourceLocation resourcelocation1 = map.put(RandomSequence.seedForKey(resourcelocation), resourcelocation); if (resourcelocation1 != null) { - Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_288259_); -@@ -66,15 +_,8 @@ - } - }); +- Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_339366_.location()); ++ Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_335199_.location()); + } -- for(ResourceLocation resourcelocation : Sets.difference(this.requiredTables, map.keySet())) { -- problemreporter$collector.report("Missing built-in table: " + resourcelocation); +- p_339367_.setRandomSequence(resourcelocation); +- LootTable loottable = p_339367_.setParamSet(p_329847_.paramSet).build(); +- writableregistry.register(p_339366_, loottable, RegistrationInfo.BUILT_IN); ++ p_335200_.setRandomSequence(resourcelocation); ++ LootTable loottable = p_335200_.setParamSet(p_329847_.paramSet).build(); ++ writableregistry.register(p_335199_, loottable, RegistrationInfo.BUILT_IN); + })); + writableregistry.freeze(); + ProblemReporter.Collector problemreporter$collector = new ProblemReporter.Collector(); + HolderGetter.Provider holdergetter$provider = new RegistryAccess.ImmutableRegistryAccess(List.of(writableregistry)).freeze().asGetterLookup(); + ValidationContext validationcontext = new ValidationContext(problemreporter$collector, LootContextParamSets.ALL_PARAMS, holdergetter$provider); + +- for (ResourceKey resourcekey : Sets.difference(this.requiredTables, writableregistry.registryKeySet())) { +- problemreporter$collector.report("Missing built-in table: " + resourcekey.location()); - } -+ validate(map, validationcontext); ++ validate(writableregistry, validationcontext, problemreporter$collector); -- map.forEach( -- (p_278897_, p_278898_) -> p_278898_.validate( -- validationcontext.setParams(p_278898_.getParamSet()).enterElement("{" + p_278897_ + "}", new LootDataId<>(LootDataType.TABLE, p_278897_)) -- ) -- ); +- writableregistry.holders() +- .forEach( +- p_339369_ -> p_339369_.value() +- .validate( +- validationcontext.setParams(p_339369_.value().getParamSet()).enterElement("{" + p_339369_.key().location() + "}", p_339369_.key()) +- ) +- ); Multimap multimap = problemreporter$collector.get(); if (!multimap.isEmpty()) { multimap.forEach((p_124446_, p_124447_) -> LOGGER.warn("Found validation problem in {}: {}", p_124446_, p_124447_)); -@@ -87,6 +_,20 @@ - return DataProvider.saveStable(p_254060_, LootTable.CODEC, loottable, path); - }).toArray(p_253403_ -> new CompletableFuture[p_253403_])); +@@ -101,6 +_,20 @@ + return DataProvider.saveStable(p_324447_, p_323978_, LootTable.DIRECT_CODEC, loottable, path); + }).toArray(CompletableFuture[]::new)); } + } + @@ -36,14 +51,14 @@ + return this.subProviders; + } + -+ protected void validate(Map map, ValidationContext validationcontext) { -+ for(ResourceLocation resourcelocation : Sets.difference(this.requiredTables, map.keySet())) { -+ validationcontext.reportProblem("Missing built-in table: " + resourcelocation); ++ protected void validate(WritableRegistry writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) { ++ for(ResourceKey resourcekey : Sets.difference(this.requiredTables, writableregistry.registryKeySet())) { ++ problemreporter$collector.report("Missing built-in table: " + resourcekey.location()); + } + -+ map.forEach((p_278897_, p_278898_) -> { -+ p_278898_.validate(validationcontext.setParams(p_278898_.getParamSet()).enterElement("{" + p_278897_ + "}", new LootDataId<>(LootDataType.TABLE, p_278897_))); ++ writableregistry.holders().forEach(p_335195_ -> { ++ p_335195_.value().validate(validationcontext.setParams(p_335195_.value().getParamSet()).enterElement("{" + p_335195_.key().location() + "}", p_335195_.key())); + }); } - @Override + private static ResourceLocation sequenceIdForLootTable(ResourceKey p_336172_) { diff --git a/patches/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/net/minecraft/data/recipes/RecipeProvider.java.patch index a636ba985d..99ae038cbe 100644 --- a/patches/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,45 +1,38 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -66,6 +_,10 @@ - .put(BlockFamily.Variant.WALL, (p_248024_, p_248025_) -> wallBuilder(RecipeCategory.DECORATIONS, p_248024_, Ingredient.of(p_248025_))) - .build(); - -+ @Deprecated(forRemoval = true, since = "1.20.4") // TODO: remove in 1.20.5 -+ public RecipeProvider(PackOutput p_248933_, CompletableFuture lookupProvider) { -+ this(p_248933_); -+ } - public RecipeProvider(PackOutput p_248933_) { - this.recipePathProvider = p_248933_.createPathProvider(PackOutput.Target.DATA_PACK, "recipes"); - this.advancementPathProvider = p_248933_.createPathProvider(PackOutput.Target.DATA_PACK, "advancements"); -@@ -78,15 +_,15 @@ +@@ -85,18 +_,18 @@ this.buildRecipes( new RecipeOutput() { @Override - public void accept(ResourceLocation p_312039_, Recipe p_312254_, @Nullable AdvancementHolder p_311794_) { -+ public void accept(ResourceLocation p_312039_, Recipe p_312254_, @org.jetbrains.annotations.Nullable AdvancementHolder p_311794_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { ++ public void accept(ResourceLocation p_312039_, Recipe p_312254_, @Nullable AdvancementHolder p_311794_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { if (!set.add(p_312039_)) { throw new IllegalStateException("Duplicate recipe " + p_312039_); } else { -- list.add(DataProvider.saveStable(p_254020_, Recipe.CODEC, p_312254_, RecipeProvider.this.recipePathProvider.json(p_312039_))); -+ list.add(DataProvider.saveStable(p_254020_, Recipe.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_312254_, conditions)), RecipeProvider.this.recipePathProvider.json(p_312039_))); +- list.add(DataProvider.saveStable(p_324494_, p_324248_, Recipe.CODEC, p_312254_, RecipeProvider.this.recipePathProvider.json(p_312039_))); ++ list.add(DataProvider.saveStable(p_324494_, p_324248_, Recipe.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_312254_, conditions)), RecipeProvider.this.recipePathProvider.json(p_312039_))); if (p_311794_ != null) { list.add( DataProvider.saveStable( -- p_254020_, Advancement.CODEC, p_311794_.value(), RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) -+ p_254020_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_311794_.value(), conditions)), RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) + p_324494_, + p_324248_, +- Advancement.CODEC, +- p_311794_.value(), ++ Advancement.CONDITIONAL_CODEC, ++ Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_311794_.value(), conditions)), + RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) ) ); - } -@@ -103,12 +_,16 @@ +@@ -114,12 +_,16 @@ } - protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_) { -- return DataProvider.saveStable(p_253674_, Advancement.CODEC, p_301116_.value(), this.advancementPathProvider.json(p_301116_.id())); -+ return buildAdvancement(p_253674_, p_301116_, new net.neoforged.neoforge.common.conditions.ICondition[0]); + protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_) { +- return DataProvider.saveStable(p_253674_, p_323646_, Advancement.CODEC, p_301116_.value(), this.advancementPathProvider.json(p_301116_.id())); ++ return buildAdvancement(p_253674_, p_323646_, p_301116_, new net.neoforged.neoforge.common.conditions.ICondition[0]); + } + -+ protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { -+ return DataProvider.saveStable(p_253674_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_301116_.value(), conditions)), this.advancementPathProvider.json(p_301116_.id())); ++ protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { ++ return DataProvider.saveStable(p_253674_, p_323646_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_301116_.value(), conditions)), this.advancementPathProvider.json(p_301116_.id())); } protected abstract void buildRecipes(RecipeOutput p_301172_); diff --git a/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch b/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch index f99750cc3f..fb0bc660cf 100644 --- a/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch +++ b/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java +++ b/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java -@@ -27,6 +_,7 @@ +@@ -28,6 +_,7 @@ private final RecipeCategory category; private final CookingBookCategory bookCategory; private final Item result; @@ -8,7 +8,7 @@ private final Ingredient ingredient; private final float experience; private final int cookingTime; -@@ -44,9 +_,22 @@ +@@ -45,9 +_,22 @@ int p_250189_, AbstractCookingRecipe.Factory p_311960_ ) { @@ -32,7 +32,7 @@ this.ingredient = p_250362_; this.experience = p_251204_; this.cookingTime = p_250189_; -@@ -85,6 +_,38 @@ +@@ -86,6 +_,38 @@ return new SimpleCookingRecipeBuilder(p_250319_, CookingBookCategory.FOOD, p_250377_, p_248930_, p_252329_, p_250482_, SmokingRecipe::new); } @@ -71,7 +71,7 @@ public SimpleCookingRecipeBuilder unlockedBy(String p_176792_, Criterion p_300970_) { this.criteria.put(p_176792_, p_300970_); return this; -@@ -110,7 +_,7 @@ +@@ -111,7 +_,7 @@ this.criteria.forEach(advancement$builder::addCriterion); AbstractCookingRecipe abstractcookingrecipe = this.factory .create( diff --git a/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch b/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch index 337301bfd6..201f615df9 100644 --- a/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch +++ b/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/registries/RegistriesDatapackGenerator.java +++ b/net/minecraft/data/registries/RegistriesDatapackGenerator.java -@@ -19,12 +_,23 @@ +@@ -18,12 +_,23 @@ import net.minecraft.resources.ResourceKey; import org.slf4j.Logger; @@ -24,17 +24,17 @@ this.registries = p_255780_; this.output = p_256643_; } -@@ -36,8 +_,7 @@ - p_256533_ -> { - DynamicOps dynamicops = RegistryOps.create(JsonOps.INSTANCE, p_256533_); +@@ -35,8 +_,7 @@ + p_326736_ -> { + DynamicOps dynamicops = p_326736_.createSerializationContext(JsonOps.INSTANCE); return CompletableFuture.allOf( - RegistryDataLoader.WORLDGEN_REGISTRIES - .stream() -+ net.neoforged.neoforge.registries.DataPackRegistriesHooks.getDataPackRegistriesWithDimensions() - .flatMap(p_256552_ -> this.dumpRegistryCap(p_255785_, p_256533_, dynamicops, p_256552_).stream()) - .toArray(p_255809_ -> new CompletableFuture[p_255809_]) - ); -@@ -53,9 +_,10 @@ ++ net.neoforged.neoforge.registries.DataPackRegistriesHooks.getDataPackRegistriesWithDimensions() + .flatMap( + p_256552_ -> this.dumpRegistryCap(p_255785_, p_326736_, dynamicops, (RegistryDataLoader.RegistryData)p_256552_).stream() + ) +@@ -54,9 +_,10 @@ .map( p_255847_ -> { PackOutput.PathProvider packoutput$pathprovider = this.output diff --git a/patches/net/minecraft/data/registries/VanillaRegistries.java.patch b/patches/net/minecraft/data/registries/VanillaRegistries.java.patch index ace8e9ee5a..8b05c87b0d 100644 --- a/patches/net/minecraft/data/registries/VanillaRegistries.java.patch +++ b/patches/net/minecraft/data/registries/VanillaRegistries.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/data/registries/VanillaRegistries.java +++ b/net/minecraft/data/registries/VanillaRegistries.java -@@ -56,6 +_,7 @@ - .add(Registries.TRIM_PATTERN, TrimPatterns::bootstrap) - .add(Registries.TRIM_MATERIAL, TrimMaterials::bootstrap) - .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap); +@@ -60,6 +_,7 @@ + .add(Registries.WOLF_VARIANT, WolfVariants::bootstrap) + .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap) + .add(Registries.BANNER_PATTERN, BannerPatterns::bootstrap); + public static final List>> DATAPACK_REGISTRY_KEYS = BUILDER.getEntryKeys(); private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider p_256242_) { diff --git a/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch index c963734247..9b0020e2ed 100644 --- a/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -53,8 +_,14 @@ - GameEvent.UNEQUIP - }; +@@ -55,8 +_,14 @@ + GameEvent.UNEQUIP.key() + ); -+ /** @deprecated Forge: Use the {@linkplain #GameEventTagsProvider(PackOutput, CompletableFuture, String, net.neoforged.neoforge.common.data.ExistingFileHelper) mod id variant} */ ++ /** @deprecated Neo: Use the {@linkplain #GameEventTagsProvider(PackOutput, CompletableFuture, String, net.neoforged.neoforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated public GameEventTagsProvider(PackOutput p_256060_, CompletableFuture p_255621_) { -- super(p_256060_, Registries.GAME_EVENT, p_255621_, p_256368_ -> p_256368_.builtInRegistryHolder().key()); +- super(p_256060_, Registries.GAME_EVENT, p_255621_); + this(p_256060_, p_255621_, "vanilla", null); + } + + public GameEventTagsProvider(PackOutput p_256060_, CompletableFuture p_255621_, String modId, @org.jetbrains.annotations.Nullable net.neoforged.neoforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256060_, Registries.GAME_EVENT, p_255621_, p_256368_ -> p_256368_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(p_256060_, Registries.GAME_EVENT, p_255621_, modId, existingFileHelper); } @Override diff --git a/patches/net/minecraft/data/tags/TagsProvider.java.patch b/patches/net/minecraft/data/tags/TagsProvider.java.patch index 4b6cb5a9d3..f4f7cbf52c 100644 --- a/patches/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/net/minecraft/data/tags/TagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/TagsProvider.java +++ b/net/minecraft/data/tags/TagsProvider.java -@@ -37,26 +_,54 @@ +@@ -36,26 +_,54 @@ private final CompletableFuture> parentProvider; protected final ResourceKey> registryKey; protected final Map builders = Maps.newLinkedHashMap(); @@ -57,9 +57,9 @@ } protected abstract void addTags(HolderLookup.Provider p_256380_); -@@ -86,7 +_,10 @@ - ResourceLocation resourcelocation = p_255499_.getKey(); - TagBuilder tagbuilder = p_255499_.getValue(); +@@ -88,7 +_,10 @@ + ResourceLocation resourcelocation = p_323138_.getKey(); + TagBuilder tagbuilder = p_323138_.getValue(); List list = tagbuilder.build(); - List list1 = list.stream().filter(p_274771_ -> !p_274771_.verifyIfPresent(predicate, predicate1)).toList(); + List list1 = java.util.stream.Stream.concat(list.stream(), tagbuilder.getRemoveEntries()) @@ -69,23 +69,21 @@ if (!list1.isEmpty()) { throw new IllegalArgumentException( String.format( -@@ -97,10 +_,10 @@ +@@ -99,8 +_,10 @@ ) ); } else { -- JsonElement jsonelement = TagFile.CODEC -- .encodeStart(JsonOps.INSTANCE, new TagFile(list, false)) -- .getOrThrow(false, LOGGER::error); - Path path = this.pathProvider.json(resourcelocation); -+ var removed = tagbuilder.getRemoveEntries().toList(); -+ JsonElement jsonelement = TagFile.CODEC.encodeStart(JsonOps.INSTANCE, new TagFile(list, tagbuilder.isReplace(), removed)).getOrThrow(false, LOGGER::error); +- return DataProvider.saveStable(p_253684_, p_323140_.contents, TagFile.CODEC, new TagFile(list, false), path); + Path path = this.getPath(resourcelocation); -+ if (path == null) return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. - return DataProvider.saveStable(p_253684_, jsonelement, path); ++ if (path == null) return CompletableFuture.completedFuture(null); // Neo: Allow running this data provider without writing it. Recipe provider needs valid tags. ++ var removed = tagbuilder.getRemoveEntries().toList(); ++ return DataProvider.saveStable(p_253684_, p_323140_.contents, TagFile.CODEC, new TagFile(list, tagbuilder.isReplace(), removed), path); } } -@@ -113,12 +_,24 @@ - + ) +@@ -110,12 +_,24 @@ + ); } + private boolean missing(TagEntry reference) { @@ -110,7 +108,7 @@ return this.builders.computeIfAbsent(p_236452_.location(), p_236442_ -> TagBuilder.create()); } -@@ -134,11 +_,13 @@ +@@ -131,11 +_,13 @@ }); } @@ -127,7 +125,7 @@ } public final TagsProvider.TagAppender add(ResourceKey p_256138_) { -@@ -168,6 +_,19 @@ +@@ -173,6 +_,19 @@ public TagsProvider.TagAppender addOptionalTag(ResourceLocation p_176842_) { this.builder.addOptionalTag(p_176842_); return this; diff --git a/patches/net/minecraft/data/worldgen/BootstapContext.java.patch b/patches/net/minecraft/data/worldgen/BootstrapContext.java.patch similarity index 67% rename from patches/net/minecraft/data/worldgen/BootstapContext.java.patch rename to patches/net/minecraft/data/worldgen/BootstrapContext.java.patch index 4931d96458..1224885b1d 100644 --- a/patches/net/minecraft/data/worldgen/BootstapContext.java.patch +++ b/patches/net/minecraft/data/worldgen/BootstrapContext.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/data/worldgen/BootstapContext.java -+++ b/net/minecraft/data/worldgen/BootstapContext.java +--- a/net/minecraft/data/worldgen/BootstrapContext.java ++++ b/net/minecraft/data/worldgen/BootstrapContext.java @@ -14,4 +_,6 @@ } - HolderGetter lookup(ResourceKey> p_256410_); + HolderGetter lookup(ResourceKey> p_321547_); + + default java.util.Optional> registryLookup(ResourceKey> registry) { return java.util.Optional.empty(); } } diff --git a/patches/net/minecraft/gametest/framework/GameTest.java.patch b/patches/net/minecraft/gametest/framework/GameTest.java.patch index c697957222..bd0ecb0109 100644 --- a/patches/net/minecraft/gametest/framework/GameTest.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTest.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/gametest/framework/GameTest.java +++ b/net/minecraft/gametest/framework/GameTest.java -@@ -16,6 +_,11 @@ +@@ -20,6 +_,11 @@ - boolean required() default true; + boolean manualOnly() default false; + /** + * The namespace of where to grab the structure from, generally a mod id. diff --git a/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch b/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch deleted file mode 100644 index 35c72b0dfc..0000000000 --- a/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/gametest/framework/GameTestHelper.java -+++ b/net/minecraft/gametest/framework/GameTestHelper.java -@@ -836,7 +_,8 @@ - - public void forEveryBlockInStructure(Consumer p_177293_) { - AABB aabb = this.getRelativeBounds(); -- BlockPos.MutableBlockPos.betweenClosedStream(aabb.move(0.0, 1.0, 0.0)).forEach(p_177293_); -+ // Neo: Shrink AABB by one as an aabb surrounding two blocks is increased by one compared to the actual positions -+ BlockPos.MutableBlockPos.betweenClosedStream(aabb.contract(1.0, 1.0, 1.0)).forEach(p_177293_); - } - - public void onEachTick(Runnable p_177424_) { diff --git a/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch b/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch index 8d77141599..6d77cc9d23 100644 --- a/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/gametest/framework/GameTestInfo.java +++ b/net/minecraft/gametest/framework/GameTestInfo.java -@@ -247,6 +_,7 @@ - public void prepareTestStructure(BlockPos p_309710_) { - this.structureBlockEntity = StructureUtils.prepareTestStructure(this, p_309710_, this.getRotation(), this.level); +@@ -264,6 +_,7 @@ + BlockPos blockpos = this.getOrCalculateNorthwestCorner(); + this.structureBlockEntity = StructureUtils.prepareTestStructure(this, blockpos, this.getRotation(), this.level); this.structureBlockPos = this.structureBlockEntity.getBlockPos(); + this.structureBlockEntity.setMetaData(this.getTestName()); // Neo: set the test name as metadata as it isn't always RL-compatible StructureUtils.addCommandBlockAndButtonToStartTest(this.structureBlockPos, new BlockPos(1, 0, -1), this.getRotation(), this.level); + StructureUtils.encaseStructure(this.getStructureBounds(), this.level, !this.testFunction.skyAccess()); this.listeners.forEach(p_127630_ -> p_127630_.testStructureLoaded(this)); - } diff --git a/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch b/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch index 5a3e4ab6e5..eab23f3bf4 100644 --- a/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/gametest/framework/GameTestRegistry.java +++ b/net/minecraft/gametest/framework/GameTestRegistry.java -@@ -26,21 +_,33 @@ +@@ -25,21 +_,33 @@ private static final Map> AFTER_BATCH_FUNCTIONS = Maps.newHashMap(); - private static final Collection LAST_FAILED_TESTS = Sets.newHashSet(); + private static final Set LAST_FAILED_TESTS = Sets.newHashSet(); + /** @deprecated Forge: Use {@link net.neoforged.neoforge.event.RegisterGameTestsEvent RegisterGameTestsEvent} to register game tests */ + @Deprecated @@ -31,12 +31,12 @@ - TEST_FUNCTIONS.addAll(useTestGeneratorMethod(p_177504_)); + Collection testFunctions = new java.util.ArrayList<>(useTestGeneratorMethod(p_177504_)); + if (!allowedNamespaces.isEmpty()) -+ testFunctions.removeIf(t -> !allowedNamespaces.contains(new net.minecraft.resources.ResourceLocation(t.getStructureName()).getNamespace())); ++ testFunctions.removeIf(t -> !allowedNamespaces.contains(new net.minecraft.resources.ResourceLocation(t.structureName()).getNamespace())); + TEST_FUNCTIONS.addAll(testFunctions); TEST_CLASS_NAMES.add(s); } -@@ -102,7 +_,9 @@ +@@ -101,7 +_,9 @@ private static Collection useTestGeneratorMethod(Method p_177514_) { try { @@ -47,7 +47,7 @@ return (Collection)p_177514_.invoke(object); } catch (ReflectiveOperationException reflectiveoperationexception) { throw new RuntimeException(reflectiveoperationexception); -@@ -113,8 +_,9 @@ +@@ -112,8 +_,9 @@ GameTest gametest = p_177516_.getAnnotation(GameTest.class); String s = p_177516_.getDeclaringClass().getSimpleName(); String s1 = s.toLowerCase(); @@ -59,7 +59,7 @@ String s4 = gametest.batch(); Rotation rotation = StructureUtils.getRotationForRotationSteps(gametest.rotationSteps()); return new TestFunction( -@@ -134,7 +_,9 @@ +@@ -135,7 +_,9 @@ private static Consumer turnMethodIntoConsumer(Method p_177520_) { return p_177512_ -> { try { diff --git a/patches/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/net/minecraft/gametest/framework/GameTestServer.java.patch index 8529f97058..804e14dc60 100644 --- a/patches/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java -@@ -136,12 +_,14 @@ +@@ -148,6 +_,7 @@ public boolean initServer() { this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, 1) { }); + net.neoforged.neoforge.server.ServerLifecycleHooks.handleServerAboutToStart(this); this.loadLevel(); ServerLevel serverlevel = this.overworld(); - serverlevel.setDefaultSpawnPos(this.spawnPos, 0.0F); + this.testBatches = Lists.newArrayList(GameTestBatchFactory.fromTestFunction(this.testFunctions, serverlevel)); +@@ -155,6 +_,7 @@ int i = 20000000; serverlevel.setWeatherParameters(20000000, 20000000, false, false); LOGGER.info("Started game test server"); diff --git a/patches/net/minecraft/gametest/framework/TestCommand.java.patch b/patches/net/minecraft/gametest/framework/TestCommand.java.patch index 000f085553..8e77c005eb 100644 --- a/patches/net/minecraft/gametest/framework/TestCommand.java.patch +++ b/patches/net/minecraft/gametest/framework/TestCommand.java.patch @@ -1,21 +1,11 @@ --- a/net/minecraft/gametest/framework/TestCommand.java +++ b/net/minecraft/gametest/framework/TestCommand.java -@@ -341,7 +_,7 @@ - - private static void runTest(ServerLevel p_127930_, BlockPos p_127931_, @Nullable MultipleTestTracker p_127932_, boolean p_304927_) { - StructureBlockEntity structureblockentity = (StructureBlockEntity)p_127930_.getBlockEntity(p_127931_); -- String s = structureblockentity.getMetaData(); -+ String s = structureblockentity.getMetaData().isBlank() ? structureblockentity.getStructureName() : structureblockentity.getMetaData(); // Neo: use the metadata for the structure name - Optional optional = GameTestRegistry.findTestFunction(s); - if (optional.isEmpty()) { - say(p_127930_, "Test function for test " + s + " could not be found", ChatFormatting.RED); -@@ -544,8 +_,8 @@ - } - - private static int importTestStructure(CommandSourceStack p_128016_, String p_128017_) { -- Path path = Paths.get(StructureUtils.testStructuresDir, p_128017_ + ".snbt"); - ResourceLocation resourcelocation = new ResourceLocation(p_128017_); -+ Path path = Paths.get(StructureUtils.testStructuresDir, resourcelocation.getPath() + ".snbt"); - Path path1 = p_128016_.getLevel().getStructureManager().getPathToGeneratedStructure(resourcelocation, ".nbt"); - - try { +@@ -343,7 +_,7 @@ + } else { + BlockPos blockpos1 = blockpos.subtract(optional.get()); + String s = blockpos1.getX() + ", " + blockpos1.getY() + ", " + blockpos1.getZ(); +- String s1 = structureblockentity.getMetaData(); ++ String s1 = structureblockentity.getMetaData().isBlank() ? structureblockentity.getStructureName() : structureblockentity.getMetaData(); // Neo: use the metadata for the structure name + Component component = Component.literal(s) + .setStyle( + Style.EMPTY diff --git a/patches/net/minecraft/nbt/CompoundTag.java.patch b/patches/net/minecraft/nbt/CompoundTag.java.patch index 170db8e2c9..dc97869d83 100644 --- a/patches/net/minecraft/nbt/CompoundTag.java.patch +++ b/patches/net/minecraft/nbt/CompoundTag.java.patch @@ -14,7 +14,7 @@ Map map = Maps.newHashMap(); byte b0; -- while((b0 = p_302338_.readByte()) != 0) { +- while ((b0 = p_302338_.readByte()) != 0) { - String s = readString(p_302338_, p_302362_); + while((b0 = readNamedTagType(p_302338_, p_302362_)) != 0) { + String s = p_302362_.readUTF(p_302338_.readUTF()); diff --git a/patches/net/minecraft/nbt/NbtIo.java.patch b/patches/net/minecraft/nbt/NbtIo.java.patch index e183a204de..0dec753d04 100644 --- a/patches/net/minecraft/nbt/NbtIo.java.patch +++ b/patches/net/minecraft/nbt/NbtIo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/NbtIo.java +++ b/net/minecraft/nbt/NbtIo.java -@@ -172,10 +_,12 @@ +@@ -178,10 +_,12 @@ private static Tag readUnnamedTag(DataInput p_128931_, NbtAccounter p_128933_) throws IOException { byte b0 = p_128931_.readByte(); diff --git a/patches/net/minecraft/network/Connection.java.patch b/patches/net/minecraft/network/Connection.java.patch index deab365962..b8ebe5e567 100644 --- a/patches/net/minecraft/network/Connection.java.patch +++ b/patches/net/minecraft/network/Connection.java.patch @@ -1,14 +1,21 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -110,6 +_,7 @@ +@@ -104,6 +_,8 @@ + private volatile Component delayedDisconnect; + @Nullable + BandwidthDebugMonitor bandwidthDebugMonitor; ++ @Nullable ++ private ProtocolInfo inboundProtocol; + + public Connection(PacketFlow p_129482_) { + this.receiving = p_129482_; +@@ -117,11 +_,13 @@ if (this.delayedDisconnect != null) { this.disconnect(this.delayedDisconnect); } + net.neoforged.neoforge.network.connection.ConnectionUtils.setConnection(p_129525_, this); } - public static void setInitialProtocolAttributes(Channel p_294962_) { -@@ -120,6 +_,7 @@ @Override public void channelInactive(ChannelHandlerContext p_129527_) { this.disconnect(Component.translatable("disconnect.endOfStream")); @@ -16,7 +23,7 @@ } @Override -@@ -135,6 +_,14 @@ +@@ -137,6 +_,14 @@ this.disconnect(Component.translatable("disconnect.timeout")); } else { Component component = Component.translatable("disconnect.genericReason", "Internal Exception: " + p_129534_); @@ -31,7 +38,27 @@ if (flag) { LOGGER.debug("Failed to sent packet", p_129534_); if (this.getSending() == PacketFlow.CLIENTBOUND) { -@@ -380,7 +_,7 @@ +@@ -203,6 +_,7 @@ + if (p_320903_.flow() != this.getReceiving()) { + throw new IllegalStateException("Invalid inbound protocol: " + p_320903_.id()); + } else { ++ this.inboundProtocol = p_320903_; + this.packetListener = p_320940_; + this.disconnectListener = null; + UnconfiguredPipelineHandler.InboundConfigurationTask unconfiguredpipelinehandler$inboundconfigurationtask = UnconfiguredPipelineHandler.setupInboundProtocol( +@@ -231,7 +_,10 @@ + if (bundlerinfo != null) { + PacketBundleUnpacker packetbundleunpacker = new PacketBundleUnpacker(bundlerinfo); + unconfiguredpipelinehandler$outboundconfigurationtask = unconfiguredpipelinehandler$outboundconfigurationtask.andThen( +- p_319516_ -> p_319516_.pipeline().addAfter("encoder", "unbundler", packetbundleunpacker) ++ p_319516_ -> { ++ p_319516_.pipeline().addAfter("encoder", "unbundler", packetbundleunpacker); ++ net.neoforged.neoforge.network.filters.NetworkFilters.injectIfNecessary(this); // Neo: our handlers must be between the encoder and the unbundler, so re-inject them ++ } + ); + } + +@@ -404,7 +_,7 @@ if (this.address == null) { return "local"; } else { @@ -40,7 +67,7 @@ } } -@@ -419,6 +_,7 @@ +@@ -443,6 +_,7 @@ } public static ChannelFuture connect(InetSocketAddress p_290034_, boolean p_290035_, final Connection p_290031_) { @@ -48,10 +75,10 @@ Class oclass; EventLoopGroup eventloopgroup; if (Epoll.isAvailable() && p_290035_) { -@@ -569,6 +_,14 @@ +@@ -599,5 +_,17 @@ - public float getAverageSentPackets() { - return this.averageSentPackets; + public void setBandwidthLogger(LocalSampleLogger p_323799_) { + this.bandwidthDebugMonitor = new BandwidthDebugMonitor(p_323799_); + } + + public Channel channel() { @@ -60,6 +87,9 @@ + + public PacketFlow getDirection() { + return this.receiving; ++ } ++ ++ public ProtocolInfo getInboundProtocol() { ++ return Objects.requireNonNull(this.inboundProtocol, "Inbound protocol not set?"); } - - public void setBandwidthLogger(SampleLogger p_299187_) { + } diff --git a/patches/net/minecraft/network/ConnectionProtocol.java.patch b/patches/net/minecraft/network/ConnectionProtocol.java.patch index e68f14ccaa..fedefcf3b9 100644 --- a/patches/net/minecraft/network/ConnectionProtocol.java.patch +++ b/patches/net/minecraft/network/ConnectionProtocol.java.patch @@ -1,181 +1,14 @@ --- a/net/minecraft/network/ConnectionProtocol.java +++ b/net/minecraft/network/ConnectionProtocol.java -@@ -243,7 +_,7 @@ - .addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new) - .addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new) - .addPacket(ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new) -- .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) -+ .addContextualPacket(ClientboundCustomPayloadPacket.class, (buf, context) -> new ClientboundCustomPayloadPacket(buf, context, ConnectionProtocol.play())) - .addPacket(ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new) - .addPacket(ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new) - .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) -@@ -356,7 +_,7 @@ - .addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new) - .addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new) - .addPacket(ServerboundContainerSlotStateChangedPacket.class, ServerboundContainerSlotStateChangedPacket::new) -- .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) -+ .addContextualPacket(ServerboundCustomPayloadPacket.class, (buf, context) -> new ServerboundCustomPayloadPacket(buf, context, ConnectionProtocol.play())) - .addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new) - .addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new) - .addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new) -@@ -440,7 +_,7 @@ - .addFlow( - PacketFlow.CLIENTBOUND, - new ConnectionProtocol.PacketSet() -- .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) -+ .addContextualPacket(ClientboundCustomPayloadPacket.class, (buf, context) -> new ClientboundCustomPayloadPacket(buf, context, ConnectionProtocol.configuration())) - .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) - .addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new) - .addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new) -@@ -455,7 +_,7 @@ - PacketFlow.SERVERBOUND, - new ConnectionProtocol.PacketSet() - .addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new) -- .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) -+ .addContextualPacket(ServerboundCustomPayloadPacket.class, (buf, context) -> new ServerboundCustomPayloadPacket(buf, context, ConnectionProtocol.configuration())) - .addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new) - .addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new) - .addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new) -@@ -467,6 +_,22 @@ - private final String id; - private final Map> flows; - -+ private static ConnectionProtocol play() { -+ return PLAY; -+ } -+ -+ private static ConnectionProtocol configuration() { -+ return CONFIGURATION; -+ } +@@ -16,4 +_,11 @@ + public String id() { + return this.id; + } + + public boolean isPlay() { + return this == PLAY; + } -+ + public boolean isConfiguration() { + return this == CONFIGURATION; + } -+ - private static ConnectionProtocol.ProtocolBuilder protocol() { - return new ConnectionProtocol.ProtocolBuilder(); - } -@@ -524,11 +_,28 @@ - return int2objectmap; - } - -+ /** -+ * @deprecated Use {@link #createPacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)} instead, which provides the channel context for creating custom packet payloads. -+ */ - @Nullable -+ @Deprecated - public Packet createPacket(int p_294972_, FriendlyByteBuf p_296217_) { - return this.packetSet.createPacket(p_294972_, p_296217_); - } - -+ /** -+ * Creates a new packet from the discriminator and the buffer. -+ * -+ * @param p_294972_ The discriminator -+ * @param p_296217_ The buffer -+ * @param p_130535_ The channel context -+ * @return The packet -+ */ -+ @Nullable -+ public Packet createPacket(int p_294972_, FriendlyByteBuf p_296217_, io.netty.channel.ChannelHandlerContext p_130535_) { -+ return this.packetSet.createPacket(p_294972_, p_296217_, p_130535_); -+ } -+ - public boolean isValidPacketType(Packet p_294142_) { - return this.packetSet.isKnownPacket(p_294142_.getClass()); - } -@@ -539,12 +_,22 @@ - final Object2IntMap>> classToId = Util.make( - new Object2IntOpenHashMap<>(), p_129613_ -> p_129613_.defaultReturnValue(-1) - ); -+ /** -+ * @deprecated Use {@link #contextualIdToDeserializer} instead it allows for context to be passed to the deserializer -+ */ -+ @Deprecated - private final List>> idToDeserializer = Lists.newArrayList(); -+ private final List>> contextualIdToDeserializer = Lists.newArrayList(); - private BundlerInfo bundlerInfo = BundlerInfo.EMPTY; - private final Set>> extraClasses = new HashSet<>(); - - public

> ConnectionProtocol.PacketSet addPacket(Class

p_178331_, Function p_178332_) { - int i = this.idToDeserializer.size(); -+ int k = this.contextualIdToDeserializer.size(); -+ if (i != k) { -+ throw new IllegalStateException("Deserializer lists must be equal in length! Somebody externally modified the registration!"); -+ } -+ - int j = this.classToId.put(p_178331_, i); - if (j != -1) { - String s = "Packet " + p_178331_ + " is already registered to ID " + j; -@@ -552,11 +_,33 @@ - throw new IllegalArgumentException(s); - } else { - this.idToDeserializer.add(p_178332_); -- return this; -- } -- } -- -- public

> ConnectionProtocol.PacketSet withBundlePacket(Class

p_265034_, Function>, P> p_265591_) { -+ this.contextualIdToDeserializer.add((p_296217_, p_130535_) -> p_178332_.apply(p_296217_)); //NeoForge: We always want to be able to create a packet from a buffer, even if we don't have a channel context -+ return this; -+ } -+ } -+ -+ public

> ConnectionProtocol.PacketSet addContextualPacket(Class

p_178331_, java.util.function.BiFunction readerBuilder) { -+ int i = this.contextualIdToDeserializer.size(); -+ int k = this.idToDeserializer.size(); -+ if (i != k) { -+ throw new IllegalStateException("Deserializer lists must be equal in length! Somebody externally modified the registration!"); -+ } -+ -+ int j = this.classToId.put(p_178331_, i); -+ if (j != -1) { -+ String s = "Packet " + p_178331_ + " is already registered to ID " + j; -+ LOGGER.error(LogUtils.FATAL_MARKER, s); -+ throw new IllegalArgumentException(s); -+ } else { -+ this.idToDeserializer.add((buffer -> { -+ throw new IllegalStateException("Cannot deserialize contextual packet: " + p_178331_.getSimpleName() + " without context"); -+ })); -+ this.contextualIdToDeserializer.add(readerBuilder); -+ return this; -+ } -+ } -+ -+ public

> ConnectionProtocol.PacketSet withBundlePacket(Class

p_265034_, Function>, P> p_265591_) { - if (this.bundlerInfo != BundlerInfo.EMPTY) { - throw new IllegalStateException("Bundle packet already configured"); - } else { -@@ -576,10 +_,28 @@ - return this.classToId.containsKey(p_295070_) || this.extraClasses.contains(p_295070_); - } - -+ /** -+ * @deprecated Use {@link #createPacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)} instead, which provides the channel context for creating custom packet payloads. -+ */ -+ @Deprecated - @Nullable - public Packet createPacket(int p_178328_, FriendlyByteBuf p_178329_) { - Function> function = this.idToDeserializer.get(p_178328_); - return function != null ? function.apply(p_178329_) : null; -+ } -+ -+ /** -+ * Creates a new packet from the given discriminator and buffer. -+ * -+ * @param p_178328_ The discriminator -+ * @param p_178329_ The buffer -+ * @param p_130535_ The channel context -+ * @return The packet, or null if no packet could be read. -+ */ -+ @Nullable -+ public Packet createPacket(int p_178328_, FriendlyByteBuf p_178329_, io.netty.channel.ChannelHandlerContext p_130535_) { -+ java.util.function.BiFunction> function = this.contextualIdToDeserializer.get(p_178328_); -+ return function != null ? function.apply(p_178329_, p_130535_) : null; - } - - public BundlerInfo bundlerInfo() { + } diff --git a/patches/net/minecraft/network/FriendlyByteBuf.java.patch b/patches/net/minecraft/network/FriendlyByteBuf.java.patch index 1713996a56..5f72bfa0a5 100644 --- a/patches/net/minecraft/network/FriendlyByteBuf.java.patch +++ b/patches/net/minecraft/network/FriendlyByteBuf.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java -@@ -80,7 +_,7 @@ +@@ -67,7 +_,7 @@ import org.joml.Quaternionf; import org.joml.Vector3f; @@ -9,26 +9,14 @@ public static final int DEFAULT_NBT_QUOTA = 2097152; private final ByteBuf source; public static final short MAX_STRING_LENGTH = 32767; -@@ -572,9 +_,10 @@ - this.writeId(BuiltInRegistries.ITEM, item); - this.writeByte(p_130056_.getCount()); - CompoundTag compoundtag = null; -- if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) { -+ if (item.isDamageable(p_130056_) || item.shouldOverrideMultiplayerNbt()) { - compoundtag = p_130056_.getTag(); - } -+ compoundtag = net.neoforged.neoforge.attachment.AttachmentInternals.addAttachmentsToTag(compoundtag, p_130056_, false); - - this.writeNbt(compoundtag); - } -@@ -588,9 +_,7 @@ - } else { - Item item = this.readById(BuiltInRegistries.ITEM); - int i = this.readByte(); -- ItemStack itemstack = new ItemStack(item, i); -- itemstack.setTag(this.readNbt()); -- return itemstack; -+ return net.neoforged.neoforge.attachment.AttachmentInternals.reconstructItemStack(item, i, this.readNbt()); - } +@@ -1588,5 +_,10 @@ + @Override + public boolean release(int p_130347_) { + return this.source.release(p_130347_); ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public ByteBuf getSource() { ++ return this.source; } - + } diff --git a/patches/net/minecraft/network/PacketBundleUnpacker.java.patch b/patches/net/minecraft/network/PacketBundleUnpacker.java.patch index 1c153d15a8..a26060545b 100644 --- a/patches/net/minecraft/network/PacketBundleUnpacker.java.patch +++ b/patches/net/minecraft/network/PacketBundleUnpacker.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/PacketBundleUnpacker.java +++ b/net/minecraft/network/PacketBundleUnpacker.java -@@ -20,7 +_,7 @@ - if (bundlerinfo$provider == null) { - throw new EncoderException("Bundler not configured: " + p_265038_); - } else { -- bundlerinfo$provider.bundlerInfo().unbundlePacket(p_265038_, p_265735_::add); -+ bundlerinfo$provider.bundlerInfo().unbundlePacket(p_265038_, p_265735_::add, p_265691_); - } +@@ -14,7 +_,7 @@ } - } + + protected void encode(ChannelHandlerContext p_265691_, Packet p_265038_, List p_265735_) throws Exception { +- this.bundlerInfo.unbundlePacket(p_265038_, p_265735_::add); ++ this.bundlerInfo.unbundlePacket(p_265038_, p_265735_::add, p_265691_); + if (p_265038_.isTerminal()) { + p_265691_.pipeline().remove(p_265691_.name()); + } diff --git a/patches/net/minecraft/network/PacketDecoder.java.patch b/patches/net/minecraft/network/PacketDecoder.java.patch index fd0a0ecc06..eaad1cb228 100644 --- a/patches/net/minecraft/network/PacketDecoder.java.patch +++ b/patches/net/minecraft/network/PacketDecoder.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/PacketDecoder.java +++ b/net/minecraft/network/PacketDecoder.java -@@ -28,7 +_,7 @@ - ConnectionProtocol.CodecData codecdata = attribute.get(); - FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(p_130536_); - int j = friendlybytebuf.readVarInt(); -- Packet packet = codecdata.createPacket(j, friendlybytebuf); -+ Packet packet = codecdata.createPacket(j, friendlybytebuf, p_130535_); - if (packet == null) { - throw new IOException("Bad packet id " + j); - } else { +@@ -23,6 +_,8 @@ + protected void decode(ChannelHandlerContext p_130535_, ByteBuf p_130536_, List p_130537_) throws Exception { + int i = p_130536_.readableBytes(); + if (i != 0) { ++ // Neo: Wrap buffer with ChannelHandlerContext ++ p_130536_ = new net.neoforged.neoforge.network.connection.ChannelAwareFriendlyByteBuf(p_130536_, p_130535_); + Packet packet = this.protocolInfo.codec().decode(p_130536_); + PacketType> packettype = packet.type(); + JvmProfiler.INSTANCE.onPacketReceived(this.protocolInfo.id(), packettype, p_130535_.channel().remoteAddress(), i); diff --git a/patches/net/minecraft/network/PacketEncoder.java.patch b/patches/net/minecraft/network/PacketEncoder.java.patch index 294ee0f07a..8fc4dbe04e 100644 --- a/patches/net/minecraft/network/PacketEncoder.java.patch +++ b/patches/net/minecraft/network/PacketEncoder.java.patch @@ -1,11 +1,21 @@ --- a/net/minecraft/network/PacketEncoder.java +++ b/net/minecraft/network/PacketEncoder.java -@@ -46,7 +_,7 @@ +@@ -25,6 +_,8 @@ - JvmProfiler.INSTANCE.onPacketSent(codecdata.protocol(), i, p_130545_.channel().remoteAddress(), k); - } catch (Throwable throwable) { -- LOGGER.error("Error receiving packet {}", i, throwable); -+ LOGGER.error("Error sending packet {}", i, throwable); // Neo: fix flipped log message - if (p_130546_.isSkippable()) { - throw new SkipPacketException(throwable); - } + try { + int i = p_130547_.writerIndex(); ++ // Neo: Wrap buffer with ChannelHandlerContext ++ p_130547_ = new net.neoforged.neoforge.network.connection.ChannelAwareFriendlyByteBuf(p_130547_, p_130545_); + this.protocolInfo.codec().encode(p_130547_, p_130546_); + int j = p_130547_.writerIndex() - i; + if (j > 8388608) { +@@ -42,5 +_,9 @@ + } finally { + ProtocolSwapHandler.handleOutboundTerminalPacket(p_130545_, p_130546_); + } ++ } ++ ++ public ProtocolInfo getProtocolInfo() { ++ return protocolInfo; + } + } diff --git a/patches/net/minecraft/network/chat/SignableCommand.java.patch b/patches/net/minecraft/network/chat/SignableCommand.java.patch index 50a699bb1c..84b38e3dab 100644 --- a/patches/net/minecraft/network/chat/SignableCommand.java.patch +++ b/patches/net/minecraft/network/chat/SignableCommand.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/network/chat/SignableCommand.java +++ b/net/minecraft/network/chat/SignableCommand.java -@@ -22,7 +_,8 @@ - (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null; - commandcontextbuilder1 = commandcontextbuilder2 - ) { -- boolean flag = commandcontextbuilder2.getRootNode() != commandcontextbuilder.getRootNode(); +@@ -24,7 +_,8 @@ + + CommandContextBuilder commandcontextbuilder2; + while ( +- (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null && commandcontextbuilder2.getRootNode() != commandcontextbuilder.getRootNode() + // NEO: Check if the command node is a RootCommandNode, instead of simply being the original root node; fixes #186 -+ boolean flag = !(commandcontextbuilder2.getRootNode() instanceof com.mojang.brigadier.tree.RootCommandNode); - if (!flag) { - break; - } ++ (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null && !(commandcontextbuilder2.getRootNode() instanceof com.mojang.brigadier.tree.RootCommandNode) + ) { + list.addAll(collectArguments(s, commandcontextbuilder2)); + commandcontextbuilder1 = commandcontextbuilder2; diff --git a/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch b/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch index 96c278f8a7..faf12f6e86 100644 --- a/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch +++ b/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -139,6 +_,11 @@ - } +@@ -140,6 +_,11 @@ + j = l; } + if (j == 0) { -+ // Forge has some special formatting handlers defined in ForgeI18n, use those if no %s replacements present. ++ // Neo has some special formatting handlers defined in I18nExtension, use those if no %s replacements present. + j = net.neoforged.neoforge.internal.TextComponentMessageFormatHandler.handle(this, p_237517_, this.args, p_237516_); + } + diff --git a/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch b/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch new file mode 100644 index 0000000000..c497b82a8e --- /dev/null +++ b/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/network/codec/ByteBufCodecs.java ++++ b/net/minecraft/network/codec/ByteBufCodecs.java +@@ -463,7 +_,11 @@ + ) { + return new StreamCodec() { + private IdMap getRegistryOrThrow(RegistryFriendlyByteBuf p_330361_) { +- return p_320353_.apply(p_330361_.registryAccess().registryOrThrow(p_319942_)); ++ var registry = p_330361_.registryAccess().registryOrThrow(p_319942_); ++ if (net.neoforged.neoforge.registries.RegistryManager.isNonSyncedBuiltInRegistry(registry)) { ++ throw new IllegalStateException("Cannot use ID syncing for non-synced built-in registry: " + registry.key()); ++ } ++ return p_320353_.apply(registry); + } + + public R decode(RegistryFriendlyByteBuf p_331253_) { diff --git a/patches/net/minecraft/network/protocol/BundlePacket.java.patch b/patches/net/minecraft/network/protocol/BundlePacket.java.patch index e14526cf49..a2af013714 100644 --- a/patches/net/minecraft/network/protocol/BundlePacket.java.patch +++ b/patches/net/minecraft/network/protocol/BundlePacket.java.patch @@ -1,20 +1,11 @@ --- a/net/minecraft/network/protocol/BundlePacket.java +++ b/net/minecraft/network/protocol/BundlePacket.java -@@ -4,13 +_,13 @@ - import net.minecraft.network.PacketListener; +@@ -6,7 +_,7 @@ + private final Iterable> packets; - public abstract class BundlePacket implements Packet { -- private final Iterable> packets; -+ private final Iterable> packets; - -- protected BundlePacket(Iterable> p_265290_) { + protected BundlePacket(Iterable> p_265290_) { - this.packets = p_265290_; -+ protected BundlePacket(Iterable> p_265290_) { + this.packets = net.neoforged.neoforge.network.bundle.BundlePacketUtils.flatten(p_265290_); } -- public final Iterable> subPackets() { -+ public final Iterable> subPackets() { - return this.packets; - } - + public final Iterable> subPackets() { diff --git a/patches/net/minecraft/network/protocol/BundlerInfo.java.patch b/patches/net/minecraft/network/protocol/BundlerInfo.java.patch index 99ac4915d5..0379ebbfe4 100644 --- a/patches/net/minecraft/network/protocol/BundlerInfo.java.patch +++ b/patches/net/minecraft/network/protocol/BundlerInfo.java.patch @@ -1,21 +1,12 @@ --- a/net/minecraft/network/protocol/BundlerInfo.java +++ b/net/minecraft/network/protocol/BundlerInfo.java -@@ -23,7 +_,7 @@ - }; - - static > BundlerInfo createForPacket( -- final Class

p_265438_, final Function>, P> p_265627_, final BundleDelimiterPacket p_265373_ -+ final Class

p_265438_, final Function>, P> p_265627_, final BundleDelimiterPacket p_265373_ - ) { - return new BundlerInfo() { - @Override -@@ -38,11 +_,31 @@ +@@ -26,6 +_,26 @@ } } + @Override + public void unbundlePacket(Packet bundlePacket, Consumer> packetSender, io.netty.channel.ChannelHandlerContext context) { -+ if (bundlePacket.getClass() == p_265438_) { ++ if (bundlePacket.type() == p_320816_) { + P p = (P)bundlePacket; + java.util.List> packets = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().filterGameBundlePackets(context, p.subPackets()); + if (packets.isEmpty()) { @@ -35,14 +26,8 @@ + @Nullable @Override - public BundlerInfo.Bundler startPacketBundling(Packet p_265097_) { - return p_265097_ == p_265373_ ? new BundlerInfo.Bundler() { -- private final List> bundlePackets = new ArrayList<>(); -+ private final List> bundlePackets = new ArrayList<>(); - - @Nullable - @Override -@@ -61,7 +_,24 @@ + public BundlerInfo.Bundler startPacketBundling(Packet p_265749_) { +@@ -49,7 +_,24 @@ }; } diff --git a/patches/net/minecraft/network/protocol/PacketFlow.java.patch b/patches/net/minecraft/network/protocol/PacketFlow.java.patch index 5daa652952..1a455bdb82 100644 --- a/patches/net/minecraft/network/protocol/PacketFlow.java.patch +++ b/patches/net/minecraft/network/protocol/PacketFlow.java.patch @@ -5,6 +5,6 @@ -public enum PacketFlow { +public enum PacketFlow implements net.neoforged.neoforge.common.extensions.IPacketFlowExtension { - SERVERBOUND, - CLIENTBOUND; + SERVERBOUND("serverbound"), + CLIENTBOUND("clientbound"); diff --git a/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch b/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch index f63e14ba20..f9a18764ed 100644 --- a/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/common/ClientCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ClientCommonPacketListener.java -@@ -2,7 +_,7 @@ - +@@ -3,7 +_,7 @@ import net.minecraft.network.ClientboundPacketListener; + import net.minecraft.network.protocol.cookie.ClientCookiePacketListener; --public interface ClientCommonPacketListener extends ClientboundPacketListener { -+public interface ClientCommonPacketListener extends ClientboundPacketListener, net.neoforged.neoforge.common.extensions.IClientCommonPacketListenerExtension { +-public interface ClientCommonPacketListener extends ClientCookiePacketListener, ClientboundPacketListener { ++public interface ClientCommonPacketListener extends ClientCookiePacketListener, ClientboundPacketListener, net.neoforged.neoforge.common.extensions.IClientCommonPacketListenerExtension { void handleKeepAlive(ClientboundKeepAlivePacket p_295236_); void handlePing(ClientboundPingPacket p_296451_); diff --git a/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch b/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch index c7be664e92..f17a187ea5 100644 --- a/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch +++ b/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch @@ -1,46 +1,21 @@ --- a/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java -@@ -53,10 +_,43 @@ - .put(WorldGenAttemptDebugPayload.ID, WorldGenAttemptDebugPayload::new) - .build(); +@@ -60,12 +_,16 @@ + ), + p_333492_ -> { + } +- ) ++ ), ++ net.minecraft.network.ConnectionProtocol.PLAY, ++ net.minecraft.network.protocol.PacketFlow.CLIENTBOUND + ) + .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); + public static final StreamCodec CONFIG_STREAM_CODEC = CustomPacketPayload.codec( + p_320228_ -> DiscardedPayload.codec(p_320228_, 1048576), +- List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)) ++ List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), ++ net.minecraft.network.ConnectionProtocol.CONFIGURATION, ++ net.minecraft.network.protocol.PacketFlow.CLIENTBOUND + ) + .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); -+ /** -+ * @deprecated Use {@link #ClientboundCustomPayloadPacket(FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated() - public ClientboundCustomPayloadPacket(FriendlyByteBuf p_295835_) { - this(readPayload(p_295835_.readResourceLocation(), p_295835_)); - } - -+ /** -+ * Reads a custom payload packet from the given buffer. -+ * -+ * @param buffer The buffer to read from -+ * @param context The context of the channel in which this packet is read -+ * @param protocol The protocol of the connection -+ */ -+ public ClientboundCustomPayloadPacket(FriendlyByteBuf buffer, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ this(readPayload(buffer.readResourceLocation(), buffer, context, protocol)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @param context The context of the channel in which this packet is read -+ * @param protocol The protocol of the connection -+ * @return The payload -+ */ -+ private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ FriendlyByteBuf.Reader reader = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getReader(p_294367_, context, protocol, KNOWN_TYPES); -+ return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); -+ } -+ -+ /** -+ * @deprecated Use {@link #readPayload(ResourceLocation, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - private static CustomPacketPayload readPayload(ResourceLocation p_294802_, FriendlyByteBuf p_294886_) { - FriendlyByteBuf.Reader reader = KNOWN_TYPES.get(p_294802_); - return (CustomPacketPayload)(reader != null ? reader.apply(p_294886_) : readUnknownPayload(p_294802_, p_294886_)); diff --git a/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch b/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch index 535b26b1c8..bb57676d72 100644 --- a/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/common/ServerCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ServerCommonPacketListener.java -@@ -2,7 +_,7 @@ - +@@ -3,7 +_,7 @@ + import net.minecraft.network.protocol.cookie.ServerCookiePacketListener; import net.minecraft.network.protocol.game.ServerPacketListener; --public interface ServerCommonPacketListener extends ServerPacketListener { -+public interface ServerCommonPacketListener extends ServerPacketListener, net.neoforged.neoforge.common.extensions.IServerCommonPacketListenerExtension { +-public interface ServerCommonPacketListener extends ServerCookiePacketListener, ServerPacketListener { ++public interface ServerCommonPacketListener extends ServerCookiePacketListener, ServerPacketListener, net.neoforged.neoforge.common.extensions.IServerCommonPacketListenerExtension { void handleKeepAlive(ServerboundKeepAlivePacket p_296457_); void handlePong(ServerboundPongPacket p_294309_); diff --git a/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch index 18ad269406..133c107221 100644 --- a/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch +++ b/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -1,52 +1,21 @@ --- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java -@@ -17,10 +_,49 @@ - .put(BrandPayload.ID, BrandPayload::new) - .build(); +@@ -17,7 +_,17 @@ + public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec( + p_319841_ -> DiscardedPayload.codec(p_319841_, 32767), + Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_333493_ -> { +- }) ++ }), ++ net.minecraft.network.ConnectionProtocol.PLAY, ++ net.minecraft.network.protocol.PacketFlow.SERVERBOUND ++ ) ++ .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); ++ public static final StreamCodec CONFIG_STREAM_CODEC = CustomPacketPayload.codec( ++ p_319841_ -> DiscardedPayload.codec(p_319841_, 32767), ++ Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_333493_ -> { ++ }), ++ net.minecraft.network.ConnectionProtocol.CONFIGURATION, ++ net.minecraft.network.protocol.PacketFlow.SERVERBOUND + ) + .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); -+ /** -+ * Creates a new packet with a custom payload from the network. -+ * @param p_296108_ The buffer to read the packet from. -+ * @deprecated Use {@link #ServerboundCustomPayloadPacket(FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - public ServerboundCustomPayloadPacket(FriendlyByteBuf p_296108_) { - this(readPayload(p_296108_.readResourceLocation(), p_296108_)); - } - -+ /** -+ * Creates a new packet with a custom payload from the network. -+ * -+ * @param p_296108_ The buffer to read the packet from. -+ * @param context The context of the channel handler -+ * @param protocol The protocol of the connection -+ */ -+ public ServerboundCustomPayloadPacket(FriendlyByteBuf p_296108_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ this(readPayload(p_296108_.readResourceLocation(), p_296108_, context, protocol)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @param context The context of the channel handler -+ * @param protocol The protocol of the connection -+ * @return The payload -+ */ -+ private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ FriendlyByteBuf.Reader reader = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getReader(p_294367_, context, protocol, KNOWN_TYPES); -+ return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @return The payload -+ * @deprecated Use {@link #readPayload(ResourceLocation, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_) { - FriendlyByteBuf.Reader reader = KNOWN_TYPES.get(p_294367_); - return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); diff --git a/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch b/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch new file mode 100644 index 0000000000..390baaa8c8 --- /dev/null +++ b/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java ++++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java +@@ -22,10 +_,11 @@ + } + + static StreamCodec codec( +- final CustomPacketPayload.FallbackProvider p_319839_, List> p_320495_ ++ final CustomPacketPayload.FallbackProvider p_319839_, List> p_320495_, net.minecraft.network.ConnectionProtocol protocol, net.minecraft.network.protocol.PacketFlow packetFlow + ) { + final Map> map = p_320495_.stream() + .collect(Collectors.toUnmodifiableMap(p_320895_ -> p_320895_.type().id(), CustomPacketPayload.TypeAndCodec::codec)); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().storeVanillaCustomPayloads(protocol, packetFlow, map.keySet()); + return new StreamCodec() { + private StreamCodec findCodec(ResourceLocation p_320938_) { + StreamCodec streamcodec = map.get(p_320938_); +@@ -34,7 +_,7 @@ + + private void writeCap(B p_320565_, CustomPacketPayload.Type p_320917_, CustomPacketPayload p_320112_) { + p_320565_.writeResourceLocation(p_320917_.id()); +- StreamCodec streamcodec = (StreamCodec)this.findCodec(p_320917_.id); ++ StreamCodec streamcodec = (StreamCodec)net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getCodec(p_320917_.id(), p_320565_, protocol, map, true); + streamcodec.encode(p_320565_, (T)p_320112_); + } + +@@ -44,7 +_,8 @@ + + public CustomPacketPayload decode(B p_320227_) { + ResourceLocation resourcelocation = p_320227_.readResourceLocation(); +- return (CustomPacketPayload)this.findCodec(resourcelocation).decode(p_320227_); ++ var codec = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getCodec(resourcelocation, p_320227_, protocol, map, false); ++ return codec != null ? codec.decode(p_320227_) : p_319839_.create(resourcelocation).decode(p_320227_); + } + }; + } diff --git a/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch b/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch new file mode 100644 index 0000000000..f17f4a678a --- /dev/null +++ b/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java ++++ b/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java +@@ -27,7 +_,7 @@ + ConnectionProtocol.CONFIGURATION, + p_325554_ -> p_325554_.addPacket(CommonPacketTypes.SERVERBOUND_CLIENT_INFORMATION, ServerboundClientInformationPacket.STREAM_CODEC) + .addPacket(CookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE, ServerboundCookieResponsePacket.STREAM_CODEC) +- .addPacket(CommonPacketTypes.SERVERBOUND_CUSTOM_PAYLOAD, ServerboundCustomPayloadPacket.STREAM_CODEC) ++ .addPacket(CommonPacketTypes.SERVERBOUND_CUSTOM_PAYLOAD, ServerboundCustomPayloadPacket.CONFIG_STREAM_CODEC) // Neo: use protocol-aware stream codec instead + .addPacket(ConfigurationPacketTypes.SERVERBOUND_FINISH_CONFIGURATION, ServerboundFinishConfigurationPacket.STREAM_CODEC) + .addPacket(CommonPacketTypes.SERVERBOUND_KEEP_ALIVE, ServerboundKeepAlivePacket.STREAM_CODEC) + .addPacket(CommonPacketTypes.SERVERBOUND_PONG, ServerboundPongPacket.STREAM_CODEC) diff --git a/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch b/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch deleted file mode 100644 index 076aea75d6..0000000000 --- a/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/protocol/game/ClientboundBundlePacket.java -+++ b/net/minecraft/network/protocol/game/ClientboundBundlePacket.java -@@ -4,7 +_,7 @@ - import net.minecraft.network.protocol.Packet; - - public class ClientboundBundlePacket extends BundlePacket { -- public ClientboundBundlePacket(Iterable> p_265231_) { -+ public ClientboundBundlePacket(Iterable> p_265231_) { - super(p_265231_); - } - diff --git a/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch b/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch index 294239c1f5..f24f3d2b43 100644 --- a/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/game/ServerGamePacketListener.java +++ b/net/minecraft/network/protocol/game/ServerGamePacketListener.java -@@ -3,7 +_,7 @@ - import net.minecraft.network.ConnectionProtocol; +@@ -4,7 +_,7 @@ import net.minecraft.network.protocol.common.ServerCommonPacketListener; + import net.minecraft.network.protocol.ping.ServerPingPacketListener; --public interface ServerGamePacketListener extends ServerPingPacketListener, ServerCommonPacketListener { -+public interface ServerGamePacketListener extends ServerPingPacketListener, ServerCommonPacketListener, net.neoforged.neoforge.common.extensions.IServerGamePacketListenerExtension { +-public interface ServerGamePacketListener extends ServerCommonPacketListener, ServerPingPacketListener { ++public interface ServerGamePacketListener extends ServerCommonPacketListener, ServerPingPacketListener, net.neoforged.neoforge.common.extensions.IServerGamePacketListenerExtension { @Override default ConnectionProtocol protocol() { return ConnectionProtocol.PLAY; diff --git a/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch b/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch index ec00a70e1c..db8640a673 100644 --- a/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch +++ b/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch @@ -1,21 +1,24 @@ --- a/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java +++ b/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java -@@ -3,13 +_,19 @@ - import net.minecraft.network.FriendlyByteBuf; +@@ -5,16 +_,22 @@ import net.minecraft.network.protocol.Packet; + import net.minecraft.network.protocol.PacketType; -public record ClientboundStatusResponsePacket(ServerStatus status) implements Packet { +public record ClientboundStatusResponsePacket(ServerStatus status, @org.jetbrains.annotations.Nullable String cachedStatus) implements Packet { + public static final StreamCodec STREAM_CODEC = Packet.codec( + ClientboundStatusResponsePacket::write, ClientboundStatusResponsePacket::new + ); + + public ClientboundStatusResponsePacket(ServerStatus status) { + this(status, null); + } + - public ClientboundStatusResponsePacket(FriendlyByteBuf p_179834_) { + private ClientboundStatusResponsePacket(FriendlyByteBuf p_179834_) { this(p_179834_.readJsonWithCodec(ServerStatus.CODEC)); } - @Override - public void write(FriendlyByteBuf p_134899_) { + private void write(FriendlyByteBuf p_134899_) { + if (cachedStatus != null) p_134899_.writeUtf(cachedStatus); + else p_134899_.writeJsonWithCodec(ServerStatus.CODEC, this.status); diff --git a/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch b/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch index e689a1900e..8d6b09b9b5 100644 --- a/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch +++ b/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch @@ -9,14 +9,14 @@ + boolean isModded ) { public static final Codec CODEC = RecordCodecBuilder.create( - p_304170_ -> p_304170_.group( + p_337519_ -> p_337519_.group( @@ -29,7 +_,8 @@ - ServerStatus.Players.CODEC.optionalFieldOf("players").forGetter(ServerStatus::players), - ServerStatus.Version.CODEC.optionalFieldOf("version").forGetter(ServerStatus::version), - ServerStatus.Favicon.CODEC.optionalFieldOf("favicon").forGetter(ServerStatus::favicon), -- Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat) + ServerStatus.Players.CODEC.lenientOptionalFieldOf("players").forGetter(ServerStatus::players), + ServerStatus.Version.CODEC.lenientOptionalFieldOf("version").forGetter(ServerStatus::version), + ServerStatus.Favicon.CODEC.lenientOptionalFieldOf("favicon").forGetter(ServerStatus::favicon), +- Codec.BOOL.lenientOptionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat) + Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat), + Codec.BOOL.optionalFieldOf("isModded", Boolean.FALSE).forGetter(ServerStatus::isModded) ) - .apply(p_304170_, ServerStatus::new) + .apply(p_337519_, ServerStatus::new) ); diff --git a/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch b/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch index 7812a36787..7a567aeba4 100644 --- a/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch +++ b/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -156,17 +_,29 @@ - FriendlyByteBuf::writeQuaternion, FriendlyByteBuf::readQuaternion - ); +@@ -133,17 +_,29 @@ + public static final EntityDataSerializer VECTOR3 = EntityDataSerializer.forValueType(ByteBufCodecs.VECTOR3F); + public static final EntityDataSerializer QUATERNION = EntityDataSerializer.forValueType(ByteBufCodecs.QUATERNIONF); + private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); + private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); @@ -13,8 +13,8 @@ public static void registerSerializer(EntityDataSerializer p_135051_) { - SERIALIZERS.add(p_135051_); + if (!STACK_WALKER.getCallerClass().equals(EntityDataSerializers.class)) { -+ // TODO 1.20.5: throw an exception in dev instead -+ LOGGER.error("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!", new Throwable()); ++ LOGGER.error("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!"); ++ throw new UnsupportedOperationException("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!"); + } + + if (SERIALIZERS.add(p_135051_) >= net.neoforged.neoforge.common.CommonHooks.VANILLA_SERIALIZER_LIMIT) diff --git a/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch b/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch index 9219d9abfa..2e15f885e1 100644 --- a/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch +++ b/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/network/syncher/SynchedEntityData.java +++ b/net/minecraft/network/syncher/SynchedEntityData.java -@@ -36,11 +_,13 @@ +@@ -27,11 +_,13 @@ } - public static EntityDataAccessor defineId(Class p_135354_, EntityDataSerializer p_135355_) { + public static EntityDataAccessor defineId(Class p_135354_, EntityDataSerializer p_135355_) { - if (LOGGER.isDebugEnabled()) { + if (true || LOGGER.isDebugEnabled()) { // Forge: This is very useful for mods that register keys on classes that are not their own try { diff --git a/patches/net/minecraft/recipebook/PlaceRecipe.java.patch b/patches/net/minecraft/recipebook/PlaceRecipe.java.patch index 14ebb938d1..1abbdfb98a 100644 --- a/patches/net/minecraft/recipebook/PlaceRecipe.java.patch +++ b/patches/net/minecraft/recipebook/PlaceRecipe.java.patch @@ -1,15 +1,11 @@ --- a/net/minecraft/recipebook/PlaceRecipe.java +++ b/net/minecraft/recipebook/PlaceRecipe.java -@@ -11,9 +_,9 @@ +@@ -9,7 +_,7 @@ + default void placeRecipe(int p_135409_, int p_135410_, int p_135411_, RecipeHolder p_301225_, Iterator p_135413_, int p_135414_) { int i = p_135409_; int j = p_135410_; - Recipe recipe = p_301225_.value(); -- if (recipe instanceof ShapedRecipe shapedrecipe) { -- i = shapedrecipe.getWidth(); -- j = shapedrecipe.getHeight(); -+ if (recipe instanceof net.neoforged.neoforge.common.crafting.IShapedRecipe shapedrecipe) { -+ i = shapedrecipe.getRecipeWidth(); -+ j = shapedrecipe.getRecipeHeight(); +- if (p_301225_.value() instanceof ShapedRecipe shapedrecipe) { ++ if (p_301225_.value() instanceof net.neoforged.neoforge.common.crafting.IShapedRecipe shapedrecipe) { + i = shapedrecipe.getWidth(); + j = shapedrecipe.getHeight(); } - - int k1 = 0; diff --git a/patches/net/minecraft/resources/HolderSetCodec.java.patch b/patches/net/minecraft/resources/HolderSetCodec.java.patch index 257cc7d72c..4cdd27b37f 100644 --- a/patches/net/minecraft/resources/HolderSetCodec.java.patch +++ b/patches/net/minecraft/resources/HolderSetCodec.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/HolderSetCodec.java +++ b/net/minecraft/resources/HolderSetCodec.java -@@ -22,6 +_,8 @@ +@@ -21,6 +_,8 @@ private final Codec> elementCodec; private final Codec>> homogenousListCodec; private final Codec, List>>> registryAwareCodec; @@ -8,32 +8,39 @@ + private final Codec, Either, List>>>> combinedCodec; private static Codec>> homogenousList(Codec> p_206668_, boolean p_206669_) { - Codec>> codec = ExtraCodecs.validate(p_206668_.listOf(), ExtraCodecs.ensureHomogenous(Holder::kind)); -@@ -43,6 +_,10 @@ + Codec>> codec = p_206668_.listOf().validate(ExtraCodecs.ensureHomogenous(Holder::kind)); +@@ -42,6 +_,10 @@ this.elementCodec = p_206661_; this.homogenousListCodec = homogenousList(p_206661_, p_206662_); this.registryAwareCodec = Codec.either(TagKey.hashedCodec(p_206660_), this.homogenousListCodec); + // FORGE: make registry-specific dispatch codec and make forge-or-vanilla either codec + this.forgeDispatchCodec = net.neoforged.neoforge.registries.NeoForgeRegistries.HOLDER_SET_TYPES.byNameCodec() + .dispatch(net.neoforged.neoforge.registries.holdersets.ICustomHolderSet::type, type -> type.makeCodec(p_206660_, p_206661_, p_206662_)); -+ this.combinedCodec = new ExtraCodecs.EitherCodec<>(this.forgeDispatchCodec, this.registryAwareCodec); ++ this.combinedCodec = Codec.either(this.forgeDispatchCodec, this.registryAwareCodec); } @Override -@@ -51,9 +_,9 @@ +@@ -50,14 +_,17 @@ Optional> optional = registryops.getter(this.registryKey); if (optional.isPresent()) { HolderGetter holdergetter = optional.get(); - return this.registryAwareCodec - .decode(p_206696_, p_206697_) -- .map(p_206682_ -> p_206682_.mapFirst(p_206679_ -> p_206679_.map(holdergetter::getOrThrow, HolderSet::direct))); -+ // FORGE: use the wrapped codec to decode custom/tag/list instead of just tag/list ++ // NEO: use the wrapped codec to decode custom/tag/list instead of just tag/list + return this.combinedCodec.decode(p_206696_, p_206697_) -+ .map(p_206682_ -> p_206682_.mapFirst(p_206679_ -> p_206679_.map(java.util.function.Function.identity(), tagOrList -> tagOrList.map(holdergetter::getOrThrow, HolderSet::direct)))); - } - } - -@@ -68,6 +_,9 @@ + .flatMap( + p_337522_ -> { + DataResult> dataresult = p_337522_.getFirst() + .map( ++ DataResult::success, ++ tagOrList -> tagOrList.map( + p_332559_ -> lookupTag(holdergetter, (TagKey)p_332559_), + p_332564_ -> DataResult.success(HolderSet.direct((List>)p_332564_)) ++ ) + ); + return dataresult.map(p_332563_ -> Pair.of((HolderSet)p_332563_, (T)p_337522_.getSecond())); + } +@@ -82,6 +_,9 @@ return DataResult.error(() -> "HolderSet " + p_206674_ + " is not valid in current registry set"); } diff --git a/patches/net/minecraft/resources/RegistryDataLoader.java.patch b/patches/net/minecraft/resources/RegistryDataLoader.java.patch index 280c7e26f2..ffb556750a 100644 --- a/patches/net/minecraft/resources/RegistryDataLoader.java.patch +++ b/patches/net/minecraft/resources/RegistryDataLoader.java.patch @@ -1,6 +1,24 @@ --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java -@@ -143,7 +_,7 @@ +@@ -92,7 +_,7 @@ + public static final List> DIMENSION_REGISTRIES = List.of( + new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC) + ); +- public static final List> SYNCHRONIZED_REGISTRIES = List.of( ++ public static final List> SYNCHRONIZED_REGISTRIES = net.neoforged.neoforge.registries.DataPackRegistriesHooks.grabNetworkableRegistries(List.of( + new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.NETWORK_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC), +@@ -101,7 +_,7 @@ + new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC) +- ); ++ )); // Neo: Keep the list so custom registries can be added later + + public static RegistryAccess.Frozen load(ResourceManager p_252046_, RegistryAccess p_249916_, List> p_250344_) { + return load((p_321412_, p_321413_) -> p_321412_.loadFromResources(p_252046_, p_321413_), p_249916_, p_250344_); +@@ -182,7 +_,7 @@ } private static String registryDirPath(ResourceLocation p_252033_) { @@ -8,30 +26,32 @@ + return net.neoforged.neoforge.common.CommonHooks.prefixNamespace(p_252033_); // FORGE: add non-vanilla registry namespace to loader directory, same format as tag directory (see net.minecraft.tags.TagManager#getTagDir(ResourceKey)) } - static void loadRegistryContents( -@@ -156,7 +_,8 @@ + private static void loadElementFromResource( +@@ -193,11 +_,16 @@ + Resource p_326141_, + RegistrationInfo p_326033_ + ) throws IOException { ++ Decoder> decoder = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.decodeOnly(p_326476_)); + try (Reader reader = p_326141_.openAsReader()) { + JsonElement jsonelement = JsonParser.parseReader(reader); +- DataResult dataresult = p_326476_.parse(p_325932_, jsonelement); +- E e = dataresult.getOrThrow(); ++ DataResult> dataresult = decoder.parse(p_325932_, jsonelement); ++ Optional candidate = dataresult.getOrThrow(); ++ candidate.ifPresentOrElse(e -> { + p_326195_.register(p_326054_, e, p_326033_); ++ }, () -> { ++ LOGGER.debug("Skipping loading registry entry {} as its conditions were not met", p_326054_); ++ }); + } + } + +@@ -210,7 +_,7 @@ ) { - String s = registryDirPath(p_255792_.location()); + String s = registryDirPath(p_321557_.key().location()); FileToIdConverter filetoidconverter = FileToIdConverter.json(s); -- RegistryOps registryops = RegistryOps.create(JsonOps.INSTANCE, p_256369_); -+ RegistryOps registryops = net.neoforged.neoforge.common.conditions.ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, p_256369_), net.neoforged.neoforge.common.conditions.ICondition.IContext.TAGS_INVALID); -+ Decoder> decoder = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.decodeOnly(p_256232_)); +- RegistryOps registryops = RegistryOps.create(JsonOps.INSTANCE, p_321612_); ++ RegistryOps registryops = new net.neoforged.neoforge.common.conditions.ConditionalOps<>(RegistryOps.create(JsonOps.INSTANCE, p_321612_), net.neoforged.neoforge.common.conditions.ICondition.IContext.TAGS_INVALID); - for(Entry entry : filetoidconverter.listMatchingResources(p_256349_).entrySet()) { + for (Entry entry : filetoidconverter.listMatchingResources(p_321535_).entrySet()) { ResourceLocation resourcelocation = entry.getKey(); -@@ -165,10 +_,12 @@ - - try (Reader reader = resource.openAsReader()) { - JsonElement jsonelement = JsonParser.parseReader(reader); -- DataResult dataresult = p_256232_.parse(registryops, jsonelement); -- E e = dataresult.getOrThrow(false, p_248715_ -> { -+ DataResult> dataresult = decoder.parse(registryops, jsonelement); -+ Optional candidate = dataresult.getOrThrow(true, p_248715_ -> { - }); -- p_256211_.register(resourcekey, e, resource.isBuiltin() ? Lifecycle.stable() : dataresult.lifecycle()); -+ candidate.ifPresentOrElse(e -> { -+ p_256211_.register(resourcekey, e, resource.isBuiltin() ? Lifecycle.stable() : dataresult.lifecycle()); -+ }, () -> LOGGER.debug("Skipping loading registry entry {} as it's conditions were not met", resourcelocation)); - } catch (Exception exception) { - p_255884_.put( - resourcekey, diff --git a/patches/net/minecraft/resources/RegistryOps.java.patch b/patches/net/minecraft/resources/RegistryOps.java.patch index c62b8d5abd..25532e9e84 100644 --- a/patches/net/minecraft/resources/RegistryOps.java.patch +++ b/patches/net/minecraft/resources/RegistryOps.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/resources/RegistryOps.java +++ b/net/minecraft/resources/RegistryOps.java -@@ -46,6 +_,11 @@ +@@ -51,6 +_,11 @@ this.lookupProvider = p_255799_; } -+ protected RegistryOps(RegistryOps p_256313_) { -+ super(p_256313_); -+ this.lookupProvider = p_256313_.lookupProvider; ++ protected RegistryOps(RegistryOps other) { ++ super(other); ++ this.lookupProvider = other.lookupProvider; + } + - public Optional> owner(ResourceKey> p_255757_) { - return this.lookupProvider.lookup(p_255757_).map(RegistryOps.RegistryInfo::owner); + public RegistryOps withParent(DynamicOps p_330654_) { + return (RegistryOps)(p_330654_ == this.delegate ? this : new RegistryOps<>(p_330654_, this.lookupProvider)); } -@@ -64,6 +_,20 @@ +@@ -73,6 +_,20 @@ : DataResult.error(() -> "Not a registry ops") ) .forGetter(p_255526_ -> null); diff --git a/patches/net/minecraft/resources/ResourceKey.java.patch b/patches/net/minecraft/resources/ResourceKey.java.patch index 3cffe45f10..f4deb2c344 100644 --- a/patches/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/net/minecraft/resources/ResourceKey.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/resources/ResourceKey.java +++ b/net/minecraft/resources/ResourceKey.java -@@ -7,7 +_,7 @@ - import net.minecraft.core.Registry; +@@ -9,7 +_,7 @@ import net.minecraft.core.registries.Registries; + import net.minecraft.network.codec.StreamCodec; -public class ResourceKey { +public class ResourceKey implements Comparable> { private static final ConcurrentMap> VALUES = new MapMaker().weakValues().makeMap(); private final ResourceLocation registryName; private final ResourceLocation location; -@@ -54,6 +_,13 @@ +@@ -64,6 +_,13 @@ - public ResourceLocation registry() { - return this.registryName; + public ResourceKey> registryKey() { + return createRegistryKey(this.registryName); + } + + @Override diff --git a/patches/net/minecraft/resources/ResourceLocation.java.patch b/patches/net/minecraft/resources/ResourceLocation.java.patch index 1ddc7854b4..aee9d7e8be 100644 --- a/patches/net/minecraft/resources/ResourceLocation.java.patch +++ b/patches/net/minecraft/resources/ResourceLocation.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourceLocation.java +++ b/net/minecraft/resources/ResourceLocation.java -@@ -146,6 +_,12 @@ +@@ -149,6 +_,12 @@ return i; } diff --git a/patches/net/minecraft/server/Bootstrap.java.patch b/patches/net/minecraft/server/Bootstrap.java.patch index 6054c58ba2..e775eb5eea 100644 --- a/patches/net/minecraft/server/Bootstrap.java.patch +++ b/patches/net/minecraft/server/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -55,6 +_,8 @@ +@@ -53,6 +_,8 @@ CauldronInteraction.bootStrap(); BuiltInRegistries.bootStrap(); CreativeModeTabs.validate(); @@ -9,7 +9,7 @@ wrapStreams(); bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); } -@@ -121,7 +_,6 @@ +@@ -119,7 +_,6 @@ Commands.validate(); } diff --git a/patches/net/minecraft/server/Main.java.patch b/patches/net/minecraft/server/Main.java.patch index ec05761518..29faddd628 100644 --- a/patches/net/minecraft/server/Main.java.patch +++ b/patches/net/minecraft/server/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -63,7 +_,7 @@ +@@ -64,7 +_,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); @DontObfuscate @@ -9,10 +9,10 @@ SharedConstants.tryDetectVersion(); OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); -@@ -81,6 +_,15 @@ - OptionSpec optionspec12 = optionparser.accepts("jfrProfile"); - OptionSpec optionspec13 = optionparser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); - OptionSpec optionspec14 = optionparser.nonOptions(); +@@ -83,6 +_,15 @@ + OptionSpec optionspec13 = optionparser.accepts("jfrProfile"); + OptionSpec optionspec14 = optionparser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); + OptionSpec optionspec15 = optionparser.nonOptions(); + optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed + optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + final OptionSpec spawnPosOpt; @@ -25,7 +25,7 @@ try { OptionSet optionset = optionparser.parse(p_129699_); -@@ -88,6 +_,13 @@ +@@ -90,6 +_,13 @@ optionparser.printHelpOn(System.err); return; } @@ -37,15 +37,16 @@ + return; + } - Path path = optionset.valueOf(optionspec13); + Path path = optionset.valueOf(optionspec14); if (path != null) { -@@ -103,23 +_,21 @@ +@@ -105,24 +_,22 @@ Bootstrap.validate(); Util.startTimerHackThread(); Path path1 = Paths.get("server.properties"); + if (!optionset.has(optionspec1)) net.neoforged.neoforge.server.loading.ServerModLoader.load(); // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path1); dedicatedserversettings.forceSave(); + RegionFileVersion.configure(dedicatedserversettings.getProperties().regionFileComression); - Path path2 = Paths.get("eula.txt"); - Eula eula = new Eula(path2); if (optionset.has(optionspec1)) { @@ -58,9 +59,9 @@ - return; - } - - File file1 = new File(optionset.valueOf(optionspec8)); + File file1 = new File(optionset.valueOf(optionspec9)); Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file1); - String s = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(dedicatedserversettings.getProperties().levelName); + String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName); + if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { + LOGGER.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); + return; @@ -68,7 +69,7 @@ LevelStorageSource levelstoragesource = LevelStorageSource.createDefault(file1.toPath()); LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.validateAndCreateAccess(s); Dynamic dynamic; -@@ -128,6 +_,7 @@ +@@ -131,6 +_,7 @@ try { dynamic = levelstoragesource$levelstorageaccess.getDataTag(); levelsummary = levelstoragesource$levelstorageaccess.getSummary(dynamic); @@ -76,7 +77,7 @@ } catch (NbtException | ReportedNbtException | IOException ioexception1) { LevelStorageSource.LevelDirectory levelstoragesource$leveldirectory = levelstoragesource$levelstorageaccess.getLevelDirectory(); LOGGER.warn("Failed to load world data from {}", levelstoragesource$leveldirectory.dataFile(), ioexception1); -@@ -136,6 +_,7 @@ +@@ -139,6 +_,7 @@ try { dynamic = levelstoragesource$levelstorageaccess.getDataTagFallback(); levelsummary = levelstoragesource$levelstorageaccess.getSummary(dynamic); @@ -84,7 +85,7 @@ } catch (NbtException | ReportedNbtException | IOException ioexception) { LOGGER.error("Failed to load world data from {}", levelstoragesource$leveldirectory.oldDataFile(), ioexception); LOGGER.error( -@@ -210,7 +_,10 @@ +@@ -213,7 +_,10 @@ : dedicatedserverproperties.worldOptions; worlddimensions = dedicatedserverproperties.createDimensions(p_307161_.datapackWorldgen()); } @@ -96,7 +97,7 @@ WorldDimensions.Complete worlddimensions$complete = worlddimensions.bake(registry); Lifecycle lifecycle = worlddimensions$complete.lifecycle().add(p_307161_.datapackWorldgen().allRegistriesLifecycle()); return new WorldLoader.DataLoadOutput<>( -@@ -246,24 +_,23 @@ +@@ -246,24 +_,22 @@ WorldData worlddata = worldstem.worldData(); levelstoragesource$levelstorageaccess.saveDataTag(registryaccess$frozen, worlddata); @@ -111,22 +112,21 @@ - dedicatedserversettings, - DataFixers.getDataFixer(), - services, -- LoggerChunkProgressListener::new +- LoggerChunkProgressListener::createFromGameruleRadius - ); + MinecraftServer dedicatedserver1; + if (gametestEnabled) { + net.neoforged.neoforge.gametest.GameTestHooks.registerGametests(); -+ java.util.Collection testBatches = net.minecraft.gametest.framework.GameTestRunner.groupTestsIntoBatches(net.minecraft.gametest.framework.GameTestRegistry.getAllTestFunctions()); + net.minecraft.core.BlockPos spawnPos = optionset.valueOf(spawnPosOpt); -+ dedicatedserver1 = net.minecraft.gametest.framework.GameTestServer.create(p_293760_, levelstoragesource$levelstorageaccess, packrepository, testBatches, spawnPos); ++ dedicatedserver1 = net.minecraft.gametest.framework.GameTestServer.create(p_293760_, levelstoragesource$levelstorageaccess, packrepository, net.minecraft.gametest.framework.GameTestRegistry.getAllTestFunctions(), spawnPos); + } else { -+ dedicatedserver1 = new DedicatedServer(p_293760_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new); ++ dedicatedserver1 = new DedicatedServer(p_293760_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius); + } - dedicatedserver1.setPort(optionset.valueOf(optionspec10)); + dedicatedserver1.setPort(optionset.valueOf(optionspec11)); dedicatedserver1.setDemo(optionset.has(optionspec2)); - dedicatedserver1.setId(optionset.valueOf(optionspec11)); - boolean flag1 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec14).contains("nogui"); -- if (flag1 && !GraphicsEnvironment.isHeadless()) { + dedicatedserver1.setId(optionset.valueOf(optionspec12)); + boolean flag2 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec15).contains("nogui"); +- if (flag2 && !GraphicsEnvironment.isHeadless()) { - dedicatedserver1.showGui(); + if (dedicatedserver1 instanceof DedicatedServer dedicatedServer && flag1 && !GraphicsEnvironment.isHeadless()) { + dedicatedServer.showGui(); diff --git a/patches/net/minecraft/server/MinecraftServer.java.patch b/patches/net/minecraft/server/MinecraftServer.java.patch index c10f110d95..7254fdbc56 100644 --- a/patches/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -252,7 +_,7 @@ +@@ -257,7 +_,7 @@ public static S spin(Function p_129873_) { AtomicReference atomicreference = new AtomicReference<>(); @@ -9,7 +9,7 @@ thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> LOGGER.error("Uncaught exception in server thread", p_177910_)); if (Runtime.getRuntime().availableProcessors() > 4) { thread.setPriority(8); -@@ -358,6 +_,7 @@ +@@ -365,6 +_,7 @@ this.readScoreboard(dimensiondatastorage); this.commandStorage = new CommandStorage(dimensiondatastorage); WorldBorder worldborder = serverlevel.getWorldBorder(); @@ -17,7 +17,7 @@ if (!serverleveldata.isInitialized()) { try { setInitialSpawn(serverlevel, serverleveldata, worldoptions.generateBonusChest(), flag); -@@ -407,6 +_,7 @@ +@@ -414,6 +_,7 @@ ); worldborder.addListener(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.getWorldBorder())); this.levels.put(resourcekey1, serverlevel1); @@ -25,7 +25,7 @@ } } -@@ -418,6 +_,7 @@ +@@ -425,6 +_,7 @@ p_177898_.setSpawn(BlockPos.ZERO.above(80), 0.0F); } else { ServerChunkCache serverchunkcache = p_177897_.getChunkSource(); @@ -34,7 +34,7 @@ int i = serverchunkcache.getGenerator().getSpawnHeight(p_177897_); if (i < p_177897_.getMinBuildHeight()) { @@ -506,6 +_,7 @@ - ChunkPos chunkpos = new ChunkPos(i); + ChunkPos chunkpos = new ChunkPos(k); serverlevel1.getChunkSource().updateChunkForced(chunkpos, true); } + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.reinstatePersistentChunks(serverlevel1, forcedchunkssaveddata); @@ -42,7 +42,7 @@ } @@ -613,6 +_,7 @@ - for(ServerLevel serverlevel2 : this.getAllLevels()) { + for (ServerLevel serverlevel2 : this.getAllLevels()) { if (serverlevel2 != null) { try { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(serverlevel2)); @@ -59,9 +59,9 @@ this.status = this.buildServerStatus(); + resetStatusCache(status); - while(this.running) { + while (this.running) { long i; -@@ -704,6 +_,8 @@ +@@ -707,6 +_,8 @@ this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } @@ -70,7 +70,7 @@ } catch (Throwable throwable1) { LOGGER.error("Encountered an unexpected exception", throwable1); CrashReport crashreport = constructOrExtractCrashReport(throwable1); -@@ -715,6 +_,7 @@ +@@ -718,6 +_,7 @@ LOGGER.error("We were unable to save this crash report to disk."); } @@ -78,7 +78,7 @@ this.onServerCrash(crashreport); } finally { try { -@@ -727,6 +_,7 @@ +@@ -730,6 +_,7 @@ this.services.profileCache().clearExecutor(); } @@ -86,12 +86,12 @@ this.onServerExit(); } } -@@ -838,12 +_,14 @@ +@@ -875,12 +_,14 @@ public void tickServer(BooleanSupplier p_129871_) { long i = Util.getNanos(); + net.neoforged.neoforge.event.EventHooks.onPreServerTick(p_129871_, this); - ++this.tickCount; + this.tickCount++; this.tickRateManager.tick(); this.tickChildren(p_129871_); if (i - this.lastServerStatus >= STATUS_EXPIRE_TIME_NANOS) { @@ -100,26 +100,33 @@ + resetStatusCache(status); } - --this.ticksUntilAutosave; -@@ -866,6 +_,17 @@ - long l = Util.getNanos(); - this.logTickTime(l - i); + this.ticksUntilAutosave--; +@@ -902,6 +_,7 @@ + this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)j / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; + this.logTickMethodTime(i); this.profiler.pop(); + net.neoforged.neoforge.event.EventHooks.onPostServerTick(p_129871_, this); -+ } -+ + } + + private void logTickMethodTime(long p_321837_) { +@@ -910,6 +_,16 @@ + } + } + + private static final com.google.gson.Gson GSON = new com.google.gson.Gson(); -+ private String cachedServerStatus; // FORGE: cache the server status json in case a client spams requests ++ private String cachedServerStatus; // NEO: cache the server status json in case a client spams requests + private void resetStatusCache(ServerStatus status) { + this.cachedServerStatus = GSON.toJson(ServerStatus.CODEC.encodeStart(com.mojang.serialization.JsonOps.INSTANCE, status) -+ .result().orElseThrow()); ++ .result().orElseThrow()); + } + public String getStatusJson() { + return cachedServerStatus; - } - ++ } ++ private int computeNextAutosaveInterval() { -@@ -898,7 +_,8 @@ + float f; + if (this.tickRateManager.isSprinting()) { +@@ -941,7 +_,8 @@ Optional.of(serverstatus$players), Optional.of(ServerStatus.Version.current()), Optional.ofNullable(this.statusIcon), @@ -129,17 +136,17 @@ ); } -@@ -928,7 +_,8 @@ +@@ -971,7 +_,8 @@ this.getFunctions().tick(); this.profiler.popPush("levels"); -- for(ServerLevel serverlevel : this.getAllLevels()) { +- for (ServerLevel serverlevel : this.getAllLevels()) { + for(ServerLevel serverlevel : this.getWorldArray()) { + long tickStart = Util.getNanos(); this.profiler.push(() -> serverlevel + " " + serverlevel.dimension().location()); if (this.tickCount % 20 == 0) { this.profiler.push("timeSync"); -@@ -937,6 +_,7 @@ +@@ -980,6 +_,7 @@ } this.profiler.push("tick"); @@ -147,7 +154,7 @@ try { serverlevel.tick(p_129954_); -@@ -945,16 +_,18 @@ +@@ -988,16 +_,18 @@ serverlevel.fillReportDetails(crashreport); throw new ReportedException(crashreport); } @@ -167,7 +174,7 @@ GameTestTicker.SINGLETON.tick(); } -@@ -1050,7 +_,7 @@ +@@ -1093,7 +_,7 @@ @DontObfuscate public String getServerModName() { @@ -176,16 +183,16 @@ } public SystemReport fillSystemReport(SystemReport p_177936_) { -@@ -1379,7 +_,7 @@ +@@ -1422,7 +_,7 @@ + public CompletableFuture reloadResources(Collection p_129862_) { - RegistryAccess.Frozen registryaccess$frozen = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); CompletableFuture completablefuture = CompletableFuture.supplyAsync( - () -> p_129862_.stream().map(this.packRepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()), + () -> p_129862_.stream().map(this.packRepository::getPack).filter(Objects::nonNull).flatMap(Pack::streamSelfAndChildren).map(Pack::open).collect(ImmutableList.toImmutableList()), this ) .thenCompose( -@@ -1416,6 +_,7 @@ +@@ -1459,6 +_,7 @@ this.getPlayerList().reloadResources(); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); @@ -193,7 +200,7 @@ }, this ); -@@ -1430,9 +_,11 @@ +@@ -1473,9 +_,11 @@ PackRepository p_248681_, DataPackConfig p_248920_, boolean p_249869_, FeatureFlagSet p_251243_ ) { p_248681_.reload(); @@ -207,7 +214,7 @@ } else { Set set = Sets.newLinkedHashSet(); -@@ -1616,6 +_,31 @@ +@@ -1661,6 +_,31 @@ public abstract boolean isSingleplayerOwner(GameProfile p_129840_); @@ -239,7 +246,7 @@ public void dumpServerProperties(Path p_177911_) throws IOException { } -@@ -1777,6 +_,10 @@ +@@ -1822,6 +_,10 @@ public WorldData getWorldData() { return this.worldData; diff --git a/patches/net/minecraft/server/PlayerAdvancements.java.patch b/patches/net/minecraft/server/PlayerAdvancements.java.patch index 4c983fd132..950744b08f 100644 --- a/patches/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/net/minecraft/server/PlayerAdvancements.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java -@@ -166,6 +_,8 @@ +@@ -165,6 +_,8 @@ } public boolean award(AdvancementHolder p_300979_, String p_135990_) { @@ -9,22 +9,22 @@ boolean flag = false; AdvancementProgress advancementprogress = this.getOrStartProgress(p_300979_); boolean flag1 = advancementprogress.isDone(); -@@ -173,12 +_,14 @@ +@@ -172,12 +_,14 @@ this.unregisterListeners(p_300979_); this.progressChanged.add(p_300979_); flag = true; + net.neoforged.neoforge.event.EventHooks.onAdvancementProgressedEvent(this.player, p_300979_, advancementprogress, p_135990_, net.neoforged.neoforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent.ProgressType.GRANT); if (!flag1 && advancementprogress.isDone()) { p_300979_.value().rewards().grant(this.player); - p_300979_.value().display().ifPresent(p_311529_ -> { - if (p_311529_.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { - this.playerList.broadcastSystemMessage(p_311529_.getType().createAnnouncement(p_300979_, this.player), false); + p_300979_.value().display().ifPresent(p_337526_ -> { + if (p_337526_.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { + this.playerList.broadcastSystemMessage(p_337526_.getType().createAnnouncement(p_300979_, this.player), false); } + net.neoforged.neoforge.event.EventHooks.onAdvancementEarnedEvent(this.player, p_300979_); }); } } -@@ -198,6 +_,7 @@ +@@ -197,6 +_,7 @@ this.registerListeners(p_301073_); this.progressChanged.add(p_301073_); flag = true; diff --git a/patches/net/minecraft/server/ReloadableServerResources.java.patch b/patches/net/minecraft/server/ReloadableServerResources.java.patch index 6e04d8f8f5..cf23f14fbc 100644 --- a/patches/net/minecraft/server/ReloadableServerResources.java.patch +++ b/patches/net/minecraft/server/ReloadableServerResources.java.patch @@ -1,58 +1,19 @@ --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java -@@ -44,6 +_,9 @@ - this.commands = new Commands(p_206858_, this.commandBuildContext); - this.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.CREATE_NEW); +@@ -49,6 +_,8 @@ + this.commands = new Commands(p_206858_, CommandBuildContext.simple(this.registryLookup, p_250695_)); + this.advancements = new ServerAdvancementManager(this.registryLookup); this.functionLibrary = new ServerFunctionLibrary(p_206859_, this.commands.getDispatcher()); -+ // Neo: Create context object and inject it into listeners that need it -+ this.registryAccess = p_206857_; ++ // Neo: Create context object + this.context = new net.neoforged.neoforge.common.conditions.ConditionContext(this.tagManager); } public ServerFunctionLibrary getFunctionLibrary() { -@@ -80,19 +_,33 @@ - Executor p_249601_ - ) { - ReloadableServerResources reloadableserverresources = new ReloadableServerResources(p_251163_, p_250212_, p_249301_, p_251126_); -+ List listeners = new java.util.ArrayList<>(reloadableserverresources.listeners()); -+ listeners.addAll(net.neoforged.neoforge.event.EventHooks.onResourceReload(reloadableserverresources, p_251163_)); -+ listeners.forEach(rl -> { -+ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) srl.injectContext(reloadableserverresources.context, reloadableserverresources.registryAccess); -+ }); - return SimpleReloadInstance.create( -- p_248588_, reloadableserverresources.listeners(), p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() -+ p_248588_, listeners, p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() - ) - .done() - .whenComplete( - (p_255534_, p_255535_) -> reloadableserverresources.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.FAIL) - ) -+ .thenRun(() -> { -+ // Clear context after reload complete -+ listeners.forEach(rl -> { -+ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) { -+ srl.injectContext(net.neoforged.neoforge.common.conditions.ICondition.IContext.EMPTY, RegistryAccess.EMPTY); -+ } -+ }); -+ }) - .thenApply(p_214306_ -> reloadableserverresources); +@@ -75,6 +_,24 @@ + return List.of(this.tagManager, this.recipes, this.functionLibrary, this.advancements); } - public void updateRegistryTags(RegistryAccess p_206869_) { - this.tagManager.getResult().forEach(p_214315_ -> updateRegistryTags(p_206869_, p_214315_)); - Blocks.rebuildCache(); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(p_206869_, false, false)); - } - - private static void updateRegistryTags(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { -@@ -106,5 +_,23 @@ - ) - ); - p_206871_.registryOrThrow(resourcekey).bindTags(map); -+ } -+ + private final net.neoforged.neoforge.common.conditions.ICondition.IContext context; -+ private final net.minecraft.core.RegistryAccess registryAccess; + + /** + * Exposes the current condition context for usage in other reload listeners.
@@ -62,10 +23,51 @@ + public net.neoforged.neoforge.common.conditions.ICondition.IContext getConditionContext() { + return this.context; + } ++ + /** -+ * {@return the registry access for the currently active reload} -+ */ -+ public net.minecraft.core.RegistryAccess getRegistryAccess() { -+ return this.registryAccess; ++ * {@return the lookup provider access for the currently active reload} ++ */ ++ public HolderLookup.Provider getRegistryLookup() { ++ return this.registryLookup; ++ } ++ + public static CompletableFuture loadResources( + ResourceManager p_248588_, + LayeredRegistryAccess p_335667_, +@@ -90,14 +_,27 @@ + ReloadableServerResources reloadableserverresources = new ReloadableServerResources( + p_335211_.compositeAccess(), p_250212_, p_249301_, p_251126_ + ); ++ List listeners = new java.util.ArrayList<>(reloadableserverresources.listeners()); ++ listeners.addAll(net.neoforged.neoforge.event.EventHooks.onResourceReload(reloadableserverresources, p_335211_.compositeAccess())); ++ listeners.forEach(rl -> { ++ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) srl.injectContext(reloadableserverresources.context, reloadableserverresources.registryLookup); ++ }); + return SimpleReloadInstance.create( +- p_248588_, reloadableserverresources.listeners(), p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() ++ p_248588_, listeners, p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() + ) + .done() + .whenComplete( + (p_323178_, p_323179_) -> reloadableserverresources.registryLookup + .missingTagAccessPolicy(ReloadableServerResources.MissingTagAccessPolicy.FAIL) + ) ++ .thenRun(() -> { ++ // Clear context after reload completes ++ listeners.forEach(rl -> { ++ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) { ++ srl.injectContext(net.neoforged.neoforge.common.conditions.ICondition.IContext.EMPTY, RegistryAccess.EMPTY); ++ } ++ }); ++ }) + .thenApply(p_214306_ -> reloadableserverresources); + } + ); +@@ -107,6 +_,7 @@ + this.tagManager.getResult().forEach(p_335204_ -> updateRegistryTags(this.fullRegistryHolder.get(), (TagManager.LoadResult)p_335204_)); + AbstractFurnaceBlockEntity.invalidateCache(); + Blocks.rebuildCache(); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(this.fullRegistryHolder.get(), false, false)); } - } + + private static void updateRegistryTags(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { diff --git a/patches/net/minecraft/server/ServerAdvancementManager.java.patch b/patches/net/minecraft/server/ServerAdvancementManager.java.patch index 211b7f3ad9..73decf3369 100644 --- a/patches/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/patches/net/minecraft/server/ServerAdvancementManager.java.patch @@ -1,19 +1,20 @@ --- a/net/minecraft/server/ServerAdvancementManager.java +++ b/net/minecraft/server/ServerAdvancementManager.java -@@ -41,10 +_,15 @@ +@@ -41,11 +_,15 @@ } protected void apply(Map p_136034_, ResourceManager p_136035_, ProfilerFiller p_136036_) { -+ var ops = this.makeConditionalOps(); +- RegistryOps registryops = this.registries.createSerializationContext(JsonOps.INSTANCE); ++ RegistryOps registryops = this.makeConditionalOps(); // Neo: add condition context Builder builder = ImmutableMap.builder(); - p_136034_.forEach((p_311532_, p_311533_) -> { + p_136034_.forEach((p_337529_, p_337530_) -> { try { -- Advancement advancement = Util.getOrThrow(Advancement.CODEC.parse(JsonOps.INSTANCE, p_311533_), JsonParseException::new); -+ Advancement advancement = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Advancement.CONDITIONAL_CODEC, ops, p_311533_).orElse(null); +- Advancement advancement = Advancement.CODEC.parse(registryops, p_337530_).getOrThrow(JsonParseException::new); ++ Advancement advancement = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Advancement.CONDITIONAL_CODEC, registryops, p_337530_).orElse(null); + if (advancement == null) { -+ LOGGER.debug("Skipping loading advancement {} as its conditions were not met", p_311532_); ++ LOGGER.debug("Skipping loading advancement {} as its conditions were not met", p_337529_); + return; + } - this.validate(p_311532_, advancement); - builder.put(p_311532_, new AdvancementHolder(p_311532_, advancement)); + this.validate(p_337529_, advancement); + builder.put(p_337529_, new AdvancementHolder(p_337529_, advancement)); } catch (Exception exception) { diff --git a/patches/net/minecraft/server/commands/DataPackCommand.java.patch b/patches/net/minecraft/server/commands/DataPackCommand.java.patch index ec062a79da..0a43913de1 100644 --- a/patches/net/minecraft/server/commands/DataPackCommand.java.patch +++ b/patches/net/minecraft/server/commands/DataPackCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/DataPackCommand.java +++ b/net/minecraft/server/commands/DataPackCommand.java -@@ -183,7 +_,7 @@ +@@ -186,7 +_,7 @@ private static int listEnabledPacks(CommandSourceStack p_136866_) { PackRepository packrepository = p_136866_.getServer().getPackRepository(); packrepository.reload(); diff --git a/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch b/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch index 4c3ed4dccd..9f297b76ee 100644 --- a/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch +++ b/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/SpreadPlayersCommand.java +++ b/net/minecraft/server/commands/SpreadPlayersCommand.java -@@ -257,15 +_,22 @@ +@@ -259,15 +_,22 @@ spreadplayerscommand$position = p_138732_[i++]; } @@ -30,4 +30,4 @@ + } double d2 = Double.MAX_VALUE; - for(SpreadPlayersCommand.Position spreadplayerscommand$position1 : p_138732_) { + for (SpreadPlayersCommand.Position spreadplayerscommand$position1 : p_138732_) { diff --git a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch index f366de9e25..40836552ae 100644 --- a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -68,6 +_,8 @@ - private MinecraftServerGui gui; +@@ -77,6 +_,8 @@ + private RemoteSampleLogger tickTimeLogger; @Nullable - private final TextFilterClient textFilterClient; + private DebugSampleSubscriptionTracker debugSampleSubscriptionTracker; + @Nullable + private net.minecraft.client.server.LanServerPinger dediLanPinger; public DedicatedServer( Thread p_214789_, -@@ -90,6 +_,7 @@ +@@ -99,6 +_,7 @@ Thread thread = new Thread("Server console handler") { @Override public void run() { @@ -17,7 +17,7 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); String s1; -@@ -168,11 +_,13 @@ +@@ -181,11 +_,13 @@ long i = Util.getNanos(); SkullBlockEntity.setup(this.services, this); GameProfileCache.setUsesAuthentication(this.usesAuthentication()); @@ -31,7 +31,7 @@ if (dedicatedserverproperties.announcePlayerAchievements != null) { this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS).set(dedicatedserverproperties.announcePlayerAchievements, this); } -@@ -200,6 +_,12 @@ +@@ -213,6 +_,12 @@ LOGGER.info("JMX monitoring enabled"); } @@ -44,7 +44,7 @@ return true; } } -@@ -278,6 +_,10 @@ +@@ -291,6 +_,10 @@ if (this.queryThreadGs4 != null) { this.queryThreadGs4.stop(); } @@ -55,7 +55,7 @@ } @Override -@@ -531,7 +_,12 @@ +@@ -544,7 +_,12 @@ @Override public void stopServer() { diff --git a/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch b/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch index b778e30ed2..bc6f5a8bc9 100644 --- a/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch +++ b/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch @@ -7,7 +7,7 @@ - Error error = new Error("Watchdog"); + Error error = new Error(String.format(java.util.Locale.ENGLISH, "ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error - for(ThreadInfo threadinfo : athreadinfo) { + for (ThreadInfo threadinfo : athreadinfo) { if (threadinfo.getThreadId() == this.server.getRunningThread().getId()) { error.setStackTrace(threadinfo.getStackTrace()); } diff --git a/patches/net/minecraft/server/level/ChunkHolder.java.patch b/patches/net/minecraft/server/level/ChunkHolder.java.patch index f3c2095e67..28db7d98ba 100644 --- a/patches/net/minecraft/server/level/ChunkHolder.java.patch +++ b/patches/net/minecraft/server/level/ChunkHolder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ChunkHolder.java +++ b/net/minecraft/server/level/ChunkHolder.java -@@ -69,6 +_,7 @@ +@@ -62,6 +_,7 @@ private final ChunkHolder.LevelChangeListener onLevelChange; private final ChunkHolder.PlayerProvider playerProvider; private boolean wasAccessibleSinceLastSave; diff --git a/patches/net/minecraft/server/level/ChunkMap.java.patch b/patches/net/minecraft/server/level/ChunkMap.java.patch index cb555e6d2b..0e0f0ae50b 100644 --- a/patches/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/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 -@@ -414,6 +_,7 @@ +@@ -421,6 +_,7 @@ this.modified = true; } @@ -8,7 +8,7 @@ return p_140179_; } } -@@ -528,6 +_,7 @@ +@@ -534,6 +_,7 @@ if (this.pendingUnloads.remove(p_140182_, p_140183_) && p_203002_ != null) { if (p_203002_ instanceof LevelChunk) { ((LevelChunk)p_203002_).setLoaded(false); @@ -16,38 +16,38 @@ } this.save(p_203002_); -@@ -737,11 +_,22 @@ - } +@@ -731,11 +_,22 @@ + } - levelchunk.setFullStatus(() -> ChunkLevel.fullStatus(p_140384_.getTicketLevel())); + levelchunk.setFullStatus(() -> ChunkLevel.fullStatus(p_140384_.getTicketLevel())); ++ try { ++ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. + levelchunk.runPostLoad(); ++ } finally { ++ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. ++ } + if (this.entitiesInLevel.add(chunkpos.toLong())) { + levelchunk.setLoaded(true); + try { + p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. - levelchunk.runPostLoad(); + levelchunk.registerAllBlockEntitiesAfterLevelLoad(); + levelchunk.registerTickContainerInLevel(this.level); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Load(levelchunk, !(protochunk instanceof ImposterProtoChunk))); + } finally { -+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. ++ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. + } - if (this.entitiesInLevel.add(chunkpos.toLong())) { - levelchunk.setLoaded(true); -+ try { -+ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. - levelchunk.registerAllBlockEntitiesAfterLevelLoad(); - levelchunk.registerTickContainerInLevel(this.level); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Load(levelchunk, !(protochunk instanceof ImposterProtoChunk))); -+ } finally { -+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. -+ } - } + } - return levelchunk; -@@ -844,6 +_,7 @@ + return levelchunk; +@@ -835,6 +_,7 @@ this.level.getProfiler().incrementCounter("chunkSave"); CompoundTag compoundtag = ChunkSerializer.write(this.level, p_140259_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Save(p_140259_, p_140259_.getWorldForge() != null ? p_140259_.getWorldForge() : this.level, compoundtag)); - this.write(chunkpos, compoundtag); - this.markPosition(chunkpos, chunkstatus.getChunkType()); - return true; -@@ -902,9 +_,11 @@ + this.write(chunkpos, compoundtag).exceptionallyAsync(p_329914_ -> { + this.level.getServer().reportChunkSaveFailure(chunkpos); + return null; +@@ -897,9 +_,11 @@ private static void markChunkPendingToSend(ServerPlayer p_295834_, LevelChunk p_296281_) { p_295834_.connection.chunkSender.markChunkPendingToSend(p_296281_); @@ -59,7 +59,7 @@ p_294215_.connection.chunkSender.dropChunk(p_294215_, p_294758_); } -@@ -1099,6 +_,7 @@ +@@ -1098,6 +_,7 @@ this.playerMap.unIgnorePlayer(p_140185_); } @@ -67,7 +67,7 @@ this.updateChunkTracking(p_140185_); } } -@@ -1151,7 +_,7 @@ +@@ -1149,7 +_,7 @@ } protected void addEntity(Entity p_140200_) { diff --git a/patches/net/minecraft/server/level/DistanceManager.java.patch b/patches/net/minecraft/server/level/DistanceManager.java.patch index bb0299fdd6..3744355296 100644 --- a/patches/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/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 -@@ -55,6 +_,8 @@ +@@ -54,6 +_,8 @@ private long ticketTickCounter; private int simulationDistance = 10; @@ -9,7 +9,7 @@ protected DistanceManager(Executor p_140774_, Executor p_140775_) { ProcessorHandle processorhandle = ProcessorHandle.of("player ticket throttler", p_140775_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorhandle), p_140774_, 4); -@@ -152,6 +_,10 @@ +@@ -151,6 +_,10 @@ if (p_140786_.getTicketLevel() < i) { this.ticketTracker.update(p_140785_, p_140786_.getTicketLevel(), true); } @@ -20,7 +20,7 @@ } void removeTicket(long p_140819_, Ticket p_140820_) { -@@ -164,6 +_,13 @@ +@@ -163,6 +_,13 @@ } this.ticketTracker.update(p_140819_, getTicketLevelAt(sortedarrayset), false); @@ -34,7 +34,7 @@ } public void addTicket(TicketType p_140793_, ChunkPos p_140794_, int p_140795_, T p_140796_) { -@@ -176,14 +_,20 @@ +@@ -175,14 +_,20 @@ } public void addRegionTicket(TicketType p_140841_, ChunkPos p_140842_, int p_140843_, T p_140844_) { @@ -57,7 +57,7 @@ long i = p_140851_.toLong(); this.removeTicket(i, ticket); this.tickingTicketsTracker.removeTicket(i, ticket); -@@ -267,6 +_,11 @@ +@@ -266,6 +_,11 @@ public String getDebugStatus() { return this.ticketThrottler.getDebugStatus(); diff --git a/patches/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/net/minecraft/server/level/ServerChunkCache.java.patch index 736014f095..54d36f092f 100644 --- a/patches/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/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 -@@ -45,7 +_,7 @@ +@@ -44,7 +_,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; @@ -9,7 +9,7 @@ private static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); private final DistanceManager distanceManager; public final ServerLevel level; -@@ -150,6 +_,10 @@ +@@ -149,6 +_,10 @@ } } @@ -18,18 +18,18 @@ + return chunkholder.currentlyLoading; // Neo: If the requested chunk is loading, bypass the future chain to prevent a deadlock. + profilerfiller.incrementCounter("getChunkCacheMiss"); - CompletableFuture> completablefuture = this.getChunkFutureMainThread( - p_8360_, p_8361_, p_8362_, p_8363_ -@@ -187,6 +_,7 @@ + CompletableFuture> completablefuture = this.getChunkFutureMainThread(p_8360_, p_8361_, p_330876_, p_8363_); + this.mainThreadProcessor.managedBlock(completablefuture::isDone); +@@ -183,6 +_,7 @@ if (chunkholder == null) { return null; } else { + if (chunkholder.currentlyLoading != null) return chunkholder.currentlyLoading; // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. - Either either = chunkholder.getFutureIfPresent(ChunkStatus.FULL).getNow(null); - if (either == null) { + ChunkResult chunkresult = chunkholder.getFutureIfPresent(ChunkStatus.FULL).getNow(null); + if (chunkresult == null) { return null; -@@ -383,7 +_,7 @@ - for(ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { +@@ -375,7 +_,7 @@ + for (ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { LevelChunk levelchunk1 = serverchunkcache$chunkandholder.chunk; ChunkPos chunkpos = levelchunk1.getPos(); - if (this.level.isNaturalSpawningAllowed(chunkpos) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkpos)) { @@ -37,7 +37,7 @@ levelchunk1.incrementInhabitedTime(j); if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkpos)) { NaturalSpawner.spawnForChunk(this.level, levelchunk1, naturalspawner$spawnstate, this.spawnFriendlies, this.spawnEnemies, flag); -@@ -462,11 +_,17 @@ +@@ -454,11 +_,17 @@ } public void addRegionTicket(TicketType p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_) { diff --git a/patches/net/minecraft/server/level/ServerEntity.java.patch b/patches/net/minecraft/server/level/ServerEntity.java.patch index 7936973d00..b58ca16a46 100644 --- a/patches/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/net/minecraft/server/level/ServerEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -97,9 +_,9 @@ - Entity $$11 = this.entity; - if ($$11 instanceof ItemFrame itemframe && this.tickCount % 10 == 0) { +@@ -100,9 +_,9 @@ + + if (this.entity instanceof ItemFrame itemframe && this.tickCount % 10 == 0) { ItemStack itemstack = itemframe.getItem(); - if (itemstack.getItem() instanceof MapItem) { + if (true) { - Integer integer = MapItem.getMapId(itemstack); -- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(integer, this.level); + MapId mapid = itemstack.get(DataComponents.MAP_ID); +- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(mapid, this.level); + MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, this.level); if (mapitemsaveddata != null) { - for(ServerPlayer serverplayer : this.level.players()) { + for (ServerPlayer serverplayer : this.level.players()) { mapitemsaveddata.tickCarriedBy(serverplayer, itemstack); -@@ -219,16 +_,18 @@ +@@ -230,16 +_,18 @@ public void removePairing(ServerPlayer p_8535_) { this.entity.stopSeenByPlayer(p_8535_); p_8535_.connection.send(new ClientboundRemoveEntitiesPacket(this.entity.getId())); @@ -20,9 +20,8 @@ } public void addPairing(ServerPlayer p_8542_) { -- List> list = new ArrayList<>(); + List> list = new ArrayList<>(); - this.sendPairingData(p_8542_, list::add); -+ List> list = new ArrayList<>(); + this.sendPairingData(p_8542_, new net.neoforged.neoforge.network.bundle.PacketAndPayloadAcceptor<>(list::add)); p_8542_.connection.send(new ClientboundBundlePacket(list)); this.entity.startSeenByPlayer(p_8542_); @@ -34,7 +33,7 @@ if (this.entity.isRemoved()) { LOGGER.warn("Fetching packet for removed entity {}", this.entity); } -@@ -236,6 +_,7 @@ +@@ -247,6 +_,7 @@ Packet packet = this.entity.getAddEntityPacket(); this.yHeadRotp = Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F); p_289563_.accept(packet); diff --git a/patches/net/minecraft/server/level/ServerLevel.java.patch b/patches/net/minecraft/server/level/ServerLevel.java.patch index 9d5d3a3df5..eb3dede221 100644 --- a/patches/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/net/minecraft/server/level/ServerLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -190,7 +_,7 @@ +@@ -198,7 +_,7 @@ private final List customSpawners; @Nullable private EndDragonFight dragonFight; @@ -9,7 +9,7 @@ private final StructureManager structureManager; private final StructureCheck structureCheck; private final boolean tickTime; -@@ -281,6 +_,8 @@ +@@ -297,6 +_,8 @@ this.randomSequences = Objects.requireNonNullElseGet( p_288977_, () -> this.getDataStorage().computeIfAbsent(RandomSequences.factory(i), "random_sequences") ); @@ -18,7 +18,7 @@ } @Deprecated -@@ -325,7 +_,7 @@ +@@ -341,7 +_,7 @@ if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { long j = this.levelData.getDayTime() + 24000L; @@ -27,7 +27,7 @@ } this.wakeUpAllPlayers(); -@@ -363,7 +_,7 @@ +@@ -379,7 +_,7 @@ this.handlingTick = false; profilerfiller.pop(); @@ -36,7 +36,7 @@ if (flag1) { this.resetEmptyTime(); } -@@ -395,7 +_,9 @@ +@@ -411,7 +_,9 @@ } profilerfiller.push("tick"); @@ -47,7 +47,7 @@ profilerfiller.pop(); } } -@@ -527,6 +_,7 @@ +@@ -541,6 +_,7 @@ BlockPos blockpos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, p_295060_); BlockPos blockpos1 = blockpos.below(); Biome biome = this.getBiome(blockpos).value(); @@ -55,7 +55,7 @@ if (biome.shouldFreeze(this, blockpos1)) { this.setBlockAndUpdate(blockpos1, Blocks.ICE.defaultBlockState()); } -@@ -699,15 +_,19 @@ +@@ -713,15 +_,19 @@ .broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel), this.dimension()); } @@ -79,7 +79,7 @@ } } -@@ -760,6 +_,7 @@ +@@ -774,6 +_,7 @@ ProfilerFiller profilerfiller = this.getProfiler(); profilerfiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_8664_.getType()).toString()); profilerfiller.incrementCounter("tickPassenger"); @@ -87,7 +87,7 @@ p_8664_.rideTick(); profilerfiller.pop(); -@@ -792,6 +_,7 @@ +@@ -806,6 +_,7 @@ } else { this.entityManager.autoSave(); } @@ -95,7 +95,7 @@ } } -@@ -885,6 +_,7 @@ +@@ -899,6 +_,7 @@ } private void addPlayer(ServerPlayer p_8854_) { @@ -103,7 +103,7 @@ Entity entity = this.getEntities().get(p_8854_.getUUID()); if (entity != null) { LOGGER.warn("Force-added player with duplicate UUID {}", p_8854_.getUUID()); -@@ -892,7 +_,8 @@ +@@ -906,7 +_,8 @@ this.removePlayerImmediately((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); } @@ -113,7 +113,7 @@ } private boolean addEntity(Entity p_8873_) { -@@ -900,7 +_,12 @@ +@@ -914,7 +_,12 @@ LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityType.getKey(p_8873_.getType())); return false; } else { @@ -127,7 +127,7 @@ } } -@@ -948,6 +_,12 @@ +@@ -962,6 +_,12 @@ float p_263390_, long p_263403_ ) { @@ -140,7 +140,7 @@ this.server .getPlayerList() .broadcast( -@@ -965,6 +_,12 @@ +@@ -979,6 +_,12 @@ public void playSeededSound( @Nullable Player p_263545_, Entity p_263544_, Holder p_263491_, SoundSource p_263542_, float p_263530_, float p_263520_, long p_263490_ ) { @@ -153,15 +153,15 @@ this.server .getPlayerList() .broadcast( -@@ -1008,6 +_,7 @@ +@@ -1022,6 +_,7 @@ @Override - public void gameEvent(GameEvent p_215041_, Vec3 p_215042_, GameEvent.Context p_215043_) { -+ if (!net.neoforged.neoforge.common.CommonHooks.onVanillaGameEvent(this, p_215041_, p_215042_, p_215043_)) return; - this.gameEventDispatcher.post(p_215041_, p_215042_, p_215043_); + public void gameEvent(Holder p_316597_, Vec3 p_215042_, GameEvent.Context p_215043_) { ++ if (!net.neoforged.neoforge.common.CommonHooks.onVanillaGameEvent(this, p_316597_, p_215042_, p_215043_)) return; + this.gameEventDispatcher.post(p_316597_, p_215042_, p_215043_); } -@@ -1045,11 +_,16 @@ +@@ -1060,11 +_,16 @@ @Override public void updateNeighborsAt(BlockPos p_215045_, Block p_215046_) { @@ -178,18 +178,18 @@ this.neighborUpdater.updateNeighborsAtExceptFromFacing(p_215052_, p_215053_, p_215054_); } -@@ -1695,8 +_,8 @@ +@@ -1727,8 +_,8 @@ ServerLevel.this.navigatingMobs.add(mob); } - if (p_143371_ instanceof EnderDragon enderdragon) { -- for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { +- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + if (p_143371_.isMultipartEntity()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_143371_.getParts()) { ServerLevel.this.dragonParts.put(enderdragonpart.getId(), enderdragonpart); } } -@@ -1715,24 +_,61 @@ +@@ -1747,24 +_,61 @@ if (ServerLevel.this.isUpdatingNavigations) { String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde( @@ -202,7 +202,7 @@ } - if (p_143375_ instanceof EnderDragon enderdragon) { -- for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { +- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + if (p_143375_.isMultipartEntity()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_143375_.getParts()) { ServerLevel.this.dragonParts.remove(enderdragonpart.getId()); diff --git a/patches/net/minecraft/server/level/ServerPlayer.java.patch b/patches/net/minecraft/server/level/ServerPlayer.java.patch index dc55b4f700..a8dec0571e 100644 --- a/patches/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -234,6 +_,10 @@ +@@ -250,6 +_,10 @@ } private void broadcastDataValue(AbstractContainerMenu p_143455_, int p_143456_, int p_143457_) { -+ if (ServerPlayer.this.connection.isConnected(net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload.ID)) { -+ ServerPlayer.this.connection.send(new net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload(p_143455_.containerId, p_143456_, p_143457_)); ++ if (ServerPlayer.this.connection.isConnected(net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload.TYPE)) { ++ ServerPlayer.this.connection.send(new net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload((byte) p_143455_.containerId, (short) p_143456_, p_143457_)); + return; + } ServerPlayer.this.connection.send(new ClientboundContainerSetDataPacket(p_143455_.containerId, p_143456_, p_143457_)); } }; -@@ -546,6 +_,11 @@ +@@ -599,6 +_,11 @@ this.connection.send(new ClientboundSetExperiencePacket(this.experienceProgress, this.totalExperience, this.experienceLevel)); } @@ -23,7 +23,7 @@ if (this.tickCount % 20 == 0) { CriteriaTriggers.LOCATION.trigger(this); } -@@ -594,6 +_,7 @@ +@@ -650,6 +_,7 @@ @Override public void die(DamageSource p_9035_) { this.gameEvent(GameEvent.ENTITY_DIE); @@ -31,7 +31,7 @@ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); if (flag) { Component component = this.getCombatTracker().getDeathMessage(); -@@ -740,11 +_,12 @@ +@@ -793,11 +_,12 @@ @Nullable @Override @@ -46,7 +46,7 @@ this.unRide(); this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -@@ -761,13 +_,14 @@ +@@ -814,13 +_,14 @@ PlayerList playerlist = this.server.getPlayerList(); playerlist.sendPlayerPermissionLevel(this); serverlevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); @@ -64,7 +64,7 @@ this.createEndPlatform(p_9180_, BlockPos.containing(portalinfo.pos)); } -@@ -779,6 +_,9 @@ +@@ -832,6 +_,9 @@ p_9180_.addDuringPortalTeleport(this); serverlevel.getProfiler().pop(); this.triggerDimensionChangeTriggers(serverlevel); @@ -74,8 +74,8 @@ this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); playerlist.sendLevelInfo(this, p_9180_); playerlist.sendAllPlayerInfo(this); -@@ -787,10 +_,12 @@ - this.connection.send(new ClientboundUpdateMobEffectPacket(this.getId(), mobeffectinstance)); +@@ -840,10 +_,12 @@ + this.connection.send(new ClientboundUpdateMobEffectPacket(this.getId(), mobeffectinstance, false)); } + if (teleporter.playTeleportSound(this, serverlevel, p_9180_)) @@ -87,7 +87,7 @@ } return this; -@@ -859,6 +_,9 @@ +@@ -912,6 +_,9 @@ @Override public Either startSleepInBed(BlockPos p_9115_) { @@ -97,7 +97,7 @@ Direction direction = this.level().getBlockState(p_9115_).getValue(HorizontalDirectionalBlock.FACING); if (this.isSleeping() || !this.isAlive()) { return Either.left(Player.BedSleepingProblem.OTHER_PROBLEM); -@@ -870,7 +_,7 @@ +@@ -923,7 +_,7 @@ return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { this.setRespawnPosition(this.level().dimension(), p_9115_, this.getYRot(), false, true); @@ -106,7 +106,7 @@ return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { if (!this.isCreative()) { -@@ -909,6 +_,7 @@ +@@ -962,6 +_,7 @@ } private boolean bedInRange(BlockPos p_9117_, Direction p_9118_) { @@ -114,15 +114,15 @@ return this.isReachableBedBlock(p_9117_) || this.isReachableBedBlock(p_9117_.relative(p_9118_.getOpposite())); } -@@ -983,11 +_,19 @@ +@@ -1052,11 +_,19 @@ @Override public OptionalInt openMenu(@Nullable MenuProvider p_9033_) { -+ return openMenu(p_9033_, (java.util.function.Consumer) null); ++ return openMenu(p_9033_, (java.util.function.Consumer) null); + } + + @Override -+ public OptionalInt openMenu(@Nullable MenuProvider p_9033_, @Nullable java.util.function.Consumer extraDataWriter) { ++ public OptionalInt openMenu(@Nullable MenuProvider p_9033_, @Nullable java.util.function.Consumer extraDataWriter) { if (p_9033_ == null) { return OptionalInt.empty(); } else { @@ -134,7 +134,7 @@ } this.nextContainerCounter(); -@@ -999,10 +_,16 @@ +@@ -1068,10 +_,16 @@ return OptionalInt.empty(); } else { @@ -143,7 +143,7 @@ .send(new ClientboundOpenScreenPacket(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName())); + } else { + this.connection -+ .send(new net.neoforged.neoforge.network.payload.AdvancedOpenScreenPayload(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName(), extraDataWriter)); ++ .send(new net.neoforged.neoforge.network.payload.AdvancedOpenScreenPayload(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName(), net.neoforged.neoforge.common.util.FriendlyByteBufUtil.writeCustomData(extraDataWriter, registryAccess()))); + } this.initMenu(abstractcontainermenu); this.containerMenu = abstractcontainermenu; @@ -151,7 +151,7 @@ return OptionalInt.of(this.containerCounter); } } -@@ -1023,6 +_,7 @@ +@@ -1092,6 +_,7 @@ this.connection.send(new ClientboundHorseScreenOpenPacket(this.containerCounter, p_9060_.getContainerSize(), p_9059_.getId())); this.containerMenu = new HorseInventoryMenu(this.containerCounter, this.getInventory(), p_9060_, p_9059_); this.initMenu(this.containerMenu); @@ -159,7 +159,7 @@ } @Override -@@ -1051,6 +_,7 @@ +@@ -1120,6 +_,7 @@ public void doCloseContainer() { this.containerMenu.removed(this); this.inventoryMenu.transferState(this.containerMenu); @@ -167,7 +167,7 @@ this.containerMenu = this.inventoryMenu; } -@@ -1276,6 +_,15 @@ +@@ -1345,6 +_,15 @@ this.setShoulderEntityLeft(p_9016_.getShoulderEntityLeft()); this.setShoulderEntityRight(p_9016_.getShoulderEntityRight()); this.setLastDeathLocation(p_9016_.getLastDeathLocation()); @@ -183,7 +183,7 @@ } @Override -@@ -1369,6 +_,8 @@ +@@ -1438,6 +_,8 @@ } public boolean setGameMode(GameType p_143404_) { @@ -192,15 +192,15 @@ if (!this.gameMode.changeGameModeForPlayer(p_143404_)) { return false; } else { -@@ -1517,6 +_,7 @@ +@@ -1582,6 +_,7 @@ public void setCamera(@Nullable Entity p_9214_) { Entity entity = this.getCamera(); this.camera = (Entity)(p_9214_ == null ? this : p_9214_); -+ while (this.camera instanceof net.neoforged.neoforge.entity.PartEntity partEntity) this.camera = partEntity.getParent(); // FORGE: fix MC-46486 ++ while (this.camera instanceof net.neoforged.neoforge.entity.PartEntity partEntity) this.camera = partEntity.getParent(); // Neo: fix MC-46486 if (entity != this.camera) { - Level level = this.camera.level(); - if (level instanceof ServerLevel serverlevel) { -@@ -1554,7 +_,11 @@ + if (this.camera.level() instanceof ServerLevel serverlevel) { + this.teleportTo(serverlevel, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot()); +@@ -1618,7 +_,11 @@ @Nullable public Component getTabListDisplayName() { @@ -213,7 +213,7 @@ } @Override -@@ -1580,21 +_,23 @@ +@@ -1644,21 +_,23 @@ this.stopRiding(); if (p_9000_ == this.level()) { this.connection.teleport(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); @@ -239,7 +239,7 @@ } } -@@ -1616,6 +_,7 @@ +@@ -1680,6 +_,7 @@ } public void setRespawnPosition(ResourceKey p_9159_, @Nullable BlockPos p_9160_, float p_9161_, boolean p_9162_, boolean p_9163_) { @@ -247,7 +247,7 @@ if (p_9160_ != null) { boolean flag = p_9160_.equals(this.respawnPosition) && p_9159_.equals(this.respawnDimension); if (p_9163_ && !flag) { -@@ -1673,6 +_,8 @@ +@@ -1737,6 +_,8 @@ if (itementity == null) { return null; } else { @@ -256,7 +256,7 @@ this.level().addFreshEntity(itementity); ItemStack itemstack = itementity.getItem(); if (p_9087_) { -@@ -1687,6 +_,75 @@ +@@ -1751,6 +_,75 @@ } } @@ -332,7 +332,7 @@ public TextFilter getTextFilter() { return this.textFilter; } -@@ -1751,9 +_,12 @@ +@@ -1811,9 +_,12 @@ public boolean drop(boolean p_182295_) { Inventory inventory = this.getInventory(); diff --git a/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch index f06c2b6a55..39a1a26532 100644 --- a/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -65,7 +_,10 @@ +@@ -68,7 +_,10 @@ protected void setGameModeForPlayer(GameType p_9274_, @Nullable GameType p_9275_) { this.previousGameModeForPlayer = p_9275_; this.gameModeForPlayer = p_9274_; @@ -11,20 +11,18 @@ } public GameType getGameModeForPlayer() { -@@ -126,7 +_,11 @@ +@@ -129,6 +_,10 @@ } public void handleBlockBreakAction(BlockPos p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) { -- if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(p_215120_)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { + net.neoforged.neoforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.neoforged.neoforge.common.CommonHooks.onLeftClickBlock(player, p_215120_, p_215122_, p_215121_); + if (event.isCanceled() || (!this.isCreative() && event.getResult() == net.neoforged.bus.api.Event.Result.DENY)) { + return; + } -+ if (!this.player.canReach(p_215120_, 1.5)) { // Vanilla check is eye-to-center distance < 6, so padding is 6 - 4.5 = 1.5 + if (!this.player.canInteractWithBlock(p_215120_, 1.0)) { this.debugLogging(p_215120_, false, p_215124_, "too far"); } else if (p_215120_.getY() >= p_215123_) { - this.player.connection.send(new ClientboundBlockUpdatePacket(p_215120_, this.level.getBlockState(p_215120_))); -@@ -154,6 +_,7 @@ +@@ -157,6 +_,7 @@ float f = 1.0F; BlockState blockstate = this.level.getBlockState(p_215120_); if (!blockstate.isAir()) { @@ -32,7 +30,7 @@ blockstate.attack(this.level, p_215120_, this.player); f = blockstate.getDestroyProgress(this.player, this.player.level(), p_215120_); } -@@ -221,7 +_,8 @@ +@@ -224,7 +_,8 @@ public boolean destroyBlock(BlockPos p_9281_) { BlockState blockstate1 = this.level.getBlockState(p_9281_); @@ -42,7 +40,7 @@ return false; } else { BlockEntity blockentity = this.level.getBlockEntity(p_9281_); -@@ -229,30 +_,44 @@ +@@ -232,30 +_,44 @@ if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { this.level.sendBlockUpdated(p_9281_, blockstate1, blockstate1, 3); return false; @@ -93,7 +91,7 @@ } public InteractionResult useItem(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) { -@@ -261,6 +_,8 @@ +@@ -264,6 +_,8 @@ } else if (p_9262_.getCooldowns().isOnCooldown(p_9264_.getItem())) { return InteractionResult.PASS; } else { @@ -102,7 +100,7 @@ int i = p_9264_.getCount(); int j = p_9264_.getDamageValue(); InteractionResultHolder interactionresultholder = p_9264_.use(p_9263_, p_9262_, p_9265_); -@@ -299,7 +_,10 @@ +@@ -295,7 +_,10 @@ BlockState blockstate = p_9267_.getBlockState(blockpos); if (!blockstate.getBlock().isEnabled(p_9267_.enabledFeatures())) { return InteractionResult.FAIL; @@ -114,7 +112,7 @@ MenuProvider menuprovider = blockstate.getMenuProvider(p_9267_, blockpos); if (menuprovider != null) { p_9266_.openMenu(menuprovider); -@@ -308,10 +_,15 @@ +@@ -304,10 +_,15 @@ return InteractionResult.PASS; } } else { @@ -129,10 +127,10 @@ ItemStack itemstack = p_9268_.copy(); - if (!flag1) { + if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { - InteractionResult interactionresult = blockstate.use(p_9267_, p_9266_, p_9269_, p_9270_); - if (interactionresult.consumesAction()) { + ItemInteractionResult iteminteractionresult = blockstate.useItemOn(p_9266_.getItemInHand(p_9269_), p_9267_, p_9266_, p_9269_, p_9270_); + if (iteminteractionresult.consumesAction()) { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(p_9266_, blockpos, itemstack); -@@ -319,8 +_,8 @@ +@@ -323,8 +_,8 @@ } } diff --git a/patches/net/minecraft/server/level/Ticket.java.patch b/patches/net/minecraft/server/level/Ticket.java.patch index 642b8d78be..4e9481d89b 100644 --- a/patches/net/minecraft/server/level/Ticket.java.patch +++ b/patches/net/minecraft/server/level/Ticket.java.patch @@ -15,29 +15,29 @@ } public int compareTo(Ticket p_9432_) { -@@ -32,18 +_,18 @@ - return false; +@@ -31,18 +_,18 @@ } else { - Ticket ticket = (Ticket)p_9439_; -- return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key); -+ return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key) && this.forceTicks == ticket.forceTicks; + return !(p_9439_ instanceof Ticket ticket) + ? false +- : this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key); ++ : this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key) && this.forceTicks == ticket.forceTicks; } } @Override public int hashCode() { - return Objects.hash(this.type, this.ticketLevel, this.key); -+ return Objects.hash(this.type, this.ticketLevel, this.key, forceTicks); ++ return Objects.hash(this.type, this.ticketLevel, this.key, this.forceTicks); } @Override public String toString() { - return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick; -+ return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick + " force ticks " + forceTicks; ++ return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick + " force ticks " + this.forceTicks; } public TicketType getType() { -@@ -61,5 +_,12 @@ +@@ -60,5 +_,12 @@ protected boolean timedOut(long p_9435_) { long i = this.type.timeout(); return i != 0L && p_9435_ - this.createdTick > i; diff --git a/patches/net/minecraft/server/level/WorldGenRegion.java.patch b/patches/net/minecraft/server/level/WorldGenRegion.java.patch index 7c12ce987a..7088fd0b6b 100644 --- a/patches/net/minecraft/server/level/WorldGenRegion.java.patch +++ b/patches/net/minecraft/server/level/WorldGenRegion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java -@@ -328,6 +_,7 @@ +@@ -325,6 +_,7 @@ @Override public boolean addFreshEntity(Entity p_9580_) { diff --git a/patches/net/minecraft/server/network/CommonListenerCookie.java.patch b/patches/net/minecraft/server/network/CommonListenerCookie.java.patch index 7a0a60af21..52c6459eda 100644 --- a/patches/net/minecraft/server/network/CommonListenerCookie.java.patch +++ b/patches/net/minecraft/server/network/CommonListenerCookie.java.patch @@ -1,20 +1,19 @@ --- a/net/minecraft/server/network/CommonListenerCookie.java +++ b/net/minecraft/server/network/CommonListenerCookie.java -@@ -3,7 +_,16 @@ +@@ -3,7 +_,15 @@ import com.mojang.authlib.GameProfile; import net.minecraft.server.level.ClientInformation; --public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation) { -+public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { -+ +-public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred) { ++public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { + /** -+ * @deprecated Use {@link #CommonListenerCookie(GameProfile, int, ClientInformation, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. ++ * @deprecated Use {@link #CommonListenerCookie(GameProfile, int, ClientInformation, boolean, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. + */ + @Deprecated -+ public CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation) { -+ this(gameProfile, latency, clientInformation, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); ++ public CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred) { ++ this(gameProfile, latency, clientInformation, transferred, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); + } + - public static CommonListenerCookie createInitial(GameProfile p_302024_) { - return new CommonListenerCookie(p_302024_, 0, ClientInformation.createDefault()); + public static CommonListenerCookie createInitial(GameProfile p_302024_, boolean p_320180_) { + return new CommonListenerCookie(p_302024_, 0, ClientInformation.createDefault(), p_320180_); } diff --git a/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch index 7e68fe5071..ec969565db 100644 --- a/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -109,7 +_,12 @@ +@@ -140,7 +_,12 @@ this.send(p_294278_, null); } @@ -10,10 +10,10 @@ + return; + } + - boolean flag = !this.suspendFlushingOnServerThread || !this.server.isSameThread(); - - try { -@@ -143,7 +_,36 @@ + if (p_295099_.isTerminal()) { + this.close(); + } +@@ -178,7 +_,36 @@ return this.latency; } @@ -26,7 +26,7 @@ + */ + @Deprecated protected CommonListenerCookie createCookie(ClientInformation p_301973_) { - return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_); + return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, this.transferred); + } + + /** @@ -37,7 +37,7 @@ + * @return The cookie. + */ + protected CommonListenerCookie createCookie(ClientInformation p_301973_, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { -+ return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, connectionType); ++ return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, this.transferred, connectionType); + } + + @Override diff --git a/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch index 7e5a1fe4fc..303a11b867 100644 --- a/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java -@@ -41,6 +_,8 @@ - @Nullable - private ConfigurationTask currentTask; +@@ -45,6 +_,8 @@ private ClientInformation clientInformation; + @Nullable + private SynchronizeRegistriesTask synchronizeRegistriesTask; + private net.neoforged.neoforge.network.connection.ConnectionType connectionType = net.neoforged.neoforge.network.connection.ConnectionType.VANILLA; + private boolean isHandlingModdedConfigurationPhase = false; public ServerConfigurationPacketListenerImpl(MinecraftServer p_294645_, Connection p_295787_, CommonListenerCookie p_302003_) { super(p_294645_, p_295787_, p_302003_); -@@ -65,6 +_,14 @@ +@@ -69,10 +_,20 @@ } public void startConfiguration() { @@ -23,8 +23,14 @@ + private void runConfiguration() { this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName()))); LayeredRegistryAccess layeredregistryaccess = this.server.registries(); + List list = this.server.getResourceManager().listPacks().flatMap(p_325637_ -> p_325637_.location().knownPackInfo().stream()).toList(); this.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(this.server.getWorldData().enabledFeatures()))); -@@ -86,6 +_,53 @@ ++ // Neo: we must sync the registries before vanilla sends tags in SynchronizeRegistriesTask! ++ net.neoforged.neoforge.network.ConfigurationInitialization.configureEarlyTasks(this, this.configurationTasks::add); + this.synchronizeRegistriesTask = new SynchronizeRegistriesTask(list, layeredregistryaccess); + this.configurationTasks.add(this.synchronizeRegistriesTask); + this.addOptionalTasks(); +@@ -87,6 +_,60 @@ private void addOptionalTasks() { this.server.getServerResourcePack().ifPresent(p_296496_ -> this.configurationTasks.add(new ServerResourcePackConfigurationTask(p_296496_))); @@ -56,9 +62,16 @@ + ); + return; + } ++ if (p_294276_.payload().type().id().getNamespace().equals("minecraft")) { ++ // Vanilla clients send minecraft:brand packets. ++ super.handleCustomPayload(p_294276_); ++ return; ++ } + -+ if (!isHandlingModdedConfigurationPhase) { ++ // Special case our registry sync completed payload because it runs before the modded configuration phase. ++ if (!isHandlingModdedConfigurationPhase && !(p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.FrozenRegistrySyncCompletedPayload)) { + super.handleCustomPayload(p_294276_); ++ LOGGER.warn("Ignoring unexpected custom payload received outside of the modded configuration phase: {}", p_294276_.payload().type().id()); + return; + } + @@ -78,28 +91,29 @@ } @Override -@@ -103,6 +_,11 @@ - - @Override - public void handleConfigurationFinished(ServerboundFinishConfigurationPacket p_294283_) { +@@ -118,6 +_,12 @@ + PacketUtils.ensureRunningOnSameThread(p_294283_, this, this.server); + this.finishCurrentTask(JoinWorldTask.TYPE); + this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()))); ++ // Packets can only be sent after the outbound protocol is set up again + if (this.connectionType == net.neoforged.neoforge.network.connection.ConnectionType.OTHER) { + //We need to also initialize this here, as the client may have sent the packet before we have finished our configuration. + net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedConnectionDetectedAtServer(this, java.util.Set.of(), java.util.Set.of()); + } + net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onConfigurationFinished(this); - this.connection.suspendInboundAfterProtocolChange(); - PacketUtils.ensureRunningOnSameThread(p_294283_, this, this.server); - this.finishCurrentTask(JoinWorldTask.TYPE); -@@ -121,7 +_,7 @@ + + try { + PlayerList playerlist = this.server.getPlayerList(); +@@ -133,7 +_,7 @@ } ServerPlayer serverplayer = playerlist.getPlayerForLogin(this.gameProfile, this.clientInformation); - playerlist.placeNewPlayer(this.connection, serverplayer, this.createCookie(this.clientInformation)); + playerlist.placeNewPlayer(this.connection, serverplayer, this.createCookie(this.clientInformation, this.connectionType)); - this.connection.resumeInboundAfterProtocolChange(); } catch (Exception exception) { LOGGER.error("Couldn't place player in world", (Throwable)exception); -@@ -155,5 +_,19 @@ + this.connection.send(new ClientboundDisconnectPacket(DISCONNECT_REASON_INVALID_DATA)); +@@ -166,5 +_,19 @@ this.currentTask = null; this.startNextTask(); } diff --git a/patches/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/net/minecraft/server/network/ServerConnectionListener.java.patch index 1a375ea705..db197d541f 100644 --- a/patches/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -21,15 +21,15 @@ public void startTcpServerListener(@Nullable InetAddress p_9712_, int p_9713_) throws IOException { + if (p_9712_ == null) p_9712_ = new java.net.InetSocketAddress(p_9713_).getAddress(); + net.neoforged.neoforge.network.DualStackUtils.checkIPv6(p_9712_); - synchronized(this.channels) { + synchronized (this.channels) { Class oclass; EventLoopGroup eventloopgroup; -@@ -94,7 +_,7 @@ - } - - ChannelPipeline channelpipeline = p_9729_.pipeline() -- .addLast("timeout", new ReadTimeoutHandler(30)) -+ .addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)) - .addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); - Connection.configureSerialization(channelpipeline, PacketFlow.SERVERBOUND, null); - int i = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); +@@ -86,7 +_,7 @@ + } catch (ChannelException channelexception) { + } + +- ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)); ++ ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)); + if (ServerConnectionListener.this.server.repliesToStatus()) { + channelpipeline.addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); + } diff --git a/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 976dee8343..355ce538a2 100644 --- a/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,19 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -187,6 +_,12 @@ - ServerPlayerConnection, - TickablePacketListener { - static final Logger LOGGER = LogUtils.getLogger(); -+ /** -+ * Forge: Deprecated in favor of range/reach attributes. -+ * @see net.neoforged.neoforge.common.NeoForgeMod#BLOCK_REACH -+ * @see net.neoforged.neoforge.common.NeoForgeMod#ENTITY_REACH -+ */ -+ @Deprecated - public static final double MAX_INTERACTION_DISTANCE = Mth.square(6.0); - private static final int NO_BLOCK_UPDATES_TO_ACK = -1; - private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; -@@ -228,6 +_,7 @@ +@@ -235,6 +_,7 @@ private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); private final FutureChain chatMessageChain; private boolean waitingForSwitchToConfig; @@ -21,7 +8,7 @@ public ServerGamePacketListenerImpl(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_, CommonListenerCookie p_301978_) { super(p_9770_, p_9771_, p_301978_); -@@ -238,6 +_,7 @@ +@@ -244,6 +_,7 @@ p_9772_.getTextFilter().join(); this.signedMessageDecoder = SignedMessageChain.Decoder.unsigned(p_9772_.getUUID(), p_9770_::enforceSecureProfile); this.chatMessageChain = new FutureChain(p_9770_); @@ -29,7 +16,7 @@ } @Override -@@ -424,9 +_,11 @@ +@@ -439,9 +_,11 @@ } entity.absMoveTo(d3, d4, d5, f, f1); @@ -41,7 +28,7 @@ this.send(new ClientboundMoveVehiclePacket(entity)); return; } -@@ -445,6 +_,23 @@ +@@ -460,6 +_,23 @@ } } @@ -65,24 +52,16 @@ private boolean noBlocksAround(Entity p_9794_) { return p_9794_.level() .getBlockStates(p_9794_.getBoundingBox().inflate(0.0625).expandTowards(0.0, -0.55, 0.0)) -@@ -770,6 +_,7 @@ - if (compoundtag != null) { - itemstack1.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - - itemstack1.addTagElement("author", StringTag.valueOf(this.player.getName().getString())); - if (this.player.isTextFilteringEnabled()) { -@@ -952,7 +_,7 @@ - && !flag +@@ -935,7 +_,7 @@ + && !flag1 && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR && !this.server.isFlightAllowed() - && !this.player.getAbilities().mayfly + && !this.player.mayFly() && !this.player.hasEffect(MobEffects.LEVITATION) - && !this.player.isFallFlying() - && !this.player.isAutoSpinAttack() -@@ -1028,8 +_,10 @@ + && !flag + && !flag3 +@@ -1018,8 +_,10 @@ case SWAP_ITEM_WITH_OFFHAND: if (!this.player.isSpectator()) { ItemStack itemstack = this.player.getItemInHand(InteractionHand.OFF_HAND); @@ -95,7 +74,7 @@ this.player.stopUsingItem(); } -@@ -1057,7 +_,7 @@ +@@ -1047,7 +_,7 @@ .handleBlockBreakAction( blockpos, serverboundplayeractionpacket$action, p_9889_.getDirection(), this.player.level().getMaxBuildHeight(), p_9889_.getSequence() ); @@ -104,7 +83,7 @@ return; default: throw new IllegalArgumentException("Invalid player action"); -@@ -1076,7 +_,7 @@ +@@ -1066,7 +_,7 @@ @Override public void handleUseItemOn(ServerboundUseItemOnPacket p_9930_) { PacketUtils.ensureRunningOnSameThread(p_9930_, this, this.player.serverLevel()); @@ -113,36 +92,18 @@ ServerLevel serverlevel = this.player.serverLevel(); InteractionHand interactionhand = p_9930_.getHand(); ItemStack itemstack = this.player.getItemInHand(interactionhand); -@@ -1085,7 +_,7 @@ - Vec3 vec3 = blockhitresult.getLocation(); - BlockPos blockpos = blockhitresult.getBlockPos(); - Vec3 vec31 = Vec3.atCenterOf(blockpos); -- if (!(this.player.getEyePosition().distanceToSqr(vec31) > MAX_INTERACTION_DISTANCE)) { -+ if (this.player.canReach(blockpos, 1.5)) { // Vanilla uses eye-to-center distance < 6, which implies a padding of 1.5 - Vec3 vec32 = vec3.subtract(vec31); - double d0 = 1.0000001; - if (Math.abs(vec32.x()) < 1.0000001 && Math.abs(vec32.y()) < 1.0000001 && Math.abs(vec32.z()) < 1.0000001) { -@@ -1225,8 +_,9 @@ - } - - CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -- Component component = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); -+ Component component = net.neoforged.neoforge.common.CommonHooks.getServerChatSubmittedDecorator().decorate(this.player, playerchatmessage.decoratedContent()); - this.chatMessageChain.append(completablefuture, p_300785_ -> { -+ if (component == null) return; // Forge: ServerChatEvent was canceled if this is null. - PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_300785_.mask()); - this.broadcastChatMessage(playerchatmessage1); - }); -@@ -1478,7 +_,7 @@ - } +@@ -1212,8 +_,9 @@ + } - AABB aabb = entity.getBoundingBox(); -- if (aabb.distanceToSqr(this.player.getEyePosition()) < MAX_INTERACTION_DISTANCE) { -+ if (this.player.canReach(entity, 3)) { // Vanilla padding is 3.0 (distSq < 6.0 * 6.0) - p_9866_.dispatch( - new ServerboundInteractPacket.Handler() { - private void performInteraction(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) { -@@ -1502,7 +_,11 @@ + CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); +- Component component = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); ++ Component component = net.neoforged.neoforge.common.CommonHooks.getServerChatSubmittedDecorator().decorate(this.player, playerchatmessage.decoratedContent()); + this.chatMessageChain.append(completablefuture, p_300785_ -> { ++ if (component == null) return; // Forge: ServerChatEvent was canceled if this is null. + PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_300785_.mask()); + this.broadcastChatMessage(playerchatmessage1); + }); +@@ -1540,7 +_,11 @@ @Override public void onInteraction(InteractionHand p_143682_, Vec3 p_143683_) { @@ -155,7 +116,7 @@ } @Override -@@ -1688,7 +_,7 @@ +@@ -1727,7 +_,7 @@ @Override public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket p_9887_) { PacketUtils.ensureRunningOnSameThread(p_9887_, this, this.player.serverLevel()); @@ -164,23 +125,21 @@ } @Override -@@ -1745,7 +_,7 @@ - throw new IllegalStateException("Client acknowledged config, but none was requested"); - } else { +@@ -1786,7 +_,7 @@ this.connection -- .setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation()))); -+ .setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation(), this.connectionType))); + .setupInboundProtocol( + ConfigurationProtocols.SERVERBOUND, +- new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())) ++ new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation(), this.connectionType)) + ); } } +@@ -1820,7 +_,27 @@ + } -@@ -1779,5 +_,33 @@ - @FunctionalInterface - interface EntityInteraction { - InteractionResult run(ServerPlayer p_143695_, Entity p_143696_, InteractionHand p_143697_); -+ } -+ -+ @Override -+ public void handleCustomPayload(net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket p_294276_) { + @Override +- public void handleCustomPayload(ServerboundCustomPayloadPacket p_333887_) { ++ public void handleCustomPayload(ServerboundCustomPayloadPacket p_294276_) { + if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { + this.connectionType = this.connectionType.withMinecraftRegisterPayload(); + net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftRegister(this, minecraftRegisterPayload.newChannels()); @@ -201,6 +160,13 @@ + net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtServer( + this, p_294276_ + ); + } + + @Override +@@ -1831,5 +_,9 @@ + @FunctionalInterface + interface EntityInteraction { + InteractionResult run(ServerPlayer p_143695_, Entity p_143696_, InteractionHand p_143697_); + } + + public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { diff --git a/patches/net/minecraft/server/packs/AbstractPackResources.java.patch b/patches/net/minecraft/server/packs/AbstractPackResources.java.patch index a40bb252b0..226fe4b923 100644 --- a/patches/net/minecraft/server/packs/AbstractPackResources.java.patch +++ b/patches/net/minecraft/server/packs/AbstractPackResources.java.patch @@ -1,13 +1,12 @@ --- a/net/minecraft/server/packs/AbstractPackResources.java +++ b/net/minecraft/server/packs/AbstractPackResources.java -@@ -70,4 +_,10 @@ - public boolean isBuiltin() { - return this.isBuiltin; +@@ -63,4 +_,9 @@ + public PackLocationInfo location() { + return this.location; } + + @Override -+ public String toString() -+ { -+ return String.format(java.util.Locale.ROOT, "%s: %s", getClass().getName(), this.name); ++ public String toString() { ++ return String.format(java.util.Locale.ROOT, "%s: %s", getClass().getName(), location.id()); + } } diff --git a/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch b/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch index 6c47a12d1a..2e54cc8665 100644 --- a/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch +++ b/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/OverlayMetadataSection.java +++ b/net/minecraft/server/packs/OverlayMetadataSection.java -@@ -13,7 +_,7 @@ +@@ -12,7 +_,7 @@ public record OverlayMetadataSection(List overlays) { private static final Pattern DIR_VALIDATOR = Pattern.compile("[-_a-zA-Z0-9.]+"); private static final Codec CODEC = RecordCodecBuilder.create( diff --git a/patches/net/minecraft/server/packs/PackResources.java.patch b/patches/net/minecraft/server/packs/PackResources.java.patch index 296632d3be..9ad60847cd 100644 --- a/patches/net/minecraft/server/packs/PackResources.java.patch +++ b/patches/net/minecraft/server/packs/PackResources.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/packs/PackResources.java +++ b/net/minecraft/server/packs/PackResources.java -@@ -9,7 +_,7 @@ - import net.minecraft.server.packs.metadata.MetadataSectionSerializer; +@@ -11,7 +_,7 @@ + import net.minecraft.server.packs.repository.KnownPack; import net.minecraft.server.packs.resources.IoSupplier; -public interface PackResources extends AutoCloseable { diff --git a/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch b/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch index 76317be154..e34e6e1a5a 100644 --- a/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch +++ b/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java +++ b/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java @@ -19,4 +_,8 @@ - .apply(p_304321_, PackMetadataSection::new) + .apply(p_337567_, PackMetadataSection::new) ); public static final MetadataSectionType TYPE = MetadataSectionType.fromCodec("pack", CODEC); + diff --git a/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch b/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch index 69c1b3332d..304892b0bf 100644 --- a/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch +++ b/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/server/packs/repository/BuiltInPackSource.java +++ b/net/minecraft/server/packs/repository/BuiltInPackSource.java -@@ -105,4 +_,18 @@ +@@ -106,4 +_,18 @@ } }; } + -+ public static Pack.ResourcesSupplier fromName(final Function onName) { ++ public static Pack.ResourcesSupplier fromName(final Function onName) { + return new Pack.ResourcesSupplier() { + @Override -+ public PackResources openPrimary(String p_294636_) { ++ public PackResources openPrimary(PackLocationInfo p_294636_) { + return onName.apply(p_294636_); + } + + @Override -+ public PackResources openFull(String p_251717_, Pack.Info p_294956_) { ++ public PackResources openFull(PackLocationInfo p_251717_, Pack.Metadata p_294956_) { + return onName.apply(p_251717_); + } + }; diff --git a/patches/net/minecraft/server/packs/repository/Pack.java.patch b/patches/net/minecraft/server/packs/repository/Pack.java.patch index bea5e8183e..4778f9100e 100644 --- a/patches/net/minecraft/server/packs/repository/Pack.java.patch +++ b/patches/net/minecraft/server/packs/repository/Pack.java.patch @@ -1,32 +1,22 @@ --- a/net/minecraft/server/packs/repository/Pack.java +++ b/net/minecraft/server/packs/repository/Pack.java -@@ -29,6 +_,8 @@ - private final Pack.Position defaultPosition; - private final boolean required; - private final boolean fixedPosition; +@@ -23,6 +_,8 @@ + private final Pack.ResourcesSupplier resources; + private final Pack.Metadata metadata; + private final PackSelectionConfig selectionConfig; + private final boolean hidden; // Neo: Allow packs to be hidden from the UI entirely + private final List children; // Neo: Allows packs to specify packs which will always be placed beneath them; must be hidden - private final PackSource packSource; @Nullable -@@ -69,6 +_,33 @@ - boolean p_249753_, - PackSource p_251608_ - ) { -+ this(p_252218_, p_248829_, p_249377_, p_251718_, p_250162_, p_251298_, p_249753_, p_251608_, List.of()); + public static Pack readMetaAndCreate(PackLocationInfo p_326065_, Pack.ResourcesSupplier p_252210_, PackType p_250595_, PackSelectionConfig p_326429_) { +@@ -32,6 +_,23 @@ + } + + public Pack(PackLocationInfo p_326123_, Pack.ResourcesSupplier p_249377_, Pack.Metadata p_326375_, PackSelectionConfig p_326282_) { ++ this(p_326123_, p_249377_, p_326375_, p_326282_, List.of()); + } + -+ private Pack( -+ String p_252218_, -+ boolean p_248829_, -+ Pack.ResourcesSupplier p_249377_, -+ Component p_251718_, -+ Pack.Info p_250162_, -+ Pack.Position p_251298_, -+ boolean p_249753_, -+ PackSource p_251608_, -+ List children -+ ) { ++ private Pack(PackLocationInfo p_326123_, Pack.ResourcesSupplier p_249377_, Pack.Metadata p_326375_, PackSelectionConfig p_326282_, List children) { + List flattenedChildren = new java.util.ArrayList<>(); + List remainingChildren = children; + // recursively flatten children @@ -39,26 +29,30 @@ + } + } + this.children = List.copyOf(flattenedChildren); -+ this.hidden = p_250162_.isHidden(); - this.id = p_252218_; ++ this.hidden = p_326375_.isHidden(); + this.location = p_326123_; this.resources = p_249377_; - this.title = p_251718_; -@@ -96,7 +_,7 @@ - PackCompatibility packcompatibility = PackCompatibility.forVersion(inclusiverange, p_294759_); + this.metadata = p_326375_; +@@ -55,7 +_,7 @@ + PackCompatibility packcompatibility = PackCompatibility.forVersion(inclusiverange, p_326341_); OverlayMetadataSection overlaymetadatasection = packresources.getMetadataSection(OverlayMetadataSection.TYPE); - List list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_294759_) : List.of(); -- pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list); -+ pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); + List list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_326341_) : List.of(); +- pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list); ++ pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); } - return pack$info; -@@ -172,6 +_,37 @@ - return this.packSource; + return pack$metadata; +@@ -132,6 +_,38 @@ + return this.location.source(); } -+ public boolean isHidden() { return hidden; } ++ public boolean isHidden() { ++ return hidden; ++ } + -+ public List getChildren() { return children; } ++ public List getChildren() { ++ return children; ++ } + + public java.util.stream.Stream streamSelfAndChildren() { + return java.util.stream.Stream.concat(java.util.stream.Stream.of(this), children.stream()); @@ -68,7 +62,7 @@ + * {@return a copy of the pack with the provided children in place of any children this pack currently has} + */ + public Pack withChildren(List children) { -+ return new Pack(this.id, this.required, this.resources, this.title, this.info, this.defaultPosition, this.fixedPosition, this.packSource, children); ++ return new Pack(this.location, this.resources, this.metadata, this.selectionConfig, children); + } + + /** @@ -76,26 +70,28 @@ + */ + public Pack hidden() { + return new Pack( -+ this.id, this.required, this.resources, this.title, -+ new Info( -+ this.info.description(), -+ info.compatibility(), -+ info.requestedFeatures(), -+ info.overlays(), -+ true -+ ), -+ this.defaultPosition, this.fixedPosition, this.packSource, this.children); ++ new PackLocationInfo(this.location.id(), this.location.title(), this.location.source(), this.location.knownPackInfo()), ++ this.resources, ++ new Metadata(this.metadata.description, this.metadata.compatibility, this.metadata.requestedFeatures, this.metadata.overlays, this.metadata.isHidden), ++ new PackSelectionConfig(this.selectionConfig.required(), this.selectionConfig.defaultPosition(), this.selectionConfig.fixedPosition()), ++ this.children ++ ); + } + @Override public boolean equals(Object p_10448_) { if (this == p_10448_) { -@@ -189,7 +_,7 @@ - return this.id.hashCode(); +@@ -146,7 +_,12 @@ + return this.location.hashCode(); } -- public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { -+ public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { +- public static record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { ++ public static record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { ++ /** @deprecated Neo: use {@link #Metadata(Component,PackCompatibility,FeatureFlagSet,List,boolean)} instead */ ++ @Deprecated ++ public Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { ++ this(description, compatibility, requestedFeatures, overlays, false); ++ } } public static enum Position { diff --git a/patches/net/minecraft/server/packs/repository/PackRepository.java.patch b/patches/net/minecraft/server/packs/repository/PackRepository.java.patch index 8b48bb78c1..2ba11c40f8 100644 --- a/patches/net/minecraft/server/packs/repository/PackRepository.java.patch +++ b/patches/net/minecraft/server/packs/repository/PackRepository.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/PackRepository.java +++ b/net/minecraft/server/packs/repository/PackRepository.java -@@ -23,7 +_,7 @@ +@@ -22,7 +_,7 @@ private List selected = ImmutableList.of(); public PackRepository(RepositorySource... p_251886_) { @@ -9,7 +9,7 @@ } public void reload() { -@@ -33,10 +_,13 @@ +@@ -32,10 +_,13 @@ } private Map discoverAvailable() { @@ -17,7 +17,7 @@ + // Neo: sort packs within a source by name, between sources according to source order + Map map = Maps.newLinkedHashMap(); - for(RepositorySource repositorysource : this.sources) { + for (RepositorySource repositorysource : this.sources) { - repositorysource.loadPacks(p_143903_ -> map.put(p_143903_.getId(), p_143903_)); + Map sourceMap = Maps.newTreeMap(); + repositorysource.loadPacks(p_143903_ -> sourceMap.put(p_143903_.getId(), p_143903_)); @@ -25,22 +25,22 @@ } return ImmutableMap.copyOf(map); -@@ -71,11 +_,12 @@ +@@ -70,11 +_,12 @@ } private List rebuildSelected(Collection p_10518_) { -- List list = this.getAvailablePacks(p_10518_).collect(Collectors.toList()); -+ List list = this.getAvailablePacks(p_10518_).flatMap(p -> Stream.concat(Stream.of(p), p.getChildren().stream())).collect(Collectors.toList()); +- List list = this.getAvailablePacks(p_10518_).collect(Util.toMutableList()); ++ List list = this.getAvailablePacks(p_10518_).flatMap(p -> Stream.concat(Stream.of(p), p.getChildren().stream())).collect(java.util.stream.Collectors.toList()); - for(Pack pack : this.available.values()) { + for (Pack pack : this.available.values()) { if (pack.isRequired() && !list.contains(pack)) { -- pack.getDefaultPosition().insert(list, pack, Functions.identity(), false); -+ int i = pack.getDefaultPosition().insert(list, pack, Functions.identity(), false); +- pack.getDefaultPosition().insert(list, pack, Pack::selectionConfig, false); ++ int i = pack.getDefaultPosition().insert(list, pack, Pack::selectionConfig, false); + list.addAll(i + 1, pack.getChildren()); } } -@@ -95,7 +_,7 @@ +@@ -94,7 +_,7 @@ } public Collection getSelectedIds() { @@ -49,7 +49,7 @@ } public FeatureFlagSet getRequestedFeatureFlags() { -@@ -109,6 +_,10 @@ +@@ -108,6 +_,10 @@ @Nullable public Pack getPack(String p_10508_) { return this.available.get(p_10508_); diff --git a/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch b/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch index 321df4c325..ec137e5e5d 100644 --- a/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch +++ b/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -64,7 +_,9 @@ +@@ -72,7 +_,9 @@ } public static PackRepository createPackRepository(Path p_251569_, DirectoryValidator p_295336_) { diff --git a/patches/net/minecraft/server/players/PlayerList.java.patch b/patches/net/minecraft/server/players/PlayerList.java.patch index e9f2695017..ff9fb342ea 100644 --- a/patches/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/net/minecraft/server/players/PlayerList.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -126,6 +_,7 @@ - private boolean allowCheatsForAllPlayers; +@@ -128,6 +_,7 @@ + private boolean allowCommandsForAllPlayers; private static final boolean ALLOW_LOGOUTIVATOR = false; private int sendAllPlayerInfoIn; + private final List playersView = java.util.Collections.unmodifiableList(players); public PlayerList(MinecraftServer p_203842_, LayeredRegistryAccess p_251844_, PlayerDataStorage p_203844_, int p_203845_) { this.server = p_203842_; -@@ -194,6 +_,7 @@ +@@ -201,6 +_,7 @@ servergamepacketlistenerimpl.send(new ClientboundChangeDifficultyPacket(leveldata.getDifficulty(), leveldata.isDifficultyLocked())); servergamepacketlistenerimpl.send(new ClientboundPlayerAbilitiesPacket(p_11263_.getAbilities())); servergamepacketlistenerimpl.send(new ClientboundSetCarriedItemPacket(p_11263_.getInventory().selected)); @@ -16,7 +16,7 @@ servergamepacketlistenerimpl.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes())); this.sendPlayerPermissionLevel(p_11263_); p_11263_.getStats().markAllDirty(); -@@ -262,6 +_,7 @@ +@@ -269,6 +_,7 @@ } p_11263_.initInventoryMenu(); @@ -24,15 +24,15 @@ } protected void updateEntireScoreboard(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -328,6 +_,7 @@ - compoundtag1 = compoundtag; +@@ -334,6 +_,7 @@ + optional = Optional.of(compoundtag); p_11225_.load(compoundtag); LOGGER.debug("loading single player"); + net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_11225_, this.playerIo, p_11225_.getUUID().toString()); } else { - compoundtag1 = this.playerIo.load(p_11225_); + optional = this.playerIo.load(p_11225_); } -@@ -336,6 +_,7 @@ +@@ -342,6 +_,7 @@ } protected void save(ServerPlayer p_11277_) { @@ -40,7 +40,7 @@ this.playerIo.save(p_11277_); ServerStatsCounter serverstatscounter = this.stats.get(p_11277_.getUUID()); if (serverstatscounter != null) { -@@ -349,6 +_,7 @@ +@@ -355,6 +_,7 @@ } public void remove(ServerPlayer p_11287_) { @@ -48,7 +48,7 @@ ServerLevel serverlevel = p_11287_.serverLevel(); p_11287_.awardStat(Stats.LEAVE_GAME); this.save(p_11287_); -@@ -499,6 +_,7 @@ +@@ -505,6 +_,7 @@ this.playersByUUID.put(serverplayer.getUUID(), serverplayer); serverplayer.initInventoryMenu(); serverplayer.setHealth(serverplayer.getHealth()); @@ -56,7 +56,7 @@ if (flag2) { serverplayer.connection .send( -@@ -590,6 +_,7 @@ +@@ -596,6 +_,7 @@ } public void op(GameProfile p_11254_) { @@ -64,7 +64,7 @@ this.ops.add(new ServerOpListEntry(p_11254_, this.server.getOperatorUserPermissionLevel(), this.ops.canBypassPlayerLimit(p_11254_))); ServerPlayer serverplayer = this.getPlayer(p_11254_.getId()); if (serverplayer != null) { -@@ -598,6 +_,7 @@ +@@ -604,6 +_,7 @@ } public void deop(GameProfile p_11281_) { @@ -72,7 +72,7 @@ this.ops.remove(p_11281_); ServerPlayer serverplayer = this.getPlayer(p_11281_.getId()); if (serverplayer != null) { -@@ -816,13 +_,6 @@ +@@ -822,13 +_,6 @@ if (serverstatscounter == null) { File file1 = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile(); File file2 = new File(file1, uuid + ".json"); @@ -86,7 +86,7 @@ serverstatscounter = new ServerStatsCounter(this.server, file2); this.stats.put(uuid, serverstatscounter); -@@ -840,6 +_,8 @@ +@@ -846,6 +_,8 @@ this.advancements.put(uuid, playeradvancements); } @@ -95,7 +95,7 @@ playeradvancements.setPlayer(p_11297_); return playeradvancements; } -@@ -867,7 +_,7 @@ +@@ -873,7 +_,7 @@ } public List getPlayers() { @@ -104,7 +104,7 @@ } @Nullable -@@ -884,6 +_,7 @@ +@@ -890,6 +_,7 @@ playeradvancements.reload(this.server.getAdvancements()); } diff --git a/patches/net/minecraft/server/rcon/thread/RconClient.java.patch b/patches/net/minecraft/server/rcon/thread/RconClient.java.patch index 5a2dde166a..25199a3e9e 100644 --- a/patches/net/minecraft/server/rcon/thread/RconClient.java.patch +++ b/patches/net/minecraft/server/rcon/thread/RconClient.java.patch @@ -17,6 +17,6 @@ + this.send(p_11595_, 0, new String(java.util.Arrays.copyOfRange(whole, start, j+start), StandardCharsets.UTF_8)); + i -= j; + start += j; - } while(0 != i); + } while (0 != i); } diff --git a/patches/net/minecraft/stats/RecipeBookSettings.java.patch b/patches/net/minecraft/stats/RecipeBookSettings.java.patch index 9c29dfd150..4e0a5a31e1 100644 --- a/patches/net/minecraft/stats/RecipeBookSettings.java.patch +++ b/patches/net/minecraft/stats/RecipeBookSettings.java.patch @@ -20,7 +20,7 @@ private final Map states; private RecipeBookSettings(Map p_12730_) { -@@ -159,5 +_,9 @@ +@@ -158,5 +_,9 @@ public String toString() { return "[open=" + this.open + ", filtering=" + this.filtering + "]"; } diff --git a/patches/net/minecraft/tags/BlockTags.java.patch b/patches/net/minecraft/tags/BlockTags.java.patch index ef836380c8..0d9202d3c3 100644 --- a/patches/net/minecraft/tags/BlockTags.java.patch +++ b/patches/net/minecraft/tags/BlockTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -184,4 +_,8 @@ +@@ -194,4 +_,8 @@ private static TagKey create(String p_203847_) { return TagKey.create(Registries.BLOCK, new ResourceLocation(p_203847_)); } diff --git a/patches/net/minecraft/tags/ItemTags.java.patch b/patches/net/minecraft/tags/ItemTags.java.patch index cf0c2fd537..e9d95e3236 100644 --- a/patches/net/minecraft/tags/ItemTags.java.patch +++ b/patches/net/minecraft/tags/ItemTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -111,4 +_,8 @@ +@@ -160,4 +_,8 @@ private static TagKey bind(String p_203855_) { return TagKey.create(Registries.ITEM, new ResourceLocation(p_203855_)); } diff --git a/patches/net/minecraft/tags/TagLoader.java.patch b/patches/net/minecraft/tags/TagLoader.java.patch index 854abb284c..6e7fa7b78f 100644 --- a/patches/net/minecraft/tags/TagLoader.java.patch +++ b/patches/net/minecraft/tags/TagLoader.java.patch @@ -16,7 +16,7 @@ + var builder = new java.util.LinkedHashSet(); // Set must retain insertion order, some tag consumers rely on this being the case (see NeoForge#256) List list = new ArrayList<>(); - for(TagLoader.EntryWithSource tagloader$entrywithsource : p_215980_) { + for (TagLoader.EntryWithSource tagloader$entrywithsource : p_215980_) { - if (!tagloader$entrywithsource.entry().build(p_215979_, builder::add)) { + if (!tagloader$entrywithsource.entry().build(p_215979_, tagloader$entrywithsource.remove() ? builder::remove : builder::add)) { + if (!tagloader$entrywithsource.remove()) // Treat all removals as optional at runtime. If it was missing, then it could of never been added. @@ -29,7 +29,7 @@ } public Map> build(Map> p_203899_) { -@@ -102,7 +_,7 @@ +@@ -104,7 +_,7 @@ p_215977_ -> LOGGER.error( "Couldn't load tag {} as it is missing following references: {}", p_284682_, @@ -37,8 +37,8 @@ + p_215977_.stream().map(Objects::toString).collect(Collectors.joining("\n\t", "\n\t", "")) ) ) - .ifRight(p_216001_ -> map.put(p_284682_, p_216001_)) -@@ -114,7 +_,8 @@ + .ifRight(p_216001_ -> map.put(p_284682_, (Collection)p_216001_)) +@@ -116,7 +_,8 @@ return this.build(this.load(p_203901_)); } diff --git a/patches/net/minecraft/util/SpawnUtil.java.patch b/patches/net/minecraft/util/SpawnUtil.java.patch index e7ba1ae3ff..9b3eea749e 100644 --- a/patches/net/minecraft/util/SpawnUtil.java.patch +++ b/patches/net/minecraft/util/SpawnUtil.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/util/SpawnUtil.java @@ -35,7 +_,7 @@ && moveToPossibleSpawnPosition(p_216406_, p_216410_, blockpos$mutableblockpos, p_216411_)) { - T t = p_216404_.create(p_216406_, null, null, blockpos$mutableblockpos, p_216405_, false, false); + T t = (T)p_216404_.create(p_216406_, null, blockpos$mutableblockpos, p_216405_, false, false); if (t != null) { - if (t.checkSpawnRules(p_216406_, p_216405_) && t.checkSpawnObstruction(p_216406_)) { + if (net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(t, p_216406_, p_216405_)) { diff --git a/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch b/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch index 1129f3c268..7e41a6ccbb 100644 --- a/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch +++ b/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch @@ -1,29 +1,33 @@ --- a/net/minecraft/util/datafix/fixes/MobEffectIdFix.java +++ b/net/minecraft/util/datafix/fixes/MobEffectIdFix.java -@@ -88,8 +_,16 @@ +@@ -76,8 +_,20 @@ return updateMobEffectIdField(p_299001_, p_298420_, p_299001_, p_299179_); } + private static Dynamic updateMobEffectIdFieldConsideringForge(Dynamic p_298948_, String p_299234_, Dynamic p_298832_, String p_298487_, String forgeFieldId) { + final var forgeField = p_298948_.get(forgeFieldId).result(); + if (forgeField.isPresent()) { -+ return setFieldIfPresent((p_298948_ == p_298832_ ? p_298948_.remove(forgeFieldId) : p_298832_), p_298487_, forgeField); -+ } ++ return setFieldIfPresent((p_298948_ == p_298832_ ? p_298948_.remove(forgeFieldId) : p_298832_), p_298487_, forgeField); ++ } + return updateMobEffectIdField(p_298948_, p_299234_, p_298832_, p_298487_); + } ++ ++ private static Dynamic setFieldIfPresent(Dynamic dynamic, String s, Optional> optional) { ++ return optional.isEmpty() ? dynamic : dynamic.set(s, optional.get()); ++ } + private static Dynamic updateMobEffectInstance(Dynamic p_298320_) { - p_298320_ = updateMobEffectIdField(p_298320_, "Id", "id"); + p_298320_ = updateMobEffectIdFieldConsideringForge(p_298320_, "Id", p_298320_, "id", "forge:id"); - p_298320_ = renameField(p_298320_, "Ambient", "ambient"); - p_298320_ = renameField(p_298320_, "Amplifier", "amplifier"); - p_298320_ = renameField(p_298320_, "Duration", "duration"); -@@ -109,7 +_,7 @@ + p_298320_ = p_298320_.renameField("Ambient", "ambient"); + p_298320_ = p_298320_.renameField("Amplifier", "amplifier"); + p_298320_ = p_298320_.renameField("Duration", "duration"); +@@ -96,7 +_,7 @@ } private static Dynamic updateSuspiciousStewEntry(Dynamic p_298902_, Dynamic p_299113_) { - p_299113_ = updateMobEffectIdField(p_298902_, "EffectId", p_299113_, "id"); + p_299113_ = updateMobEffectIdFieldConsideringForge(p_298902_, "EffectId", p_299113_, "id", "forge:effect_id"); Optional> optional = p_298902_.get("EffectDuration").result(); - return replaceField(p_299113_, "EffectDuration", "duration", optional); + return p_299113_.replaceField("EffectDuration", "duration", optional); } diff --git a/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch b/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch index 26c2259db0..f1ca147082 100644 --- a/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch +++ b/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java +++ b/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java -@@ -177,7 +_,10 @@ - private Dynamic findUpdatedStructureType(Pair, Dynamic> p_207724_, Dynamic p_207725_) { - String s = p_207724_.getFirst().asString("UNKNOWN").toLowerCase(Locale.ROOT); +@@ -181,7 +_,11 @@ + private Dynamic findUpdatedStructureType(Dynamic p_207725_, Dynamic p_339616_) { + String s = p_207725_.asString("UNKNOWN").toLowerCase(Locale.ROOT); StructuresBecomeConfiguredFix.Conversion structuresbecomeconfiguredfix$conversion = CONVERSION_MAP.get(s); -+ if (structuresbecomeconfiguredfix$conversion == null) structuresbecomeconfiguredfix$conversion = net.neoforged.neoforge.common.CommonHooks.getStructureConversion(s); // Forge: hook for mods to register conversions through RegisterStructureConversionsEvent ++ if (structuresbecomeconfiguredfix$conversion == null) structuresbecomeconfiguredfix$conversion = net.neoforged.neoforge.common.CommonHooks.getStructureConversion(s); // Neo: hook for mods to register conversions through RegisterStructureConversionsEvent if (structuresbecomeconfiguredfix$conversion == null) { -+ if (net.neoforged.neoforge.common.CommonHooks.checkStructureNamespace(s)) return p_207724_.getSecond().createString(s); // Forge: pass-through structure IDs which have a non-"minecraft" namespace -+ if (true) return p_207724_.getSecond().createString("unknown." + s); // Forge: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data - throw new IllegalStateException("Found unknown structure: " + s); ++ // Porting 1.20.5 check if this is correct ++ if (net.neoforged.neoforge.common.CommonHooks.checkStructureNamespace(s)) return p_339616_.createString(s); // Neo: pass-through structure IDs which have a non-"minecraft" namespace ++ if (true) return p_339616_.createString("unknown." + s); // Neo: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data + return null; } else { - Dynamic dynamic = p_207724_.getSecond(); + String s1 = structuresbecomeconfiguredfix$conversion.fallback; diff --git a/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch b/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch index ec01fca6b8..39297f647a 100644 --- a/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch +++ b/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/thread/BlockableEventLoop.java +++ b/net/minecraft/util/thread/BlockableEventLoop.java -@@ -55,10 +_,15 @@ +@@ -56,10 +_,15 @@ } public CompletableFuture submitAsync(Runnable p_18690_) { @@ -17,4 +17,4 @@ + }); } - public CompletableFuture submit(Runnable p_18708_) { + @CheckReturnValue diff --git a/patches/net/minecraft/world/damagesource/CombatTracker.java.patch b/patches/net/minecraft/world/damagesource/CombatTracker.java.patch index dc2ed5c5b1..9559ffb29a 100644 --- a/patches/net/minecraft/world/damagesource/CombatTracker.java.patch +++ b/patches/net/minecraft/world/damagesource/CombatTracker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/damagesource/CombatTracker.java +++ b/net/minecraft/world/damagesource/CombatTracker.java -@@ -90,6 +_,11 @@ +@@ -91,6 +_,11 @@ DamageSource damagesource = combatentry.source(); CombatEntry combatentry1 = this.getMostSignificantFall(); DeathMessageType deathmessagetype = damagesource.type().deathMessageType(); diff --git a/patches/net/minecraft/world/damagesource/DamageEffects.java.patch b/patches/net/minecraft/world/damagesource/DamageEffects.java.patch index ef84a9cff7..e5e7b48a37 100644 --- a/patches/net/minecraft/world/damagesource/DamageEffects.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageEffects.java.patch @@ -14,7 +14,7 @@ FREEZING("freezing", SoundEvents.PLAYER_HURT_FREEZE); - public static final Codec CODEC = StringRepresentable.fromEnum(DamageEffects::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DamageEffects::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DamageEffects::values)); private final String id; + @Deprecated // Neo: Always set to null. Use the getter. private final SoundEvent sound; diff --git a/patches/net/minecraft/world/damagesource/DamageScaling.java.patch b/patches/net/minecraft/world/damagesource/DamageScaling.java.patch index 53cdba8e79..d6c682a170 100644 --- a/patches/net/minecraft/world/damagesource/DamageScaling.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageScaling.java.patch @@ -11,7 +11,7 @@ ALWAYS("always"); - public static final Codec CODEC = StringRepresentable.fromEnum(DamageScaling::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DamageScaling::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DamageScaling::values)); private final String id; private DamageScaling(String p_270266_) { diff --git a/patches/net/minecraft/world/damagesource/DamageSource.java.patch b/patches/net/minecraft/world/damagesource/DamageSource.java.patch index 3af1ab51bd..7703c72fb1 100644 --- a/patches/net/minecraft/world/damagesource/DamageSource.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageSource.java.patch @@ -9,5 +9,5 @@ + */ + @Deprecated(since = "1.20.1") public boolean scalesWithDifficulty() { - return switch(this.type().scaling()) { + return switch (this.type().scaling()) { case NEVER -> false; diff --git a/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch b/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch index 27b44bb662..3095a21a68 100644 --- a/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch +++ b/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch @@ -11,7 +11,7 @@ INTENTIONAL_GAME_DESIGN("intentional_game_design"); - public static final Codec CODEC = StringRepresentable.fromEnum(DeathMessageType::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DeathMessageType::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DeathMessageType::values)); private final String id; private DeathMessageType(String p_270201_) { diff --git a/patches/net/minecraft/world/effect/MobEffect.java.patch b/patches/net/minecraft/world/effect/MobEffect.java.patch index 9343c7f2b3..45952530cd 100644 --- a/patches/net/minecraft/world/effect/MobEffect.java.patch +++ b/patches/net/minecraft/world/effect/MobEffect.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/effect/MobEffect.java +++ b/net/minecraft/world/effect/MobEffect.java -@@ -18,7 +_,7 @@ - import net.minecraft.world.entity.ai.attributes.AttributeMap; - import net.minecraft.world.entity.ai.attributes.AttributeModifier; +@@ -30,7 +_,7 @@ + import net.minecraft.world.flag.FeatureFlagSet; + import net.minecraft.world.flag.FeatureFlags; --public class MobEffect { -+public class MobEffect implements net.neoforged.neoforge.common.extensions.IMobEffectExtension { - private final Map attributeModifiers = Maps.newHashMap(); +-public class MobEffect implements FeatureElement { ++public class MobEffect implements FeatureElement, net.neoforged.neoforge.common.extensions.IMobEffectExtension { + private static final int AMBIENT_ALPHA = Mth.floor(38.25F); + private final Map, MobEffect.AttributeTemplate> attributeModifiers = new Object2ObjectOpenHashMap<>(); private final MobEffectCategory category; - private final int color; -@@ -30,6 +_,7 @@ - protected MobEffect(MobEffectCategory p_19451_, int p_19452_) { - this.category = p_19451_; - this.color = p_19452_; +@@ -49,6 +_,7 @@ + int i = p_333517_.isAmbient() ? AMBIENT_ALPHA : 255; + return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.color(i, p_19452_)); + }; + initClient(); } - public Optional createFactorData() { -@@ -114,6 +_,31 @@ - public boolean isBeneficial() { - return this.category == MobEffectCategory.BENEFICIAL; + protected MobEffect(MobEffectCategory p_333963_, int p_333864_, ParticleOptions p_333716_) { +@@ -174,6 +_,28 @@ + public FeatureFlagSet requiredFeatures() { + return this.requiredFeatures; } + -+ // FORGE START ++ // NEO START + private Object effectRenderer; + + /* -+ DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE -+ Call RenderProperties.getEffectRenderer instead ++ * DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE ++ * Call RenderProperties.getEffectRenderer instead + */ + public Object getEffectRendererInternal() { + return effectRenderer; @@ -36,16 +36,13 @@ + private void initClient() { + // Minecraft instance isn't available in datagen, so don't call initializeClient if in datagen + if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { -+ initializeClient(properties -> { -+ this.effectRenderer = properties; -+ }); ++ initializeClient(properties -> this.effectRenderer = properties); + } + } + + public void initializeClient(java.util.function.Consumer consumer) { + } -+ // END FORGE -+ ++ // END NEO - @Deprecated - public Holder.Reference builtInRegistryHolder() { + static record AttributeTemplate(UUID id, double amount, AttributeModifier.Operation operation) { + public AttributeModifier create(String p_316465_, int p_316614_) { diff --git a/patches/net/minecraft/world/effect/MobEffectInstance.java.patch b/patches/net/minecraft/world/effect/MobEffectInstance.java.patch index 82196a218b..d2ce3a5057 100644 --- a/patches/net/minecraft/world/effect/MobEffectInstance.java.patch +++ b/patches/net/minecraft/world/effect/MobEffectInstance.java.patch @@ -1,14 +1,33 @@ --- a/net/minecraft/world/effect/MobEffectInstance.java +++ b/net/minecraft/world/effect/MobEffectInstance.java -@@ -78,6 +_,7 @@ - this.showIcon = p_216892_; - this.hiddenEffect = p_216893_; - this.factorData = p_216894_; -+ this.effect.fillEffectCures(this.cures, this); +@@ -86,6 +_,7 @@ + this.visible = p_19532_; + this.showIcon = p_19533_; + this.hiddenEffect = p_316863_; ++ this.effect.value().fillEffectCures(this.cures, this); } public MobEffectInstance(MobEffectInstance p_19543_) { -@@ -96,6 +_,8 @@ +@@ -103,6 +_,8 @@ + p_324529_.showIcon(), + p_324529_.hiddenEffect().map(p_323227_ -> new MobEffectInstance(p_324441_, p_323227_)).orElse(null) + ); ++ this.cures.clear(); ++ p_324529_.cures().ifPresent(this.cures::addAll); + } + + private MobEffectInstance.Details asDetails() { +@@ -112,7 +_,8 @@ + this.isAmbient(), + this.isVisible(), + this.showIcon(), +- Optional.ofNullable(this.hiddenEffect).map(MobEffectInstance::asDetails) ++ Optional.ofNullable(this.hiddenEffect).map(MobEffectInstance::asDetails), ++ Optional.of(this.getCures()).filter(cures -> !cures.isEmpty()) + ); + } + +@@ -130,6 +_,8 @@ this.ambient = p_19549_.ambient; this.visible = p_19549_.visible; this.showIcon = p_19549_.showIcon; @@ -17,46 +36,24 @@ } public boolean update(MobEffectInstance p_19559_) { -@@ -272,6 +_,7 @@ - public CompoundTag save(CompoundTag p_19556_) { - ResourceLocation resourcelocation = BuiltInRegistries.MOB_EFFECT.getKey(this.effect); - p_19556_.putString("id", resourcelocation.toString()); -+ net.neoforged.neoforge.common.CommonHooks.saveMobEffect(p_19556_, "neoforge:id", this.getEffect()); - this.writeDetailsTo(p_19556_); - return p_19556_; - } -@@ -295,6 +_,8 @@ - .resultOrPartial(LOGGER::error) - .ifPresent(p_216906_ -> p_19568_.put("factor_calculation_data", p_216906_)) - ); -+ -+ writeCures(p_19568_); - } - - @Nullable -@@ -332,7 +_,7 @@ - optional = Optional.empty(); - } - -- return new MobEffectInstance(p_19546_, j, Math.max(i, 0), flag, flag1, flag2, mobeffectinstance, optional); -+ return new MobEffectInstance(p_19546_, j, Math.max(i, 0), flag, flag1, flag2, mobeffectinstance, optional).readCures(p_19547_); - } - - public int compareTo(MobEffectInstance p_19566_) { -@@ -342,12 +_,42 @@ +@@ -326,11 +_,11 @@ .compareFalseFirst(this.isAmbient(), p_19566_.isAmbient()) .compareFalseFirst(this.isInfiniteDuration(), p_19566_.isInfiniteDuration()) .compare(this.getDuration(), p_19566_.getDuration()) -- .compare(this.getEffect().getColor(), p_19566_.getEffect().getColor()) -+ .compare(this.getEffect().getSortOrder(this), p_19566_.getEffect().getSortOrder(p_19566_)) +- .compare(this.getEffect().value().getColor(), p_19566_.getEffect().value().getColor()) ++ .compare(this.getEffect().value().getSortOrder(this), p_19566_.getEffect().value().getSortOrder(p_19566_)) .result() : ComparisonChain.start() .compare(this.isAmbient(), p_19566_.isAmbient()) -- .compare(this.getEffect().getColor(), p_19566_.getEffect().getColor()) -+ .compare(this.getEffect().getSortOrder(this), p_19566_.getEffect().getSortOrder(p_19566_)) +- .compare(this.getEffect().value().getColor(), p_19566_.getEffect().value().getColor()) ++ .compare(this.getEffect().value().getSortOrder(this), p_19566_.getEffect().value().getSortOrder(p_19566_)) .result(); -+ } -+ + } + +@@ -350,6 +_,15 @@ + this.blendState.setImmediate(this); + } + + private final java.util.Set cures = com.google.common.collect.Sets.newIdentityHashSet(); + + /** @@ -66,25 +63,52 @@ + return cures; + } + -+ private MobEffectInstance readCures(CompoundTag tag) { -+ cures.clear(); // Overwrite cures with ones stored in NBT, if any -+ if (tag.contains("neoforge:cures", Tag.TAG_LIST)) { -+ net.minecraft.nbt.ListTag list = tag.getList("neoforge:cures", Tag.TAG_STRING); -+ for (int i = 0; i < list.size(); i++) { -+ cures.add(net.neoforged.neoforge.common.EffectCure.get(list.getString(i))); -+ } -+ } -+ return this; -+ } -+ -+ private void writeCures(CompoundTag tag) { -+ if (!cures.isEmpty()) { -+ net.minecraft.nbt.ListTag list = new net.minecraft.nbt.ListTag(); -+ for (net.neoforged.neoforge.common.EffectCure cure : cures) { -+ list.add(net.minecraft.nbt.StringTag.valueOf(cure.name())); -+ } -+ tag.put("neoforge:cures", list); -+ } + static class BlendState { + private float factor; + private float factorPreviousFrame; +@@ -397,8 +_,7 @@ } - public static class FactorData { + static record Details( +- int amplifier, int duration, boolean ambient, boolean showParticles, boolean showIcon, Optional hiddenEffect +- ) { ++ int amplifier, int duration, boolean ambient, boolean showParticles, boolean showIcon, Optional hiddenEffect, Optional> cures) { + public static final MapCodec MAP_CODEC = MapCodec.recursive( + "MobEffectInstance.Details", + p_323465_ -> RecordCodecBuilder.mapCodec( +@@ -408,13 +_,14 @@ + Codec.BOOL.optionalFieldOf("ambient", Boolean.valueOf(false)).forGetter(MobEffectInstance.Details::ambient), + Codec.BOOL.optionalFieldOf("show_particles", Boolean.valueOf(true)).forGetter(MobEffectInstance.Details::showParticles), + Codec.BOOL.optionalFieldOf("show_icon").forGetter(p_323788_ -> Optional.of(p_323788_.showIcon())), +- p_323465_.optionalFieldOf("hidden_effect").forGetter(MobEffectInstance.Details::hiddenEffect) ++ p_323465_.optionalFieldOf("hidden_effect").forGetter(MobEffectInstance.Details::hiddenEffect), ++ net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.setOf(net.neoforged.neoforge.common.EffectCure.CODEC).optionalFieldOf("neoforge:cures").forGetter(MobEffectInstance.Details::cures) + ) + .apply(p_324063_, MobEffectInstance.Details::create) + ) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.recursive( +- p_329990_ -> StreamCodec.composite( ++ p_329990_ -> net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs.composite( + ByteBufCodecs.VAR_INT, + MobEffectInstance.Details::amplifier, + ByteBufCodecs.VAR_INT, +@@ -427,14 +_,16 @@ + MobEffectInstance.Details::showIcon, + p_329990_.apply(ByteBufCodecs::optional), + MobEffectInstance.Details::hiddenEffect, ++ net.neoforged.neoforge.common.EffectCure.STREAM_CODEC.>apply(ByteBufCodecs.collection(java.util.HashSet::new)).apply(ByteBufCodecs::optional), ++ MobEffectInstance.Details::cures, + MobEffectInstance.Details::new + ) + ); + + private static MobEffectInstance.Details create( +- int p_323657_, int p_324205_, boolean p_324263_, boolean p_324000_, Optional p_323607_, Optional p_324604_ ++ int p_323657_, int p_324205_, boolean p_324263_, boolean p_324000_, Optional p_323607_, Optional p_324604_, Optional> cures + ) { +- return new MobEffectInstance.Details(p_323657_, p_324205_, p_324263_, p_324000_, p_323607_.orElse(p_324000_), p_324604_); ++ return new MobEffectInstance.Details(p_323657_, p_324205_, p_324263_, p_324000_, p_323607_.orElse(p_324000_), p_324604_, cures); + } + } + } diff --git a/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch b/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch index dc091ccb47..39db38e109 100644 --- a/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch +++ b/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/effect/PoisonMobEffect.java +++ b/net/minecraft/world/effect/PoisonMobEffect.java -@@ -11,7 +_,12 @@ - public void applyEffectTick(LivingEntity p_296276_, int p_296233_) { - super.applyEffectTick(p_296276_, p_296233_); +@@ -10,7 +_,12 @@ + @Override + public boolean applyEffectTick(LivingEntity p_296276_, int p_296233_) { if (p_296276_.getHealth() > 1.0F) { - p_296276_.hurt(p_296276_.damageSources().magic(), 1.0F); + // Neo: Replace DamageSources#magic() with neoforge:poison to allow differentiating poison damage. @@ -12,5 +12,5 @@ + var dType = dTypeReg.getHolder(net.neoforged.neoforge.common.NeoForgeMod.POISON_DAMAGE).orElse(dTypeReg.getHolderOrThrow(net.minecraft.world.damagesource.DamageTypes.MAGIC)); + p_296276_.hurt(new net.minecraft.world.damagesource.DamageSource(dType), 1.0F); } - } + return true; diff --git a/patches/net/minecraft/world/entity/Entity.java.patch b/patches/net/minecraft/world/entity/Entity.java.patch index b1643feb1e..fed6996757 100644 --- a/patches/net/minecraft/world/entity/Entity.java.patch +++ b/patches/net/minecraft/world/entity/Entity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -124,7 +_,7 @@ - import org.joml.Vector3f; +@@ -126,7 +_,7 @@ + import net.minecraft.world.scores.Team; import org.slf4j.Logger; --public abstract class Entity implements Nameable, EntityAccess, CommandSource, ScoreHolder { -+public abstract class Entity extends net.neoforged.neoforge.attachment.AttachmentHolder implements Nameable, EntityAccess, CommandSource, ScoreHolder, net.neoforged.neoforge.common.extensions.IEntityExtension { +-public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder { ++public abstract class Entity extends net.neoforged.neoforge.attachment.AttachmentHolder implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder, net.neoforged.neoforge.common.extensions.IEntityExtension { private static final Logger LOGGER = LogUtils.getLogger(); public static final String ID_TAG = "id"; public static final String PASSENGERS_TAG = "Passengers"; -@@ -145,6 +_,7 @@ +@@ -147,6 +_,7 @@ private static final double LAVA_SLOW_FLOW_SCALE = 0.0023333333333333335; public static final String UUID_TAG = "UUID"; private static double viewScale = 1.0; @@ -17,7 +17,7 @@ private final EntityType type; private int id = ENTITY_COUNTER.incrementAndGet(); public boolean blocksBuilding; -@@ -191,8 +_,10 @@ +@@ -192,8 +_,10 @@ public int tickCount; private int remainingFireTicks = -this.getFireImmuneTicks(); protected boolean wasTouchingWater; @@ -28,19 +28,19 @@ private final Set> fluidOnEyes = new HashSet<>(); public int invulnerableTime; protected boolean firstTick = true; -@@ -260,7 +_,10 @@ - this.entityData.define(DATA_TICKS_FROZEN, 0); - this.defineSynchedData(); +@@ -262,7 +_,10 @@ + this.defineSynchedData(synchedentitydata$builder); + this.entityData = synchedentitydata$builder.build(); this.setPos(0.0, 0.0, 0.0); -- this.eyeHeight = this.getEyeHeight(Pose.STANDING, this.dimensions); -+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.getEyeHeight(Pose.STANDING, this.dimensions)); +- this.eyeHeight = this.dimensions.eyeHeight(); ++ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.getEyeHeight(Pose.STANDING)); + this.dimensions = sizeEvent.getNewSize(); + this.eyeHeight = sizeEvent.getNewEyeHeight(); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.EntityEvent.EntityConstructing(this)); } public boolean isColliding(BlockPos p_20040_, BlockState p_20041_) { -@@ -468,7 +_,7 @@ +@@ -466,7 +_,7 @@ if (this.isInLava()) { this.lavaHurt(); @@ -49,16 +49,16 @@ } this.checkBelowWorld(); -@@ -675,7 +_,7 @@ +@@ -672,7 +_,7 @@ double d1 = vec3.x; double d2 = vec3.y; double d3 = vec3.z; -- this.flyDist += (float)(vec3.length() * 0.6); +- this.flyDist = this.flyDist + (float)(vec3.length() * 0.6); + this.flyDist = (float)((double)this.flyDist + vec3.length() * 0.6D); BlockPos blockpos1 = this.getOnPos(); BlockState blockstate1 = this.level().getBlockState(blockpos1); boolean flag1 = this.isStateClimbable(blockstate1); -@@ -719,16 +_,16 @@ +@@ -716,16 +_,16 @@ this.setRemainingFireTicks(-this.getFireImmuneTicks()); } @@ -78,7 +78,7 @@ } } } -@@ -814,9 +_,7 @@ +@@ -811,9 +_,7 @@ return blockpos; } else { BlockState blockstate = this.level().getBlockState(blockpos); @@ -89,25 +89,7 @@ ? blockpos.atY(Mth.floor(this.position.y - (double)p_216987_)) : blockpos; } -@@ -889,12 +_,13 @@ - boolean flag1 = p_20273_.y != vec3.y; - boolean flag2 = p_20273_.z != vec3.z; - boolean flag3 = this.onGround() || flag1 && p_20273_.y < 0.0; -- if (this.maxUpStep() > 0.0F && flag3 && (flag || flag2)) { -- Vec3 vec31 = collideBoundingBox(this, new Vec3(p_20273_.x, (double)this.maxUpStep(), p_20273_.z), aabb, this.level(), list); -+ float stepHeight = getStepHeight(); -+ if (stepHeight > 0.0F && flag3 && (flag || flag2)) { -+ Vec3 vec31 = collideBoundingBox(this, new Vec3(p_20273_.x, (double)stepHeight, p_20273_.z), aabb, this.level(), list); - Vec3 vec32 = collideBoundingBox( -- this, new Vec3(0.0, (double)this.maxUpStep(), 0.0), aabb.expandTowards(p_20273_.x, 0.0, p_20273_.z), this.level(), list -+ this, new Vec3(0.0D, (double)stepHeight, 0.0D), aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), this.level(), list - ); -- if (vec32.y < (double)this.maxUpStep()) { -+ if (vec32.y < (double)stepHeight) { - Vec3 vec33 = collideBoundingBox(this, new Vec3(p_20273_.x, 0.0, p_20273_.z), aabb.move(vec32), this.level(), list).add(vec32); - if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) { - vec31 = vec33; -@@ -1042,19 +_,19 @@ +@@ -1039,19 +_,19 @@ return !blockstate.is(BlockTags.INSIDE_STEP_SOUND_BLOCKS) && !blockstate.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS) ? p_278049_ : blockpos; } @@ -133,7 +115,7 @@ this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch()); } -@@ -1192,20 +_,23 @@ +@@ -1204,20 +_,23 @@ public void updateSwimming() { if (this.isSwimming()) { @@ -162,15 +144,15 @@ } void updateInWaterStateAndDoWaterCurrentPushing() { -@@ -1231,6 +_,7 @@ +@@ -1242,6 +_,7 @@ private void updateFluidOnEyes() { this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER); this.fluidOnEyes.clear(); + this.forgeFluidTypeOnEyes = net.neoforged.neoforge.common.NeoForgeMod.EMPTY_TYPE.value(); - double d0 = this.getEyeY() - 0.11111111F; - Entity entity = this.getVehicle(); - if (entity instanceof Boat boat && !boat.isUnderWater() && boat.getBoundingBox().maxY >= d0 && boat.getBoundingBox().minY <= d0) { -@@ -1241,7 +_,7 @@ + double d0 = this.getEyeY(); + if (this.getVehicle() instanceof Boat boat && !boat.isUnderWater() && boat.getBoundingBox().maxY >= d0 && boat.getBoundingBox().minY <= d0) { + return; +@@ -1251,7 +_,7 @@ FluidState fluidstate = this.level().getFluidState(blockpos); double d1 = (double)((float)blockpos.getY() + fluidstate.getHeight(this.level(), blockpos)); if (d1 > d0) { @@ -179,7 +161,7 @@ } } -@@ -1286,12 +_,13 @@ +@@ -1296,12 +_,13 @@ } public boolean canSpawnSprintParticle() { @@ -194,7 +176,7 @@ if (blockstate.getRenderShape() != RenderShape.INVISIBLE) { Vec3 vec3 = this.getDeltaMovement(); BlockPos blockpos1 = this.blockPosition(); -@@ -1305,16 +_,19 @@ +@@ -1315,16 +_,19 @@ d1 = Mth.clamp(d1, (double)blockpos.getZ(), (double)blockpos.getZ() + 1.0); } @@ -216,7 +198,7 @@ } public void moveRelative(float p_19921_, Vec3 p_19922_) { -@@ -1631,6 +_,8 @@ +@@ -1645,6 +_,8 @@ p_20241_.putBoolean("HasVisualFire", this.hasVisualFire); } @@ -225,28 +207,28 @@ if (!this.tags.isEmpty()) { ListTag listtag = new ListTag(); -@@ -1641,6 +_,10 @@ +@@ -1655,6 +_,10 @@ p_20241_.put("Tags", listtag); } -+ CompoundTag attachments = serializeAttachments(); ++ CompoundTag attachments = serializeAttachments(registryAccess()); + if (attachments != null) p_20241_.put(ATTACHMENTS_NBT_KEY, attachments); + if (persistentData != null) p_20241_.put("NeoForgeData", persistentData.copy()); + this.addAdditionalSaveData(p_20241_); if (this.isVehicle()) { ListTag listtag1 = new ListTag(); -@@ -1721,6 +_,9 @@ +@@ -1735,6 +_,9 @@ this.setGlowingTag(p_20259_.getBoolean("Glowing")); this.setTicksFrozen(p_20259_.getInt("TicksFrozen")); this.hasVisualFire = p_20259_.getBoolean("HasVisualFire"); + if (p_20259_.contains("NeoForgeData", 10)) persistentData = p_20259_.getCompound("NeoForgeData"); + if (p_20259_.contains("CanUpdate", 99)) this.canUpdate(p_20259_.getBoolean("CanUpdate")); -+ if (p_20259_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_20259_.getCompound(ATTACHMENTS_NBT_KEY)); ++ if (p_20259_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(registryAccess(), p_20259_.getCompound(ATTACHMENTS_NBT_KEY)); if (p_20259_.contains("Tags", 9)) { this.tags.clear(); ListTag listtag3 = p_20259_.getList("Tags", 8); -@@ -1805,6 +_,8 @@ +@@ -1819,6 +_,8 @@ } else { ItemEntity itementity = new ItemEntity(this.level(), this.getX(), this.getY() + (double)p_19986_, this.getZ(), p_19985_); itementity.setDefaultPickUpDelay(); @@ -255,7 +237,7 @@ this.level().addFreshEntity(itementity); return itementity; } -@@ -1851,6 +_,7 @@ +@@ -1865,6 +_,7 @@ public void rideTick() { this.setDeltaMovement(Vec3.ZERO); @@ -263,7 +245,7 @@ this.tick(); if (this.isPassenger()) { this.getVehicle().positionRider(this); -@@ -1908,6 +_,7 @@ +@@ -1923,6 +_,7 @@ } } @@ -271,7 +253,7 @@ if (p_19967_ || this.canRide(p_19966_) && p_19966_.canAddPassenger(this)) { if (this.isPassenger()) { this.stopRiding(); -@@ -1939,6 +_,7 @@ +@@ -1954,6 +_,7 @@ public void removeVehicle() { if (this.vehicle != null) { Entity entity = this.vehicle; @@ -279,7 +261,7 @@ this.vehicle = null; entity.removePassenger(this); } -@@ -1988,6 +_,8 @@ +@@ -2003,6 +_,8 @@ return this.passengers.isEmpty(); } @@ -288,7 +270,7 @@ protected boolean couldAcceptPassenger() { return true; } -@@ -2193,7 +_,7 @@ +@@ -2192,7 +_,7 @@ } public boolean isVisuallyCrawling() { @@ -297,8 +279,8 @@ } public void setSwimming(boolean p_20283_) { -@@ -2302,7 +_,7 @@ - this.setSecondsOnFire(8); +@@ -2301,7 +_,7 @@ + this.igniteForSeconds(8); } - this.hurt(this.damageSources().lightningBolt(), 5.0F); @@ -306,7 +288,7 @@ } public void onAboveBubbleCol(boolean p_20313_) { -@@ -2397,7 +_,7 @@ +@@ -2396,7 +_,7 @@ } protected Component getTypeName() { @@ -315,7 +297,7 @@ } public boolean is(Entity p_20356_) { -@@ -2480,14 +_,20 @@ +@@ -2479,14 +_,20 @@ @Nullable public Entity changeDimension(ServerLevel p_20118_) { @@ -337,7 +319,7 @@ this.level().getProfiler().popPush("reloading"); Entity entity = this.getType().create(p_20118_); if (entity != null) { -@@ -2495,17 +_,19 @@ +@@ -2494,17 +_,19 @@ entity.moveTo(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z, portalinfo.yRot, entity.getXRot()); entity.setDeltaMovement(portalinfo.speed); p_20118_.addDuringTeleport(entity); @@ -359,7 +341,7 @@ } } else { return null; -@@ -2641,6 +_,7 @@ +@@ -2639,6 +_,7 @@ return this.stringUUID; } @@ -367,31 +349,30 @@ public boolean isPushedByFluid() { return true; } -@@ -2764,8 +_,10 @@ +@@ -2764,6 +_,8 @@ EntityDimensions entitydimensions = this.dimensions; Pose pose = this.getPose(); EntityDimensions entitydimensions1 = this.getDimensions(pose); -+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1, this.getEyeHeight(pose, entitydimensions1)); ++ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1, entitydimensions1.eyeHeight()); // Porting 1.20.5 check if this still works + entitydimensions1 = sizeEvent.getNewSize(); this.dimensions = entitydimensions1; -- this.eyeHeight = this.getEyeHeight(pose, entitydimensions1); -+ this.eyeHeight = sizeEvent.getNewEyeHeight(); + this.eyeHeight = entitydimensions1.eyeHeight(); this.reapplyPosition(); - boolean flag = (double)entitydimensions1.width <= 4.0 && (double)entitydimensions1.height <= 4.0; - if (!this.level().isClientSide -@@ -2778,9 +_,10 @@ - double d0 = (double)Math.max(0.0F, entitydimensions1.width - entitydimensions.width) + 1.0E-6; - double d1 = (double)Math.max(0.0F, entitydimensions1.height - entitydimensions.height) + 1.0E-6; +@@ -2778,11 +_,12 @@ + double d0 = (double)Math.max(0.0F, entitydimensions1.width() - entitydimensions.width()) + 1.0E-6; + double d1 = (double)Math.max(0.0F, entitydimensions1.height() - entitydimensions.height()) + 1.0E-6; VoxelShape voxelshape = Shapes.create(AABB.ofSize(vec3, d0, d1, d0)); + EntityDimensions finalEntitydimensions = entitydimensions1; this.level() - .findFreePosition(this, voxelshape, vec3, (double)entitydimensions1.width, (double)entitydimensions1.height, (double)entitydimensions1.width) -- .ifPresent(p_185956_ -> this.setPos(p_185956_.add(0.0, (double)(-entitydimensions1.height) / 2.0, 0.0))); -+ .ifPresent(p_185956_ -> this.setPos(p_185956_.add(0.0, (double)(-finalEntitydimensions.height) / 2.0, 0.0))); + .findFreePosition( + this, voxelshape, vec3, (double)entitydimensions1.width(), (double)entitydimensions1.height(), (double)entitydimensions1.width() + ) +- .ifPresent(p_315932_ -> this.setPos(p_315932_.add(0.0, (double)(-entitydimensions1.height()) / 2.0, 0.0))); ++ .ifPresent(p_315932_ -> this.setPos(p_315932_.add(0.0, (double)(-finalEntitydimensions.height()) / 2.0, 0.0))); } } -@@ -3076,9 +_,17 @@ +@@ -3084,9 +_,17 @@ this.yRotO = this.getYRot(); } @@ -410,7 +391,7 @@ } else { AABB aabb = this.getBoundingBox().deflate(0.001); int i = Mth.floor(aabb.minX); -@@ -3093,25 +_,36 @@ +@@ -3101,25 +_,36 @@ Vec3 vec3 = Vec3.ZERO; int k1 = 0; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); @@ -421,9 +402,9 @@ + } + it.unimi.dsi.fastutil.objects.Object2ObjectMap interimCalcs = null; - for(int l1 = i; l1 < j; ++l1) { - for(int i2 = k; i2 < l; ++i2) { - for(int j2 = i1; j2 < j1; ++j2) { + for (int l1 = i; l1 < j; l1++) { + for (int i2 = k; i2 < l; i2++) { + for (int j2 = i1; j2 < j1; j2++) { blockpos$mutableblockpos.set(l1, i2, j2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(p_204032_)) { @@ -448,13 +429,13 @@ } - vec3 = vec3.add(vec31); -- ++k1; +- k1++; + interim.flowVector = interim.flowVector.add(vec31); + interim.blockCount++; } } } -@@ -3119,27 +_,30 @@ +@@ -3127,27 +_,30 @@ } } @@ -495,7 +476,7 @@ } } -@@ -3152,7 +_,10 @@ +@@ -3160,7 +_,10 @@ return !this.level().hasChunksAt(i, k, j, l); } @@ -506,7 +487,7 @@ return this.fluidHeight.getDouble(p_204037_); } -@@ -3289,6 +_,7 @@ +@@ -3297,6 +_,7 @@ this.levelCallback.onMove(); } @@ -514,35 +495,7 @@ } public void checkDespawn() { -@@ -3360,10 +_,27 @@ - return false; - } - -+ /** -+ * Gets the value of the legacy {@link #maxUpStep} field. Only used by players when the modified value causes issues. -+ * @deprecated Use {@link net.neoforged.neoforge.common.extensions.IEntityExtension#getStepHeight()} to get the real step height value. -+ */ -+ @Deprecated - public float maxUpStep() { - return this.maxUpStep; - } - -+ /** -+ * Changes the legacy {@link #maxUpStep} field. Only used by vanilla entities to improve maintainability. -+ *

-+ * For your own entities, you should change the default value of {@linkplain net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT} -+ * during attribute creation. -+ *

-+ * For modifying the step height of other entities, you should use {@link net.minecraft.world.entity.ai.attributes.AttributeModifier AttributeModifiers} for -+ * {@link net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT}. -+ * -+ * @deprecated Use attribute modifiers for the {@link net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT} attribute. -+ */ -+ @Deprecated - public void setMaxUpStep(float p_275672_) { - this.maxUpStep = p_275672_; - } -@@ -3419,6 +_,126 @@ +@@ -3424,6 +_,126 @@ public boolean mayInteract(Level p_146843_, BlockPos p_146844_) { return true; } @@ -608,10 +561,10 @@ + + // no AT because of overrides + /** -+ * Accessor method for {@link #getEyeHeight(Pose, EntityDimensions)} ++ * Accessor method for {@link #getEyeHeight(Pose)} + */ -+ public float getEyeHeightAccess(Pose pose, EntityDimensions size) { -+ return this.getEyeHeight(pose, size); ++ public float getEyeHeightAccess(Pose pose) { ++ return this.getEyeHeight(pose); + } + + protected Object2DoubleMap forgeFluidTypeHeight = new Object2DoubleArrayMap<>(net.neoforged.neoforge.fluids.FluidType.SIZE.get()); diff --git a/patches/net/minecraft/world/entity/EntityType.java.patch b/patches/net/minecraft/world/entity/EntityType.java.patch index 60d081b829..a1a2002bf8 100644 --- a/patches/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/net/minecraft/world/entity/EntityType.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -620,6 +_,10 @@ - private final EntityDimensions dimensions; +@@ -852,6 +_,10 @@ + private final float spawnDimensionsScale; private final FeatureFlagSet requiredFeatures; + private final java.util.function.Predicate> trackDeltasSupplier; @@ -11,12 +11,13 @@ private static EntityType register(String p_20635_, EntityType.Builder p_20636_) { return Registry.register(BuiltInRegistries.ENTITY_TYPE, p_20635_, p_20636_.build(p_20635_)); } -@@ -645,6 +_,24 @@ +@@ -878,6 +_,26 @@ int p_273451_, FeatureFlagSet p_273518_ ) { -+ this(p_273268_, p_272918_, p_273417_, p_273389_, p_273556_, p_272654_, p_273631_, p_272946_, p_272895_, p_273451_, p_273518_, EntityType::defaultTrackDeltasSupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier); ++ this(p_273268_, p_272918_, p_273417_, p_273389_, p_273556_, p_272654_, p_273631_, p_272946_, p_338404_, p_272895_, p_273451_, p_273518_, EntityType::defaultTrackDeltasSupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier); + } ++ + public EntityType( + EntityType.EntityFactory p_273268_, + MobCategory p_272918_, @@ -26,6 +27,7 @@ + boolean p_272654_, + ImmutableSet p_273631_, + EntityDimensions p_272946_, ++ float p_338404_, + int p_272895_, + int p_273451_, + FeatureFlagSet p_273518_, @@ -36,7 +38,7 @@ this.factory = p_273268_; this.category = p_272918_; this.canSpawnFarFromPlayer = p_272654_; -@@ -656,6 +_,9 @@ +@@ -890,6 +_,9 @@ this.clientTrackingRange = p_272895_; this.updateInterval = p_273451_; this.requiredFeatures = p_273518_; @@ -46,10 +48,10 @@ } @Nullable -@@ -760,6 +_,15 @@ +@@ -976,6 +_,15 @@ mob.yHeadRot = mob.getYRot(); mob.yBodyRot = mob.getYRot(); - mob.finalizeSpawn(p_262637_, p_262637_.getCurrentDifficultyAt(mob.blockPosition()), p_262666_, null, p_262687_); + mob.finalizeSpawn(p_262637_, p_262637_.getCurrentDifficultyAt(mob.blockPosition()), p_262666_, null); + + if (mob.isSpawnCancelled()) { + // Neo: Discard mob, spawn was cancelled @@ -62,7 +64,7 @@ mob.playAmbientSound(); } -@@ -958,14 +_,23 @@ +@@ -1167,14 +_,23 @@ } public int clientTrackingRange() { @@ -86,7 +88,7 @@ return this != PLAYER && this != LLAMA_SPIT && this != WITHER -@@ -1001,6 +_,8 @@ +@@ -1210,6 +_,8 @@ return this.builtInRegistryHolder; } @@ -95,8 +97,8 @@ public static class Builder { private final EntityType.EntityFactory factory; private final MobCategory category; -@@ -1014,6 +_,10 @@ - private EntityDimensions dimensions = EntityDimensions.scalable(0.6F, 1.8F); +@@ -1225,6 +_,10 @@ + private EntityAttachments.Builder attachments = EntityAttachments.builder(); private FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + private java.util.function.Predicate> velocityUpdateSupplier = EntityType::defaultTrackDeltasSupplier; @@ -106,7 +108,7 @@ private Builder(EntityType.EntityFactory p_20696_, MobCategory p_20697_) { this.factory = p_20696_; this.category = p_20697_; -@@ -1073,6 +_,21 @@ +@@ -1332,6 +_,21 @@ return this; } @@ -128,8 +130,8 @@ public EntityType build(String p_20713_) { if (this.serialize) { Util.fetchChoiceType(References.ENTITY_TREE, p_20713_); -@@ -1089,7 +_,10 @@ - this.dimensions, +@@ -1349,7 +_,10 @@ + this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, - this.requiredFeatures diff --git a/patches/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/net/minecraft/world/entity/ExperienceOrb.java.patch index 2bc78b7104..009bd98510 100644 --- a/patches/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java -@@ -103,7 +_,8 @@ +@@ -109,7 +_,8 @@ this.move(MoverType.SELF, this.getDeltaMovement()); float f = 0.98F; if (this.onGround()) { @@ -10,7 +10,7 @@ } this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.98, (double)f)); -@@ -219,6 +_,7 @@ +@@ -225,6 +_,7 @@ public void playerTouch(Player p_20792_) { if (!this.level().isClientSide) { if (p_20792_.takeXpDelay == 0) { @@ -18,7 +18,7 @@ p_20792_.takeXpDelay = 2; p_20792_.take(this, 1); int i = this.repairPlayerItems(p_20792_, this.value); -@@ -238,7 +_,7 @@ +@@ -244,7 +_,7 @@ Entry entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, p_147093_, ItemStack::isDamaged); if (entry != null) { ItemStack itemstack = entry.getValue(); diff --git a/patches/net/minecraft/world/entity/LightningBolt.java.patch b/patches/net/minecraft/world/entity/LightningBolt.java.patch index 56e8cc9bb6..f74497ef94 100644 --- a/patches/net/minecraft/world/entity/LightningBolt.java.patch +++ b/patches/net/minecraft/world/entity/LightningBolt.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LightningBolt.java +++ b/net/minecraft/world/entity/LightningBolt.java -@@ -37,6 +_,7 @@ +@@ -38,6 +_,7 @@ private ServerPlayer cause; private final Set hitEntities = Sets.newHashSet(); private int blocksSetOnFire; @@ -8,7 +8,7 @@ public LightningBolt(EntityType p_20865_, Level p_20866_) { super(p_20865_, p_20866_); -@@ -72,6 +_,14 @@ +@@ -73,6 +_,14 @@ } } @@ -23,10 +23,10 @@ @Override public void tick() { super.tick(); -@@ -150,6 +_,7 @@ +@@ -151,6 +_,7 @@ ); - for(Entity entity : list1) { + for (Entity entity : list1) { + if (!net.neoforged.neoforge.event.EventHooks.onEntityStruckByLightning(entity, this)) entity.thunderHit((ServerLevel)this.level(), this); } diff --git a/patches/net/minecraft/world/entity/LivingEntity.java.patch b/patches/net/minecraft/world/entity/LivingEntity.java.patch index 05608ae5db..6fe6f9f8d7 100644 --- a/patches/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -119,14 +_,16 @@ - import net.minecraft.world.scores.PlayerTeam; +@@ -126,7 +_,7 @@ + import net.minecraft.world.scores.Scoreboard; import org.slf4j.Logger; -public abstract class LivingEntity extends Entity implements Attackable { @@ -9,39 +9,28 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_ACTIVE_EFFECTS = "active_effects"; private static final UUID SPEED_MODIFIER_SOUL_SPEED_UUID = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); - private static final UUID SPEED_MODIFIER_POWDER_SNOW_UUID = UUID.fromString("1eaf83ff-7207-4596-b37a-d7a07b3ec4ce"); -+ private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); - private static final AttributeModifier SPEED_MODIFIER_SPRINTING = new AttributeModifier( - UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"), "Sprinting speed boost", 0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL - ); -+ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 - public static final int HAND_SLOTS = 2; - public static final int ARMOR_SLOTS = 4; - public static final int EQUIPMENT_SLOT_OFFSET = 98; -@@ -284,7 +_,11 @@ - .add(Attributes.MOVEMENT_SPEED) - .add(Attributes.ARMOR) - .add(Attributes.ARMOR_TOUGHNESS) -- .add(Attributes.MAX_ABSORPTION); -+ .add(Attributes.MAX_ABSORPTION) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.NAMETAG_DISTANCE.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_GRAVITY.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.STEP_HEIGHT.value()); +@@ -302,7 +_,9 @@ + .add(Attributes.GRAVITY) + .add(Attributes.SAFE_FALL_DISTANCE) + .add(Attributes.FALL_DAMAGE_MULTIPLIER) +- .add(Attributes.JUMP_STRENGTH); ++ .add(Attributes.JUMP_STRENGTH) ++ .add(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED) ++ .add(net.neoforged.neoforge.common.NeoForgeMod.NAMETAG_DISTANCE); } @Override -@@ -314,7 +_,8 @@ - float f = (float)Mth.ceil(this.fallDistance - 3.0F); - double d4 = Math.min((double)(0.2F + f / 15.0F), 2.5); - int i = (int)(150.0 * d4); -- ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_), d0, d1, d2, i, 0.0, 0.0, 0.0, 0.15F); -+ if (!p_20992_.addLandingEffects((ServerLevel) this.level(), p_20993_, p_20992_, this, i)) -+ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_).setPos(p_20993_), d0, d1, d2, i, 0.0D, 0.0D, 0.0D, (double)0.15F); +@@ -331,7 +_,8 @@ + float f = (float)Mth.ceil((double)this.fallDistance - d0); + double d5 = Math.min((double)(0.2F + f / 15.0F), 2.5); + int i = (int)(150.0 * d5); +- ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_), d1, d2, d3, i, 0.0, 0.0, 0.0, 0.15F); ++ if (!p_20992_.addLandingEffects((ServerLevel) this.level(), p_20993_, p_20992_, this, i)) ++ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_).setPos(p_20993_), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15F); + } } - super.checkFallDamage(p_20990_, p_20991_, p_20992_, p_20993_); -@@ -323,6 +_,7 @@ +@@ -341,6 +_,7 @@ } } @@ -49,7 +38,7 @@ public final boolean canBreatheUnderwater() { return this.getType().is(EntityTypeTags.CAN_BREATHE_UNDER_WATER); } -@@ -364,6 +_,9 @@ +@@ -382,6 +_,9 @@ } } @@ -59,7 +48,7 @@ if (this.isEyeInFluid(FluidTags.WATER) && !this.level().getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) { boolean flag1 = !this.canBreatheUnderwater() -@@ -402,7 +_,7 @@ +@@ -420,7 +_,7 @@ } } @@ -68,29 +57,24 @@ this.extinguishFire(); } -@@ -776,7 +_,7 @@ - MobEffect mobeffect = iterator.next(); - MobEffectInstance mobeffectinstance = this.activeEffects.get(mobeffect); +@@ -813,7 +_,7 @@ + Holder holder = iterator.next(); + MobEffectInstance mobeffectinstance = this.activeEffects.get(holder); if (!mobeffectinstance.tick(this, () -> this.onEffectUpdated(mobeffectinstance, true, null))) { - if (!this.level().isClientSide) { + if (!this.level().isClientSide && !net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Expired(this, mobeffectinstance)).isCanceled()) { iterator.remove(); this.onEffectRemoved(mobeffectinstance); } -@@ -834,8 +_,10 @@ - this.setInvisible(false); - } else { - Collection collection = this.activeEffects.values(); -- this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(collection)); -- this.entityData.set(DATA_EFFECT_COLOR_ID, PotionUtils.getColor(collection)); -+ net.neoforged.neoforge.event.entity.living.PotionColorCalculationEvent event = new net.neoforged.neoforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.getColor(collection), areAllEffectsAmbient(collection), collection); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); -+ this.entityData.set(DATA_EFFECT_AMBIENCE_ID, event.areParticlesHidden()); -+ this.entityData.set(DATA_EFFECT_COLOR_ID, event.getColor()); - this.setInvisible(this.hasEffect(MobEffects.INVISIBILITY)); - } +@@ -861,6 +_,7 @@ + .filter(MobEffectInstance::isVisible) + .map(MobEffectInstance::getParticleOptions) + .toList(); ++ // Porting 1.20.5 re-add or remove PotionColorCalculationEvent + this.entityData.set(DATA_EFFECT_PARTICLES, list); + this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(this.activeEffects.values())); } -@@ -874,6 +_,7 @@ +@@ -899,6 +_,7 @@ } } @@ -98,10 +82,10 @@ return d0; } -@@ -916,7 +_,9 @@ +@@ -940,7 +_,9 @@ boolean flag; - for(flag = false; iterator.hasNext(); flag = true) { + for (flag = false; iterator.hasNext(); flag = true) { - this.onEffectRemoved(iterator.next()); + MobEffectInstance effect = iterator.next(); + if(net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, effect, null)) continue; @@ -109,7 +93,7 @@ iterator.remove(); } -@@ -951,6 +_,7 @@ +@@ -975,6 +_,7 @@ } else { MobEffectInstance mobeffectinstance = this.activeEffects.get(p_147208_.getEffect()); boolean flag = false; @@ -117,25 +101,25 @@ if (mobeffectinstance == null) { this.activeEffects.put(p_147208_.getEffect(), p_147208_); this.onEffectAdded(p_147208_, p_147209_); -@@ -966,6 +_,9 @@ +@@ -991,6 +_,9 @@ } public boolean canBeAffected(MobEffectInstance p_21197_) { + net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable event = new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable(this, p_21197_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); + if (event.getResult() != net.neoforged.bus.api.Event.Result.DEFAULT) return event.getResult() == net.neoforged.bus.api.Event.Result.ALLOW; - if (this.getMobType() == MobType.UNDEAD) { - MobEffect mobeffect = p_21197_.getEffect(); - if (mobeffect == MobEffects.REGENERATION || mobeffect == MobEffects.POISON) { -@@ -997,6 +_,7 @@ + if (this.getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) { + return !p_21197_.is(MobEffects.INFESTED); + } else if (this.getType().is(EntityTypeTags.IMMUNE_TO_OOZING)) { +@@ -1024,6 +_,7 @@ } - public boolean removeEffect(MobEffect p_21196_) { -+ if (net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, p_21196_, null)) return false; - MobEffectInstance mobeffectinstance = this.removeEffectNoUpdate(p_21196_); + public boolean removeEffect(Holder p_316570_) { ++ if (net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, p_316570_, null)) return false; + MobEffectInstance mobeffectinstance = this.removeEffectNoUpdate(p_316570_); if (mobeffectinstance != null) { this.onEffectRemoved(mobeffectinstance); -@@ -1071,6 +_,8 @@ +@@ -1098,6 +_,8 @@ } public void heal(float p_21116_) { @@ -144,7 +128,7 @@ float f = this.getHealth(); if (f > 0.0F) { this.setHealth(f + p_21116_); -@@ -1091,6 +_,7 @@ +@@ -1118,6 +_,7 @@ @Override public boolean hurt(DamageSource p_21016_, float p_21017_) { @@ -152,7 +136,7 @@ if (this.isInvulnerableTo(p_21016_)) { return false; } else if (this.level().isClientSide) { -@@ -1109,9 +_,11 @@ +@@ -1136,14 +_,17 @@ boolean flag = false; float f1 = 0.0F; if (p_21017_ > 0.0F && this.isDamageSourceBlocked(p_21016_)) { @@ -164,11 +148,8 @@ + if(ev.shieldTakesDamage()) this.hurtCurrentlyUsedShield(p_21017_); + f1 = ev.getBlockedDamage(); + p_21017_ -= ev.getBlockedDamage(); - if (!p_21016_.is(DamageTypeTags.IS_PROJECTILE)) { - Entity entity = p_21016_.getDirectEntity(); - if (entity instanceof LivingEntity livingentity) { -@@ -1119,7 +_,8 @@ - } + if (!p_21016_.is(DamageTypeTags.IS_PROJECTILE) && p_21016_.getDirectEntity() instanceof LivingEntity livingentity) { + this.blockUsingShield(livingentity); } - flag = true; @@ -177,19 +158,19 @@ } if (p_21016_.is(DamageTypeTags.IS_FREEZING) && this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)) { -@@ -1158,9 +_,9 @@ - if (entity1 instanceof Player player1) { +@@ -1184,9 +_,9 @@ + if (entity instanceof Player player1) { this.lastHurtByPlayerTime = 100; this.lastHurtByPlayer = player1; -- } else if (entity1 instanceof Wolf wolf && wolf.isTame()) { -+ } else if (entity1 instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame()) { +- } else if (entity instanceof Wolf wolf && wolf.isTame()) { ++ } else if (entity instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame()) { this.lastHurtByPlayerTime = 100; -- LivingEntity livingentity2 = wolf.getOwner(); -+ LivingEntity livingentity2 = tamableAnimal.getOwner(); - if (livingentity2 instanceof Player player) { +- if (wolf.getOwner() instanceof Player player) { ++ if (tamableAnimal.getOwner() instanceof Player player) { this.lastHurtByPlayer = player; } else { -@@ -1217,7 +_,7 @@ + this.lastHurtByPlayer = null; +@@ -1245,7 +_,7 @@ if (this instanceof ServerPlayer) { CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer)this, p_21016_, f, p_21017_, flag); if (f1 > 0.0F && f1 < 3.4028235E37F) { @@ -198,16 +179,16 @@ } } -@@ -1245,7 +_,7 @@ +@@ -1273,7 +_,7 @@ - for(InteractionHand interactionhand : InteractionHand.values()) { + for (InteractionHand interactionhand : InteractionHand.values()) { ItemStack itemstack1 = this.getItemInHand(interactionhand); - if (itemstack1.is(Items.TOTEM_OF_UNDYING)) { + if (itemstack1.is(Items.TOTEM_OF_UNDYING) && net.neoforged.neoforge.common.CommonHooks.onLivingUseTotem(this, p_21263_, itemstack1, interactionhand)) { itemstack = itemstack1.copy(); itemstack1.shrink(1); break; -@@ -1254,13 +_,13 @@ +@@ -1282,13 +_,13 @@ if (itemstack != null) { if (this instanceof ServerPlayer serverplayer) { @@ -223,7 +204,7 @@ this.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); this.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); -@@ -1328,6 +_,7 @@ +@@ -1359,6 +_,7 @@ } public void die(DamageSource p_21014_) { @@ -231,7 +212,7 @@ if (!this.isRemoved() && !this.dead) { Entity entity = p_21014_.getEntity(); LivingEntity livingentity = this.getKillCredit(); -@@ -1364,7 +_,7 @@ +@@ -1394,7 +_,7 @@ if (!this.level().isClientSide) { boolean flag = false; if (p_21269_ instanceof WitherBoss) { @@ -240,7 +221,7 @@ BlockPos blockpos = this.blockPosition(); BlockState blockstate = Blocks.WITHER_ROSE.defaultBlockState(); if (this.level().getBlockState(blockpos).isAir() && blockstate.canSurvive(this.level(), blockpos)) { -@@ -1383,12 +_,9 @@ +@@ -1413,12 +_,9 @@ protected void dropAllDeathLoot(DamageSource p_21192_) { Entity entity = p_21192_.getEntity(); @@ -256,7 +237,7 @@ boolean flag = this.lastHurtByPlayerTime > 0; if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { -@@ -1398,6 +_,10 @@ +@@ -1428,6 +_,10 @@ this.dropEquipment(); this.dropExperience(); @@ -267,7 +248,7 @@ } protected void dropEquipment() { -@@ -1410,7 +_,8 @@ +@@ -1440,7 +_,8 @@ this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT) )) { @@ -277,7 +258,7 @@ } } -@@ -1444,6 +_,11 @@ +@@ -1474,6 +_,11 @@ } public void knockback(double p_147241_, double p_147242_, double p_147243_) { @@ -289,10 +270,10 @@ p_147241_ *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); if (!(p_147241_ <= 0.0)) { this.hasImpulse = true; -@@ -1515,15 +_,9 @@ +@@ -1545,15 +_,9 @@ } else { BlockPos blockpos = this.blockPosition(); - BlockState blockstate = this.getFeetBlockState(); + BlockState blockstate = this.getInBlockState(); - if (blockstate.is(BlockTags.CLIMBABLE)) { - this.lastClimbablePos = Optional.of(blockpos); - return true; @@ -308,7 +289,7 @@ } } -@@ -1545,6 +_,11 @@ +@@ -1584,6 +_,11 @@ @Override public boolean causeFallDamage(float p_147187_, float p_147188_, DamageSource p_147189_) { @@ -320,7 +301,7 @@ boolean flag = super.causeFallDamage(p_147187_, p_147188_, p_147189_); int i = this.calculateFallDamage(p_147187_, p_147188_); if (i > 0) { -@@ -1572,9 +_,10 @@ +@@ -1611,9 +_,10 @@ int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - 0.2F); int k = Mth.floor(this.getZ()); @@ -333,7 +314,7 @@ this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F); } } -@@ -1621,9 +_,9 @@ +@@ -1675,9 +_,9 @@ float f2 = f1 - p_21194_; if (f2 > 0.0F && f2 < 3.4028235E37F) { if (this instanceof ServerPlayer) { @@ -345,7 +326,7 @@ } } } -@@ -1645,6 +_,8 @@ +@@ -1699,6 +_,8 @@ protected void actuallyHurt(DamageSource p_21240_, float p_21241_) { if (!this.isInvulnerableTo(p_21240_)) { @@ -354,15 +335,15 @@ p_21241_ = this.getDamageAfterArmorAbsorb(p_21240_, p_21241_); p_21241_ = this.getDamageAfterMagicAbsorb(p_21240_, p_21241_); float f1 = Math.max(p_21241_ - this.getAbsorptionAmount(), 0.0F); -@@ -1657,6 +_,7 @@ - } +@@ -1708,6 +_,7 @@ + serverplayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f * 10.0F)); } + f1 = net.neoforged.neoforge.common.CommonHooks.onLivingDamage(this, p_21240_, f1); if (f1 != 0.0F) { this.getCombatTracker().recordDamage(p_21240_, f1); this.setHealth(this.getHealth() - f1); -@@ -1716,6 +_,8 @@ +@@ -1767,6 +_,8 @@ } public void swing(InteractionHand p_21012_, boolean p_21013_) { @@ -371,7 +352,7 @@ if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) { this.swingTime = -1; this.swinging = true; -@@ -1825,8 +_,10 @@ +@@ -1879,8 +_,10 @@ private void swapHandItems() { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.OFFHAND); @@ -384,11 +365,12 @@ } @Override -@@ -2018,14 +_,17 @@ - } +@@ -2077,15 +_,18 @@ + } - this.hasImpulse = true; -+ net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); + this.hasImpulse = true; ++ net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); + } } + @Deprecated // FORGE: use sinkInFluid instead @@ -400,23 +382,12 @@ + @Deprecated // FORGE: use jumpInFluid instead protected void jumpInLiquid(TagKey p_204043_) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.04F, 0.0)); -+ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F * this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()).getValue(), 0.0D)); ++ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F * this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED).getValue(), 0.0D)); } protected float getWaterSlowDown() { -@@ -2039,13 +_,18 @@ - public void travel(Vec3 p_21280_) { - if (this.isControlledByLocalInstance()) { - double d0 = 0.08; -+ AttributeInstance gravity = this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_GRAVITY.value()); - boolean flag = this.getDeltaMovement().y <= 0.0; - if (flag && this.hasEffect(MobEffects.SLOW_FALLING)) { -- d0 = 0.01; -+ if (!gravity.hasModifier(SLOW_FALLING)) gravity.addTransientModifier(SLOW_FALLING); -+ } else if (gravity.hasModifier(SLOW_FALLING)) { -+ gravity.removeModifier(SLOW_FALLING_ID); +@@ -2110,7 +_,8 @@ } -+ d0 = gravity.getValue(); FluidState fluidstate = this.level().getFluidState(this.blockPosition()); - if (this.isInWater() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate)) { @@ -425,15 +396,15 @@ double d9 = this.getY(); float f4 = this.isSprinting() ? 0.9F : this.getWaterSlowDown(); float f5 = 0.02F; -@@ -2067,6 +_,7 @@ +@@ -2132,6 +_,7 @@ f4 = 0.96F; } -+ f5 *= (float)this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()).getValue(); ++ f5 *= (float)this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED).getValue(); this.moveRelative(f5, p_21280_); this.move(MoverType.SELF, this.getDeltaMovement()); Vec3 vec36 = this.getDeltaMovement(); -@@ -2080,6 +_,7 @@ +@@ -2145,6 +_,7 @@ if (this.horizontalCollision && this.isFree(vec32.x, vec32.y + 0.6F - this.getY() + d9, vec32.z)) { this.setDeltaMovement(vec32.x, 0.3F, vec32.z); } @@ -441,7 +412,7 @@ } else if (this.isInLava() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate)) { double d8 = this.getY(); this.moveRelative(0.02F, p_21280_); -@@ -2142,7 +_,7 @@ +@@ -2207,7 +_,7 @@ } } else { BlockPos blockpos = this.getBlockPosBelowThatAffectsMyMovement(); @@ -450,16 +421,16 @@ float f3 = this.onGround() ? f2 * 0.91F : 0.91F; Vec3 vec35 = this.handleRelativeFrictionAndCalculateMovement(p_21280_, f2); double d2 = vec35.y; -@@ -2238,7 +_,7 @@ +@@ -2301,7 +_,7 @@ double d0 = Mth.clamp(p_21298_.x, -0.15F, 0.15F); double d1 = Mth.clamp(p_21298_.z, -0.15F, 0.15F); double d2 = Math.max(p_21298_.y, -0.15F); -- if (d2 < 0.0 && !this.getFeetBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { -+ if (d2 < 0.0D && !this.getFeetBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { +- if (d2 < 0.0 && !this.getInBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { ++ if (d2 < 0.0D && !this.getInBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { d2 = 0.0; } -@@ -2271,6 +_,7 @@ +@@ -2334,6 +_,7 @@ @Override public void tick() { @@ -467,15 +438,15 @@ super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2422,6 +_,7 @@ - +@@ -2484,6 +_,7 @@ + }; ItemStack itemstack1 = this.getItemBySlot(equipmentslot); if (this.equipmentHasChanged(itemstack, itemstack1)) { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslot, itemstack, itemstack1)); if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2566,6 +_,9 @@ +@@ -2643,6 +_,9 @@ this.level().getProfiler().push("jump"); if (this.jumping && this.isAffectedByFluids()) { double d3; @@ -485,7 +456,7 @@ if (this.isInLava()) { d3 = this.getFluidHeight(FluidTags.LAVA); } else { -@@ -2576,15 +_,17 @@ +@@ -2653,15 +_,17 @@ double d4 = this.getFluidJumpThreshold(); if (!flag || this.onGround() && !(d3 > d4)) { if (!this.isInLava() || this.onGround() && !(d3 > d4)) { @@ -505,16 +476,16 @@ } } else { this.noJumpDelay = 0; -@@ -2650,6 +_,8 @@ +@@ -2726,6 +_,8 @@ boolean flag = this.getSharedFlag(7); if (flag && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); + flag = itemstack.canElytraFly(this) && itemstack.elytraFlightTick(this, this.fallFlyTicks); -+ if (false) //Forge: Moved to ElytraItem ++ if (false) //Neo: Moved to ElytraItem if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack)) { flag = true; int i = this.fallFlyTicks + 1; -@@ -2910,8 +_,11 @@ +@@ -2983,8 +_,11 @@ private void updatingUsingItem() { if (this.isUsingItem()) { @@ -528,12 +499,12 @@ this.updateUsingItem(this.useItem); } else { this.stopUsingItem(); -@@ -2920,19 +_,22 @@ +@@ -2993,12 +_,15 @@ } protected void updateUsingItem(ItemStack p_147201_) { + if (!p_147201_.isEmpty()) -+ this.useItemRemaining = net.neoforged.neoforge.event.EventHooks.onItemUseTick(this, p_147201_, this.getUseItemRemainingTicks()); ++ this.useItemRemaining = net.neoforged.neoforge.event.EventHooks.onItemUseTick(this, p_147201_, this.getUseItemRemainingTicks()); + if (this.getUseItemRemainingTicks() > 0) p_147201_.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); if (this.shouldTriggerItemUseEffects()) { @@ -545,15 +516,7 @@ this.completeUsingItem(); } } - - private boolean shouldTriggerItemUseEffects() { - int i = this.getUseItemRemainingTicks(); -- FoodProperties foodproperties = this.useItem.getItem().getFoodProperties(); -+ FoodProperties foodproperties = this.useItem.getFoodProperties(this); - boolean flag = foodproperties != null && foodproperties.isFastFood(); - flag |= i <= this.useItem.getUseDuration() - 7; - return flag && i % 4 == 0; -@@ -2961,8 +_,10 @@ +@@ -3033,8 +_,10 @@ public void startUsingItem(InteractionHand p_21159_) { ItemStack itemstack = this.getItemInHand(p_21159_); if (!itemstack.isEmpty() && !this.isUsingItem()) { @@ -565,7 +528,7 @@ if (!this.level().isClientSide) { this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -3038,7 +_,8 @@ +@@ -3110,7 +_,8 @@ } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { this.triggerItemUseEffects(this.useItem, 16); @@ -575,7 +538,7 @@ if (itemstack != this.useItem) { this.setItemInHand(interactionhand, itemstack); } -@@ -3063,7 +_,11 @@ +@@ -3135,7 +_,11 @@ public void releaseUsingItem() { if (!this.useItem.isEmpty()) { @@ -587,7 +550,7 @@ if (this.useItem.useOnRelease()) { this.updatingUsingItem(); } -@@ -3073,6 +_,7 @@ +@@ -3145,6 +_,7 @@ } public void stopUsingItem() { @@ -595,16 +558,16 @@ if (!this.level().isClientSide) { boolean flag = this.isUsingItem(); this.setLivingEntityFlag(1, false); -@@ -3088,7 +_,7 @@ +@@ -3160,7 +_,7 @@ public boolean isBlocking() { if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); -- if (item.getUseAnimation(this.useItem) != UseAnim.BLOCK) { -+ if (!this.useItem.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { - return false; - } else { - return item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; -@@ -3229,8 +_,8 @@ +- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; ++ return !this.useItem.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK) ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; + } else { + return false; + } +@@ -3301,8 +_,8 @@ } BlockState blockstate = this.level().getBlockState(p_21141_); @@ -615,11 +578,11 @@ } this.setPose(Pose.SLEEPING); -@@ -3245,15 +_,17 @@ +@@ -3317,15 +_,17 @@ } private boolean checkBedExists() { -- return this.getSleepingPos().map(p_311581_ -> this.level().getBlockState(p_311581_).getBlock() instanceof BedBlock).orElse(false); +- return this.getSleepingPos().map(p_337701_ -> this.level().getBlockState(p_337701_).getBlock() instanceof BedBlock).orElse(false); + return this.getSleepingPos().map((p_289310_) -> { + return net.neoforged.neoforge.event.EventHooks.fireSleepingLocationCheck(this, p_289310_); + }).orElse(false); @@ -636,7 +599,7 @@ Vec3 vec31 = BedBlock.findStandUpPosition(this.getType(), this.level(), p_261435_, direction, this.getYRot()).orElseGet(() -> { BlockPos blockpos = p_261435_.above(); return new Vec3((double)blockpos.getX() + 0.5, (double)blockpos.getY() + 0.1, (double)blockpos.getZ() + 0.5); -@@ -3274,7 +_,9 @@ +@@ -3346,7 +_,9 @@ @Nullable public Direction getBedOrientation() { BlockPos blockpos = this.getSleepingPos().orElse(null); @@ -647,7 +610,7 @@ } @Override -@@ -3292,7 +_,7 @@ +@@ -3355,11 +_,11 @@ } public ItemStack getProjectile(ItemStack p_21272_) { @@ -656,17 +619,13 @@ } public ItemStack eat(Level p_21067_, ItemStack p_21068_) { -@@ -3321,7 +_,7 @@ - private void addEatEffect(ItemStack p_21064_, Level p_21065_, LivingEntity p_21066_) { - Item item = p_21064_.getItem(); - if (item.isEdible()) { -- for(Pair pair : item.getFoodProperties().getEffects()) { -+ for(Pair pair : p_21064_.getFoodProperties(this).getEffects()) { - if (!p_21065_.isClientSide && pair.getFirst() != null && p_21065_.random.nextFloat() < pair.getSecond()) { - p_21066_.addEffect(new MobEffectInstance(pair.getFirst())); - } -@@ -3356,6 +_,39 @@ - this.broadcastBreakEvent(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); +- FoodProperties foodproperties = p_21068_.get(DataComponents.FOOD); ++ FoodProperties foodproperties = p_21068_.getFoodProperties(this); + if (foodproperties != null) { + p_21067_.playSound( + null, +@@ -3410,6 +_,39 @@ + return p_320526_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; } + /* ==== FORGE START ==== */ @@ -705,7 +664,7 @@ @Override public AABB getBoundingBoxForCulling() { if (this.getItemBySlot(EquipmentSlot.HEAD).is(Items.DRAGON_HEAD)) { -@@ -3367,6 +_,8 @@ +@@ -3421,6 +_,8 @@ } public static EquipmentSlot getEquipmentSlotForItem(ItemStack p_147234_) { @@ -714,7 +673,7 @@ Equipable equipable = Equipable.get(p_147234_); return equipable != null ? equipable.getEquipmentSlot() : EquipmentSlot.MAINHAND; } -@@ -3442,9 +_,14 @@ +@@ -3498,7 +_,7 @@ } public boolean canDisableShield() { @@ -722,11 +681,4 @@ + return this.getMainHandItem().canDisableShield(this.useItem, this, this); } -+ /** -+ * Gets the value of the legacy {@link #maxUpStep} field. -+ * @deprecated Use {@link #getStepHeight()} to get the real step height value. -+ */ -+ @Deprecated @Override - public float maxUpStep() { - float f = super.maxUpStep(); diff --git a/patches/net/minecraft/world/entity/Mob.java.patch b/patches/net/minecraft/world/entity/Mob.java.patch index d8af2cb3ca..4dfe7f3de4 100644 --- a/patches/net/minecraft/world/entity/Mob.java.patch +++ b/patches/net/minecraft/world/entity/Mob.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -118,6 +_,9 @@ - private CompoundTag leashInfoTag; +@@ -133,6 +_,9 @@ + private Either delayedLeashInfo; private BlockPos restrictCenter = BlockPos.ZERO; private float restrictRadius = -1.0F; + @Nullable @@ -10,7 +10,7 @@ protected Mob(EntityType p_21368_, Level p_21369_) { super(p_21368_, p_21369_); -@@ -221,7 +_,10 @@ +@@ -239,7 +_,10 @@ } public void setTarget(@Nullable LivingEntity p_21544_) { @@ -22,7 +22,20 @@ } @Override -@@ -424,6 +_,9 @@ +@@ -351,6 +_,12 @@ + this.updateControlFlags(); + } + } ++ ++ // Neo: Animal armor tick patch ++ if (this.canWearBodyArmor()) { ++ ItemStack stack = this.getBodyArmorItem(); ++ if (isBodyArmorItem(stack)) stack.onAnimalArmorTick(level(), this); ++ } + } + + protected void updateControlFlags() { +@@ -444,6 +_,9 @@ if (this.isNoAi()) { p_21484_.putBoolean("NoAI", this.isNoAi()); } @@ -32,7 +45,7 @@ } @Override -@@ -477,6 +_,14 @@ +@@ -510,6 +_,14 @@ } this.setNoAi(p_21450_.getBoolean("NoAI")); @@ -47,7 +60,7 @@ } @Override -@@ -525,7 +_,7 @@ +@@ -565,7 +_,7 @@ && this.canPickUpLoot() && this.isAlive() && !this.dead @@ -55,8 +68,8 @@ + && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.level(), this)) { Vec3i vec3i = this.getPickupReach(); - for(ItemEntity itementity : this.level() -@@ -698,6 +_,14 @@ + for (ItemEntity itementity : this.level() +@@ -736,6 +_,14 @@ this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { Entity entity = this.level().getNearestPlayer(this, -1.0); @@ -71,7 +84,7 @@ if (entity != null) { double d0 = entity.distanceToSqr(this); int i = this.getType().getCategory().getDespawnDistance(); -@@ -1031,6 +_,16 @@ +@@ -1137,6 +_,14 @@ } } @@ -80,23 +93,21 @@ + * Overrides are allowed. Do not wrap super calls within override (as that will cause stack overflows).
+ * Vanilla calls are replaced with a transformer, and are not visible in source.
+ *

-+ * Be certain to either call super.finalizeSpawn or set the {@link #spawnType} field from within your override. -+ * @see {@link net.neoforged.neoforge.event.EventHooks#onFinalizeSpawn onFinalizeSpawn} for additional documentation. + */ + @Deprecated + @org.jetbrains.annotations.ApiStatus.OverrideOnly @Nullable - public SpawnGroupData finalizeSpawn( - ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_, @Nullable CompoundTag p_21438_ -@@ -1046,6 +_,7 @@ - this.setLeftHanded(false); - } - + public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_) { + RandomSource randomsource = p_21434_.getRandom(); +@@ -1145,6 +_,7 @@ + new AttributeModifier("Random spawn bonus", randomsource.triangle(0.0, 0.11485000000000001), AttributeModifier.Operation.ADD_MULTIPLIED_BASE) + ); + this.setLeftHanded(randomsource.nextFloat() < 0.05F); + this.spawnType = p_21436_; return p_21437_; } -@@ -1442,14 +_,24 @@ +@@ -1532,14 +_,24 @@ } @Override @@ -122,7 +133,7 @@ @VisibleForTesting public void removeFreeWill() { this.removeAllGoals(p_262562_ -> true); -@@ -1476,5 +_,40 @@ +@@ -1566,5 +_,40 @@ public ItemStack getPickResult() { SpawnEggItem spawneggitem = SpawnEggItem.byId(this.getType()); return spawneggitem == null ? null : new ItemStack(spawneggitem); diff --git a/patches/net/minecraft/world/entity/SpawnPlacements.java.patch b/patches/net/minecraft/world/entity/SpawnPlacements.java.patch index afb0d27ae9..c4572c7570 100644 --- a/patches/net/minecraft/world/entity/SpawnPlacements.java.patch +++ b/patches/net/minecraft/world/entity/SpawnPlacements.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java -@@ -45,6 +_,7 @@ +@@ -47,6 +_,7 @@ private static final Map, SpawnPlacements.Data> DATA_BY_TYPE = Maps.newHashMap(); - public static void register( + private static void register( + @Deprecated // FORGE: use SpawnPlacementRegisterEvent to register and modify spawn placements - EntityType p_21755_, SpawnPlacements.Type p_21756_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate p_21758_ + EntityType p_21755_, SpawnPlacementType p_321847_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate p_21758_ ) { - SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.put(p_21755_, new SpawnPlacements.Data(p_21757_, p_21756_, p_21758_)); -@@ -67,7 +_,8 @@ + SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.put(p_21755_, new SpawnPlacements.Data(p_21757_, p_321847_, p_21758_)); +@@ -73,7 +_,8 @@ EntityType p_217075_, ServerLevelAccessor p_217076_, MobSpawnType p_217077_, BlockPos p_217078_, RandomSource p_217079_ ) { SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.get(p_217075_); @@ -18,32 +18,10 @@ } static { -@@ -173,10 +_,35 @@ +@@ -168,5 +_,14 @@ + @FunctionalInterface + public interface SpawnPredicate { boolean test(EntityType p_217081_, ServerLevelAccessor p_217082_, MobSpawnType p_217083_, BlockPos p_217084_, RandomSource p_217085_); - } - -- public static enum Type { -+ public static enum Type implements net.neoforged.neoforge.common.IExtensibleEnum { - ON_GROUND, - IN_WATER, - NO_RESTRICTIONS, - IN_LAVA; -+ -+ public static Type create(String name, net.neoforged.neoforge.common.util.TriPredicate> predicate) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ private net.neoforged.neoforge.common.util.TriPredicate> predicate; -+ private Type() { this(null); } -+ private Type(net.neoforged.neoforge.common.util.TriPredicate> predicate) { -+ this.predicate = predicate; -+ } -+ -+ public boolean canSpawnAt(net.minecraft.world.level.LevelReader world, BlockPos pos, EntityType type) { -+ if (this == NO_RESTRICTIONS) return true; -+ if (predicate == null) return net.minecraft.world.level.NaturalSpawner.canSpawnAtBody(this, world, pos, type); -+ return predicate.test(world, pos, type); -+ } + } + + // ******* FORGE START. INTERNAL USE ONLY! ****** // diff --git a/patches/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/net/minecraft/world/entity/TamableAnimal.java.patch index b7554d2bd2..bb25362bc1 100644 --- a/patches/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/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 -@@ -194,11 +_,15 @@ +@@ -195,11 +_,15 @@ @Override public void die(DamageSource p_21809_) { diff --git a/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch b/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch index 752fc79750..f60c40d462 100644 --- a/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch +++ b/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch @@ -1,8 +1,11 @@ --- a/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java -@@ -69,6 +_,22 @@ +@@ -66,8 +_,24 @@ + } + public static class Builder { - private final Map builder = Maps.newHashMap(); +- private final ImmutableMap.Builder, AttributeInstance> builder = ImmutableMap.builder(); ++ private final Map, AttributeInstance> builder = new java.util.HashMap<>(); private boolean instanceFrozen; + private final java.util.List others = new java.util.ArrayList<>(); + @@ -17,17 +20,19 @@ + others.add(other); + } + -+ public boolean hasAttribute(Attribute attribute) { ++ public boolean hasAttribute(Holder attribute) { + return this.builder.containsKey(attribute); + } - private AttributeInstance create(Attribute p_22275_) { - AttributeInstance attributeinstance = new AttributeInstance( -@@ -98,6 +_,7 @@ + private AttributeInstance create(Holder p_316369_) { + AttributeInstance attributeinstance = new AttributeInstance(p_316369_, p_315942_ -> { +@@ -92,7 +_,8 @@ public AttributeSupplier build() { this.instanceFrozen = true; +- return new AttributeSupplier(this.builder.buildKeepingLast()); + others.forEach(b -> b.instanceFrozen = true); - return new AttributeSupplier(this.builder); ++ return new AttributeSupplier(ImmutableMap.copyOf(this.builder)); } } + } diff --git a/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch b/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch index 27fcb34f03..2a3dd7d38f 100644 --- a/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch +++ b/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -170,11 +_,12 @@ +@@ -176,11 +_,12 @@ .build(); public static AttributeSupplier getSupplier(EntityType p_22298_) { diff --git a/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch b/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch index dd1c5af6a4..a42fc22694 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java +++ b/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java -@@ -23,7 +_,7 @@ +@@ -25,7 +_,7 @@ protected boolean checkExtraStartConditions(ServerLevel p_22778_, E p_22779_) { LivingEntity livingentity = getAttackTarget(p_22779_); @@ -9,16 +9,16 @@ && BehaviorUtils.canSee(p_22779_, livingentity) && BehaviorUtils.isWithinAttackRange(p_22779_, livingentity, 0); } -@@ -43,7 +_,7 @@ +@@ -45,7 +_,7 @@ p_22806_.stopUsingItem(); } - if (p_22806_.isHolding(Items.CROSSBOW)) { + if (p_22806_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { p_22806_.setChargingCrossbow(false); - CrossbowItem.setCharged(p_22806_.getUseItem(), false); + p_22806_.getUseItem().set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); } -@@ -51,7 +_,7 @@ +@@ -53,7 +_,7 @@ private void crossbowAttack(E p_22787_, LivingEntity p_22788_) { if (this.crossbowState == CrossbowAttack.CrossbowState.UNCHARGED) { @@ -27,12 +27,3 @@ this.crossbowState = CrossbowAttack.CrossbowState.CHARGING; p_22787_.setChargingCrossbow(true); } else if (this.crossbowState == CrossbowAttack.CrossbowState.CHARGING) { -@@ -74,7 +_,7 @@ - } - } else if (this.crossbowState == CrossbowAttack.CrossbowState.READY_TO_ATTACK) { - p_22787_.performRangedAttack(p_22788_, 1.0F); -- ItemStack itemstack1 = p_22787_.getItemInHand(ProjectileUtil.getWeaponHoldingHand(p_22787_, Items.CROSSBOW)); -+ ItemStack itemstack1 = p_22787_.getItemInHand(ProjectileUtil.getWeaponHoldingHand(p_22787_, item -> item instanceof CrossbowItem)); - CrossbowItem.setCharged(itemstack1, false); - this.crossbowState = CrossbowAttack.CrossbowState.UNCHARGED; - } diff --git a/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch b/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch index 13bf8f819e..f12f631b99 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch @@ -5,21 +5,19 @@ private static final int MAX_TIME_BETWEEN_GIFTS = 6600; private static final int TIME_TO_DELAY_FOR_HEAD_TO_FINISH_TURNING = 20; + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#RAID_HERO_GIFTS data map} instead */ - private static final Map GIFTS = Util.make(Maps.newHashMap(), p_23020_ -> { + private static final Map> GIFTS = Util.make(Maps.newHashMap(), p_23020_ -> { p_23020_.put(VillagerProfession.ARMORER, BuiltInLootTables.ARMORER_GIFT); p_23020_.put(VillagerProfession.BUTCHER, BuiltInLootTables.BUTCHER_GIFT); -@@ -121,8 +_,14 @@ +@@ -121,8 +_,12 @@ return ImmutableList.of(new ItemStack(Items.POPPY)); } else { VillagerProfession villagerprofession = p_23010_.getVillagerData().getProfession(); - if (GIFTS.containsKey(villagerprofession)) { -- LootTable loottable = p_23010_.level().getServer().getLootData().getLootTable(GIFTS.get(villagerprofession)); +- LootTable loottable = p_23010_.level().getServer().reloadableRegistries().getLootTable(GIFTS.get(villagerprofession)); + LootTable loottable = null; + var gift = net.minecraft.core.registries.BuiltInRegistries.VILLAGER_PROFESSION.wrapAsHolder(villagerprofession).getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.RAID_HERO_GIFTS); + if (gift != null) { -+ loottable = p_23010_.level().getServer().getLootData().getLootTable(gift.lootTable()); -+ } else if (GIFTS.containsKey(villagerprofession)) { -+ loottable = p_23010_.level().getServer().getLootData().getLootTable(GIFTS.get(villagerprofession)); ++ loottable = p_23010_.level().getServer().reloadableRegistries().getLootTable(gift.lootTable()); + } + if (loottable != null) { LootParams lootparams = new LootParams.Builder((ServerLevel)p_23010_.level()) diff --git a/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch b/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch index ceeb601971..9a34ee81b6 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch +++ b/patches/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 -@@ -48,7 +_,7 @@ +@@ -47,7 +_,7 @@ } protected boolean checkExtraStartConditions(ServerLevel p_23174_, Villager p_23175_) { @@ -9,15 +9,15 @@ return false; } else if (p_23175_.getVillagerData().getProfession() != VillagerProfession.FARMER) { return false; -@@ -123,6 +_,11 @@ - p_23196_.setBlockAndUpdate(this.aboveFarmlandPos, blockstate1); - p_23196_.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(p_23197_, blockstate1)); - flag = true; -+ } else if (itemstack.getItem() instanceof net.neoforged.neoforge.common.IPlantable) { -+ if (((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlantType(p_23196_, aboveFarmlandPos) == net.neoforged.neoforge.common.PlantType.CROP) { -+ p_23196_.setBlock(aboveFarmlandPos, ((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlant(p_23196_, aboveFarmlandPos), 3); -+ flag = true; -+ } - } +@@ -120,6 +_,11 @@ + p_23196_.setBlockAndUpdate(this.aboveFarmlandPos, blockstate1); + p_23196_.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(p_23197_, blockstate1)); + flag = true; ++ } else if (itemstack.getItem() instanceof net.neoforged.neoforge.common.IPlantable) { ++ if (((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlantType(p_23196_, aboveFarmlandPos) == net.neoforged.neoforge.common.PlantType.CROP) { ++ p_23196_.setBlock(aboveFarmlandPos, ((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlant(p_23196_, aboveFarmlandPos), 3); ++ flag = true; ++ } } + if (flag) { diff --git a/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch b/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch index b5b51a46bc..abe3c40c8d 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java -@@ -32,7 +_,11 @@ +@@ -30,7 +_,11 @@ if (!p_258774_.canAttack(livingentity)) { return false; } else { diff --git a/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch b/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch index 6992d43d47..b9fd7fcb35 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch @@ -3,9 +3,9 @@ @@ -14,7 +_,7 @@ } - protected boolean checkExtraStartConditions(ServerLevel p_24388_, Mob p_24389_) { -- return p_24389_.isInWater() && p_24389_.getFluidHeight(FluidTags.WATER) > p_24389_.getFluidJumpThreshold() || p_24389_.isInLava(); -+ return p_24389_.isInWater() && p_24389_.getFluidHeight(FluidTags.WATER) > p_24389_.getFluidJumpThreshold() || p_24389_.isInLava() || p_24389_.isInFluidType((fluidType, height) -> p_24389_.canSwimInFluidType(fluidType) && height > p_24389_.getFluidJumpThreshold()); + public static boolean shouldSwim(Mob p_316787_) { +- return p_316787_.isInWater() && p_316787_.getFluidHeight(FluidTags.WATER) > p_316787_.getFluidJumpThreshold() || p_316787_.isInLava(); ++ return p_316787_.isInWater() && p_316787_.getFluidHeight(FluidTags.WATER) > p_316787_.getFluidJumpThreshold() || p_316787_.isInLava() || p_316787_.isInFluidType((fluidType, height) -> p_316787_.canSwimInFluidType(fluidType) && height > p_316787_.getFluidJumpThreshold()); } - protected boolean canStillUse(ServerLevel p_24391_, Mob p_24392_, long p_24393_) { + protected boolean checkExtraStartConditions(ServerLevel p_24388_, Mob p_24389_) { diff --git a/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch b/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch deleted file mode 100644 index f24b14bd34..0000000000 --- a/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/ai/control/MoveControl.java -+++ b/net/minecraft/world/entity/ai/control/MoveControl.java -@@ -98,7 +_,7 @@ - BlockPos blockpos = this.mob.blockPosition(); - BlockState blockstate = this.mob.level().getBlockState(blockpos); - VoxelShape voxelshape = blockstate.getCollisionShape(this.mob.level(), blockpos); -- if (d2 > (double)this.mob.maxUpStep() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.mob.getBbWidth()) -+ if (d2 > (double)this.mob.getStepHeight() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.mob.getBbWidth()) - || !voxelshape.isEmpty() - && this.mob.getY() < voxelshape.max(Direction.Axis.Y) + (double)blockpos.getY() - && !blockstate.is(BlockTags.DOORS) diff --git a/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch index 8a6f6deb0a..a0d2d9d38f 100644 --- a/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java +++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java -@@ -31,7 +_,7 @@ - public boolean canUse() { +@@ -32,7 +_,7 @@ if (!super.canUse()) { return false; -- } else if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.common.CommonHooks.canEntityDestroy(this.mob.level(), this.doorPos, this.mob)) { - return false; } else { - return this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen(); +- return !this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.common.CommonHooks.canEntityDestroy(this.mob.level(), this.doorPos, this.mob) + ? false + : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen(); + } diff --git a/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch index 8cc3ffb627..2d2ca4cab1 100644 --- a/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java -@@ -65,7 +_,7 @@ +@@ -61,7 +_,7 @@ if (this.eatAnimationTick == this.adjustedTickDelay(4)) { BlockPos blockpos = this.mob.blockPosition(); if (IS_TALL_GRASS.test(this.level.getBlockState(blockpos))) { @@ -9,7 +9,7 @@ this.level.destroyBlock(blockpos, false); } -@@ -73,7 +_,7 @@ +@@ -69,7 +_,7 @@ } else { BlockPos blockpos1 = blockpos.below(); if (this.level.getBlockState(blockpos1).is(Blocks.GRASS_BLOCK)) { diff --git a/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch index 06193a16f9..d8b844bdfe 100644 --- a/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch @@ -23,9 +23,9 @@ + } + } this.path = this.mob.getNavigation().createPath(livingentity, 0); - if (this.path != null) { - return true; -@@ -110,6 +_,18 @@ + return this.path != null ? true : this.mob.isWithinMeleeAttackRange(livingentity); + } +@@ -106,6 +_,18 @@ this.pathedTargetZ = livingentity.getZ(); this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); double d0 = this.mob.distanceToSqr(livingentity); diff --git a/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch index 2d7c5136e5..d594680f75 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java -@@ -10,7 +_,7 @@ +@@ -9,7 +_,7 @@ import net.minecraft.world.item.BowItem; import net.minecraft.world.item.Items; @@ -9,7 +9,7 @@ private final T mob; private final double speedModifier; private int attackIntervalMin; -@@ -21,6 +_,10 @@ +@@ -20,6 +_,10 @@ private boolean strafingBackwards; private int strafingTime = -1; @@ -20,7 +20,7 @@ public RangedBowAttackGoal(T p_25792_, double p_25793_, int p_25794_, float p_25795_) { this.mob = p_25792_; this.speedModifier = p_25793_; -@@ -39,7 +_,7 @@ +@@ -38,7 +_,7 @@ } protected boolean isHoldingBow() { @@ -29,7 +29,7 @@ } @Override -@@ -134,7 +_,7 @@ +@@ -132,7 +_,7 @@ } } } else if (--this.attackTime <= 0 && this.seeTime >= -60) { diff --git a/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch index adabc953d2..13c3f325ef 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java -@@ -12,7 +_,7 @@ - import net.minecraft.world.item.ItemStack; +@@ -14,7 +_,7 @@ import net.minecraft.world.item.Items; + import net.minecraft.world.item.component.ChargedProjectiles; -public class RangedCrossbowAttackGoal extends Goal { +public class RangedCrossbowAttackGoal extends Goal { public static final UniformInt PATHFINDING_DELAY_RANGE = TimeUtil.rangeOfSeconds(1, 2); private final T mob; private RangedCrossbowAttackGoal.CrossbowState crossbowState = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; -@@ -22,6 +_,10 @@ +@@ -24,6 +_,10 @@ private int attackDelay; private int updatePathDelay; @@ -20,7 +20,7 @@ public RangedCrossbowAttackGoal(T p_25814_, double p_25815_, float p_25816_) { this.mob = p_25814_; this.speedModifier = p_25815_; -@@ -35,7 +_,7 @@ +@@ -37,7 +_,7 @@ } private boolean isHoldingCrossbow() { @@ -29,7 +29,7 @@ } @Override -@@ -97,7 +_,7 @@ +@@ -99,7 +_,7 @@ this.mob.getLookControl().setLookAt(livingentity, 30.0F, 30.0F); if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.UNCHARGED) { if (!flag2) { @@ -38,12 +38,3 @@ this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.CHARGING; this.mob.setChargingCrossbow(true); } -@@ -121,7 +_,7 @@ - } - } else if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.READY_TO_ATTACK && flag) { - this.mob.performRangedAttack(livingentity, 1.0F); -- ItemStack itemstack1 = this.mob.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this.mob, Items.CROSSBOW)); -+ ItemStack itemstack1 = this.mob.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this.mob, item -> item instanceof CrossbowItem)); - CrossbowItem.setCharged(itemstack1, false); - this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; - } diff --git a/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch index 165a3ee895..e5945226c9 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch @@ -8,12 +8,14 @@ + if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.removerMob.level(), this.removerMob)) { return false; } else if (this.nextStartTick > 0) { - --this.nextStartTick; -@@ -159,6 +_,7 @@ - if (chunkaccess == null) { - return false; - } else { -+ if (!chunkaccess.getBlockState(p_25851_).canEntityDestroy(p_25850_, p_25851_, this.removerMob)) return false; - return chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) + this.nextStartTick--; +@@ -158,7 +_,8 @@ + ); + return chunkaccess == null + ? false +- : chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) ++ : chunkaccess.getBlockState(p_25851_).canEntityDestroy(p_25850_, p_25851_, this.removerMob) ++ && chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) && chunkaccess.getBlockState(p_25851_.above()).isAir() && chunkaccess.getBlockState(p_25851_.above(2)).isAir(); + } diff --git a/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch index 4d9aa2849f..75309fc078 100644 --- a/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch +++ b/patches/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 -@@ -228,10 +_,10 @@ +@@ -232,10 +_,10 @@ Vec3 vec3 = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; Vec3i vec3i = this.path.getNextNodePos(); diff --git a/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch b/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch index e3acda4a8b..075cd89a91 100644 --- a/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch +++ b/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch @@ -17,6 +17,6 @@ try { - zombie = new Zombie(p_27017_); + zombie = EntityType.ZOMBIE.create(p_27017_); //Forge: Direct Initialization is deprecated, use EntityType. - zombie.finalizeSpawn(p_27017_, p_27017_.getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.EVENT, null, null); + zombie.finalizeSpawn(p_27017_, p_27017_.getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.EVENT, null); } catch (Exception exception) { LOGGER.warn("Failed to create zombie for village siege at {}", vec3, exception); diff --git a/patches/net/minecraft/world/entity/animal/Animal.java.patch b/patches/net/minecraft/world/entity/animal/Animal.java.patch index f7ba2b902b..a078fe5a41 100644 --- a/patches/net/minecraft/world/entity/animal/Animal.java.patch +++ b/patches/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 -@@ -212,6 +_,17 @@ +@@ -205,6 +_,17 @@ public void spawnChildFromBreeding(ServerLevel p_27564_, Animal p_27565_) { AgeableMob ageablemob = this.getBreedOffspring(p_27564_, p_27565_); diff --git a/patches/net/minecraft/world/entity/animal/Bee.java.patch b/patches/net/minecraft/world/entity/animal/Bee.java.patch index 6181e8634f..83f78c1437 100644 --- a/patches/net/minecraft/world/entity/animal/Bee.java.patch +++ b/patches/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 -@@ -498,7 +_,7 @@ +@@ -482,7 +_,7 @@ return false; } else { BlockEntity blockentity = this.level().getBlockEntity(this.hivePos); @@ -9,7 +9,7 @@ } } -@@ -657,8 +_,18 @@ +@@ -631,8 +_,18 @@ } @Override diff --git a/patches/net/minecraft/world/entity/animal/Cat.java.patch b/patches/net/minecraft/world/entity/animal/Cat.java.patch index b47fa892ba..dcdb70386e 100644 --- a/patches/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/net/minecraft/world/entity/animal/Cat.java.patch @@ -1,21 +1,23 @@ --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java -@@ -382,8 +_,8 @@ - if (this.isOwnedBy(p_28153_)) { - if (!(item instanceof DyeItem)) { - if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { -+ this.heal((float)itemstack.getFoodProperties(this).getNutrition()); - this.usePlayerItem(p_28153_, p_28154_, itemstack); -- this.heal((float)item.getFoodProperties().getNutrition()); - return InteractionResult.CONSUME; - } +@@ -379,9 +_,9 @@ + } + } else if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { + if (!this.level().isClientSide()) { +- this.usePlayerItem(p_28153_, p_28154_, itemstack); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(this); + this.heal(foodproperties != null ? (float)foodproperties.nutrition() : 1.0F); ++ this.usePlayerItem(p_28153_, p_28154_, itemstack); + } -@@ -408,7 +_,7 @@ - } - } else if (this.isFood(itemstack)) { - this.usePlayerItem(p_28153_, p_28154_, itemstack); -- if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_28153_)) { - this.tame(p_28153_); - this.setOrderedToSit(true); - this.level().broadcastEntityEvent(this, (byte)7); + return InteractionResult.sidedSuccess(this.level().isClientSide()); +@@ -441,7 +_,7 @@ + } + + private void tryToTame(Player p_333858_) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_333858_)) { + this.tame(p_333858_); + this.setOrderedToSit(true); + this.level().broadcastEntityEvent(this, (byte)7); diff --git a/patches/net/minecraft/world/entity/animal/Fox.java.patch b/patches/net/minecraft/world/entity/animal/Fox.java.patch index 1b3f772f86..770e31200d 100644 --- a/patches/net/minecraft/world/entity/animal/Fox.java.patch +++ b/patches/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 -@@ -693,13 +_,16 @@ +@@ -681,13 +_,16 @@ @Override protected void dropAllDeathLoot(DamageSource p_28536_) { @@ -17,8 +17,8 @@ - super.dropAllDeathLoot(p_28536_); } - @Override -@@ -868,6 +_,17 @@ + public static boolean isPathClear(Fox p_28472_, LivingEntity p_28473_) { +@@ -846,6 +_,17 @@ protected void breed() { ServerLevel serverlevel = (ServerLevel)this.level; Fox fox = (Fox)this.animal.getBreedOffspring(serverlevel, this.partner); @@ -36,7 +36,7 @@ if (fox != null) { ServerPlayer serverplayer = this.animal.getLoveCause(); ServerPlayer serverplayer1 = this.partner.getLoveCause(); -@@ -945,7 +_,7 @@ +@@ -923,7 +_,7 @@ } protected void onReachedTarget() { @@ -45,7 +45,7 @@ BlockState blockstate = Fox.this.level().getBlockState(this.blockPos); if (blockstate.is(Blocks.SWEET_BERRY_BUSH)) { this.pickSweetBerries(blockstate); -@@ -1004,7 +_,7 @@ +@@ -982,7 +_,7 @@ @Override public boolean canUse() { diff --git a/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch b/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch index af856f60c4..4618aab072 100644 --- a/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch +++ b/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch @@ -9,7 +9,7 @@ this.shear(SoundSource.PLAYERS); this.gameEvent(GameEvent.SHEAR, p_28941_); if (!this.level().isClientSide) { -@@ -167,8 +_,10 @@ +@@ -165,8 +_,10 @@ public void shear(SoundSource p_28924_) { this.level().playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, p_28924_, 1.0F, 1.0F); if (!this.level().isClientSide()) { @@ -20,10 +20,10 @@ ((ServerLevel)this.level()).sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); this.discard(); cow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); -@@ -187,10 +_,9 @@ +@@ -185,10 +_,9 @@ this.level().addFreshEntity(cow); - for(int i = 0; i < 5; ++i) { + for (int i = 0; i < 5; i++) { - this.level() - .addFreshEntity( - new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())) diff --git a/patches/net/minecraft/world/entity/animal/Ocelot.java.patch b/patches/net/minecraft/world/entity/animal/Ocelot.java.patch index 3722dc4ce7..da7e37316a 100644 --- a/patches/net/minecraft/world/entity/animal/Ocelot.java.patch +++ b/patches/net/minecraft/world/entity/animal/Ocelot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Ocelot.java +++ b/net/minecraft/world/entity/animal/Ocelot.java -@@ -173,7 +_,7 @@ +@@ -170,7 +_,7 @@ if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && p_29021_.distanceToSqr(this) < 9.0) { this.usePlayerItem(p_29021_, p_29022_, itemstack); if (!this.level().isClientSide) { diff --git a/patches/net/minecraft/world/entity/animal/Parrot.java.patch b/patches/net/minecraft/world/entity/animal/Parrot.java.patch index 7edfe74e57..9cbc9c4deb 100644 --- a/patches/net/minecraft/world/entity/animal/Parrot.java.patch +++ b/patches/net/minecraft/world/entity/animal/Parrot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Parrot.java +++ b/net/minecraft/world/entity/animal/Parrot.java -@@ -76,13 +_,15 @@ +@@ -70,9 +_,11 @@ private static final EntityDataAccessor DATA_VARIANT_ID = SynchedEntityData.defineId(Parrot.class, EntityDataSerializers.INT); private static final Predicate NOT_PARROT_PREDICATE = new Predicate() { public boolean test(@Nullable Mob p_29453_) { @@ -8,16 +8,12 @@ + return p_29453_ != null && (Parrot.MOB_SOUND_MAP.containsKey(p_29453_.getType()) || p_29453_.getType().builtInRegistryHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.PARROT_IMITATIONS) != null); } }; - private static final Item POISONOUS_FOOD = Items.COOKIE; - private static final Set TAME_FOOD = Sets.newHashSet( - Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS, Items.TORCHFLOWER_SEEDS, Items.PITCHER_POD - ); + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#PARROT_IMITATIONS data map} instead */ + @Deprecated - static final Map, SoundEvent> MOB_SOUND_MAP = Util.make(Maps.newHashMap(), p_311670_ -> { - p_311670_.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE); - p_311670_.put(EntityType.BREEZE, SoundEvents.PARROT_IMITATE_BREEZE); -@@ -272,7 +_,7 @@ + static final Map, SoundEvent> MOB_SOUND_MAP = Util.make(Maps.newHashMap(), p_326764_ -> { + p_326764_.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE); + p_326764_.put(EntityType.BOGGED, SoundEvents.PARROT_IMITATE_BOGGED); +@@ -253,7 +_,7 @@ } if (!this.level().isClientSide) { @@ -26,7 +22,7 @@ this.tame(p_29414_); this.level().broadcastEntityEvent(this, (byte)7); } else { -@@ -342,7 +_,10 @@ +@@ -322,7 +_,10 @@ public static SoundEvent getAmbient(Level p_218239_, RandomSource p_218240_) { if (p_218239_.getDifficulty() != Difficulty.PEACEFUL && p_218240_.nextInt(1000) == 0) { @@ -38,7 +34,7 @@ return getImitatedSound(list.get(p_218240_.nextInt(list.size()))); } else { return SoundEvents.PARROT_AMBIENT; -@@ -350,6 +_,8 @@ +@@ -330,6 +_,8 @@ } private static SoundEvent getImitatedSound(EntityType p_29409_) { diff --git a/patches/net/minecraft/world/entity/animal/Pig.java.patch b/patches/net/minecraft/world/entity/animal/Pig.java.patch index 45321d4546..6346151346 100644 --- a/patches/net/minecraft/world/entity/animal/Pig.java.patch +++ b/patches/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 -@@ -215,7 +_,7 @@ +@@ -206,7 +_,7 @@ @Override public void thunderHit(ServerLevel p_29473_, LightningBolt p_29474_) { @@ -9,7 +9,7 @@ ZombifiedPiglin zombifiedpiglin = EntityType.ZOMBIFIED_PIGLIN.create(p_29473_); if (zombifiedpiglin != null) { zombifiedpiglin.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); -@@ -228,6 +_,7 @@ +@@ -219,6 +_,7 @@ } zombifiedpiglin.setPersistenceRequired(); diff --git a/patches/net/minecraft/world/entity/animal/Rabbit.java.patch b/patches/net/minecraft/world/entity/animal/Rabbit.java.patch index 93d9d625c4..b71d6d55bd 100644 --- a/patches/net/minecraft/world/entity/animal/Rabbit.java.patch +++ b/patches/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 -@@ -534,7 +_,7 @@ +@@ -527,7 +_,7 @@ @Override public boolean canUse() { if (this.nextStartTick <= 0) { diff --git a/patches/net/minecraft/world/entity/animal/Sheep.java.patch b/patches/net/minecraft/world/entity/animal/Sheep.java.patch index c689463a80..0b64bf2ffe 100644 --- a/patches/net/minecraft/world/entity/animal/Sheep.java.patch +++ b/patches/net/minecraft/world/entity/animal/Sheep.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Sheep.java +++ b/net/minecraft/world/entity/animal/Sheep.java -@@ -206,7 +_,7 @@ +@@ -209,7 +_,7 @@ @Override public InteractionResult mobInteract(Player p_29853_, InteractionHand p_29854_) { ItemStack itemstack = p_29853_.getItemInHand(p_29854_); diff --git a/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch b/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch index a700a407ea..907cd15285 100644 --- a/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch +++ b/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/SnowGolem.java +++ b/net/minecraft/world/entity/animal/SnowGolem.java -@@ -95,7 +_,7 @@ +@@ -92,7 +_,7 @@ this.hurt(this.damageSources().onFire(), 1.0F); } @@ -9,7 +9,7 @@ return; } -@@ -135,7 +_,7 @@ +@@ -127,7 +_,7 @@ @Override protected InteractionResult mobInteract(Player p_29920_, InteractionHand p_29921_) { ItemStack itemstack = p_29920_.getItemInHand(p_29921_); diff --git a/patches/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/net/minecraft/world/entity/animal/Wolf.java.patch index c9bd0f1966..02d705a49e 100644 --- a/patches/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,34 +1,25 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -342,11 +_,12 @@ - return flag ? InteractionResult.CONSUME : InteractionResult.PASS; - } else if (this.isTame()) { - if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { -+ this.heal((float)itemstack.getFoodProperties(this).getNutrition()); - if (!p_30412_.getAbilities().instabuild) { - itemstack.shrink(1); - } - -- this.heal((float)item.getFoodProperties().getNutrition()); -+ this.gameEvent(GameEvent.EAT, this); - return InteractionResult.SUCCESS; - } else { - if (item instanceof DyeItem dyeitem && this.isOwnedBy(p_30412_)) { -@@ -379,7 +_,7 @@ - itemstack.shrink(1); - } - -- if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_30412_)) { - this.tame(p_30412_); - this.navigation.stop(); - this.setTarget(null); -@@ -419,7 +_,7 @@ - @Override - public boolean isFood(ItemStack p_30440_) { - Item item = p_30440_.getItem(); -- return item.isEdible() && item.getFoodProperties().isMeat(); -+ return item.isEdible() && p_30440_.getFoodProperties(this).isMeat(); +@@ -421,10 +_,11 @@ + if (!this.level().isClientSide || this.isBaby() && this.isFood(itemstack)) { + if (this.isTame()) { + if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { +- itemstack.consume(1, p_30412_); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(this); + float f = foodproperties != null ? (float)foodproperties.nutrition() : 1.0F; + this.heal(2.0F * f); ++ itemstack.consume(1, p_30412_); ++ this.gameEvent(GameEvent.EAT); // Neo: add EAT game event + return InteractionResult.sidedSuccess(this.level().isClientSide()); + } else { + if (item instanceof DyeItem dyeitem && this.isOwnedBy(p_30412_)) { +@@ -490,7 +_,7 @@ } - @Override + private void tryToTame(Player p_333736_) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_333736_)) { + this.tame(p_333736_); + this.navigation.stop(); + this.setTarget(null); diff --git a/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch b/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch index a5b22c00b5..c11160e1b8 100644 --- a/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch +++ b/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -370,9 +_,9 @@ +@@ -366,9 +_,9 @@ public boolean wantsToPickUp(ItemStack p_218387_) { ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); return !itemstack.isEmpty() diff --git a/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch b/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch index e85711b7f1..637cf5cae4 100644 --- a/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch +++ b/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -226,8 +_,10 @@ +@@ -225,8 +_,10 @@ + private void ageUp() { - Level $$1 = this.level(); - if ($$1 instanceof ServerLevel serverlevel) { + if (this.level() instanceof ServerLevel serverlevel) { + if (!net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.FROG, (timer) -> {})) return; Frog frog = EntityType.FROG.create(this.level()); if (frog != null) { + net.neoforged.neoforge.event.EventHooks.onLivingConvert(this, frog); frog.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - frog.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null, null); + frog.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null); frog.setNoAi(this.isNoAi()); diff --git a/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index ec57d9585b..24f0e2cf24 100644 --- a/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/patches/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 -@@ -384,9 +_,9 @@ +@@ -393,9 +_,9 @@ protected void playStepSound(BlockPos p_30584_, BlockState p_30585_) { if (!p_30585_.liquid()) { BlockState blockstate = this.level().getBlockState(p_30584_.above()); @@ -12,31 +12,18 @@ } if (this.isVehicle() && this.canGallop) { -@@ -669,6 +_,12 @@ - this.mouthAnim = 0.0F; - } - } -+ -+ // Neo: Horse armor tick patch -+ if (this.canWearArmor()) { -+ ItemStack stack = this.inventory.getItem(1); -+ if (isArmor(stack)) stack.onHorseArmorTick(level(), this); -+ } - } - - @Override -@@ -802,6 +_,7 @@ - this.setDeltaMovement(vec3.x, d1, vec3.z); +@@ -811,6 +_,7 @@ + this.setDeltaMovement(vec3.x, d0, vec3.z); this.setIsJumping(true); this.hasImpulse = true; + net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); if (p_275435_.z > 0.0) { float f = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)); float f1 = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); -@@ -1137,6 +_,11 @@ +@@ -1113,6 +_,11 @@ this.randomizeAttributes(p_30555_.getRandom()); - return super.finalizeSpawn(p_30555_, p_30556_, p_30557_, p_30558_, p_30559_); + return super.finalizeSpawn(p_30555_, p_30556_, p_30557_, p_30558_); + } + + // Neo: Inventory getter diff --git a/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch index c025729dc7..e3a7684a92 100644 --- a/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch +++ b/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -@@ -28,6 +_,10 @@ +@@ -31,6 +_,10 @@ @Override public void tick() { ServerLevel serverlevel = (ServerLevel)this.horse.level(); @@ -11,7 +11,7 @@ DifficultyInstance difficultyinstance = serverlevel.getCurrentDifficultyAt(this.horse.blockPosition()); this.horse.setTrap(false); this.horse.setTamed(true); -@@ -55,6 +_,7 @@ +@@ -58,6 +_,7 @@ } } } diff --git a/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch b/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch index 02c0676e3e..cfa11ac57e 100644 --- a/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch +++ b/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -295,7 +_,7 @@ +@@ -299,7 +_,7 @@ if (this.tickCount % 10 == 0) { this.level() .playLocalSound( diff --git a/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch b/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch index d31569dbe8..935ae3aceb 100644 --- a/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch +++ b/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/boss/EnderDragonPart.java +++ b/net/minecraft/world/entity/boss/EnderDragonPart.java -@@ -11,13 +_,13 @@ +@@ -12,13 +_,13 @@ import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.item.ItemStack; diff --git a/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 3a2fd0eef2..edc0e0d450 100644 --- a/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/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 -@@ -104,6 +_,14 @@ +@@ -102,6 +_,14 @@ this.noPhysics = true; this.noCulling = true; this.phaseManager = new EnderDragonPhaseManager(this); @@ -15,7 +15,7 @@ } public void setDragonFight(EndDragonFight p_287736_) { -@@ -171,8 +_,12 @@ +@@ -169,8 +_,12 @@ return adouble; } @@ -28,7 +28,7 @@ this.processFlappingMovement(); if (this.level().isClientSide) { this.setHealth(this.getHealth()); -@@ -470,7 +_,7 @@ +@@ -465,7 +_,7 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); BlockState blockstate = this.level().getBlockState(blockpos); if (!blockstate.isAir() && !blockstate.is(BlockTags.DRAGON_TRANSPARENT)) { @@ -37,7 +37,7 @@ flag1 = this.level().removeBlock(blockpos, false) || flag1; } else { flag = true; -@@ -564,7 +_,8 @@ +@@ -559,7 +_,8 @@ if (this.level() instanceof ServerLevel) { if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && flag) { @@ -47,7 +47,7 @@ } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -575,7 +_,8 @@ +@@ -570,7 +_,8 @@ this.move(MoverType.SELF, new Vec3(0.0, 0.1F, 0.0)); if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) { if (flag) { @@ -57,7 +57,7 @@ } if (this.dragonFight != null) { -@@ -907,8 +_,19 @@ +@@ -902,8 +_,19 @@ } @Override @@ -76,4 +76,4 @@ + if (true) return; // Forge: Fix MC-158205: Moved into setId() EnderDragonPart[] aenderdragonpart = this.getSubEntities(); - for(int i = 0; i < aenderdragonpart.length; ++i) { + for (int i = 0; i < aenderdragonpart.length; i++) { diff --git a/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index 9241c282de..3ac2613fb4 100644 --- a/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -315,7 +_,7 @@ +@@ -321,7 +_,7 @@ if (this.destroyBlocksTick > 0) { - --this.destroyBlocksTick; + this.destroyBlocksTick--; - if (this.destroyBlocksTick == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (this.destroyBlocksTick == 0 && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.level(), this)) { - int j1 = Mth.floor(this.getY()); - int i2 = Mth.floor(this.getX()); - int j2 = Mth.floor(this.getZ()); -@@ -329,7 +_,7 @@ - int i1 = j2 + k2; - BlockPos blockpos = new BlockPos(l2, l, i1); - BlockState blockstate = this.level().getBlockState(blockpos); -- if (canDestroy(blockstate)) { -+ if (blockstate.canEntityDestroy(this.level(), blockpos, this) && net.neoforged.neoforge.event.EventHooks.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = this.level().destroyBlock(blockpos, true, this) || flag; - } - } -@@ -350,6 +_,10 @@ + boolean flag = false; + int l = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); + int i1 = Mth.floor(this.getBbHeight()); +@@ -330,7 +_,7 @@ + this.getBlockX() - l, this.getBlockY(), this.getBlockZ() - l, this.getBlockX() + l, this.getBlockY() + i1, this.getBlockZ() + l + )) { + BlockState blockstate = this.level().getBlockState(blockpos); +- if (canDestroy(blockstate)) { ++ if (blockstate.canEntityDestroy(this.level(), blockpos, this) && net.neoforged.neoforge.event.EventHooks.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag = this.level().destroyBlock(blockpos, true, this) || flag; + } + } +@@ -349,6 +_,10 @@ } } diff --git a/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch b/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch index 23c3ae3cf9..5bc9fd973b 100644 --- a/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch +++ b/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -71,7 +_,7 @@ +@@ -74,7 +_,7 @@ public static final EntityDataAccessor DATA_LEFT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); public static final EntityDataAccessor DATA_RIGHT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); private static final Predicate RIDABLE_MINECARTS = p_31582_ -> p_31582_ instanceof AbstractMinecart diff --git a/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch b/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch index b533f4f73b..76faef3e12 100644 --- a/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/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 -@@ -120,6 +_,8 @@ +@@ -121,6 +_,8 @@ int j1 = (j - 1) / -2; blockpos$mutableblockpos.set(blockpos).move(direction, k + i1).move(Direction.UP, l + j1); BlockState blockstate = this.level().getBlockState(blockpos$mutableblockpos); diff --git a/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index 99b9f3d3f5..be3b00816d 100644 --- a/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -131,7 +_,7 @@ +@@ -133,7 +_,7 @@ if (!this.level().isClientSide) { BlockPos blockpos = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; @@ -9,7 +9,7 @@ double d0 = this.getDeltaMovement().lengthSqr(); if (flag && d0 > 1.0) { BlockHitResult blockhitresult = this.level() -@@ -140,7 +_,7 @@ +@@ -142,7 +_,7 @@ new Vec3(this.xo, this.yo, this.zo), this.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this ) ); diff --git a/patches/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/net/minecraft/world/entity/item/ItemEntity.java.patch index 74b76796d5..ef93c50397 100644 --- a/patches/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -44,6 +_,10 @@ +@@ -48,6 +_,10 @@ @Nullable private UUID target; public final float bobOffs; @@ -11,7 +11,7 @@ public ItemEntity(EntityType p_31991_, Level p_31992_) { super(p_31991_, p_31992_); -@@ -62,6 +_,7 @@ +@@ -66,6 +_,7 @@ this.setPos(p_149664_, p_149665_, p_149666_); this.setDeltaMovement(p_149668_, p_149669_, p_149670_); this.setItem(p_149667_); @@ -19,7 +19,7 @@ } private ItemEntity(ItemEntity p_31994_) { -@@ -70,6 +_,7 @@ +@@ -74,6 +_,7 @@ this.copyPosition(p_31994_); this.age = p_31994_.age; this.bobOffs = p_31994_.bobOffs; @@ -27,7 +27,7 @@ } @Override -@@ -115,6 +_,7 @@ +@@ -119,6 +_,7 @@ @Override public void tick() { @@ -35,27 +35,27 @@ if (this.getItem().isEmpty()) { this.discard(); } else { -@@ -128,6 +_,9 @@ +@@ -131,6 +_,9 @@ + this.yo = this.getY(); this.zo = this.getZ(); Vec3 vec3 = this.getDeltaMovement(); - float f = this.getEyeHeight() - 0.11111111F; + net.neoforged.neoforge.fluids.FluidType fluidType = this.getMaxHeightFluidType(); -+ if (!fluidType.isAir() && !fluidType.isVanilla() && this.getFluidTypeHeight(fluidType) > (double)f) fluidType.setItemMovement(this); ++ if (!fluidType.isAir() && !fluidType.isVanilla() && this.getFluidTypeHeight(fluidType) > 0.1F) fluidType.setItemMovement(this); + else - if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > (double)f) { + if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > 0.1F) { this.setUnderwaterMovement(); - } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > (double)f) { -@@ -149,7 +_,8 @@ + } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > 0.1F) { +@@ -152,7 +_,8 @@ this.move(MoverType.SELF, this.getDeltaMovement()); - float f1 = 0.98F; + float f = 0.98F; if (this.onGround()) { -- f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; + BlockPos groundPos = getBlockPosBelowThatAffectsMyMovement(); -+ f1 = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; ++ f = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; } - this.setDeltaMovement(this.getDeltaMovement().multiply((double)f1, 0.98, (double)f1)); -@@ -181,7 +_,16 @@ + this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.98, (double)f)); +@@ -184,7 +_,16 @@ } } @@ -73,16 +73,7 @@ this.discard(); } } -@@ -240,6 +_,8 @@ - return false; - } else if (p_32028_.hasTag() ^ p_32027_.hasTag()) { - return false; -+ } else if (!p_32027_.areAttachmentsCompatible(p_32028_)) { -+ return false; - } else { - return !p_32028_.hasTag() || p_32028_.getTag().equals(p_32027_.getTag()); - } -@@ -286,7 +_,7 @@ +@@ -281,7 +_,7 @@ this.health = (int)((float)this.health - p_32014_); this.gameEvent(GameEvent.ENTITY_DAMAGE, p_32013_.getEntity()); if (this.health <= 0) { @@ -91,7 +82,7 @@ this.discard(); } -@@ -299,6 +_,7 @@ +@@ -294,6 +_,7 @@ p_32050_.putShort("Health", (short)this.health); p_32050_.putShort("Age", (short)this.age); p_32050_.putShort("PickupDelay", (short)this.pickupDelay); @@ -99,7 +90,7 @@ if (this.thrower != null) { p_32050_.putUUID("Thrower", this.thrower); } -@@ -319,6 +_,9 @@ +@@ -314,6 +_,9 @@ if (p_32034_.contains("PickupDelay")) { this.pickupDelay = p_32034_.getShort("PickupDelay"); } diff --git a/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch index 6f600f2dc1..1faf910165 100644 --- a/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch +++ b/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -1,23 +1,24 @@ --- a/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -165,7 +_,7 @@ +@@ -155,7 +_,7 @@ if (this.level() != null && !this.level().isClientSide) { this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); - ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); + ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); if (itemstack.is(Items.BOW)) { - int i = 20; + int i = this.getHardAttackInterval(); if (this.level().getDifficulty() != Difficulty.HARD) { -@@ -182,8 +_,10 @@ +@@ -180,8 +_,11 @@ @Override public void performRangedAttack(LivingEntity p_32141_, float p_32142_) { - ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW))); -+ ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem))); ++ ItemStack weapon = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); ++ ItemStack itemstack = this.getProjectile(weapon); AbstractArrow abstractarrow = this.getArrow(itemstack, p_32142_); -+ if (this.getMainHandItem().getItem() instanceof net.minecraft.world.item.BowItem) -+ abstractarrow = ((net.minecraft.world.item.BowItem)this.getMainHandItem().getItem()).customArrow(abstractarrow, itemstack); ++ if (weapon.getItem() instanceof net.minecraft.world.item.ProjectileWeaponItem weaponItem) ++ abstractarrow = weaponItem.customArrow(abstractarrow, itemstack); double d0 = p_32141_.getX() - this.getX(); double d1 = p_32141_.getY(0.3333333333333333) - abstractarrow.getY(); double d2 = p_32141_.getZ() - this.getZ(); diff --git a/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch b/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch index 7c9026445f..e9348deb1b 100644 --- a/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch +++ b/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch @@ -1,14 +1,11 @@ --- a/net/minecraft/world/entity/monster/CrossbowAttackMob.java +++ b/net/minecraft/world/entity/monster/CrossbowAttackMob.java -@@ -23,9 +_,9 @@ +@@ -17,7 +_,7 @@ void onCrossbowAttackPerformed(); default void performCrossbowAttack(LivingEntity p_32337_, float p_32338_) { - InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, Items.CROSSBOW); + InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, item -> item instanceof CrossbowItem); ItemStack itemstack = p_32337_.getItemInHand(interactionhand); -- if (p_32337_.isHolding(Items.CROSSBOW)) { -+ if (p_32337_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { - CrossbowItem.performShooting( - p_32337_.level(), p_32337_, interactionhand, itemstack, p_32338_, (float)(14 - p_32337_.level().getDifficulty().getId() * 4) - ); + if (itemstack.getItem() instanceof CrossbowItem crossbowitem) { + crossbowitem.performShooting( diff --git a/patches/net/minecraft/world/entity/monster/EnderMan.java.patch b/patches/net/minecraft/world/entity/monster/EnderMan.java.patch index 0da394e324..425799d7ab 100644 --- a/patches/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java -@@ -121,7 +_,6 @@ +@@ -116,7 +_,6 @@ @Override public void setTarget(@Nullable LivingEntity p_32537_) { @@ -8,7 +8,7 @@ AttributeInstance attributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (p_32537_ == null) { this.targetChangeTime = 0; -@@ -135,6 +_,7 @@ +@@ -130,6 +_,7 @@ attributeinstance.addTransientModifier(SPEED_MODIFIER_ATTACKING); } } @@ -16,7 +16,7 @@ } @Override -@@ -217,7 +_,7 @@ +@@ -212,7 +_,7 @@ boolean isLookingAtMe(Player p_32535_) { ItemStack itemstack = p_32535_.getInventory().armor.get(3); @@ -25,7 +25,7 @@ return false; } else { Vec3 vec3 = p_32535_.getViewVector(1.0F).normalize(); -@@ -314,8 +_,10 @@ +@@ -299,8 +_,10 @@ boolean flag = blockstate.blocksMotion(); boolean flag1 = blockstate.getFluidState().is(FluidTags.WATER); if (flag && !flag1) { @@ -37,16 +37,16 @@ if (flag2) { this.level().gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of(this)); if (!this.isSilent()) { -@@ -467,7 +_,7 @@ - public boolean canUse() { +@@ -451,7 +_,7 @@ if (this.enderman.getCarriedBlock() == null) { return false; -- } else if (!this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman)) { - return false; } else { - return this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; -@@ -488,7 +_,7 @@ +- return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; + } +@@ -471,7 +_,7 @@ BlockState blockstate2 = this.enderman.getCarriedBlock(); if (blockstate2 != null) { blockstate2 = Block.updateFromNeighbourShapes(blockstate2, this.enderman.level(), blockpos); @@ -55,7 +55,7 @@ level.setBlock(blockpos, blockstate2, 3); level.gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(this.enderman, blockstate2)); this.enderman.setCarriedBlock(null); -@@ -500,6 +_,7 @@ +@@ -483,6 +_,7 @@ return p_32562_.isAir() && !p_32563_.isAir() && !p_32563_.is(Blocks.BEDROCK) @@ -63,12 +63,12 @@ && p_32563_.isCollisionShapeFullBlock(p_32559_, p_32564_) && p_32561_.canSurvive(p_32559_, p_32560_) && p_32559_.getEntities(this.enderman, AABB.unitCubeFromLowerCorner(Vec3.atLowerCornerOf(p_32560_))).isEmpty(); -@@ -610,7 +_,7 @@ - public boolean canUse() { +@@ -594,7 +_,7 @@ if (this.enderman.getCarriedBlock() != null) { return false; -- } else if (!this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman)) { - return false; } else { - return this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; +- return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; + } diff --git a/patches/net/minecraft/world/entity/monster/Evoker.java.patch b/patches/net/minecraft/world/entity/monster/Evoker.java.patch index 19444669cd..a7549041ac 100644 --- a/patches/net/minecraft/world/entity/monster/Evoker.java.patch +++ b/patches/net/minecraft/world/entity/monster/Evoker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Evoker.java +++ b/net/minecraft/world/entity/monster/Evoker.java -@@ -309,7 +_,7 @@ +@@ -305,7 +_,7 @@ return false; } else if (Evoker.this.tickCount < this.nextAttackTickCount) { return false; diff --git a/patches/net/minecraft/world/entity/monster/Husk.java.patch b/patches/net/minecraft/world/entity/monster/Husk.java.patch index 623afcfb79..f36b13b010 100644 --- a/patches/net/minecraft/world/entity/monster/Husk.java.patch +++ b/patches/net/minecraft/world/entity/monster/Husk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java -@@ -72,6 +_,7 @@ +@@ -70,6 +_,7 @@ @Override protected void doUnderWaterConversion() { diff --git a/patches/net/minecraft/world/entity/monster/Illusioner.java.patch b/patches/net/minecraft/world/entity/monster/Illusioner.java.patch index e12536ba6f..d6089e1d58 100644 --- a/patches/net/minecraft/world/entity/monster/Illusioner.java.patch +++ b/patches/net/minecraft/world/entity/monster/Illusioner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Illusioner.java +++ b/net/minecraft/world/entity/monster/Illusioner.java -@@ -194,8 +_,10 @@ +@@ -173,8 +_,10 @@ @Override public void performRangedAttack(LivingEntity p_32918_, float p_32919_) { diff --git a/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch index e37c3d678d..06e5ea98f4 100644 --- a/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/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 -@@ -77,17 +_,28 @@ +@@ -71,17 +_,28 @@ float f = (float)this.getSize() * 0.1F; this.setDeltaMovement(vec3.x, (double)(this.getJumpPower() + f), vec3.z); this.hasImpulse = true; diff --git a/patches/net/minecraft/world/entity/monster/Pillager.java.patch b/patches/net/minecraft/world/entity/monster/Pillager.java.patch index 8937d159fb..0ecf222c12 100644 --- a/patches/net/minecraft/world/entity/monster/Pillager.java.patch +++ b/patches/net/minecraft/world/entity/monster/Pillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Pillager.java +++ b/net/minecraft/world/entity/monster/Pillager.java -@@ -120,7 +_,7 @@ +@@ -112,7 +_,7 @@ public AbstractIllager.IllagerArmPose getArmPose() { if (this.isChargingCrossbow()) { return AbstractIllager.IllagerArmPose.CROSSBOW_CHARGE; diff --git a/patches/net/minecraft/world/entity/monster/Ravager.java.patch b/patches/net/minecraft/world/entity/monster/Ravager.java.patch index d27c87c1e0..50f6d92831 100644 --- a/patches/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/net/minecraft/world/entity/monster/Ravager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java -@@ -139,7 +_,7 @@ +@@ -133,7 +_,7 @@ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, d1, d0)); } diff --git a/patches/net/minecraft/world/entity/monster/Shulker.java.patch b/patches/net/minecraft/world/entity/monster/Shulker.java.patch index de027e3882..f7260e87d4 100644 --- a/patches/net/minecraft/world/entity/monster/Shulker.java.patch +++ b/patches/net/minecraft/world/entity/monster/Shulker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java -@@ -391,6 +_,12 @@ +@@ -392,6 +_,12 @@ && this.level().noCollision(this, new AABB(blockpos1).deflate(1.0E-6))) { Direction direction = this.findAttachableSurface(blockpos1); if (direction != null) { diff --git a/patches/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/net/minecraft/world/entity/monster/Silverfish.java.patch index d1bef172de..7e73ef502a 100644 --- a/patches/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Silverfish.java +++ b/net/minecraft/world/entity/monster/Silverfish.java -@@ -159,7 +_,7 @@ +@@ -140,7 +_,7 @@ return false; } else { RandomSource randomsource = this.mob.getRandom(); @@ -9,7 +9,7 @@ this.selectedDirection = Direction.getRandom(randomsource); BlockPos blockpos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); BlockState blockstate = this.mob.level().getBlockState(blockpos); -@@ -230,7 +_,7 @@ +@@ -211,7 +_,7 @@ BlockState blockstate = level.getBlockState(blockpos1); Block block = blockstate.getBlock(); if (block instanceof InfestedBlock) { diff --git a/patches/net/minecraft/world/entity/monster/Skeleton.java.patch b/patches/net/minecraft/world/entity/monster/Skeleton.java.patch index 499e41ec19..f9a48f3b1f 100644 --- a/patches/net/minecraft/world/entity/monster/Skeleton.java.patch +++ b/patches/net/minecraft/world/entity/monster/Skeleton.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Skeleton.java +++ b/net/minecraft/world/entity/monster/Skeleton.java -@@ -86,7 +_,9 @@ +@@ -85,7 +_,9 @@ } protected void doFreezeConversion() { diff --git a/patches/net/minecraft/world/entity/monster/Slime.java.patch b/patches/net/minecraft/world/entity/monster/Slime.java.patch index bb40934c1b..d006918b00 100644 --- a/patches/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/net/minecraft/world/entity/monster/Slime.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -136,6 +_,8 @@ - if (this.onGround() && !this.wasOnGround) { - int i = this.getSize(); +@@ -137,6 +_,8 @@ + float f = this.getDimensions(this.getPose()).width() * 2.0F; + float f1 = f / 2.0F; + // Forge: Don't spawn particles if it's handled by the implementation itself + if (!spawnCustomParticles()) - for(int j = 0; j < i * 8; ++j) { - float f = this.random.nextFloat() * (float) (Math.PI * 2); - float f1 = this.random.nextFloat() * 0.5F + 0.5F; -@@ -200,6 +_,8 @@ + for (int i = 0; (float)i < f * 16.0F; i++) { + float f2 = this.random.nextFloat() * (float) (Math.PI * 2); + float f3 = this.random.nextFloat() * 0.5F + 0.5F; +@@ -202,6 +_,8 @@ int j = i / 2; int k = 2 + this.random.nextInt(3); + var children = new java.util.ArrayList(); // Neo: Children list for MobSplitEvent. + - for(int l = 0; l < k; ++l) { - float f1 = ((float)(l % 2) - 0.5F) * f; - float f2 = ((float)(l / 2) - 0.5F) * f; -@@ -214,8 +_,13 @@ + for (int l = 0; l < k; l++) { + float f2 = ((float)(l % 2) - 0.5F) * f1; + float f3 = ((float)(l / 2) - 0.5F) * f1; +@@ -216,8 +_,13 @@ slime.setInvulnerable(this.isInvulnerable()); slime.setSize(j, true); - slime.moveTo(this.getX() + (double)f1, this.getY() + 0.5, this.getZ() + (double)f2, this.random.nextFloat() * 360.0F, 0.0F); + slime.moveTo(this.getX() + (double)f2, this.getY() + 0.5, this.getZ() + (double)f3, this.random.nextFloat() * 360.0F, 0.0F); - this.level().addFreshEntity(slime); + + children.add(slime); // Neo: Record the slime until after event firing. @@ -33,9 +33,9 @@ } } -@@ -366,6 +_,12 @@ - public EntityDimensions getDimensions(Pose p_33597_) { - return super.getDimensions(p_33597_).scale(0.255F * (float)this.getSize()); +@@ -361,6 +_,12 @@ + public EntityDimensions getDefaultDimensions(Pose p_316359_) { + return super.getDefaultDimensions(p_316359_).scale((float)this.getSize()); } + + /** diff --git a/patches/net/minecraft/world/entity/monster/Spider.java.patch b/patches/net/minecraft/world/entity/monster/Spider.java.patch index 10da6d89dd..e6368793de 100644 --- a/patches/net/minecraft/world/entity/monster/Spider.java.patch +++ b/patches/net/minecraft/world/entity/monster/Spider.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/Spider.java +++ b/net/minecraft/world/entity/monster/Spider.java -@@ -132,7 +_,12 @@ +@@ -121,7 +_,12 @@ @Override public boolean canBeAffected(MobEffectInstance p_33809_) { -- return p_33809_.getEffect() == MobEffects.POISON ? false : super.canBeAffected(p_33809_); +- return p_33809_.is(MobEffects.POISON) ? false : super.canBeAffected(p_33809_); + if (p_33809_.getEffect() == MobEffects.POISON) { + net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable event = new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable(this, p_33809_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); diff --git a/patches/net/minecraft/world/entity/monster/Zombie.java.patch b/patches/net/minecraft/world/entity/monster/Zombie.java.patch index f76a8cb274..49e8c23de4 100644 --- a/patches/net/minecraft/world/entity/monster/Zombie.java.patch +++ b/patches/net/minecraft/world/entity/monster/Zombie.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java -@@ -254,6 +_,7 @@ +@@ -251,6 +_,7 @@ } protected void doUnderWaterConversion() { @@ -8,7 +8,7 @@ this.convertToZombieType(EntityType.DROWNED); if (!this.isSilent()) { this.level().levelEvent(null, 1040, this.blockPosition(), 0); -@@ -265,6 +_,7 @@ +@@ -262,6 +_,7 @@ if (zombie != null) { zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier()); zombie.setCanBreakDoors(zombie.supportsBreakDoorGoal() && this.canBreakDoors()); @@ -16,7 +16,7 @@ } } -@@ -285,14 +_,19 @@ +@@ -282,14 +_,19 @@ livingentity = (LivingEntity)p_34288_.getEntity(); } @@ -42,9 +42,9 @@ + + Zombie zombie = event.getCustomSummonedAid() != null && event.getResult() == net.neoforged.bus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.ZOMBIE.create(this.level()); - for(int l = 0; l < 50; ++l) { + for (int l = 0; l < 50; l++) { int i1 = i + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); -@@ -308,7 +_,9 @@ +@@ -304,7 +_,9 @@ && this.level().isUnobstructed(zombie) && this.level().noCollision(zombie) && !this.level().containsAnyLiquid(zombie.getBoundingBox())) { @@ -52,10 +52,10 @@ + if (livingentity != null) { + zombie.setTarget(livingentity); + } - zombie.finalizeSpawn( - serverlevel, this.level().getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.REINFORCEMENT, null, null - ); -@@ -405,7 +_,7 @@ + zombie.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.REINFORCEMENT, null); + serverlevel.addFreshEntityWithPassengers(zombie); + this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE) +@@ -398,7 +_,7 @@ @Override public boolean killedEntity(ServerLevel p_219160_, LivingEntity p_219161_) { boolean flag = super.killedEntity(p_219160_, p_219161_); @@ -64,9 +64,9 @@ if (p_219160_.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { return flag; } -@@ -423,6 +_,7 @@ +@@ -415,6 +_,7 @@ zombievillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE)); - zombievillager.setTradeOffers(villager.getOffers().createTag()); + zombievillager.setTradeOffers(villager.getOffers().copy()); zombievillager.setVillagerXp(villager.getVillagerXp()); + net.neoforged.neoforge.event.EventHooks.onLivingConvert(p_219161_, zombievillager); if (!this.isSilent()) { diff --git a/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch index 0ea4f20d50..6f9a1242b8 100644 --- a/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/patches/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 -@@ -136,7 +_,7 @@ +@@ -139,7 +_,7 @@ if (!this.level().isClientSide && this.isAlive() && this.isConverting()) { int i = this.getConversionProgress(); this.villagerConversionTime -= i; diff --git a/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index bb0f6ecf5c..14a4f5a41d 100644 --- a/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -163,7 +_,7 @@ +@@ -161,7 +_,7 @@ HoglinAi.updateActivity(this); if (this.isConverting()) { - ++this.timeInOverworld; + this.timeInOverworld++; - if (this.timeInOverworld > 300) { + if (this.timeInOverworld > 300 && net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { - this.playSoundEvent(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); + this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); this.finishConversion((ServerLevel)this.level()); } -@@ -268,6 +_,7 @@ +@@ -259,6 +_,7 @@ Zoglin zoglin = this.convertTo(EntityType.ZOGLIN, true); if (zoglin != null) { zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); diff --git a/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch b/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch index 519798d089..36ab4f9ccd 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch @@ -1,10 +1,7 @@ --- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java -@@ -101,9 +_,10 @@ - ++this.timeInOverworld; - } else { +@@ -82,7 +_,7 @@ this.timeInOverworld = 0; -+ this.timeInOverworld = 0; } - if (this.timeInOverworld > 300) { @@ -12,7 +9,7 @@ this.playConvertedSound(); this.finishConversion((ServerLevel)this.level()); } -@@ -117,6 +_,7 @@ +@@ -96,6 +_,7 @@ ZombifiedPiglin zombifiedpiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, true); if (zombifiedpiglin != null) { zombifiedpiglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); diff --git a/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch b/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch index 5d00b21d02..7177a80222 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -355,7 +_,7 @@ +@@ -349,7 +_,7 @@ } else if (this.isChargingCrossbow()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { @@ -9,7 +9,7 @@ } } -@@ -401,7 +_,7 @@ +@@ -390,7 +_,7 @@ } protected void holdInOffHand(ItemStack p_34786_) { @@ -18,7 +18,7 @@ this.setItemSlot(EquipmentSlot.OFFHAND, p_34786_); this.setGuaranteedDrop(EquipmentSlot.OFFHAND); } else { -@@ -411,7 +_,7 @@ +@@ -400,7 +_,7 @@ @Override public boolean wantsToPickUp(ItemStack p_34777_) { diff --git a/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch b/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch index 640aa84301..3aa8dcc2a5 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch @@ -9,7 +9,7 @@ if (p_34869_ && flag) { throwItems(p_34868_, getBarterResponseItems(p_34868_)); } else if (!flag) { -@@ -465,7 +_,7 @@ +@@ -461,7 +_,7 @@ return false; } else if (isAdmiringDisabled(p_34858_) && p_34858_.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) { return false; @@ -18,7 +18,7 @@ return isNotHoldingLovedItemInOffHand(p_34858_); } else { boolean flag = p_34858_.canAddToInventory(p_34859_); -@@ -560,7 +_,7 @@ +@@ -551,7 +_,7 @@ } protected static boolean canAdmire(Piglin p_34910_, ItemStack p_34911_) { @@ -27,16 +27,16 @@ } protected static void wasHurtBy(Piglin p_34838_, LivingEntity p_34839_) { -@@ -650,7 +_,7 @@ +@@ -641,7 +_,7 @@ public static boolean isWearingGold(LivingEntity p_34809_) { - for(ItemStack itemstack : p_34809_.getArmorSlots()) { + for (ItemStack itemstack : p_34809_.getArmorAndBodyArmorSlots()) { Item item = itemstack.getItem(); -- if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial() == ArmorMaterials.GOLD) { +- if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial().is(ArmorMaterials.GOLD)) { + if (itemstack.makesPiglinsNeutral(p_34809_)) { return true; } } -@@ -803,7 +_,7 @@ +@@ -792,7 +_,7 @@ } private static boolean hasCrossbow(LivingEntity p_34919_) { diff --git a/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch b/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch index 769308e597..25f0fb1337 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java +++ b/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java -@@ -12,7 +_,7 @@ +@@ -11,7 +_,7 @@ + public static BehaviorControl create() { return BehaviorBuilder.create( - p_259197_ -> p_259197_.group(p_259197_.absent(MemoryModuleType.ADMIRING_ITEM)) - .apply(p_259197_, p_259512_ -> (p_311695_, p_311696_, p_311697_) -> { -- if (!p_311696_.getOffhandItem().isEmpty() && !p_311696_.getOffhandItem().is(Items.SHIELD)) { -+ if (!p_311696_.getOffhandItem().isEmpty() && !p_311696_.getOffhandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { - PiglinAi.stopHoldingOffHandItem(p_311696_, true); - return true; - } else { + p_259197_ -> p_259197_.group(p_259197_.absent(MemoryModuleType.ADMIRING_ITEM)).apply(p_259197_, p_259512_ -> (p_337869_, p_337870_, p_337871_) -> { +- if (!p_337870_.getOffhandItem().isEmpty() && !p_337870_.getOffhandItem().is(Items.SHIELD)) { ++ if (!p_337870_.getOffhandItem().isEmpty() && !p_337870_.getOffhandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { + PiglinAi.stopHoldingOffHandItem(p_337870_, true); + return true; + } else { diff --git a/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch b/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch index 851fe96f82..5afd75101b 100644 --- a/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch +++ b/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/net/minecraft/world/entity/npc/AbstractVillager.java -@@ -127,6 +_,7 @@ +@@ -123,6 +_,7 @@ if (this.tradingPlayer instanceof ServerPlayer) { CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, p_35274_.getResult()); } @@ -8,7 +8,7 @@ } protected abstract void rewardTradeXp(MerchantOffer p_35299_); -@@ -180,9 +_,9 @@ +@@ -181,9 +_,9 @@ @Nullable @Override diff --git a/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch index e9bd6dd1c8..c0cbf518d6 100644 --- a/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java -@@ -84,8 +_,8 @@ +@@ -83,8 +_,8 @@ if (cat == null) { return 0; } else { + cat.moveTo(p_35334_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat - cat.finalizeSpawn(p_35335_, p_35335_.getCurrentDifficultyAt(p_35334_), MobSpawnType.NATURAL, null, null); + cat.finalizeSpawn(p_35335_, p_35335_.getCurrentDifficultyAt(p_35334_), MobSpawnType.NATURAL, null); - cat.moveTo(p_35334_, 0.0F, 0.0F); p_35335_.addFreshEntityWithPassengers(cat); return 1; diff --git a/patches/net/minecraft/world/entity/npc/Villager.java.patch b/patches/net/minecraft/world/entity/npc/Villager.java.patch index ffdd057be7..f2042d3216 100644 --- a/patches/net/minecraft/world/entity/npc/Villager.java.patch +++ b/patches/net/minecraft/world/entity/npc/Villager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -323,7 +_,7 @@ +@@ -322,7 +_,7 @@ @Override public InteractionResult mobInteract(Player p_35472_, InteractionHand p_35473_) { ItemStack itemstack = p_35472_.getItemInHand(p_35473_); @@ -9,7 +9,7 @@ return super.mobInteract(p_35472_, p_35473_); } else if (this.isBaby()) { this.setUnhappy(); -@@ -747,8 +_,9 @@ +@@ -740,8 +_,9 @@ @Override protected Component getTypeName() { @@ -20,7 +20,7 @@ ); } -@@ -806,7 +_,7 @@ +@@ -797,7 +_,7 @@ @Override public void thunderHit(ServerLevel p_35409_, LightningBolt p_35410_) { @@ -29,7 +29,7 @@ LOGGER.info("Villager {} was struck by lightning {}.", this, p_35410_); Witch witch = EntityType.WITCH.create(p_35409_); if (witch != null) { -@@ -819,6 +_,7 @@ +@@ -810,6 +_,7 @@ } witch.setPersistenceRequired(); diff --git a/patches/net/minecraft/world/entity/player/Inventory.java.patch b/patches/net/minecraft/world/entity/player/Inventory.java.patch index aa02ede907..839ed70305 100644 --- a/patches/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/net/minecraft/world/entity/player/Inventory.java.patch @@ -1,31 +1,21 @@ --- a/net/minecraft/world/entity/player/Inventory.java +++ b/net/minecraft/world/entity/player/Inventory.java -@@ -137,7 +_,7 @@ +@@ -133,7 +_,7 @@ - for(int k = 0; k < 9; ++k) { + for (int k = 0; k < 9; k++) { int l = (this.selected + k) % 9; - if (!this.items.get(l).isEnchanted()) { + if (!this.items.get(l).isNotReplaceableByPickAction(this.player, l)) { return l; } } -@@ -186,7 +_,8 @@ - int i = p_36049_.getCount(); - ItemStack itemstack = this.getItem(p_36048_); - if (itemstack.isEmpty()) { -- itemstack = new ItemStack(item, 0); -+ itemstack = p_36049_.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ itemstack.setCount(0); - if (p_36049_.hasTag()) { - itemstack.setTag(p_36049_.getTag().copy()); - } -@@ -230,13 +_,18 @@ +@@ -214,13 +_,18 @@ } public void tick() { + int slot = 0; - for(NonNullList nonnulllist : this.compartments) { - for(int i = 0; i < nonnulllist.size(); ++i) { + for (NonNullList nonnulllist : this.compartments) { + for (int i = 0; i < nonnulllist.size(); i++) { if (!nonnulllist.get(i).isEmpty()) { - nonnulllist.get(i).inventoryTick(this.player.level(), this.player, i, this.selected == i); + // Neo: Fix the slot param to be the global index instead of the per-compartment index. @@ -39,7 +29,7 @@ } public boolean add(ItemStack p_36055_) { -@@ -284,6 +_,8 @@ +@@ -268,6 +_,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.addCategory("Item being added"); diff --git a/patches/net/minecraft/world/entity/player/Player.java.patch b/patches/net/minecraft/world/entity/player/Player.java.patch index d410d2472b..4ae1916af5 100644 --- a/patches/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -112,7 +_,8 @@ +@@ -113,7 +_,8 @@ import net.minecraft.world.scores.Team; import org.slf4j.Logger; @@ -8,32 +8,30 @@ +public abstract class Player extends LivingEntity implements net.neoforged.neoforge.common.extensions.IPlayerExtension { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; private static final Logger LOGGER = LogUtils.getLogger(); - public static final int MAX_NAME_LENGTH = 16; public static final HumanoidArm DEFAULT_MAIN_HAND = HumanoidArm.RIGHT; -@@ -174,6 +_,9 @@ + public static final int DEFAULT_MODEL_CUSTOMIZATION = 0; +@@ -191,6 +_,9 @@ @Nullable - public FishingHook fishing; - protected float hurtDir; + public Entity currentExplosionCause; + public boolean ignoreFallDamageFromCurrentImpulse; + 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_250508_, BlockPos p_250289_, float p_251702_, GameProfile p_252153_) { super(EntityType.PLAYER, p_250508_); -@@ -206,7 +_,11 @@ - .add(Attributes.ATTACK_DAMAGE, 1.0) - .add(Attributes.MOVEMENT_SPEED, 0.1F) - .add(Attributes.ATTACK_SPEED) -- .add(Attributes.LUCK); -+ .add(Attributes.LUCK) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.BLOCK_REACH.value()) +@@ -223,7 +_,9 @@ + .add(Attributes.LUCK) + .add(Attributes.BLOCK_INTERACTION_RANGE, 4.5) + .add(Attributes.ENTITY_INTERACTION_RANGE, 3.0) +- .add(Attributes.BLOCK_BREAK_SPEED); ++ .add(Attributes.BLOCK_BREAK_SPEED) + .add(Attributes.ATTACK_KNOCKBACK) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_REACH.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.CREATIVE_FLIGHT.value()); ++ .add(net.neoforged.neoforge.common.NeoForgeMod.CREATIVE_FLIGHT); } @Override -@@ -222,6 +_,7 @@ +@@ -239,6 +_,7 @@ @Override public void tick() { @@ -41,7 +39,7 @@ this.noPhysics = this.isSpectator(); if (this.isSpectator()) { this.setOnGround(false); -@@ -237,7 +_,7 @@ +@@ -254,7 +_,7 @@ this.sleepCounter = 100; } @@ -50,7 +48,7 @@ this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { -@@ -292,6 +_,7 @@ +@@ -309,6 +_,7 @@ this.turtleHelmetTick(); this.cooldowns.tick(); this.updatePlayerPose(); @@ -58,7 +56,7 @@ } @Override -@@ -371,6 +_,10 @@ +@@ -388,6 +_,10 @@ } protected void updatePlayerPose() { @@ -69,7 +67,7 @@ if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.SWIMMING)) { Pose pose; if (this.isFallFlying()) { -@@ -613,6 +_,7 @@ +@@ -619,6 +_,7 @@ @Override public void die(DamageSource p_36152_) { @@ -77,7 +75,7 @@ super.die(p_36152_); this.reapplyPosition(); if (!this.isSpectator()) { -@@ -667,7 +_,7 @@ +@@ -673,7 +_,7 @@ @Nullable public ItemEntity drop(ItemStack p_36177_, boolean p_36178_) { @@ -86,7 +84,7 @@ } @Nullable -@@ -709,7 +_,12 @@ +@@ -715,7 +_,12 @@ } } @@ -99,7 +97,7 @@ float f = this.inventory.getDestroySpeed(p_36282_); if (f > 1.0F) { int i = EnchantmentHelper.getBlockEfficiency(this); -@@ -740,11 +_,12 @@ +@@ -747,11 +_,12 @@ f /= 5.0F; } @@ -113,7 +111,7 @@ } @Override -@@ -831,6 +_,7 @@ +@@ -850,6 +_,7 @@ @Override public boolean hurt(DamageSource p_36154_, float p_36155_) { @@ -121,7 +119,7 @@ if (this.isInvulnerableTo(p_36154_)) { return false; } else if (this.abilities.invulnerable && !p_36154_.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -844,7 +_,9 @@ +@@ -863,7 +_,9 @@ this.removeEntitiesOnShoulder(); } @@ -132,7 +130,7 @@ if (this.level().getDifficulty() == Difficulty.PEACEFUL) { p_36155_ = 0.0F; } -@@ -898,7 +_,7 @@ +@@ -917,7 +_,7 @@ @Override protected void hurtCurrentlyUsedShield(float p_36383_) { @@ -141,20 +139,22 @@ if (!this.level().isClientSide) { this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); } -@@ -906,7 +_,11 @@ +@@ -925,7 +_,13 @@ if (p_36383_ >= 3.0F) { int i = 1 + Mth.floor(p_36383_); InteractionHand interactionhand = this.getUsedItemHand(); -- this.useItem.hurtAndBreak(i, this, p_219739_ -> p_219739_.broadcastBreakEvent(interactionhand)); -+ this.useItem.hurtAndBreak(i, this, p_219739_ -> { -+ p_219739_.broadcastBreakEvent(interactionhand); -+ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, this.useItem, interactionhand); -+ stopUsingItem(); // Neo: Fix MC-168573 ("After breaking a shield, the player's off-hand can't finish using some items") -+ }); +- this.useItem.hurtAndBreak(i, this, getSlotForHand(interactionhand)); ++ if (!level().isClientSide && !hasInfiniteMaterials()) { ++ this.useItem.hurtAndBreak(i, getRandom(), this, () -> { ++ broadcastBreakEvent(getSlotForHand(interactionhand)); ++ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, this.useItem, interactionhand); ++ stopUsingItem(); // Neo: Fix MC-168573 ("After breaking a shield, the player's off-hand can't finish using some items") ++ }); ++ } if (this.useItem.isEmpty()) { if (interactionhand == InteractionHand.MAIN_HAND) { this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); -@@ -924,10 +_,13 @@ +@@ -943,10 +_,13 @@ @Override protected void actuallyHurt(DamageSource p_36312_, float p_36313_) { if (!this.isInvulnerableTo(p_36312_)) { @@ -168,7 +168,7 @@ float f = p_36313_ - f1; if (f > 0.0F && f < 3.4028235E37F) { this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f * 10.0F)); -@@ -991,6 +_,8 @@ +@@ -1010,6 +_,8 @@ return InteractionResult.PASS; } else { @@ -177,7 +177,7 @@ ItemStack itemstack = this.getItemInHand(p_36159_); ItemStack itemstack1 = itemstack.copy(); InteractionResult interactionresult = p_36158_.interact(this, p_36159_); -@@ -999,6 +_,9 @@ +@@ -1018,6 +_,9 @@ itemstack.setCount(itemstack1.getCount()); } @@ -187,7 +187,7 @@ return interactionresult; } else { if (!itemstack.isEmpty() && p_36158_ instanceof LivingEntity) { -@@ -1010,6 +_,7 @@ +@@ -1029,6 +_,7 @@ if (interactionresult1.consumesAction()) { this.level().gameEvent(GameEvent.ENTITY_INTERACT, p_36158_.position(), GameEvent.Context.of(this)); if (itemstack.isEmpty() && !this.abilities.instabuild) { @@ -195,7 +195,7 @@ this.setItemInHand(p_36159_, ItemStack.EMPTY); } -@@ -1044,6 +_,7 @@ +@@ -1058,6 +_,7 @@ } @Override @@ -203,7 +203,7 @@ protected Vec3 maybeBackOffFromEdge(Vec3 p_36201_, MoverType p_36202_) { if (!this.abilities.flying && p_36201_.y <= 0.0 -@@ -1098,6 +_,7 @@ +@@ -1112,6 +_,7 @@ return p_36201_; } @@ -211,7 +211,7 @@ private boolean isAboveGround() { return this.onGround() || this.fallDistance < this.maxUpStep() -@@ -1105,6 +_,7 @@ +@@ -1119,6 +_,7 @@ } public void attack(Entity p_36347_) { @@ -219,75 +219,78 @@ if (p_36347_.isAttackable()) { if (!p_36347_.skipAttackInteraction(this)) { float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); -@@ -1118,11 +_,10 @@ +@@ -1126,14 +_,13 @@ float f2 = this.getAttackStrengthScale(0.5F); f *= 0.2F + f2 * f2 * 0.8F; f1 *= f2; - this.resetAttackStrengthTicker(); - if (f > 0.0F || f1 > 0.0F) { - boolean flag = f2 > 0.9F; - boolean flag1 = false; -- int i = 0; -+ float i = (float)this.getAttributeValue(Attributes.ATTACK_KNOCKBACK); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 - i += EnchantmentHelper.getKnockbackBonus(this); - if (this.isSprinting() && flag) { - this.level() -@@ -1140,8 +_,10 @@ - && !this.isPassenger() - && p_36347_ instanceof LivingEntity; - flag2 = flag2 && !this.isSprinting(); -+ net.neoforged.neoforge.event.entity.player.CriticalHitEvent hitResult = net.neoforged.neoforge.common.CommonHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); -+ flag2 = hitResult != null; - if (flag2) { -- f *= 1.5F; -+ f *= hitResult.getDamageModifier(); - } - - f += f1; -@@ -1149,9 +_,7 @@ - double d0 = (double)(this.walkDist - this.walkDistO); - if (flag && !flag2 && !flag1 && this.onGround() && d0 < (double)this.getSpeed()) { - ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); -- if (itemstack.getItem() instanceof SwordItem) { -- flag3 = true; -- } -+ flag3 = itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_SWEEP); - } + if (p_36347_.getType().is(EntityTypeTags.PUNCHABLE_PROJECTILES) && p_36347_ instanceof Projectile projectile) { + projectile.punch(this.damageSources().playerAttack(this)); + } else { + if (f > 0.0F || f1 > 0.0F) { + boolean flag = f2 > 0.9F; + boolean flag1 = false; +- int i = 0; ++ float i = (float)this.getAttributeValue(Attributes.ATTACK_KNOCKBACK); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 + i += EnchantmentHelper.getKnockbackBonus(this); + if (this.isSprinting() && flag) { + this.level() +@@ -1152,8 +_,10 @@ + && !this.isPassenger() + && p_36347_ instanceof LivingEntity + && !this.isSprinting(); ++ net.neoforged.neoforge.event.entity.player.CriticalHitEvent hitResult = net.neoforged.neoforge.common.CommonHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); ++ flag2 = hitResult != null; + if (flag2) { +- f *= 1.5F; ++ f *= hitResult.getDamageModifier(); + } - float f4 = 0.0F; -@@ -1193,11 +_,12 @@ - - for(LivingEntity livingentity : this.level() - .getEntitiesOfClass(LivingEntity.class, p_36347_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { -+ double entityReachSq = Mth.square(this.getEntityReach()); // Use entity reach instead of constant 9.0. Vanilla uses bottom center-to-center checks here, so don't update this to use canReach, since it uses closest-corner checks. - if (livingentity != this - && livingentity != p_36347_ - && !this.isAlliedTo(livingentity) - && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).isMarker()) -- && this.distanceToSqr(livingentity) < 9.0) { -+ && this.distanceToSqr(livingentity) < entityReachSq) { - livingentity.knockback( - 0.4F, - (double)Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -@@ -1246,13 +_,15 @@ - EnchantmentHelper.doPostDamageEffects(this, p_36347_); - ItemStack itemstack1 = this.getMainHandItem(); - Entity entity = p_36347_; -- if (p_36347_ instanceof EnderDragonPart) { -- entity = ((EnderDragonPart)p_36347_).parentMob; -+ if (p_36347_ instanceof net.neoforged.neoforge.entity.PartEntity) { -+ entity = ((net.neoforged.neoforge.entity.PartEntity) p_36347_).getParent(); + f += f1; +@@ -1161,9 +_,7 @@ + double d0 = (double)(this.walkDist - this.walkDistO); + if (flag && !flag2 && !flag1 && this.onGround() && d0 < (double)this.getSpeed()) { + ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); +- if (itemstack.getItem() instanceof SwordItem) { +- flag3 = true; +- } ++ flag3 = itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_SWEEP); } - if (!this.level().isClientSide && !itemstack1.isEmpty() && entity instanceof LivingEntity) { -+ ItemStack copy = itemstack1.copy(); - itemstack1.hurtEnemy((LivingEntity)entity, this); - if (itemstack1.isEmpty()) { -+ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, copy, InteractionHand.MAIN_HAND); - this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); + float f4 = 0.0F; +@@ -1205,11 +_,12 @@ + + for (LivingEntity livingentity : this.level() + .getEntitiesOfClass(LivingEntity.class, p_36347_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { ++ double entityReachSq = Mth.square(this.entityInteractionRange()); // Use entity reach instead of constant 9.0. Vanilla uses bottom center-to-center checks here, so don't update this to use canReach, since it uses closest-corner checks. + if (livingentity != this + && livingentity != p_36347_ + && !this.isAlliedTo(livingentity) + && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).isMarker()) +- && this.distanceToSqr(livingentity) < 9.0) { ++ && this.distanceToSqr(livingentity) < entityReachSq) { + livingentity.knockback( + 0.4F, + (double)Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), +@@ -1262,13 +_,15 @@ + EnchantmentHelper.doPostDamageEffects(this, p_36347_); + ItemStack itemstack1 = this.getMainHandItem(); + Entity entity = p_36347_; +- if (p_36347_ instanceof EnderDragonPart) { +- entity = ((EnderDragonPart)p_36347_).parentMob; ++ if (p_36347_ instanceof net.neoforged.neoforge.entity.PartEntity) { ++ entity = ((net.neoforged.neoforge.entity.PartEntity) p_36347_).getParent(); } - } -@@ -1280,6 +_,7 @@ + + if (!this.level().isClientSide && !itemstack1.isEmpty() && entity instanceof LivingEntity) { ++ ItemStack copy = itemstack1.copy(); + itemstack1.hurtEnemy((LivingEntity)entity, this); + if (itemstack1.isEmpty()) { ++ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, copy, InteractionHand.MAIN_HAND); + this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); + } + } +@@ -1299,6 +_,7 @@ } } } @@ -295,16 +298,16 @@ } } } -@@ -1296,7 +_,7 @@ - } +@@ -1309,7 +_,7 @@ + } - if (this.random.nextFloat() < f) { -- this.getCooldowns().addCooldown(Items.SHIELD, 100); -+ this.getCooldowns().addCooldown(this.getUseItem().getItem(), 100); - this.stopUsingItem(); - this.level().broadcastEntityEvent(this, (byte)30); - } -@@ -1358,6 +_,7 @@ + public void disableShield() { +- this.getCooldowns().addCooldown(Items.SHIELD, 100); ++ this.getCooldowns().addCooldown(this.getUseItem().getItem(), 100); + this.stopUsingItem(); + this.level().broadcastEntityEvent(this, (byte)30); + } +@@ -1375,6 +_,7 @@ } public void stopSleepInBed(boolean p_36226_, boolean p_36227_) { @@ -312,7 +315,7 @@ super.stopSleeping(); if (this.level() instanceof ServerLevel && p_36227_) { ((ServerLevel)this.level()).updateSleepingPlayerList(); -@@ -1390,7 +_,7 @@ +@@ -1407,7 +_,7 @@ } else if (block instanceof BedBlock && BedBlock.canSetSpawn(p_36131_)) { return BedBlock.findStandUpPosition(EntityType.PLAYER, p_36131_, p_36132_, blockstate.getValue(BedBlock.FACING), p_36133_); } else if (!p_36134_) { @@ -321,7 +324,7 @@ } else { boolean flag = block.isPossibleToRespawnInThis(blockstate); BlockState blockstate1 = p_36131_.getBlockState(p_36132_.above()); -@@ -1500,7 +_,8 @@ +@@ -1517,7 +_,8 @@ @Override public boolean causeFallDamage(float p_150093_, float p_150094_, DamageSource p_150095_) { @@ -331,7 +334,7 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1514,7 +_,7 @@ +@@ -1537,7 +_,7 @@ public boolean tryToStartFallFlying() { if (!this.onGround() && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(MobEffects.LEVITATION)) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); @@ -340,7 +343,7 @@ this.startFallFlying(); return true; } -@@ -1543,13 +_,13 @@ +@@ -1566,13 +_,13 @@ protected void playStepSound(BlockPos p_282121_, BlockState p_282194_) { if (this.isInWater()) { this.waterSwimSound(); @@ -356,7 +359,7 @@ } else { super.playStepSound(blockpos, blockstate); } -@@ -1578,6 +_,10 @@ +@@ -1603,6 +_,10 @@ } public void giveExperiencePoints(int p_36291_) { @@ -365,9 +368,9 @@ + p_36291_ = event.getAmount(); + this.increaseScore(p_36291_); - this.experienceProgress += (float)p_36291_ / (float)this.getXpNeededForNextLevel(); + this.experienceProgress = this.experienceProgress + (float)p_36291_ / (float)this.getXpNeededForNextLevel(); this.totalExperience = Mth.clamp(this.totalExperience + p_36291_, 0, Integer.MAX_VALUE); -@@ -1605,7 +_,7 @@ +@@ -1630,7 +_,7 @@ } public void onEnchantmentPerformed(ItemStack p_36172_, int p_36173_) { @@ -376,7 +379,7 @@ if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; -@@ -1616,6 +_,10 @@ +@@ -1641,6 +_,10 @@ } public void giveExperienceLevels(int p_36276_) { @@ -387,7 +390,7 @@ this.experienceLevel += p_36276_; if (this.experienceLevel < 0) { this.experienceLevel = 0; -@@ -1819,7 +_,11 @@ +@@ -1849,7 +_,11 @@ @Override public Component getDisplayName() { @@ -400,7 +403,7 @@ return this.decorateDisplayNameComponent(mutablecomponent); } -@@ -1966,25 +_,25 @@ +@@ -2014,25 +_,25 @@ Predicate predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getSupportedHeldProjectiles(); ItemStack itemstack = ProjectileWeaponItem.getHeldProjectile(this, predicate); if (!itemstack.isEmpty()) { @@ -409,7 +412,7 @@ } else { predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getAllSupportedProjectiles(); - for(int i = 0; i < this.inventory.getContainerSize(); ++i) { + for (int i = 0; i < this.inventory.getContainerSize(); i++) { ItemStack itemstack1 = this.inventory.getItem(i); if (predicate.test(itemstack1)) { - return itemstack1; @@ -425,12 +428,12 @@ @Override public ItemStack eat(Level p_36185_, ItemStack p_36186_) { -- this.getFoodData().eat(p_36186_.getItem(), p_36186_); -+ this.getFoodData().eat(p_36186_.getItem(), p_36186_, this); +- this.getFoodData().eat(p_36186_); ++ this.getFoodData().eat(p_36186_, this); this.awardStat(Stats.ITEM_USED.get(p_36186_.getItem())); p_36185_.playSound( null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, p_36185_.random.nextFloat() * 0.1F + 0.9F -@@ -2108,5 +_,39 @@ +@@ -2176,5 +_,39 @@ public Component getMessage() { return this.message; } diff --git a/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch index 725bcd1389..55e4f21b24 100644 --- a/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch +++ b/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -163,7 +_,7 @@ - --this.shakeTime; +@@ -167,7 +_,7 @@ + this.shakeTime--; } - if (this.isInWaterOrRain() || blockstate.is(Blocks.POWDER_SNOW)) { @@ -9,7 +9,7 @@ this.clearFire(); } -@@ -199,7 +_,9 @@ +@@ -203,7 +_,9 @@ } } @@ -17,6 +17,6 @@ + if (hitresult != null && hitresult.getType() != HitResult.Type.MISS && !flag) { + if (net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) + break; - this.onHit(hitresult); + ProjectileDeflection projectiledeflection = this.hitOrDeflect(hitresult); this.hasImpulse = true; - } + if (projectiledeflection != ProjectileDeflection.NONE) { diff --git a/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch index 2f4a7d07d0..2c7e5bd945 100644 --- a/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java -@@ -91,7 +_,7 @@ +@@ -87,7 +_,7 @@ } HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); - if (hitresult.getType() != HitResult.Type.MISS) { + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitOrDeflect(hitresult); } diff --git a/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch index 3cb9bb6bfd..61b9073b35 100644 --- a/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -171,6 +_,13 @@ +@@ -175,6 +_,13 @@ } } diff --git a/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch index 7f94247ddd..2fe912f87a 100644 --- a/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -15,12 +15,12 @@ private void checkCollision() { HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); -- this.onHit(hitresult); +- this.hitOrDeflect(hitresult); + if (hitresult.getType() == HitResult.Type.MISS || !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) this.onHit(hitresult); } @Override -@@ -439,6 +_,7 @@ +@@ -440,6 +_,7 @@ Player player = this.getPlayerOwner(); if (!this.level().isClientSide && player != null && !this.shouldStopFishing(player)) { int i = 0; @@ -28,14 +28,14 @@ if (this.hookedIn != null) { this.pullEntity(this.hookedIn); CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, Collections.emptyList()); -@@ -449,10 +_,17 @@ +@@ -450,10 +_,17 @@ .withParameter(LootContextParams.ORIGIN, this.position()) .withParameter(LootContextParams.TOOL, p_37157_) .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.KILLER_ENTITY, this.getOwner()) .withLuck((float)this.luck + player.getLuck()) .create(LootContextParamSets.FISHING); - LootTable loottable = this.level().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING); + LootTable loottable = this.level().getServer().reloadableRegistries().getLootTable(BuiltInLootTables.FISHING); List list = loottable.getRandomItems(lootparams); + event = new net.neoforged.neoforge.event.entity.player.ItemFishedEvent(list, this.onGround() ? 2 : 1, this); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); @@ -45,8 +45,8 @@ + } CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, list); - for(ItemStack itemstack : list) { -@@ -478,6 +_,7 @@ + for (ItemStack itemstack : list) { +@@ -479,6 +_,7 @@ } this.discard(); diff --git a/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch b/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch index 0681913e1f..7e45431690 100644 --- a/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch +++ b/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/net/minecraft/world/entity/projectile/LlamaSpit.java -@@ -34,6 +_,7 @@ +@@ -39,6 +_,7 @@ super.tick(); Vec3 vec3 = this.getDeltaMovement(); HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) - this.onHit(hitresult); + this.hitOrDeflect(hitresult); double d0 = this.getX() + vec3.x; double d1 = this.getY() + vec3.y; diff --git a/patches/net/minecraft/world/entity/projectile/Projectile.java.patch b/patches/net/minecraft/world/entity/projectile/Projectile.java.patch index ed0b94262c..b33bd4ff2d 100644 --- a/patches/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java -@@ -242,7 +_,7 @@ - if (entity instanceof Player) { - return entity.mayInteract(p_150167_, p_150168_); - } else { -- return entity == null || p_150167_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ return entity == null || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_150167_, entity); - } +@@ -257,7 +_,7 @@ + Entity entity = this.getOwner(); + return entity instanceof Player + ? entity.mayInteract(p_150167_, p_150168_) +- : entity == null || p_150167_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ : entity == null || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_150167_, entity); } + public boolean mayBreak(Level p_307481_) { diff --git a/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index fa05a79c3c..1f17b9e0e8 100644 --- a/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java -@@ -216,7 +_,7 @@ +@@ -220,7 +_,7 @@ } HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (hitresult.getType() != HitResult.Type.MISS) { + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitOrDeflect(hitresult); } } diff --git a/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch b/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch index 169617f5b8..a500114b94 100644 --- a/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch @@ -6,6 +6,6 @@ - if (hitresult.getType() != HitResult.Type.MISS && !flag) { + if (hitresult.getType() != HitResult.Type.MISS && !flag && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitOrDeflect(hitresult); } diff --git a/patches/net/minecraft/world/entity/raid/Raid.java.patch b/patches/net/minecraft/world/entity/raid/Raid.java.patch index 3dc76ea005..020998b229 100644 --- a/patches/net/minecraft/world/entity/raid/Raid.java.patch +++ b/patches/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 -@@ -825,7 +_,7 @@ +@@ -837,7 +_,7 @@ } } @@ -9,7 +9,7 @@ VINDICATOR(EntityType.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), EVOKER(EntityType.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), PILLAGER(EntityType.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), -@@ -839,6 +_,20 @@ +@@ -851,6 +_,20 @@ private RaiderType(EntityType p_37821_, int[] p_37822_) { this.entityType = p_37821_; this.spawnsPerWaveBeforeBonus = p_37822_; diff --git a/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index cb8c4f93ca..94468fab35 100644 --- a/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -46,7 +_,7 @@ +@@ -45,7 +_,7 @@ + import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; - import org.joml.Vector3f; -public abstract class AbstractMinecart extends VehicleEntity { +public abstract class AbstractMinecart extends VehicleEntity implements net.neoforged.neoforge.common.extensions.IAbstractMinecartExtension { - private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F; - private static final float PASSENGER_ATTACHMENT_Y = 0.1875F; + private static final Vec3 LOWERED_PASSENGER_ATTACHMENT = new Vec3(0.0, 0.0, 0.0); private static final EntityDataAccessor DATA_ID_DISPLAY_BLOCK = SynchedEntityData.defineId(AbstractMinecart.class, EntityDataSerializers.INT); -@@ -65,6 +_,7 @@ + private static final EntityDataAccessor DATA_ID_DISPLAY_OFFSET = SynchedEntityData.defineId(AbstractMinecart.class, EntityDataSerializers.INT); +@@ -63,6 +_,7 @@ private double lerpYRot; private double lerpXRot; private Vec3 targetDeltaMovement = Vec3.ZERO; @@ -17,7 +17,7 @@ private static final Map> EXITS = Util.make(Maps.newEnumMap(RailShape.class), p_38135_ -> { Vec3i vec3i = Direction.WEST.getNormal(); Vec3i vec3i1 = Direction.EAST.getNormal(); -@@ -85,6 +_,7 @@ +@@ -83,6 +_,7 @@ p_38135_.put(RailShape.NORTH_WEST, Pair.of(vec3i2, vec3i)); p_38135_.put(RailShape.NORTH_EAST, Pair.of(vec3i2, vec3i1)); }); @@ -25,7 +25,7 @@ protected AbstractMinecart(EntityType p_38087_, Level p_38088_) { super(p_38087_, p_38088_); -@@ -99,6 +_,14 @@ +@@ -97,6 +_,14 @@ this.zo = p_38094_; } @@ -40,7 +40,7 @@ public static AbstractMinecart createMinecart( ServerLevel p_305794_, double p_38121_, -@@ -141,7 +_,7 @@ +@@ -139,7 +_,7 @@ @Override public boolean isPushable() { @@ -49,8 +49,8 @@ } @Override -@@ -272,9 +_,9 @@ - BlockPos blockpos = new BlockPos(k, i, j); +@@ -271,9 +_,9 @@ + BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.level().getBlockState(blockpos); this.onRails = BaseRailBlock.isRail(blockstate); - if (this.onRails) { @@ -58,10 +58,10 @@ this.moveAlongTrack(blockpos, blockstate); - if (blockstate.is(Blocks.ACTIVATOR_RAIL)) { + if (blockstate.getBlock() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.getBlock()).isActivatorRail()) { - this.activateMinecart(k, i, j, blockstate.getValue(PoweredRailBlock.POWERED)); + this.activateMinecart(i, j, k, blockstate.getValue(PoweredRailBlock.POWERED)); } } else { -@@ -299,8 +_,11 @@ +@@ -298,8 +_,11 @@ } this.setRot(this.getYRot(), this.getXRot()); @@ -73,18 +73,18 @@ + if (canBeRidden() && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) { + List list = this.level().getEntities(this, box, EntitySelector.pushableBy(this)); if (!list.isEmpty()) { - for(Entity entity1 : list) { + for (Entity entity1 : list) { if (!(entity1 instanceof Player) -@@ -315,7 +_,7 @@ +@@ -314,7 +_,7 @@ } } } else { -- for(Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F))) { +- for (Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F))) { + for(Entity entity : this.level().getEntities(this, box)) { if (!this.hasPassenger(entity) && entity.isPushable() && entity instanceof AbstractMinecart) { entity.push(this); } -@@ -340,16 +_,23 @@ +@@ -339,16 +_,23 @@ } protected void comeOffTrack() { @@ -110,7 +110,7 @@ } } -@@ -362,18 +_,19 @@ +@@ -361,18 +_,19 @@ d1 = (double)p_38156_.getY(); boolean flag = false; boolean flag1 = false; @@ -130,10 +130,10 @@ Vec3 vec31 = this.getDeltaMovement(); - RailShape railshape = p_38157_.getValue(((BaseRailBlock)p_38157_.getBlock()).getShapeProperty()); + RailShape railshape = ((BaseRailBlock)p_38157_.getBlock()).getRailDirection(p_38157_, this.level(), p_38156_, this); - switch(railshape) { + switch (railshape) { case ASCENDING_EAST: this.setDeltaMovement(vec31.add(-d3, 0.0, 0.0)); -@@ -419,7 +_,7 @@ +@@ -418,7 +_,7 @@ } } @@ -142,7 +142,7 @@ double d22 = this.getDeltaMovement().horizontalDistance(); if (d22 < 0.03) { this.setDeltaMovement(Vec3.ZERO); -@@ -448,10 +_,7 @@ +@@ -447,10 +_,7 @@ d0 = d23 + d4 * d14; d2 = d10 + d5 * d14; this.setPos(d0, d1, d2); @@ -154,7 +154,7 @@ if (vec3i.getY() != 0 && Mth.floor(this.getX()) - p_38156_.getX() == vec3i.getX() && Mth.floor(this.getZ()) - p_38156_.getZ() == vec3i.getZ()) { this.setPos(this.getX(), this.getY() + (double)vec3i.getY(), this.getZ()); } else if (vec3i1.getY() != 0 && Mth.floor(this.getX()) - p_38156_.getX() == vec3i1.getX() && Mth.floor(this.getZ()) - p_38156_.getZ() == vec3i1.getZ() -@@ -481,7 +_,10 @@ +@@ -480,7 +_,10 @@ this.setDeltaMovement(d26 * (double)(j - p_38156_.getX()), vec35.y, d26 * (double)(i - p_38156_.getZ())); } @@ -166,7 +166,7 @@ Vec3 vec36 = this.getDeltaMovement(); double d27 = vec36.horizontalDistance(); if (d27 > 0.01) { -@@ -545,7 +_,7 @@ +@@ -544,7 +_,7 @@ BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); if (BaseRailBlock.isRail(blockstate)) { @@ -175,7 +175,7 @@ p_38098_ = (double)j; if (railshape.isAscending()) { p_38098_ = (double)(j + 1); -@@ -584,7 +_,7 @@ +@@ -583,7 +_,7 @@ BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); if (BaseRailBlock.isRail(blockstate)) { @@ -184,7 +184,7 @@ Pair pair = exits(railshape); Vec3i vec3i = pair.getFirst(); Vec3i vec3i1 = pair.getSecond(); -@@ -648,6 +_,10 @@ +@@ -647,6 +_,10 @@ @Override public void push(Entity p_38165_) { @@ -195,7 +195,7 @@ if (!this.level().isClientSide) { if (!p_38165_.noPhysics && !this.noPhysics) { if (!this.hasPassenger(p_38165_)) { -@@ -686,13 +_,11 @@ +@@ -685,13 +_,11 @@ Vec3 vec32 = this.getDeltaMovement(); Vec3 vec33 = p_38165_.getDeltaMovement(); @@ -211,7 +211,7 @@ p_38165_.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); p_38165_.push(vec32.x + d0, 0.0, vec32.z + d1); this.setDeltaMovement(vec32.multiply(0.95, 1.0, 0.95)); -@@ -791,6 +_,42 @@ +@@ -790,6 +_,42 @@ public void setCustomDisplay(boolean p_38139_) { this.getEntityData().set(DATA_ID_CUSTOM_DISPLAY, p_38139_); } diff --git a/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch b/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch index 64050a18a5..cec5eec538 100644 --- a/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -94,6 +_,8 @@ +@@ -95,6 +_,8 @@ @Override public InteractionResult interact(Player p_38232_, InteractionHand p_38233_) { diff --git a/patches/net/minecraft/world/entity/vehicle/Boat.java.patch b/patches/net/minecraft/world/entity/vehicle/Boat.java.patch index 8958f7418d..9e28a5834e 100644 --- a/patches/net/minecraft/world/entity/vehicle/Boat.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/Boat.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/vehicle/Boat.java +++ b/net/minecraft/world/entity/vehicle/Boat.java -@@ -52,7 +_,7 @@ +@@ -51,7 +_,7 @@ + import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; - import org.joml.Vector3f; -public class Boat extends VehicleEntity implements VariantHolder { +public class Boat extends VehicleEntity implements VariantHolder, net.neoforged.neoforge.common.extensions.IBoatExtension { private static final EntityDataAccessor DATA_ID_TYPE = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); -@@ -476,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -471,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(l1, k1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER)) { @@ -18,17 +18,17 @@ f = Math.max(f, fluidstate.getHeight(this.level(), blockpos$mutableblockpos)); } -@@ -522,7 +_,7 @@ +@@ -517,7 +_,7 @@ voxelshape, BooleanOp.AND )) { - f += blockstate.getBlock().getFriction(); + f += blockstate.getFriction(this.level(), blockpos$mutableblockpos, this); - ++k1; + k1++; } } -@@ -551,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -546,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER)) { @@ -36,8 +36,8 @@ float f = (float)l1 + fluidstate.getHeight(this.level(), blockpos$mutableblockpos); this.waterLevel = Math.max((double)f, this.waterLevel); flag |= aabb.minY < (double)f; -@@ -581,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -576,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER) @@ -45,7 +45,7 @@ && d0 < (double)((float)blockpos$mutableblockpos.getY() + fluidstate.getHeight(this.level(), blockpos$mutableblockpos))) { if (!fluidstate.isSource()) { return Boat.Status.UNDER_FLOWING_WATER; -@@ -795,7 +_,7 @@ +@@ -794,7 +_,7 @@ } this.resetFallDistance(); @@ -54,7 +54,7 @@ this.fallDistance -= (float)p_38307_; } } -@@ -827,7 +_,7 @@ +@@ -826,7 +_,7 @@ @Override protected boolean canAddPassenger(Entity p_38390_) { diff --git a/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch b/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch index 4793246e8a..d9d498b5e6 100644 --- a/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -101,6 +_,9 @@ +@@ -107,6 +_,9 @@ this.setLootTable(null); LootParams.Builder lootparams$builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); diff --git a/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch b/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch index 843d88da1f..2d4d876d57 100644 --- a/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch @@ -8,8 +8,8 @@ + if (ret.consumesAction()) return ret; ItemStack itemstack = p_38562_.getItemInHand(p_38563_); if (INGREDIENT.test(itemstack) && this.fuel + 3600 <= 32000) { - if (!p_38562_.getAbilities().instabuild) { -@@ -131,6 +_,11 @@ + itemstack.consume(1, p_38562_); +@@ -128,6 +_,11 @@ } return InteractionResult.sidedSuccess(this.level().isClientSide); diff --git a/patches/net/minecraft/world/food/FoodData.java.patch b/patches/net/minecraft/world/food/FoodData.java.patch index 4f4656a57d..04c31223a0 100644 --- a/patches/net/minecraft/world/food/FoodData.java.patch +++ b/patches/net/minecraft/world/food/FoodData.java.patch @@ -1,19 +1,17 @@ --- a/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java -@@ -23,9 +_,15 @@ - this.saturationLevel = Math.min(this.saturationLevel + (float)p_38708_ * p_38709_ * 2.0F, (float)this.foodLevel); +@@ -27,8 +_,13 @@ + this.add(p_38708_, FoodConstants.saturationByModifier(p_38708_, p_38709_)); } + // Use the LivingEntity sensitive version in favour of this. + @Deprecated - public void eat(Item p_38713_, ItemStack p_38714_) { -+ this.eat(p_38713_, p_38714_, null); + public void eat(ItemStack p_38714_) { +- FoodProperties foodproperties = p_38714_.get(DataComponents.FOOD); ++ this.eat(p_38714_, null); + } -+ -+ public void eat(Item p_38713_, ItemStack p_38714_, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.LivingEntity entity) { - if (p_38713_.isEdible()) { -- FoodProperties foodproperties = p_38713_.getFoodProperties(); -+ FoodProperties foodproperties = p_38714_.getFoodProperties(entity); - this.eat(foodproperties.getNutrition(), foodproperties.getSaturationModifier()); ++ public void eat(ItemStack p_38714_, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.LivingEntity entity) { ++ FoodProperties foodproperties = p_38714_.getFoodProperties(entity); + if (foodproperties != null) { + this.add(foodproperties.nutrition(), foodproperties.saturation()); } - } diff --git a/patches/net/minecraft/world/food/FoodProperties.java.patch b/patches/net/minecraft/world/food/FoodProperties.java.patch index 75f445fb58..3677e653e6 100644 --- a/patches/net/minecraft/world/food/FoodProperties.java.patch +++ b/patches/net/minecraft/world/food/FoodProperties.java.patch @@ -1,73 +1,43 @@ --- a/net/minecraft/world/food/FoodProperties.java +++ b/net/minecraft/world/food/FoodProperties.java -@@ -11,15 +_,26 @@ - private final boolean isMeat; - private final boolean canAlwaysEat; - private final boolean fastFood; -- private final List> effects; -- -+ private final List, Float>> effects; -+ -+ private FoodProperties(FoodProperties.Builder builder) { -+ this.nutrition = builder.nutrition; -+ this.saturationModifier = builder.saturationModifier; -+ this.isMeat = builder.isMeat; -+ this.canAlwaysEat = builder.canAlwaysEat; -+ this.fastFood = builder.fastFood; -+ this.effects = builder.effects; -+ } -+ -+ // Forge: Use builder method instead -+ @Deprecated - FoodProperties(int p_38730_, float p_38731_, boolean p_38732_, boolean p_38733_, boolean p_38734_, List> p_38735_) { - this.nutrition = p_38730_; - this.saturationModifier = p_38731_; - this.isMeat = p_38732_; - this.canAlwaysEat = p_38733_; - this.fastFood = p_38734_; -- this.effects = p_38735_; -+ this.effects = p_38735_.stream().map(pair -> Pair., Float>of(pair::getFirst, pair.getSecond())).collect(java.util.stream.Collectors.toList()); - } - - public int getNutrition() { -@@ -43,7 +_,7 @@ - } - - public List> getEffects() { -- return this.effects; -+ return this.effects.stream().map(pair -> Pair.of(pair.getFirst() != null ? pair.getFirst().get() : null, pair.getSecond())).collect(java.util.stream.Collectors.toList()); - } - - public static class Builder { -@@ -52,7 +_,7 @@ - private boolean isMeat; - private boolean canAlwaysEat; - private boolean fastFood; -- private final List> effects = Lists.newArrayList(); -+ private final List, Float>> effects = Lists.newArrayList(); - - public FoodProperties.Builder nutrition(int p_38761_) { - this.nutrition = p_38761_; -@@ -79,13 +_,20 @@ +@@ -68,18 +_,25 @@ return this; } -+ public FoodProperties.Builder effect(java.util.function.Supplier effectIn, float probability) { -+ this.effects.add(Pair.of(effectIn, probability)); -+ return this; -+ } -+ -+ // Forge: Use supplier method instead ++ // Neo: Use supplier method instead + @Deprecated public FoodProperties.Builder effect(MobEffectInstance p_38763_, float p_38764_) { -- this.effects.add(Pair.of(p_38763_, p_38764_)); -+ this.effects.add(Pair.of(() -> p_38763_, p_38764_)); + this.effects.add(new FoodProperties.PossibleEffect(p_38763_, p_38764_)); return this; } ++ public FoodProperties.Builder effect(java.util.function.Supplier effectIn, float probability) { ++ this.effects.add(new FoodProperties.PossibleEffect(effectIn, probability)); ++ return this; ++ } ++ public FoodProperties build() { -- return new FoodProperties(this.nutrition, this.saturationModifier, this.isMeat, this.canAlwaysEat, this.fastFood, this.effects); -+ return new FoodProperties(this); + float f = FoodConstants.saturationByModifier(this.nutrition, this.saturationModifier); + return new FoodProperties(this.nutrition, f, this.canAlwaysEat, this.eatSeconds, this.effects.build()); + } + } + +- public static record PossibleEffect(MobEffectInstance effect, float probability) { ++ public static record PossibleEffect(java.util.function.Supplier effectSupplier, float probability) { + public static final Codec CODEC = RecordCodecBuilder.create( + p_337893_ -> p_337893_.group( + MobEffectInstance.CODEC.fieldOf("effect").forGetter(FoodProperties.PossibleEffect::effect), +@@ -95,8 +_,12 @@ + FoodProperties.PossibleEffect::new + ); + ++ private PossibleEffect(MobEffectInstance effect, float probability) { ++ this(() -> effect, probability); ++ } ++ + public MobEffectInstance effect() { +- return new MobEffectInstance(this.effect); ++ return new MobEffectInstance(this.effectSupplier.get()); } } } diff --git a/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index b79bb55d6d..71020741bd 100644 --- a/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -404,6 +_,7 @@ +@@ -401,6 +_,7 @@ ItemStack itemstack10 = this.getCarried(); p_150434_.updateTutorialInventoryAction(itemstack10, slot7.getItem(), clickaction); if (!this.tryItemClickBehaviourOverride(p_150434_, clickaction, slot7, itemstack9, itemstack10)) { @@ -8,32 +8,3 @@ if (itemstack9.isEmpty()) { if (!itemstack10.isEmpty()) { int i3 = clickaction == ClickAction.PRIMARY ? itemstack10.getCount() : 1; -@@ -609,14 +_,15 @@ - ItemStack itemstack = slot.getItem(); - if (!itemstack.isEmpty() && ItemStack.isSameItemSameTags(p_38904_, itemstack)) { - int j = itemstack.getCount() + p_38904_.getCount(); -- if (j <= p_38904_.getMaxStackSize()) { -+ int maxSize = Math.min(slot.getMaxStackSize(), p_38904_.getMaxStackSize()); -+ if (j <= maxSize) { - p_38904_.setCount(0); - itemstack.setCount(j); - slot.setChanged(); - flag = true; -- } else if (itemstack.getCount() < p_38904_.getMaxStackSize()) { -- p_38904_.shrink(p_38904_.getMaxStackSize() - itemstack.getCount()); -- itemstack.setCount(p_38904_.getMaxStackSize()); -+ } else if (itemstack.getCount() < maxSize) { -+ p_38904_.shrink(maxSize - itemstack.getCount()); -+ itemstack.setCount(maxSize); - slot.setChanged(); - flag = true; - } -@@ -703,7 +_,7 @@ - return switch(p_279288_) { - case 0 -> Mth.floor((float)p_279172_.getCount() / (float)p_279393_.size()); - case 1 -> 1; -- case 2 -> p_279172_.getItem().getMaxStackSize(); -+ case 2 -> p_279172_.getMaxStackSize(); - default -> p_279172_.getCount(); - }; - } diff --git a/patches/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/net/minecraft/world/inventory/AnvilMenu.java.patch index 2c73a12075..38ae222fff 100644 --- a/patches/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/AnvilMenu.java +++ b/net/minecraft/world/inventory/AnvilMenu.java -@@ -77,6 +_,8 @@ +@@ -79,6 +_,8 @@ p_150474_.giveExperienceLevels(-this.cost.get()); } @@ -9,43 +9,45 @@ this.inputSlots.setItem(0, ItemStack.EMPTY); if (this.repairItemCountCost > 0) { ItemStack itemstack = this.inputSlots.getItem(1); -@@ -93,7 +_,7 @@ +@@ -95,7 +_,7 @@ this.cost.set(0); this.access.execute((p_150479_, p_150480_) -> { BlockState blockstate = p_150479_.getBlockState(p_150480_); -- if (!p_150474_.getAbilities().instabuild && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < 0.12F) { +- if (!p_150474_.hasInfiniteMaterials() && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < 0.12F) { + if (!p_150474_.getAbilities().instabuild && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < breakChance) { BlockState blockstate1 = AnvilBlock.damage(blockstate); if (blockstate1 == null) { p_150479_.removeBlock(p_150480_, false); -@@ -124,8 +_,11 @@ - Map map = EnchantmentHelper.getEnchantments(itemstack1); - j += itemstack.getBaseRepairCost() + (itemstack2.isEmpty() ? 0 : itemstack2.getBaseRepairCost()); +@@ -124,8 +_,10 @@ + j += (long)itemstack.getOrDefault(DataComponents.REPAIR_COST, Integer.valueOf(0)).intValue() + + (long)itemstack2.getOrDefault(DataComponents.REPAIR_COST, Integer.valueOf(0)).intValue(); this.repairItemCountCost = 0; + boolean flag = false; -+ + if (!net.neoforged.neoforge.common.CommonHooks.onAnvilChange(this, itemstack, itemstack2, resultSlots, itemName, j, this.player)) return; if (!itemstack2.isEmpty()) { -- boolean flag = itemstack2.is(Items.ENCHANTED_BOOK) && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); -+ flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); +- boolean flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); ++ flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) { int l2 = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4); if (l2 <= 0) { -@@ -242,6 +_,7 @@ +@@ -228,6 +_,7 @@ i += k; - itemstack1.resetHoverName(); + itemstack1.remove(DataComponents.CUSTOM_NAME); } + if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.EMPTY; - this.cost.set(j + i); - if (i <= 0) { -@@ -307,5 +_,9 @@ + int k2 = (int)Mth.clamp(j + (long)i, 0L, 2147483647L); + this.cost.set(k2); +@@ -297,5 +_,12 @@ public int getCost() { return this.cost.get(); + } + -+ public void setMaximumCost(int value) { -+ this.cost.set(value); ++ /** ++ * Neo: Sets the cost. Will be clamped to an integer. ++ */ ++ public void setMaximumCost(long value) { ++ this.cost.set((int)Mth.clamp(value, 0L, Integer.MAX_VALUE)); } } diff --git a/patches/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/net/minecraft/world/inventory/BeaconMenu.java.patch index 2a352f71c6..8df10e8f26 100644 --- a/patches/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/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 -@@ -97,10 +_,8 @@ +@@ -98,10 +_,8 @@ } slot.onQuickCraft(itemstack1, itemstack); diff --git a/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch index 40abcf9cda..9b9d7142ef 100644 --- a/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch +++ b/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch @@ -1,37 +1,67 @@ --- a/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java -@@ -77,7 +_,7 @@ +@@ -41,9 +_,9 @@ + this.brewingStand = p_39095_; + this.brewingStandData = p_39096_; + PotionBrewing potionbrewing = p_39094_.player.level().potionBrewing(); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 0, 56, 51)); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 1, 79, 58)); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 2, 102, 51)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 0, 56, 51)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 1, 79, 58)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 2, 102, 51)); + this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionbrewing, p_39095_, 3, 79, 17)); + this.addSlot(new BrewingStandMenu.FuelSlot(p_39095_, 4, 17, 17)); + this.addDataSlots(p_39096_); +@@ -81,7 +_,7 @@ if (!this.moveItemStackTo(itemstack1, 3, 4, false)) { return ItemStack.EMPTY; } -- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack) && itemstack.getCount() == 1) { -+ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) { +- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) { ++ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(p_39100_.level().potionBrewing(), itemstack)) { if (!this.moveItemStackTo(itemstack1, 0, 3, false)) { return ItemStack.EMPTY; } -@@ -151,7 +_,7 @@ +@@ -158,13 +_,20 @@ + } + + static class PotionSlot extends Slot { ++ private final PotionBrewing potionBrewing; ++ + public PotionSlot(Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { ++ this(PotionBrewing.EMPTY, p_39123_, p_39124_, p_39125_, p_39126_); ++ } ++ ++ public PotionSlot(PotionBrewing potionBrewing, Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { + super(p_39123_, p_39124_, p_39125_, p_39126_); ++ this.potionBrewing = potionBrewing; + } @Override - public boolean mayPlace(ItemStack p_39121_) { -- return PotionBrewing.isIngredient(p_39121_); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_39121_); + public boolean mayPlace(ItemStack p_39132_) { +- return mayPlaceItem(p_39132_); ++ return mayPlaceItem(this.potionBrewing, p_39132_); } @Override -@@ -179,6 +_,7 @@ +@@ -176,14 +_,20 @@ public void onTake(Player p_150499_, ItemStack p_150500_) { - Potion potion = PotionUtils.getPotion(p_150500_); - if (p_150499_ instanceof ServerPlayer) { + Optional> optional = p_150500_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (optional.isPresent() && p_150499_ instanceof ServerPlayer serverplayer) { + net.neoforged.neoforge.event.EventHooks.onPlayerBrewedPotion(p_150499_, p_150500_); - CriteriaTriggers.BREWED_POTION.trigger((ServerPlayer)p_150499_, potion.builtInRegistryHolder()); + CriteriaTriggers.BREWED_POTION.trigger(serverplayer, optional.get()); } -@@ -186,7 +_,7 @@ + super.onTake(p_150499_, p_150500_); } ++ @Deprecated // Neo: use the overload that takes PotionBrewing instead public static boolean mayPlaceItem(ItemStack p_39134_) { -- return p_39134_.is(Items.POTION) || p_39134_.is(Items.SPLASH_POTION) || p_39134_.is(Items.LINGERING_POTION) || p_39134_.is(Items.GLASS_BOTTLE); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_39134_); + return p_39134_.is(Items.POTION) || p_39134_.is(Items.SPLASH_POTION) || p_39134_.is(Items.LINGERING_POTION) || p_39134_.is(Items.GLASS_BOTTLE); ++ } ++ ++ public static boolean mayPlaceItem(PotionBrewing potionBrewing, ItemStack p_39134_) { ++ return potionBrewing.isInput(p_39134_) || p_39134_.is(Items.GLASS_BOTTLE); } } } diff --git a/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch index f307613524..42e27b416e 100644 --- a/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -58,7 +_,7 @@ +@@ -57,7 +_,7 @@ this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { @Override public boolean mayPlace(ItemStack p_39517_) { @@ -9,23 +9,23 @@ } @Override -@@ -95,23 +_,24 @@ +@@ -94,23 +_,24 @@ ItemStack itemstack = p_39461_.getItem(0); if (!itemstack.isEmpty() && itemstack.isEnchantable()) { - this.access.execute((p_39485_, p_39486_) -> { + this.access.execute((p_337902_, p_337903_) -> { - int j = 0; + float j = 0; - for(BlockPos blockpos : EnchantmentTableBlock.BOOKSHELF_OFFSETS) { - if (EnchantmentTableBlock.isValidBookShelf(p_39485_, p_39486_, blockpos)) { -- ++j; -+ j += p_39485_.getBlockState(p_39486_.offset(blockpos)).getEnchantPowerBonus(p_39485_, p_39486_.offset(blockpos)); + for (BlockPos blockpos : EnchantingTableBlock.BOOKSHELF_OFFSETS) { + if (EnchantingTableBlock.isValidBookShelf(p_337902_, p_337903_, blockpos)) { +- j++; ++ j += p_337902_.getBlockState(p_337903_.offset(blockpos)).getEnchantPowerBonus(p_337902_, p_337903_.offset(blockpos)); } } this.random.setSeed((long)this.enchantmentSeed.get()); - for(int k = 0; k < 3; ++k) { + for (int k = 0; k < 3; k++) { - this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, j, itemstack); + this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, (int)j, itemstack); this.enchantClue[k] = -1; @@ -33,19 +33,11 @@ if (this.costs[k] < k + 1) { this.costs[k] = 0; } -+ this.costs[k] = net.neoforged.neoforge.event.EventHooks.onEnchantmentLevelSet(p_39485_, p_39486_, k, (int)j, itemstack, costs[k]); ++ this.costs[k] = net.neoforged.neoforge.event.EventHooks.onEnchantmentLevelSet(p_337902_, p_337903_, k, (int)j, itemstack, costs[k]); } - for(int l = 0; l < 3; ++l) { -@@ -164,6 +_,7 @@ - if (compoundtag != null) { - itemstack2.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - - this.enchantSlots.setItem(0, itemstack2); - } -@@ -250,7 +_,7 @@ + for (int l = 0; l < 3; l++) { +@@ -239,7 +_,7 @@ if (!this.moveItemStackTo(itemstack1, 2, 38, true)) { return ItemStack.EMPTY; } diff --git a/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch b/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch index 53cbbbf968..b437d67b28 100644 --- a/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch +++ b/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/FurnaceResultSlot.java +++ b/net/minecraft/world/inventory/FurnaceResultSlot.java -@@ -53,5 +_,6 @@ +@@ -49,5 +_,6 @@ } this.removeCount = 0; diff --git a/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch index 6b81d193f1..4e8f80190f 100644 --- a/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -12,15 +12,15 @@ this.addSlot(new Slot(this.repairSlots, 0, 49, 19) { @Override public boolean mayPlace(ItemStack p_39607_) { -- return p_39607_.isDamageableItem() || p_39607_.is(Items.ENCHANTED_BOOK) || p_39607_.isEnchanted(); -+ return p_39607_.isDamageableItem() || p_39607_.is(Items.ENCHANTED_BOOK) || p_39607_.isEnchanted() || p_39607_.canGrindstoneRepair(); +- return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_); ++ return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_) || p_39607_.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.repairSlots, 1, 49, 40) { @Override public boolean mayPlace(ItemStack p_39616_) { -- return p_39616_.isDamageableItem() || p_39616_.is(Items.ENCHANTED_BOOK) || p_39616_.isEnchanted(); -+ return p_39616_.isDamageableItem() || p_39616_.is(Items.ENCHANTED_BOOK) || p_39616_.isEnchanted() || p_39616_.canGrindstoneRepair(); +- return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_); ++ return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_) || p_39616_.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.resultSlots, 2, 129, 34) { @@ -40,51 +40,29 @@ int l = 0; l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0)); l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1)); -@@ -128,6 +_,8 @@ - ItemStack itemstack1 = this.repairSlots.getItem(1); - boolean flag = !itemstack.isEmpty() || !itemstack1.isEmpty(); - boolean flag1 = !itemstack.isEmpty() && !itemstack1.isEmpty(); -+ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(itemstack, itemstack1, this.resultSlots, -1); -+ if (this.xp == Integer.MIN_VALUE) +@@ -130,6 +_,8 @@ + + private ItemStack computeResult(ItemStack p_332654_, ItemStack p_332736_) { + boolean flag = !p_332654_.isEmpty() || !p_332736_.isEmpty(); ++ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(p_332654_, p_332736_, this.resultSlots, -1); ++ if (this.xp != Integer.MIN_VALUE) return ItemStack.EMPTY; // Porting 1.20.5 check if this is correct if (!flag) { - this.resultSlots.setItem(0, ItemStack.EMPTY); - } else { -@@ -150,12 +_,13 @@ + return ItemStack.EMPTY; + } else if (p_332654_.getCount() <= 1 && p_332736_.getCount() <= 1) { +@@ -154,7 +_,7 @@ + int k = p_332686_.getMaxDamage() - p_332686_.getDamageValue(); + int l = j + k + i * 5 / 100; + int i1 = 1; +- if (!p_332723_.isDamageableItem()) { ++ if (!p_332723_.isDamageableItem() || !p_332723_.isRepairable()) { + if (p_332723_.getMaxStackSize() < 2 || !ItemStack.matches(p_332723_, p_332686_)) { + return ItemStack.EMPTY; } - - Item item = itemstack.getItem(); -- int k = item.getMaxDamage() - itemstack.getDamageValue(); -- int l = item.getMaxDamage() - itemstack1.getDamageValue(); -- int i1 = k + l + item.getMaxDamage() * 5 / 100; -- i = Math.max(item.getMaxDamage() - i1, 0); -+ int k = itemstack.getMaxDamage() - itemstack.getDamageValue(); -+ int l = itemstack.getMaxDamage() - itemstack1.getDamageValue(); -+ int i1 = k + l + itemstack.getMaxDamage() * 5 / 100; -+ i = Math.max(itemstack.getMaxDamage() - i1, 0); - itemstack2 = this.mergeEnchants(itemstack, itemstack1); -- if (!itemstack2.isDamageableItem()) { -+ if (!itemstack2.isRepairable()) i = itemstack.getDamageValue(); -+ if (!itemstack2.isDamageableItem() || !itemstack2.isRepairable()) { - if (!ItemStack.matches(itemstack, itemstack1)) { - this.resultSlots.setItem(0, ItemStack.EMPTY); - this.broadcastChanges(); -@@ -170,6 +_,10 @@ - itemstack2 = flag3 ? itemstack : itemstack1; +@@ -166,6 +_,7 @@ + if (itemstack.isDamageableItem()) { + itemstack.set(DataComponents.MAX_DAMAGE, i); + itemstack.setDamageValue(Math.max(i - l, 0)); ++ if (!p_332686_.isRepairable()) itemstack.setDamageValue(p_332723_.getDamageValue()); } -+ // Forge: Skip the repair if the result would give an item stack with a count not normally obtainable -+ if (j > itemstack2.getMaxStackSize()) -+ this.resultSlots.setItem(0, ItemStack.EMPTY); -+ else - this.resultSlots.setItem(0, this.removeNonCurses(itemstack2, i, j)); - } - -@@ -182,7 +_,7 @@ - - for(Entry entry : map.entrySet()) { - Enchantment enchantment = entry.getKey(); -- if (!enchantment.isCurse() || EnchantmentHelper.getItemEnchantmentLevel(enchantment, itemstack) == 0) { -+ if (!enchantment.isCurse() || EnchantmentHelper.getTagEnchantmentLevel(enchantment, itemstack) == 0) { - itemstack.enchant(enchantment, entry.getValue()); - } - } + this.mergeEnchantsFrom(itemstack, p_332686_); diff --git a/patches/net/minecraft/world/inventory/InventoryMenu.java.patch b/patches/net/minecraft/world/inventory/InventoryMenu.java.patch index 810b7719b9..03fe9e62d2 100644 --- a/patches/net/minecraft/world/inventory/InventoryMenu.java.patch +++ b/patches/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 -@@ -68,7 +_,7 @@ +@@ -70,7 +_,7 @@ @Override public boolean mayPlace(ItemStack p_39746_) { diff --git a/patches/net/minecraft/world/inventory/MenuType.java.patch b/patches/net/minecraft/world/inventory/MenuType.java.patch index 3acd580268..7d0eaf4e2d 100644 --- a/patches/net/minecraft/world/inventory/MenuType.java.patch +++ b/patches/net/minecraft/world/inventory/MenuType.java.patch @@ -16,7 +16,7 @@ + } + + @Override -+ public T create(int windowId, Inventory playerInv, net.minecraft.network.FriendlyByteBuf extraData) { ++ public T create(int windowId, Inventory playerInv, net.minecraft.network.RegistryFriendlyByteBuf extraData) { + if (this.constructor instanceof net.neoforged.neoforge.network.IContainerFactory) { + return ((net.neoforged.neoforge.network.IContainerFactory) this.constructor).create(windowId, playerInv, extraData); + } diff --git a/patches/net/minecraft/world/inventory/ResultSlot.java.patch b/patches/net/minecraft/world/inventory/ResultSlot.java.patch index c3aad3a82d..2ebbcbd578 100644 --- a/patches/net/minecraft/world/inventory/ResultSlot.java.patch +++ b/patches/net/minecraft/world/inventory/ResultSlot.java.patch @@ -7,8 +7,8 @@ + net.neoforged.neoforge.event.EventHooks.firePlayerCraftingEvent(this.player, p_40185_, this.craftSlots); } - Container container = this.container; -@@ -59,7 +_,9 @@ + if (this.container instanceof RecipeCraftingHolder recipecraftingholder) { +@@ -58,7 +_,9 @@ @Override public void onTake(Player p_150638_, ItemStack p_150639_) { this.checkTakeAchievements(p_150639_); @@ -16,5 +16,5 @@ NonNullList nonnulllist = p_150638_.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, p_150638_.level()); + net.neoforged.neoforge.common.CommonHooks.setCraftingPlayer(null); - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = this.craftSlots.getItem(i); diff --git a/patches/net/minecraft/world/item/ArmorItem.java.patch b/patches/net/minecraft/world/item/ArmorItem.java.patch deleted file mode 100644 index 684cf40cfd..0000000000 --- a/patches/net/minecraft/world/item/ArmorItem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/ArmorItem.java -+++ b/net/minecraft/world/item/ArmorItem.java -@@ -80,7 +_,7 @@ - UUID uuid = ARMOR_MODIFIER_UUID_PER_TYPE.get(p_266831_); - builder.put(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", (double)this.defense, AttributeModifier.Operation.ADDITION)); - builder.put(Attributes.ARMOR_TOUGHNESS, new AttributeModifier(uuid, "Armor toughness", (double)this.toughness, AttributeModifier.Operation.ADDITION)); -- if (p_40386_ == ArmorMaterials.NETHERITE) { -+ if (this.knockbackResistance > 0) { - builder.put( - Attributes.KNOCKBACK_RESISTANCE, - new AttributeModifier(uuid, "Armor knockback resistance", (double)this.knockbackResistance, AttributeModifier.Operation.ADDITION) diff --git a/patches/net/minecraft/world/item/ArrowItem.java.patch b/patches/net/minecraft/world/item/ArrowItem.java.patch index 88ea6a4f27..1d3c13e074 100644 --- a/patches/net/minecraft/world/item/ArrowItem.java.patch +++ b/patches/net/minecraft/world/item/ArrowItem.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/item/ArrowItem.java +++ b/net/minecraft/world/item/ArrowItem.java -@@ -15,4 +_,9 @@ - arrow.setEffectsFromItem(p_40514_); +@@ -23,4 +_,9 @@ + arrow.pickup = AbstractArrow.Pickup.ALLOWED; return arrow; } + -+ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.world.entity.player.Player player) { -+ int enchant = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY_ARROWS, bow); -+ return enchant <= 0 ? false : this.getClass() == ArrowItem.class; ++ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.world.entity.LivingEntity livingEntity) { ++ int enchant = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, bow); ++ return enchant > 0 && this.getClass() == net.minecraft.world.item.ArrowItem.class; + } } diff --git a/patches/net/minecraft/world/item/AxeItem.java.patch b/patches/net/minecraft/world/item/AxeItem.java.patch index 4b5485d328..30f2614f11 100644 --- a/patches/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/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 -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ Level level = p_40529_.getLevel(); BlockPos blockpos = p_40529_.getClickedPos(); Player player = p_40529_.getPlayer(); @@ -9,7 +9,7 @@ if (optional.isEmpty()) { return InteractionResult.PASS; } else { -@@ -74,20 +_,19 @@ +@@ -75,20 +_,19 @@ } } @@ -34,7 +34,7 @@ if (optional2.isPresent()) { p_308922_.playSound(p_309192_, p_308899_, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); p_308922_.levelEvent(p_309192_, 3004, p_308899_, 0); -@@ -99,8 +_,19 @@ +@@ -100,8 +_,19 @@ } } diff --git a/patches/net/minecraft/world/item/BannerItem.java.patch b/patches/net/minecraft/world/item/BannerItem.java.patch deleted file mode 100644 index 7a0387a347..0000000000 --- a/patches/net/minecraft/world/item/BannerItem.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/world/item/BannerItem.java -+++ b/net/minecraft/world/item/BannerItem.java -@@ -37,9 +_,10 @@ - holder.unwrapKey() - .map(p_220002_ -> p_220002_.location().toShortLanguageKey()) - .ifPresent( -- p_220006_ -> p_40544_.add( -- Component.translatable("block.minecraft.banner." + p_220006_ + "." + dyecolor.getName()).withStyle(ChatFormatting.GRAY) -- ) -+ p_220006_ -> { -+ net.minecraft.resources.ResourceLocation fileLoc = new net.minecraft.resources.ResourceLocation(p_220006_); -+ p_40544_.add(Component.translatable("block." + fileLoc.getNamespace() + ".banner." + fileLoc.getPath() + "." + dyecolor.getSerializedName()).withStyle(ChatFormatting.GRAY)); -+ } - ); - } - } diff --git a/patches/net/minecraft/world/item/BlockItem.java.patch b/patches/net/minecraft/world/item/BlockItem.java.patch index aac45ad39a..a8ef2e4e88 100644 --- a/patches/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/net/minecraft/world/item/BlockItem.java.patch @@ -14,7 +14,7 @@ SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F -@@ -102,10 +_,16 @@ +@@ -99,10 +_,16 @@ } } @@ -31,7 +31,7 @@ @Nullable public BlockPlaceContext updatePlacementContext(BlockPlaceContext p_40609_) { return p_40609_; -@@ -208,6 +_,10 @@ +@@ -193,6 +_,10 @@ public void registerBlocks(Map p_40607_, Item p_40608_) { p_40607_.put(this.getBlock(), p_40608_); diff --git a/patches/net/minecraft/world/item/BoneMealItem.java.patch b/patches/net/minecraft/world/item/BoneMealItem.java.patch index a4bf461c4e..5cbc49f60f 100644 --- a/patches/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/net/minecraft/world/item/BoneMealItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BoneMealItem.java +++ b/net/minecraft/world/item/BoneMealItem.java -@@ -38,7 +_,7 @@ +@@ -37,7 +_,7 @@ Level level = p_40637_.getLevel(); BlockPos blockpos = p_40637_.getClickedPos(); BlockPos blockpos1 = blockpos.relative(p_40637_.getClickedFace()); @@ -8,8 +8,8 @@ + if (applyBonemeal(p_40637_.getItemInHand(), level, blockpos, p_40637_.getPlayer())) { if (!level.isClientSide) { p_40637_.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); - level.levelEvent(1505, blockpos, 0); -@@ -61,8 +_,17 @@ + level.levelEvent(1505, blockpos, 15); +@@ -60,8 +_,17 @@ } } @@ -24,6 +24,6 @@ BlockState blockstate = p_40629_.getBlockState(p_40630_); + int hook = net.neoforged.neoforge.event.EventHooks.onApplyBonemeal(player, p_40629_, p_40630_, blockstate, p_40628_); + if (hook != 0) return hook > 0; - Block block = blockstate.getBlock(); - if (block instanceof BonemealableBlock bonemealableblock && bonemealableblock.isValidBonemealTarget(p_40629_, p_40630_, blockstate)) { + if (blockstate.getBlock() instanceof BonemealableBlock bonemealableblock && bonemealableblock.isValidBonemealTarget(p_40629_, p_40630_, blockstate)) { if (p_40629_ instanceof ServerLevel) { + if (bonemealableblock.isBonemealSuccess(p_40629_, p_40629_.random, p_40630_, blockstate)) { diff --git a/patches/net/minecraft/world/item/BowItem.java.patch b/patches/net/minecraft/world/item/BowItem.java.patch index 2350734da1..1273d2f5fe 100644 --- a/patches/net/minecraft/world/item/BowItem.java.patch +++ b/patches/net/minecraft/world/item/BowItem.java.patch @@ -1,32 +1,15 @@ --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java -@@ -27,18 +_,23 @@ - Player player = (Player)p_40669_; - boolean flag = player.getAbilities().instabuild || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY_ARROWS, p_40667_) > 0; +@@ -25,7 +_,7 @@ + public void releaseUsing(ItemStack p_40667_, Level p_40668_, LivingEntity p_40669_, int p_40670_) { + if (p_40669_ instanceof Player player) { ItemStack itemstack = player.getProjectile(p_40667_); -+ -+ int i = this.getUseDuration(p_40667_) - p_40670_; -+ i = net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40667_, p_40668_, player, i, !itemstack.isEmpty() || flag); -+ if (i < 0) return; -+ - if (!itemstack.isEmpty() || flag) { - if (itemstack.isEmpty()) { - itemstack = new ItemStack(Items.ARROW); - } - -- int i = this.getUseDuration(p_40667_) - p_40670_; +- if (!itemstack.isEmpty()) { ++ if (!itemstack.isEmpty()) { // Porting 1.20.5 redo EventHooks.onArrowLoose + int i = this.getUseDuration(p_40667_) - p_40670_; float f = getPowerForTime(i); if (!((double)f < 0.1)) { -- boolean flag1 = flag && itemstack.is(Items.ARROW); -+ boolean flag1 = player.getAbilities().instabuild || (itemstack.getItem() instanceof ArrowItem && ((ArrowItem)itemstack.getItem()).isInfinite(itemstack, p_40667_, player)); - if (!p_40668_.isClientSide) { - ArrowItem arrowitem = (ArrowItem)(itemstack.getItem() instanceof ArrowItem ? itemstack.getItem() : Items.ARROW); - AbstractArrow abstractarrow = arrowitem.createArrow(p_40668_, itemstack, player); -+ abstractarrow = customArrow(abstractarrow, itemstack); - abstractarrow.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, f * 3.0F, 1.0F); - if (f == 1.0F) { - abstractarrow.setCritArrow(true); -@@ -113,6 +_,10 @@ +@@ -81,6 +_,10 @@ public InteractionResultHolder use(Level p_40672_, Player p_40673_, InteractionHand p_40674_) { ItemStack itemstack = p_40673_.getItemInHand(p_40674_); boolean flag = !p_40673_.getProjectile(itemstack).isEmpty(); @@ -34,17 +17,6 @@ + InteractionResultHolder ret = net.neoforged.neoforge.event.EventHooks.onArrowNock(itemstack, p_40672_, p_40673_, p_40674_, flag); + if (ret != null) return ret; + - if (!p_40673_.getAbilities().instabuild && !flag) { + if (!p_40673_.hasInfiniteMaterials() && !flag) { return InteractionResultHolder.fail(itemstack); } else { -@@ -124,6 +_,10 @@ - @Override - public Predicate getAllSupportedProjectiles() { - return ARROW_ONLY; -+ } -+ -+ public AbstractArrow customArrow(AbstractArrow arrow, ItemStack stack) { -+ return arrow; - } - - @Override diff --git a/patches/net/minecraft/world/item/BrushItem.java.patch b/patches/net/minecraft/world/item/BrushItem.java.patch index 3b9e4d848b..7adce2ac99 100644 --- a/patches/net/minecraft/world/item/BrushItem.java.patch +++ b/patches/net/minecraft/world/item/BrushItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BrushItem.java +++ b/net/minecraft/world/item/BrushItem.java -@@ -148,4 +_,9 @@ +@@ -143,4 +_,9 @@ }; } } diff --git a/patches/net/minecraft/world/item/BucketItem.java.patch b/patches/net/minecraft/world/item/BucketItem.java.patch index 95ae7ab273..9c82e42310 100644 --- a/patches/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/net/minecraft/world/item/BucketItem.java.patch @@ -34,7 +34,7 @@ if (blockhitresult.getType() == HitResult.Type.MISS) { return InteractionResultHolder.pass(itemstack); } else if (blockhitresult.getType() != HitResult.Type.BLOCK) { -@@ -59,7 +_,7 @@ +@@ -58,7 +_,7 @@ ItemStack itemstack2 = bucketpickup.pickupBlock(p_40704_, p_40703_, blockpos, blockstate1); if (!itemstack2.isEmpty()) { p_40704_.awardStat(Stats.ITEM_USED.get(this)); @@ -43,7 +43,7 @@ p_40703_.gameEvent(p_40704_, GameEvent.FLUID_PICKUP, blockpos); ItemStack itemstack1 = ItemUtils.createFilledResult(itemstack, p_40704_, itemstack2); if (!p_40703_.isClientSide) { -@@ -73,8 +_,8 @@ +@@ -72,8 +_,8 @@ return InteractionResultHolder.fail(itemstack); } else { BlockState blockstate = p_40703_.getBlockState(blockpos); @@ -54,32 +54,19 @@ this.checkExtraContent(p_40704_, p_40703_, itemstack, blockpos2); if (p_40704_ instanceof ServerPlayer) { CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer)p_40704_, blockpos2, itemstack); -@@ -98,9 +_,14 @@ +@@ -97,7 +_,11 @@ } @Override -+ @Deprecated //Forge: use the ItemStack sensitive version ++ @Deprecated // Neo: use the ItemStack sensitive version public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_) { - Fluid $$6 = this.content; -- if (!($$6 instanceof FlowingFluid)) { + return this.emptyContents(p_150716_, p_150717_, p_150718_, p_150719_, null); + } -+ + public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_, @Nullable ItemStack container) { -+ if (!(this.content instanceof FlowingFluid)) { + if (!(this.content instanceof FlowingFluid flowingfluid)) { return false; } else { - FlowingFluid flowingfluid; -@@ -109,7 +_,7 @@ - boolean flag2; - BlockState blockstate; - label82: { -- flowingfluid = (FlowingFluid)$$6; -+ flowingfluid = (FlowingFluid)this.content; - blockstate = p_150717_.getBlockState(p_150718_); - $$7 = blockstate.getBlock(); - $$8 = blockstate.canBeReplaced(this.content); -@@ -128,8 +_,12 @@ +@@ -124,8 +_,12 @@ } boolean flag1 = flag2; @@ -93,7 +80,7 @@ } else if (p_150717_.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { int l = p_150718_.getX(); int i = p_150718_.getY(); -@@ -151,7 +_,7 @@ +@@ -147,7 +_,7 @@ return true; } else { @@ -102,7 +89,7 @@ liquidblockcontainer1.placeLiquid(p_150717_, p_150718_, blockstate, flowingfluid.getSource(false)); this.playEmptySound(p_150716_, p_150717_, p_150718_); return true; -@@ -172,8 +_,17 @@ +@@ -168,8 +_,17 @@ } protected void playEmptySound(@Nullable Player p_40696_, LevelAccessor p_40697_, BlockPos p_40698_) { diff --git a/patches/net/minecraft/world/item/BundleItem.java.patch b/patches/net/minecraft/world/item/BundleItem.java.patch index 8954a60706..945917f07c 100644 --- a/patches/net/minecraft/world/item/BundleItem.java.patch +++ b/patches/net/minecraft/world/item/BundleItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BundleItem.java +++ b/net/minecraft/world/item/BundleItem.java -@@ -40,7 +_,7 @@ +@@ -38,7 +_,7 @@ @Override public boolean overrideStackedOnOther(ItemStack p_150733_, Slot p_150734_, ClickAction p_150735_, Player p_150736_) { @@ -8,12 +8,12 @@ + if (p_150733_.getCount() != 1 || p_150735_ != ClickAction.SECONDARY) { return false; } else { - ItemStack itemstack = p_150734_.getItem(); -@@ -63,6 +_,7 @@ + BundleContents bundlecontents = p_150733_.get(DataComponents.BUNDLE_CONTENTS); +@@ -71,6 +_,7 @@ public boolean overrideOtherStackedOnMe( ItemStack p_150742_, ItemStack p_150743_, Slot p_150744_, ClickAction p_150745_, Player p_150746_, SlotAccess p_150747_ ) { + if (p_150742_.getCount() != 1) return false; if (p_150745_ == ClickAction.SECONDARY && p_150744_.allowModification(p_150746_)) { - if (p_150743_.isEmpty()) { - removeOne(p_150742_).ifPresent(p_186347_ -> { + BundleContents bundlecontents = p_150742_.get(DataComponents.BUNDLE_CONTENTS); + if (bundlecontents == null) { diff --git a/patches/net/minecraft/world/item/CompassItem.java.patch b/patches/net/minecraft/world/item/CompassItem.java.patch deleted file mode 100644 index c942fef140..0000000000 --- a/patches/net/minecraft/world/item/CompassItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/CompassItem.java -+++ b/net/minecraft/world/item/CompassItem.java -@@ -103,6 +_,7 @@ - ItemStack itemstack1 = new ItemStack(Items.COMPASS, 1); - CompoundTag compoundtag = itemstack.hasTag() ? itemstack.getTag().copy() : new CompoundTag(); - itemstack1.setTag(compoundtag); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - if (!player.getAbilities().instabuild) { - itemstack.shrink(1); - } diff --git a/patches/net/minecraft/world/item/CreativeModeTabs.java.patch b/patches/net/minecraft/world/item/CreativeModeTabs.java.patch index d9673177cb..7cb899d0d4 100644 --- a/patches/net/minecraft/world/item/CreativeModeTabs.java.patch +++ b/patches/net/minecraft/world/item/CreativeModeTabs.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/item/CreativeModeTabs.java +++ b/net/minecraft/world/item/CreativeModeTabs.java -@@ -1800,7 +_,7 @@ - ) { +@@ -1883,7 +_,7 @@ p_270903_.listElements() .map(Holder::value) -- .filter(p_270008_ -> p_270380_.contains(p_270008_.category)) + .filter(p_337914_ -> p_337914_.isEnabled(p_338678_)) +- .filter(p_335280_ -> p_270380_.contains(p_335280_.getSupportedItems())) + .filter(p_270008_ -> p_270008_.allowedInCreativeTab(Items.ENCHANTED_BOOK, p_270380_)) .map(p_270038_ -> EnchantedBookItem.createForEnchantment(new EnchantmentInstance(p_270038_, p_270038_.getMaxLevel()))) .forEach(p_269989_ -> p_270868_.accept(p_269989_, p_270407_)); } -@@ -1810,7 +_,7 @@ - ) { +@@ -1898,7 +_,7 @@ p_270628_.listElements() .map(Holder::value) -- .filter(p_269991_ -> p_271024_.contains(p_269991_.category)) + .filter(p_337930_ -> p_337930_.isEnabled(p_338625_)) +- .filter(p_335276_ -> p_271024_.contains(p_335276_.getSupportedItems())) + .filter(p_269991_ -> p_269991_.allowedInCreativeTab(Items.ENCHANTED_BOOK, p_271024_)) .flatMap( p_270024_ -> IntStream.rangeClosed(p_270024_.getMinLevel(), p_270024_.getMaxLevel()) diff --git a/patches/net/minecraft/world/item/CrossbowItem.java.patch b/patches/net/minecraft/world/item/CrossbowItem.java.patch index 8216d6c3e1..96bf507c43 100644 --- a/patches/net/minecraft/world/item/CrossbowItem.java.patch +++ b/patches/net/minecraft/world/item/CrossbowItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/CrossbowItem.java +++ b/net/minecraft/world/item/CrossbowItem.java -@@ -258,6 +_,7 @@ - } - - public static void performShooting(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) { -+ if (p_40889_ instanceof Player player && net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40891_, p_40889_.level(), player, 1, true) < 0) return; - List list = getChargedProjectiles(p_40891_); - float[] afloat = getShotPitches(p_40889_.getRandom()); - +@@ -168,6 +_,7 @@ + Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_, @Nullable LivingEntity p_331602_ + ) { + if (!p_40888_.isClientSide()) { ++ if (p_40889_ instanceof Player player && net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40891_, p_40889_.level(), player, 1, true) < 0) return; + ChargedProjectiles chargedprojectiles = p_40891_.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); + if (chargedprojectiles != null && !chargedprojectiles.isEmpty()) { + this.shoot(p_40888_, p_40889_, p_40890_, p_40891_, chargedprojectiles.getItems(), p_40892_, p_40893_, p_40889_ instanceof Player, p_331602_); diff --git a/patches/net/minecraft/world/item/DiggerItem.java.patch b/patches/net/minecraft/world/item/DiggerItem.java.patch deleted file mode 100644 index 29d8c1ae2f..0000000000 --- a/patches/net/minecraft/world/item/DiggerItem.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/world/item/DiggerItem.java -+++ b/net/minecraft/world/item/DiggerItem.java -@@ -67,7 +_,11 @@ - } - - @Override -+ @Deprecated // FORGE: Use stack sensitive variant below - public boolean isCorrectToolForDrops(BlockState p_150816_) { -+ if (net.neoforged.neoforge.common.TierSortingRegistry.isTierSorted(getTier())) { -+ return net.neoforged.neoforge.common.TierSortingRegistry.isCorrectTierForDrops(getTier(), p_150816_) && p_150816_.is(this.blocks); -+ } - int i = this.getTier().getLevel(); - if (i < 3 && p_150816_.is(BlockTags.NEEDS_DIAMOND_TOOL)) { - return false; -@@ -76,5 +_,11 @@ - } else { - return i < 1 && p_150816_.is(BlockTags.NEEDS_STONE_TOOL) ? false : p_150816_.is(this.blocks); - } -+ } -+ -+ // FORGE START -+ @Override -+ public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { -+ return state.is(blocks) && net.neoforged.neoforge.common.TierSortingRegistry.isCorrectTierForDrops(getTier(), state); - } - } diff --git a/patches/net/minecraft/world/item/DyeColor.java.patch b/patches/net/minecraft/world/item/DyeColor.java.patch index 4c9d0a2245..c075965d60 100644 --- a/patches/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/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 -@@ -38,6 +_,7 @@ +@@ -42,6 +_,7 @@ private final MapColor mapColor; private final float[] textureDiffuseColors; private final int fireworkColor; @@ -8,15 +8,15 @@ private final int textColor; private DyeColor(int p_41046_, String p_41047_, int p_41048_, MapColor p_285297_, int p_41050_, int p_41051_) { -@@ -48,6 +_,7 @@ +@@ -52,6 +_,7 @@ int i = (p_41048_ & 0xFF0000) >> 16; int j = (p_41048_ & 0xFF00) >> 8; int k = (p_41048_ & 0xFF) >> 0; -+ this.tag = net.minecraft.tags.ItemTags.create(new net.minecraft.resources.ResourceLocation("forge", "dyes/" + p_41047_)); ++ this.tag = net.minecraft.tags.ItemTags.create(new net.minecraft.resources.ResourceLocation("c", "dyes/" + p_41047_)); this.textureDiffuseColors = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; this.fireworkColor = p_41050_; } -@@ -100,5 +_,23 @@ +@@ -104,5 +_,23 @@ @Override public String getSerializedName() { return this.name; diff --git a/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch b/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch deleted file mode 100644 index 9f1f31844b..0000000000 --- a/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/DyeableHorseArmorItem.java -+++ b/net/minecraft/world/item/DyeableHorseArmorItem.java -@@ -4,4 +_,7 @@ - public DyeableHorseArmorItem(int p_41110_, String p_41111_, Item.Properties p_41112_) { - super(p_41110_, p_41111_, p_41112_); - } -+ public DyeableHorseArmorItem(int p_41110_, net.minecraft.resources.ResourceLocation p_41111_, Item.Properties p_41112_) { -+ super(p_41110_, p_41111_, p_41112_); -+ } - } diff --git a/patches/net/minecraft/world/item/ElytraItem.java.patch b/patches/net/minecraft/world/item/ElytraItem.java.patch index 6878eb7a09..7dedbef32a 100644 --- a/patches/net/minecraft/world/item/ElytraItem.java.patch +++ b/patches/net/minecraft/world/item/ElytraItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ElytraItem.java +++ b/net/minecraft/world/item/ElytraItem.java -@@ -30,6 +_,25 @@ +@@ -31,6 +_,25 @@ } @Override @@ -14,7 +14,7 @@ + int nextFlightTick = flightTicks + 1; + if (nextFlightTick % 10 == 0) { + if (nextFlightTick % 20 == 0) { -+ stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(net.minecraft.world.entity.EquipmentSlot.CHEST)); ++ stack.hurtAndBreak(1, entity, net.minecraft.world.entity.EquipmentSlot.CHEST); + } + entity.gameEvent(net.minecraft.world.level.gameevent.GameEvent.ELYTRA_GLIDE); + } @@ -23,6 +23,6 @@ + } + + @Override - public SoundEvent getEquipSound() { + public Holder getEquipSound() { return SoundEvents.ARMOR_EQUIP_ELYTRA; } diff --git a/patches/net/minecraft/world/item/FireworkRocketItem.java.patch b/patches/net/minecraft/world/item/FireworkRocketItem.java.patch deleted file mode 100644 index 14b77c8a9a..0000000000 --- a/patches/net/minecraft/world/item/FireworkRocketItem.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/world/item/FireworkRocketItem.java -+++ b/net/minecraft/world/item/FireworkRocketItem.java -@@ -122,7 +_,7 @@ - return itemstack; - } - -- public static enum Shape { -+ public static enum Shape implements net.neoforged.neoforge.common.IExtensibleEnum { - SMALL_BALL(0, "small_ball"), - LARGE_BALL(1, "large_ball"), - STAR(2, "star"), -@@ -148,8 +_,28 @@ - return this.name; - } - -+ public void save(net.minecraft.nbt.CompoundTag tag) { -+ tag.putByte("Type", (byte) getId()); -+ tag.putString("neoforge:shape_type", name()); -+ } -+ -+ /** Use {getShape(ComoundTag)} */ -+ @Deprecated - public static FireworkRocketItem.Shape byId(int p_41238_) { - return BY_ID.apply(p_41238_); -+ } -+ -+ public static FireworkRocketItem.Shape getShape(net.minecraft.nbt.CompoundTag tag) { -+ String name = tag.contains("neoforge:shape_type", net.minecraft.nbt.Tag.TAG_STRING) ? tag.getString("neoforge:shape_type") : null; -+ if (name == null) return byId(tag.getByte("Type")); -+ for (Shape ret : values()) -+ if (ret.name().equals(name)) -+ return ret; -+ return SMALL_BALL; -+ } -+ -+ public static Shape create(String registryName, int id, String shapeName) { -+ throw new IllegalStateException("Enum not extended"); - } - } - } diff --git a/patches/net/minecraft/world/item/FireworkStarItem.java.patch b/patches/net/minecraft/world/item/FireworkStarItem.java.patch deleted file mode 100644 index e8224cf8ea..0000000000 --- a/patches/net/minecraft/world/item/FireworkStarItem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/FireworkStarItem.java -+++ b/net/minecraft/world/item/FireworkStarItem.java -@@ -23,7 +_,7 @@ - } - - public static void appendHoverText(CompoundTag p_41257_, List p_41258_) { -- FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.byId(p_41257_.getByte("Type")); -+ FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.getShape(p_41257_); - p_41258_.add(Component.translatable("item.minecraft.firework_star.shape." + fireworkrocketitem$shape.getName()).withStyle(ChatFormatting.GRAY)); - int[] aint = p_41257_.getIntArray("Colors"); - if (aint.length > 0) { diff --git a/patches/net/minecraft/world/item/FishingRodItem.java.patch b/patches/net/minecraft/world/item/FishingRodItem.java.patch index 54acf90478..a8a582f03a 100644 --- a/patches/net/minecraft/world/item/FishingRodItem.java.patch +++ b/patches/net/minecraft/world/item/FishingRodItem.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/item/FishingRodItem.java +++ b/net/minecraft/world/item/FishingRodItem.java -@@ -22,7 +_,11 @@ +@@ -23,7 +_,11 @@ if (p_41291_.fishing != null) { if (!p_41290_.isClientSide) { int i = p_41291_.fishing.retrieve(itemstack); + ItemStack original = itemstack.copy(); - itemstack.hurtAndBreak(i, p_41291_, p_41288_ -> p_41288_.broadcastBreakEvent(p_41292_)); + itemstack.hurtAndBreak(i, p_41291_, LivingEntity.getSlotForHand(p_41292_)); + if(itemstack.isEmpty()) { + net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(p_41291_, original, p_41292_); + } } p_41290_.playSound( -@@ -63,5 +_,12 @@ +@@ -64,5 +_,12 @@ @Override public int getEnchantmentValue() { return 1; diff --git a/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch b/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch deleted file mode 100644 index 2402e3e0b1..0000000000 --- a/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/FoodOnAStickItem.java -+++ b/net/minecraft/world/item/FoodOnAStickItem.java -@@ -31,6 +_,7 @@ - if (itemstack.isEmpty()) { - ItemStack itemstack1 = new ItemStack(Items.FISHING_ROD); - itemstack1.setTag(itemstack.getTag()); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - return InteractionResultHolder.success(itemstack1); - } - diff --git a/patches/net/minecraft/world/item/HoeItem.java.patch b/patches/net/minecraft/world/item/HoeItem.java.patch index 9068726fcd..685c8b7c01 100644 --- a/patches/net/minecraft/world/item/HoeItem.java.patch +++ b/patches/net/minecraft/world/item/HoeItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/HoeItem.java +++ b/net/minecraft/world/item/HoeItem.java -@@ -22,6 +_,12 @@ +@@ -23,6 +_,12 @@ import net.minecraft.world.level.gameevent.GameEvent; public class HoeItem extends DiggerItem { @@ -13,7 +13,7 @@ protected static final Map, Consumer>> TILLABLES = Maps.newHashMap( ImmutableMap.of( Blocks.GRASS_BLOCK, -@@ -45,7 +_,8 @@ +@@ -46,7 +_,8 @@ public InteractionResult useOn(UseOnContext p_41341_) { Level level = p_41341_.getLevel(); BlockPos blockpos = p_41341_.getClickedPos(); @@ -23,7 +23,7 @@ if (pair == null) { return InteractionResult.PASS; } else { -@@ -85,5 +_,10 @@ +@@ -86,5 +_,10 @@ public static boolean onlyIfAirAbove(UseOnContext p_150857_) { return p_150857_.getClickedFace() != Direction.DOWN && p_150857_.getLevel().getBlockState(p_150857_.getClickedPos().above()).isAir(); diff --git a/patches/net/minecraft/world/item/HorseArmorItem.java.patch b/patches/net/minecraft/world/item/HorseArmorItem.java.patch deleted file mode 100644 index 825fa1c86c..0000000000 --- a/patches/net/minecraft/world/item/HorseArmorItem.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/world/item/HorseArmorItem.java -+++ b/net/minecraft/world/item/HorseArmorItem.java -@@ -5,16 +_,20 @@ - public class HorseArmorItem extends Item { - private static final String TEX_FOLDER = "textures/entity/horse/"; - private final int protection; -- private final String texture; -+ private final ResourceLocation texture; - - public HorseArmorItem(int p_41364_, String p_41365_, Item.Properties p_41366_) { -+ this(p_41364_, new ResourceLocation("textures/entity/horse/armor/horse_armor_" + p_41365_ + ".png"), p_41366_); -+ } -+ -+ public HorseArmorItem(int p_41364_, ResourceLocation p_41365_, Item.Properties p_41366_) { - super(p_41366_); - this.protection = p_41364_; -- this.texture = "textures/entity/horse/armor/horse_armor_" + p_41365_ + ".png"; -+ this.texture = p_41365_; - } - - public ResourceLocation getTexture() { -- return new ResourceLocation(this.texture); -+ return texture; - } - - public int getProtection() { diff --git a/patches/net/minecraft/world/item/Item.java.patch b/patches/net/minecraft/world/item/Item.java.patch index 33d805107e..d8d60d264e 100644 --- a/patches/net/minecraft/world/item/Item.java.patch +++ b/patches/net/minecraft/world/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -50,9 +_,9 @@ +@@ -54,9 +_,9 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -9,12 +9,12 @@ private static final Logger LOGGER = LogUtils.getLogger(); - public static final Map BY_BLOCK = Maps.newHashMap(); + public static final Map BY_BLOCK = net.neoforged.neoforge.registries.GameData.getBlockItemMap(); - protected static final UUID BASE_ATTACK_DAMAGE_UUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - protected static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); - public static final int MAX_STACK_SIZE = 64; -@@ -92,12 +_,14 @@ - this.foodProperties = p_41383_.foodProperties; - this.isFireResistant = p_41383_.isFireResistant; + public static final UUID BASE_ATTACK_DAMAGE_UUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + public static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); + public static final int DEFAULT_MAX_STACK_SIZE = 64; +@@ -87,12 +_,14 @@ + this.components = p_41383_.buildAndValidateComponents(); + this.craftingRemainingItem = p_41383_.craftingRemainingItem; this.requiredFeatures = p_41383_.requiredFeatures; - if (SharedConstants.IS_RUNNING_IN_IDE) { + if (SharedConstants.IS_RUNNING_IN_IDE && false) { @@ -28,7 +28,7 @@ } @Deprecated -@@ -108,6 +_,8 @@ +@@ -111,6 +_,8 @@ public void onUseTick(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { } @@ -37,48 +37,32 @@ public void onDestroyed(ItemEntity p_150887_) { } -@@ -132,9 +_,9 @@ - } +@@ -137,7 +_,7 @@ public InteractionResultHolder use(Level p_41432_, Player p_41433_, InteractionHand p_41434_) { -- if (this.isEdible()) { -- ItemStack itemstack = p_41433_.getItemInHand(p_41434_); -- if (p_41433_.canEat(this.getFoodProperties().canAlwaysEat())) { -+ ItemStack itemstack = p_41433_.getItemInHand(p_41434_); -+ if (itemstack.isEdible()) { -+ if (p_41433_.canEat(itemstack.getFoodProperties(p_41433_).canAlwaysEat())) { + ItemStack itemstack = p_41433_.getItemInHand(p_41434_); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(p_41433_); + if (foodproperties != null) { + if (p_41433_.canEat(foodproperties.canAlwaysEat())) { p_41433_.startUsingItem(p_41434_); - return InteractionResultHolder.consume(itemstack); - } else { -@@ -149,10 +_,12 @@ - return this.isEdible() ? p_41411_.eat(p_41410_, p_41409_) : p_41409_; - } - -+ @Deprecated // Use ItemStack sensitive version. - public final int getMaxStackSize() { - return this.maxStackSize; - } - -+ @Deprecated // Use ItemStack sensitive version. - public final int getMaxDamage() { - return this.maxDamage; - } -@@ -166,11 +_,12 @@ +@@ -159,12 +_,13 @@ } public int getBarWidth(ItemStack p_150900_) { -- return Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)this.maxDamage); +- return Mth.clamp(Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)p_150900_.getMaxDamage()), 0, 13); + return Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)this.getMaxDamage(p_150900_)); } public int getBarColor(ItemStack p_150901_) { -- float f = Math.max(0.0F, ((float)this.maxDamage - (float)p_150901_.getDamageValue()) / (float)this.maxDamage); + int i = p_150901_.getMaxDamage(); +- float f = Math.max(0.0F, ((float)i - (float)p_150901_.getDamageValue()) / (float)i); + float stackMaxDamage = this.getMaxDamage(p_150901_); + float f = Math.max(0.0F, (stackMaxDamage - (float)p_150901_.getDamageValue()) / stackMaxDamage); return Mth.hsvToRgb(f / 3.0F, 1.0F, 1.0F); } -@@ -206,7 +_,7 @@ +@@ -214,7 +_,7 @@ @Override public String toString() { @@ -87,7 +71,7 @@ } protected String getOrCreateDescriptionId() { -@@ -230,10 +_,12 @@ +@@ -234,10 +_,12 @@ } @Nullable @@ -100,48 +84,32 @@ public boolean hasCraftingRemainingItem() { return this.craftingRemainingItem != null; } -@@ -258,7 +_,7 @@ - - public int getUseDuration(ItemStack p_41454_) { - if (p_41454_.getItem().isEdible()) { -- return this.getFoodProperties().isFastFood() ? 16 : 32; -+ return p_41454_.getFoodProperties(null).isFastFood() ? 16 : 32; - } else { - return 0; - } -@@ -300,7 +_,7 @@ +@@ -261,7 +_,7 @@ } - public boolean isEnchantable(ItemStack p_41456_) { -- return this.getMaxStackSize() == 1 && this.canBeDepleted(); -+ return this.getMaxStackSize(p_41456_) == 1 && this.isDamageable(p_41456_); + public int getUseDuration(ItemStack p_41454_) { +- FoodProperties foodproperties = p_41454_.get(DataComponents.FOOD); ++ FoodProperties foodproperties = p_41454_.getFoodProperties(null); + return foodproperties != null ? foodproperties.eatDurationTicks() : 0; } - protected static BlockHitResult getPlayerPOVHitResult(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) { -@@ -313,11 +_,14 @@ - float f5 = Mth.sin(-f * (float) (Math.PI / 180.0)); - float f6 = f3 * f4; - float f7 = f2 * f4; -- double d0 = 5.0; -- Vec3 vec31 = vec3.add((double)f6 * 5.0, (double)f5 * 5.0, (double)f7 * 5.0); -+ double d0 = p_41437_.getBlockReach(); -+ if (!p_41437_.isCreative() && d0 != 0) d0 += 0.5D; // The vanilla constant here was 5.0, but the default survival block reach is 4.5. Creative default is already 5.0. -+ Vec3 vec31 = vec3.add((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); +@@ -293,6 +_,8 @@ return p_41436_.clip(new ClipContext(vec3, vec31, ClipContext.Block.OUTLINE, p_41438_, p_41437_)); } -+ /** Forge: Use ItemStack sensitive version. */ ++ /** @deprecated Neo: Use ItemStack sensitive version. */ + @Deprecated public int getEnchantmentValue() { return 0; } -@@ -326,12 +_,20 @@ +@@ -301,13 +_,20 @@ return false; } -+ @Deprecated // Use ItemStack sensitive version. - public Multimap getDefaultAttributeModifiers(EquipmentSlot p_41388_) { - return ImmutableMultimap.of(); +- @Deprecated ++ @Deprecated // Use ItemStack sensitive version or data components. (deprecated by vanilla too) + public ItemAttributeModifiers getDefaultAttributeModifiers() { + return ItemAttributeModifiers.EMPTY; } + protected final boolean canRepair; @@ -157,65 +125,63 @@ } public ItemStack getDefaultInstance() { -@@ -342,6 +_,8 @@ - return this.foodProperties != null; - } - -+ // Use IForgeItem#getFoodProperties(ItemStack, LivingEntity) in favour of this. -+ @Deprecated - @Nullable - public FoodProperties getFoodProperties() { - return this.foodProperties; -@@ -372,6 +_,32 @@ +@@ -335,6 +_,32 @@ return this.requiredFeatures; } -+ // FORGE START ++ // NEO START + private Object renderProperties; + + /* + DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE + Call RenderProperties.get instead -+ */ ++ */ + public Object getRenderPropertiesInternal() { + return renderProperties; + } + + private void initClient() { + // Minecraft instance isn't available in datagen, so don't call initializeClient if in datagen -+ if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { -+ initializeClient(properties -> { -+ if (properties == this) -+ throw new IllegalStateException("Don't extend IItemRenderProperties in your item, use an anonymous class instead."); -+ this.renderProperties = properties; -+ }); -+ } ++ if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { ++ initializeClient(properties -> { ++ if (properties == this) ++ throw new IllegalStateException("Don't extend IItemRenderProperties in your item, use an anonymous class instead."); ++ this.renderProperties = properties; ++ }); ++ } + } + + public void initializeClient(java.util.function.Consumer consumer) { + } -+ // END FORGE ++ // END NEO + public static class Properties { - int maxStackSize = 64; - int maxDamage; -@@ -382,6 +_,7 @@ - FoodProperties foodProperties; - boolean isFireResistant; + private static final Interner COMPONENT_INTERNER = Interners.newStrongInterner(); + @Nullable +@@ -342,6 +_,7 @@ + @Nullable + Item craftingRemainingItem; FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + private boolean canRepair = true; public Item.Properties food(FoodProperties p_41490_) { - this.foodProperties = p_41490_; -@@ -419,6 +_,11 @@ + return this.component(DataComponents.FOOD, p_41490_); +@@ -371,12 +_,18 @@ + return this.component(DataComponents.FIRE_RESISTANT, Unit.INSTANCE); + } - public Item.Properties fireResistant() { - this.isFireResistant = true; ++ public Item.Properties setNoRepair() { ++ canRepair = false; + return this; + } + -+ public Item.Properties setNoRepair() { -+ canRepair = false; + public Item.Properties requiredFeatures(FeatureFlag... p_250948_) { + this.requiredFeatures = FeatureFlags.REGISTRY.subset(p_250948_); return this; } + public Item.Properties component(DataComponentType p_330871_, T p_330323_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_330323_); + if (this.components == null) { + this.components = DataComponentMap.builder().addAll(DataComponents.COMMON_ITEM_COMPONENTS); + } diff --git a/patches/net/minecraft/world/item/ItemStack.java.patch b/patches/net/minecraft/world/item/ItemStack.java.patch index 17a83bcd12..41d754665c 100644 --- a/patches/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/net/minecraft/world/item/ItemStack.java.patch @@ -1,93 +1,15 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -81,12 +_,13 @@ - import net.minecraft.world.level.block.state.pattern.BlockInWorld; +@@ -92,7 +_,7 @@ + import org.apache.commons.lang3.mutable.MutableBoolean; import org.slf4j.Logger; --public final class ItemStack { -+public final class ItemStack extends net.neoforged.neoforge.attachment.AttachmentHolder implements net.neoforged.neoforge.common.extensions.IItemStackExtension { - public static final Codec CODEC = RecordCodecBuilder.create( - p_311716_ -> p_311716_.group( - BuiltInRegistries.ITEM.holderByNameCodec().fieldOf("id").forGetter(ItemStack::getItemHolder), - Codec.INT.fieldOf("Count").forGetter(ItemStack::getCount), -- CompoundTag.CODEC.optionalFieldOf("tag").forGetter(p_281115_ -> Optional.ofNullable(p_281115_.getTag())) -+ CompoundTag.CODEC.optionalFieldOf("tag").forGetter(p_281115_ -> Optional.ofNullable(p_281115_.getTag())), -+ ExtraCodecs.strictOptionalField(CompoundTag.CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) - .apply(p_311716_, ItemStack::new) - ); -@@ -97,14 +_,17 @@ - public static final Codec ADVANCEMENT_ICON_CODEC = RecordCodecBuilder.create( - p_311717_ -> p_311717_.group( - BuiltInRegistries.ITEM.holderByNameCodec().fieldOf("item").forGetter(ItemStack::getItemHolder), -- ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, "nbt").forGetter(p_311718_ -> Optional.ofNullable(p_311718_.getTag())) -+ ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, "nbt").forGetter(p_311718_ -> Optional.ofNullable(p_311718_.getTag())), -+ ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) -- .apply(p_311717_, (p_311722_, p_311723_) -> new ItemStack(p_311722_, 1, p_311723_)) -+ .apply(p_311717_, (p_311722_, p_311723_, attachments) -> new ItemStack(p_311722_, 1, p_311723_, attachments)) - ); - public static final Codec ITEM_WITH_COUNT_CODEC = RecordCodecBuilder.create( - p_311720_ -> p_311720_.group( - ITEM_NON_AIR_CODEC.fieldOf("item").forGetter(ItemStack::getItem), -- ExtraCodecs.strictOptionalField(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(ItemStack::getCount) -+ ExtraCodecs.strictOptionalField(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(ItemStack::getCount), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.crafting.CraftingHelper.TAG_CODEC, "nbt").forGetter(stack -> java.util.Optional.ofNullable(net.neoforged.neoforge.common.crafting.CraftingHelper.getTagForWriting(stack))), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.crafting.CraftingHelper.TAG_CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) - .apply(p_311720_, ItemStack::new) - ); -@@ -162,18 +_,30 @@ - } - - public ItemStack(Holder p_312081_, int p_41605_, Optional p_41606_) { -+ this(p_312081_.value(), p_41605_, p_41606_); -+ } -+ public ItemStack(ItemLike p_312081_, int p_41605_, Optional p_41606_) { - this(p_312081_, p_41605_); - p_41606_.ifPresent(this::setTag); - } -+ private ItemStack(Holder p_312081_, int p_41605_, Optional p_41606_, Optional attachmentsNbt) { -+ this(p_312081_.value(), p_41605_, p_41606_, attachmentsNbt); -+ } -+ private ItemStack(ItemLike p_312081_, int p_41605_, Optional p_41606_, Optional attachmentsNbt) { -+ this(p_312081_, p_41605_, attachmentsNbt.orElse(null)); -+ p_41606_.ifPresent(this::setTag); -+ } - - public ItemStack(Holder p_220155_, int p_220156_) { - this(p_220155_.value(), p_220156_); - } - -- public ItemStack(ItemLike p_41601_, int p_41602_) { -+ public ItemStack(ItemLike p_41601_, int p_41602_) { this(p_41601_, p_41602_, (CompoundTag) null); } -+ public ItemStack(ItemLike p_41601_, int p_41602_, @Nullable CompoundTag attachmentsNbt) { - this.item = p_41601_.asItem(); - this.count = p_41602_; -- if (this.item.canBeDepleted()) { -+ if (attachmentsNbt != null) deserializeAttachments(attachmentsNbt); -+ if (this.item.isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } - } -@@ -187,10 +_,15 @@ - this.count = p_41608_.getByte("Count"); - if (p_41608_.contains("tag", 10)) { - this.tag = p_41608_.getCompound("tag").copy(); -+ if (this.tag.contains(ATTACHMENTS_NBT_KEY, Tag.TAG_COMPOUND)) { // Neo: Read contained attachments -+ deserializeAttachments(this.tag.getCompound(ATTACHMENTS_NBT_KEY)); -+ this.tag = net.neoforged.neoforge.attachment.AttachmentInternals.cleanTag(this.tag); -+ } -+ if (this.tag != null) - this.getItem().verifyTagAfterLoad(this.tag); - } - -- if (this.getItem().canBeDepleted()) { -+ if (this.getItem().isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } - } -@@ -250,7 +_,7 @@ +-public final class ItemStack implements DataComponentHolder { ++public final class ItemStack implements DataComponentHolder, net.neoforged.neoforge.common.extensions.IItemStackExtension { + public static final Codec> ITEM_NON_AIR_CODEC = BuiltInRegistries.ITEM + .holderByNameCodec() + .validate( +@@ -327,7 +_,7 @@ } public boolean is(Holder p_220166_) { @@ -96,13 +18,13 @@ } public boolean is(HolderSet p_298683_) { -@@ -262,6 +_,23 @@ +@@ -339,13 +_,30 @@ } public InteractionResult useOn(UseOnContext p_41662_) { + if (p_41662_.getPlayer() != null) { // TODO 1.20.5: Make event accept nullable player, and remove this check. + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(p_41662_, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.ITEM_AFTER_BLOCK)); -+ if (e.isCanceled()) return e.getCancellationResult(); ++ if (e.isCanceled()) return e.getCancellationResult().result(); + } + if (!p_41662_.getLevel().isClientSide) return net.neoforged.neoforge.common.CommonHooks.onPlaceItemIntoWorld(p_41662_); + return onItemUse(p_41662_, (c) -> getItem().useOn(p_41662_)); @@ -111,7 +33,7 @@ + public InteractionResult onItemUseFirst(UseOnContext p_41662_) { + if (p_41662_.getPlayer() != null) { // TODO 1.20.5: Make event accept nullable player, and remove this check. + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(p_41662_, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.ITEM_BEFORE_BLOCK)); -+ if (e.isCanceled()) return e.getCancellationResult(); ++ if (e.isCanceled()) return e.getCancellationResult().result(); + } + return onItemUse(p_41662_, (c) -> getItem().onItemUseFirst(this, p_41662_)); + } @@ -119,46 +41,25 @@ + private InteractionResult onItemUse(UseOnContext p_41662_, java.util.function.Function callback) { Player player = p_41662_.getPlayer(); BlockPos blockpos = p_41662_.getClickedPos(); - BlockInWorld blockinworld = new BlockInWorld(p_41662_.getLevel(), blockpos, false); -@@ -271,7 +_,7 @@ + if (player != null && !player.getAbilities().mayBuild && !this.canPlaceOnBlockInAdventureMode(new BlockInWorld(p_41662_.getLevel(), blockpos, false))) { return InteractionResult.PASS; } else { Item item = this.getItem(); - InteractionResult interactionresult = item.useOn(p_41662_); + InteractionResult interactionresult = callback.apply(p_41662_); - if (player != null && interactionresult.shouldAwardStats()) { + if (player != null && interactionresult.indicateItemUse()) { player.awardStat(Stats.ITEM_USED.get(item)); } -@@ -296,15 +_,16 @@ - ResourceLocation resourcelocation = BuiltInRegistries.ITEM.getKey(this.getItem()); - p_41740_.putString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString()); - p_41740_.putByte("Count", (byte)this.count); -- if (this.tag != null) { -- p_41740_.put("tag", this.tag.copy()); -+ var tag = net.neoforged.neoforge.attachment.AttachmentInternals.addAttachmentsToTag(this.tag, this, true); -+ if (tag != null) { -+ p_41740_.put("tag", tag); - } - - return p_41740_; +@@ -387,7 +_,7 @@ } public int getMaxStackSize() { -- return this.getItem().getMaxStackSize(); +- return this.getOrDefault(DataComponents.MAX_STACK_SIZE, Integer.valueOf(1)); + return this.getItem().getMaxStackSize(this); } public boolean isStackable() { -@@ -312,7 +_,7 @@ - } - - public boolean isDamageableItem() { -- if (!this.isEmpty() && this.getItem().getMaxDamage() > 0) { -+ if (!this.isEmpty() && this.getItem().isDamageable(this)) { - CompoundTag compoundtag = this.getTag(); - return compoundtag == null || !compoundtag.getBoolean("Unbreakable"); - } else { -@@ -321,19 +_,19 @@ +@@ -399,23 +_,28 @@ } public boolean isDamaged() { @@ -167,126 +68,99 @@ } public int getDamageValue() { -- return this.tag == null ? 0 : this.tag.getInt("Damage"); +- return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, Integer.valueOf(0)), 0, this.getMaxDamage()); + return this.getItem().getDamage(this); } public void setDamageValue(int p_41722_) { -- this.getOrCreateTag().putInt("Damage", Math.max(0, p_41722_)); +- this.set(DataComponents.DAMAGE, Mth.clamp(p_41722_, 0, this.getMaxDamage())); + this.getItem().setDamage(this, p_41722_); } public int getMaxDamage() { -- return this.getItem().getMaxDamage(); +- return this.getOrDefault(DataComponents.MAX_DAMAGE, Integer.valueOf(0)); + return this.getItem().getMaxDamage(this); } - public boolean hurt(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_) { -@@ -369,6 +_,7 @@ - public void hurtAndBreak(int p_41623_, T p_41624_, Consumer p_41625_) { - if (!p_41624_.level().isClientSide && (!(p_41624_ instanceof Player) || !((Player)p_41624_).getAbilities().instabuild)) { - if (this.isDamageableItem()) { -+ p_41623_ = this.getItem().damageItem(this, p_41623_, p_41624_, p_41625_); - if (this.hurt(p_41623_, p_41624_.getRandom(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { - p_41625_.accept(p_41624_); - Item item = this.getItem(); -@@ -418,7 +_,7 @@ - } - - public boolean isCorrectToolForDrops(BlockState p_41736_) { -- return this.getItem().isCorrectToolForDrops(p_41736_); -+ return this.getItem().isCorrectToolForDrops(this, p_41736_); - } - - public InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) { -@@ -430,6 +_,7 @@ - return EMPTY; - } else { - ItemStack itemstack = new ItemStack(this.getItem(), this.count); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(this, itemstack); - itemstack.setPopTime(this.getPopTime()); - if (this.tag != null) { - itemstack.tag = this.tag.copy(); -@@ -465,8 +_,17 @@ - if (!p_150943_.is(p_150944_.getItem())) { - return false; - } else { -- return p_150943_.isEmpty() && p_150944_.isEmpty() ? true : Objects.equals(p_150943_.tag, p_150944_.tag); -+ return p_150943_.isEmpty() && p_150944_.isEmpty() ? true : Objects.equals(p_150943_.tag, p_150944_.tag) && p_150943_.areAttachmentsCompatible(p_150944_); - } + public void hurtAndBreak(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_, Runnable p_320659_) { ++ hurtAndBreak(p_220158_, p_220159_, (LivingEntity) p_220160_, p_320659_); + } + -+ /** -+ * Neo: Check if the attachments of this stack and another stack are compatible. -+ * If not, they cannot be stacked. -+ * @see #areAttachmentsCompatible(net.neoforged.neoforge.attachment.AttachmentHolder, net.neoforged.neoforge.attachment.AttachmentHolder) -+ */ -+ public boolean areAttachmentsCompatible(ItemStack other) { -+ return areAttachmentsCompatible(this, other); - } ++ public void hurtAndBreak(int p_220158_, RandomSource p_220159_, @Nullable LivingEntity p_220160_, Runnable p_320659_) { + if (this.isDamageableItem()) { ++ p_220158_ = getItem().damageItem(this, p_220158_, p_220160_, p_320659_); + if (p_220158_ > 0) { + int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, this); + int j = 0; +@@ -432,8 +_,8 @@ + } + } - public String getDescriptionId() { -@@ -560,7 +_,7 @@ +- if (p_220160_ != null && p_220158_ != 0) { +- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(p_220160_, this, this.getDamageValue() + p_220158_); ++ if (p_220160_ instanceof ServerPlayer sp && p_220158_ != 0) { ++ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(sp, this, this.getDamageValue() + p_220158_); + } - public void setTag(@Nullable CompoundTag p_41752_) { - this.tag = p_41752_; -- if (this.getItem().canBeDepleted()) { -+ if (this.getItem().isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } + int l = this.getDamageValue() + p_220158_; +@@ -450,7 +_,7 @@ + return; + } -@@ -619,7 +_,7 @@ +- this.hurtAndBreak(p_41623_, p_41624_.getRandom(), p_41624_ instanceof ServerPlayer serverplayer ? serverplayer : null, () -> { ++ this.hurtAndBreak(p_41623_, p_41624_.getRandom(), p_41624_, () -> { + p_41624_.broadcastBreakEvent(p_319898_); + Item item = this.getItem(); + this.shrink(1); +@@ -706,7 +_,7 @@ + return List.of(); + } else { + List list = Lists.newArrayList(); +- MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color()); ++ MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().getStyleModifier()); + if (this.has(DataComponents.CUSTOM_NAME)) { + mutablecomponent.withStyle(ChatFormatting.ITALIC); + } +@@ -761,6 +_,7 @@ + list.add(DISABLED_ITEM_TOOLTIP); + } - public List getTooltipLines(@Nullable Player p_41652_, TooltipFlag p_41653_) { - List list = Lists.newArrayList(); -- MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color); -+ MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().getStyleModifier()); - if (this.hasCustomHoverName()) { - mutablecomponent.withStyle(ChatFormatting.ITALIC); - } -@@ -792,6 +_,7 @@ - list.add(DISABLED_ITEM_TOOLTIP); ++ net.neoforged.neoforge.event.EventHooks.onItemTooltip(this, p_41652_, list, p_41653_); + return list; } - -+ net.neoforged.neoforge.event.EventHooks.onItemTooltip(this, p_41652_, list, p_41653_); - return list; - } - -@@ -800,7 +_,7 @@ } +@@ -901,11 +_,15 @@ - private int getHideFlags() { -- return this.hasTag() && this.tag.contains("HideFlags", 99) ? this.tag.getInt("HideFlags") : 0; -+ return this.hasTag() && this.tag.contains("HideFlags", 99) ? this.tag.getInt("HideFlags") : this.getItem().getDefaultTooltipHideFlags(this); - } - - public void hideTooltipPart(ItemStack.TooltipPart p_41655_) { -@@ -921,9 +_,10 @@ - } - } + public void forEachModifier(EquipmentSlot p_332001_, BiConsumer, AttributeModifier> p_330882_) { + ItemAttributeModifiers itemattributemodifiers = this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); ++ com.google.common.collect.Multimap, AttributeModifier> multimap; ++ multimap = com.google.common.collect.LinkedHashMultimap.create(); + if (!itemattributemodifiers.modifiers().isEmpty()) { +- itemattributemodifiers.forEach(p_332001_, p_330882_); ++ itemattributemodifiers.forEach(p_332001_, multimap::put); } else { -- multimap = this.getItem().getDefaultAttributeModifiers(p_41639_); -+ multimap = this.getItem().getAttributeModifiers(p_41639_, this); +- this.getItem().getDefaultAttributeModifiers().forEach(p_332001_, p_330882_); ++ this.getItem().getAttributeModifiers(this).forEach(p_332001_, multimap::put); } - -+ multimap = net.neoforged.neoforge.common.CommonHooks.getAttributeModifiers(this, p_41639_, multimap); - return multimap; ++ multimap = net.neoforged.neoforge.common.CommonHooks.getAttributeModifiers(this, p_332001_, multimap); ++ multimap.forEach(p_330882_); } -@@ -951,7 +_,7 @@ + public Component getDisplayName() { +@@ -916,7 +_,7 @@ MutableComponent mutablecomponent1 = ComponentUtils.wrapInSquareBrackets(mutablecomponent); if (!this.isEmpty()) { -- mutablecomponent1.withStyle(this.getRarity().color) +- mutablecomponent1.withStyle(this.getRarity().color()) + mutablecomponent1.withStyle(this.getRarity().getStyleModifier()) .withStyle(p_220170_ -> p_220170_.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new HoverEvent.ItemStackInfo(this)))); } -@@ -1002,6 +_,8 @@ +@@ -973,6 +_,8 @@ this.getItem().onUseTick(p_41732_, p_41733_, this, p_41734_); } -+ /** @deprecated Forge: Use {@linkplain IItemStackExtension#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ ++ /** @deprecated Forge: Use {@linkplain net.neoforged.neoforge.common.extensions.IItemStackExtension#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ + @Deprecated public void onDestroyed(ItemEntity p_150925_) { this.getItem().onDestroyed(p_150925_); diff --git a/patches/net/minecraft/world/item/Items.java.patch b/patches/net/minecraft/world/item/Items.java.patch index fde825291a..487c71e0b8 100644 --- a/patches/net/minecraft/world/item/Items.java.patch +++ b/patches/net/minecraft/world/item/Items.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -1685,11 +_,23 @@ +@@ -2089,11 +_,23 @@ } public static Item registerBlock(Block p_252092_, Block... p_248886_) { @@ -14,7 +14,7 @@ + } + } -- for(Block block : p_248886_) { +- for (Block block : p_248886_) { - Item.BY_BLOCK.put(block, blockitem); - } + @Override diff --git a/patches/net/minecraft/world/item/MapItem.java.patch b/patches/net/minecraft/world/item/MapItem.java.patch index 4d73927181..159280f4f4 100644 --- a/patches/net/minecraft/world/item/MapItem.java.patch +++ b/patches/net/minecraft/world/item/MapItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/MapItem.java +++ b/net/minecraft/world/item/MapItem.java -@@ -58,6 +_,16 @@ +@@ -57,6 +_,16 @@ @Nullable public static MapItemSavedData getSavedData(ItemStack p_42854_, Level p_42855_) { -+ // Forge: Add instance method so that mods can override ++ // Neo: Add instance method so that mods can override + Item map = p_42854_.getItem(); + if(map instanceof MapItem) { + return ((MapItem)map).getCustomMapData(p_42854_, p_42855_); @@ -14,6 +14,6 @@ + + @Nullable + protected MapItemSavedData getCustomMapData(ItemStack p_42854_, Level p_42855_) { - Integer integer = getMapId(p_42854_); - return getSavedData(integer, p_42855_); + MapId mapid = p_42854_.get(DataComponents.MAP_ID); + return getSavedData(mapid, p_42855_); } diff --git a/patches/net/minecraft/world/item/MilkBucketItem.java.patch b/patches/net/minecraft/world/item/MilkBucketItem.java.patch index ad3855d491..b6b9842af9 100644 --- a/patches/net/minecraft/world/item/MilkBucketItem.java.patch +++ b/patches/net/minecraft/world/item/MilkBucketItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/MilkBucketItem.java +++ b/net/minecraft/world/item/MilkBucketItem.java -@@ -28,7 +_,7 @@ - } +@@ -25,7 +_,7 @@ + p_42923_.consume(1, p_42925_); if (!p_42924_.isClientSide) { - p_42925_.removeAllEffects(); + p_42925_.removeEffectsCuredBy(net.neoforged.neoforge.common.EffectCures.MILK); diff --git a/patches/net/minecraft/world/item/MobBucketItem.java.patch b/patches/net/minecraft/world/item/MobBucketItem.java.patch index 0ed7536c03..559af1e1d6 100644 --- a/patches/net/minecraft/world/item/MobBucketItem.java.patch +++ b/patches/net/minecraft/world/item/MobBucketItem.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/item/MobBucketItem.java +++ b/net/minecraft/world/item/MobBucketItem.java -@@ -22,13 +_,18 @@ - import net.minecraft.world.level.material.Fluid; +@@ -25,13 +_,18 @@ public class MobBucketItem extends BucketItem { + private static final MapCodec VARIANT_FIELD_CODEC = TropicalFish.Variant.CODEC.fieldOf("BucketVariantTag"); - private final EntityType type; - private final SoundEvent emptySound; + private final java.util.function.Supplier> entityTypeSupplier; @@ -24,7 +24,7 @@ } @Override -@@ -41,11 +_,11 @@ +@@ -44,11 +_,11 @@ @Override protected void playEmptySound(@Nullable Player p_151151_, LevelAccessor p_151152_, BlockPos p_151153_) { @@ -33,21 +33,21 @@ } private void spawn(ServerLevel p_151142_, ItemStack p_151143_, BlockPos p_151144_) { -- Entity entity = this.type.spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false); -+ Entity entity = getFishType().spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false); - if (entity instanceof Bucketable bucketable) { - bucketable.loadFromBucketTag(p_151143_.getOrCreateTag()); +- if (this.type.spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false) instanceof Bucketable bucketable) { ++ if (getFishType().spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false) instanceof Bucketable bucketable) { + CustomData customdata = p_151143_.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); + bucketable.loadFromBucketTag(customdata.copyTag()); bucketable.setFromBucket(true); -@@ -54,7 +_,7 @@ +@@ -57,7 +_,7 @@ @Override - public void appendHoverText(ItemStack p_151155_, @Nullable Level p_151156_, List p_151157_, TooltipFlag p_151158_) { + public void appendHoverText(ItemStack p_151155_, Item.TooltipContext p_339675_, List p_151157_, TooltipFlag p_151158_) { - if (this.type == EntityType.TROPICAL_FISH) { + if (getFishType() == EntityType.TROPICAL_FISH) { - CompoundTag compoundtag = p_151155_.getTag(); - if (compoundtag != null && compoundtag.contains("BucketVariantTag", 3)) { - int i = compoundtag.getInt("BucketVariantTag"); -@@ -79,5 +_,14 @@ + CustomData customdata = p_151155_.getOrDefault(DataComponents.BUCKET_ENTITY_DATA, CustomData.EMPTY); + if (customdata.isEmpty()) { + return; +@@ -85,5 +_,14 @@ p_151157_.add(mutablecomponent); } } diff --git a/patches/net/minecraft/world/item/PickaxeItem.java.patch b/patches/net/minecraft/world/item/PickaxeItem.java.patch index 31dcab7549..9b4d5c6b71 100644 --- a/patches/net/minecraft/world/item/PickaxeItem.java.patch +++ b/patches/net/minecraft/world/item/PickaxeItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/PickaxeItem.java +++ b/net/minecraft/world/item/PickaxeItem.java @@ -6,4 +_,9 @@ - public PickaxeItem(Tier p_42961_, int p_42962_, float p_42963_, Item.Properties p_42964_) { - super((float)p_42962_, p_42963_, p_42961_, BlockTags.MINEABLE_WITH_PICKAXE, p_42964_); + public PickaxeItem(Tier p_42961_, Item.Properties p_42964_) { + super(p_42961_, BlockTags.MINEABLE_WITH_PICKAXE, p_42964_); } + + @Override diff --git a/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch b/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch new file mode 100644 index 0000000000..4ca03974f8 --- /dev/null +++ b/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch @@ -0,0 +1,30 @@ +--- a/net/minecraft/world/item/ProjectileWeaponItem.java ++++ b/net/minecraft/world/item/ProjectileWeaponItem.java +@@ -108,7 +_,7 @@ + abstractarrow.setPierceLevel((byte)j); + } + +- return abstractarrow; ++ return customArrow(abstractarrow, p_330846_); + } + + protected static boolean hasInfiniteArrows(ItemStack p_330642_, ItemStack p_332202_, boolean p_331512_) { +@@ -133,7 +_,7 @@ + } + + protected static ItemStack useAmmo(ItemStack p_331207_, ItemStack p_331434_, LivingEntity p_330302_, boolean p_330934_) { +- boolean flag = !p_330934_ && !hasInfiniteArrows(p_331207_, p_331434_, p_330302_.hasInfiniteMaterials()); ++ boolean flag = !p_330934_ && !(p_330302_.hasInfiniteMaterials() || (p_331434_.getItem() instanceof ArrowItem && ((ArrowItem)p_331434_.getItem()).isInfinite(p_331434_, p_331207_, p_330302_))); + if (!flag) { + ItemStack itemstack1 = p_331434_.copyWithCount(1); + itemstack1.set(DataComponents.INTANGIBLE_PROJECTILE, Unit.INSTANCE); +@@ -146,5 +_,9 @@ + + return itemstack; + } ++ } ++ ++ public AbstractArrow customArrow(AbstractArrow arrow, net.minecraft.world.item.ItemStack stack) { ++ return arrow; + } + } diff --git a/patches/net/minecraft/world/item/Rarity.java.patch b/patches/net/minecraft/world/item/Rarity.java.patch index cb12a73707..736a748945 100644 --- a/patches/net/minecraft/world/item/Rarity.java.patch +++ b/patches/net/minecraft/world/item/Rarity.java.patch @@ -1,40 +1,60 @@ --- a/net/minecraft/world/item/Rarity.java +++ b/net/minecraft/world/item/Rarity.java -@@ -2,15 +_,36 @@ +@@ -9,7 +_,7 @@ + import net.minecraft.util.ByIdMap; + import net.minecraft.util.StringRepresentable; - import net.minecraft.ChatFormatting; - --public enum Rarity { -+public enum Rarity implements net.neoforged.neoforge.common.IExtensibleEnum { - COMMON(ChatFormatting.WHITE), - UNCOMMON(ChatFormatting.YELLOW), - RARE(ChatFormatting.AQUA), - EPIC(ChatFormatting.LIGHT_PURPLE); - -+ /** @deprecated Forge: Use {@link #getStyleModifier()} */ -+ @Deprecated - public final ChatFormatting color; +-public enum Rarity implements StringRepresentable { ++public enum Rarity implements StringRepresentable, net.neoforged.neoforge.common.IExtensibleEnum { + COMMON(0, "common", ChatFormatting.WHITE), + UNCOMMON(1, "uncommon", ChatFormatting.YELLOW), + RARE(2, "rare", ChatFormatting.AQUA), +@@ -21,19 +_,46 @@ + private final int id; + private final String name; + private final ChatFormatting color; + private final java.util.function.UnaryOperator styleModifier; - private Rarity(ChatFormatting p_43028_) { + private Rarity(int p_336096_, String p_335642_, ChatFormatting p_43028_) { + this.id = p_336096_; + this.name = p_335642_; this.color = p_43028_; +- } +- + this.styleModifier = style -> style.withColor(p_43028_); + } + -+ Rarity(java.util.function.UnaryOperator styleModifier) { ++ Rarity(net.minecraft.resources.ResourceLocation serializedName, java.util.function.UnaryOperator styleModifier) { ++ this.id = 0; ++ this.name = java.util.Objects.requireNonNull(serializedName, "Modded Rarities must have a non-null serializedName").toString(); + this.color = ChatFormatting.BLACK; + this.styleModifier = styleModifier; + } + ++ Rarity(net.minecraft.resources.ResourceLocation serializedName, ChatFormatting color) { ++ this(0, java.util.Objects.requireNonNull(serializedName, "Modded Rarities must have a non-null serializedName").toString(), color); ++ } ++ ++ /** @deprecated Forge: Use {@link #getStyleModifier()} */ ++ @Deprecated + public ChatFormatting color() { + return this.color; + } + + public java.util.function.UnaryOperator getStyleModifier() { + return this.styleModifier; + } + -+ public static Rarity create(String name, ChatFormatting color) { + @Override + public String getSerializedName() { + return this.name; ++ } ++ ++ public static Rarity create(String name, net.minecraft.resources.ResourceLocation serializedName, ChatFormatting color) { + throw new IllegalStateException("Enum not extended"); + } + -+ public static Rarity create(String name, java.util.function.UnaryOperator styleModifier) { ++ public static Rarity create(String name, net.minecraft.resources.ResourceLocation serializedName, java.util.function.UnaryOperator styleModifier) { + throw new IllegalStateException("Enum not extended"); } } diff --git a/patches/net/minecraft/world/item/RecordItem.java.patch b/patches/net/minecraft/world/item/RecordItem.java.patch index 8ec63a856c..901019c8c4 100644 --- a/patches/net/minecraft/world/item/RecordItem.java.patch +++ b/patches/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 -@@ -22,17 +_,42 @@ +@@ -21,17 +_,42 @@ import net.minecraft.world.level.gameevent.GameEvent; public class RecordItem extends Item { @@ -43,7 +43,7 @@ } @Override -@@ -81,7 +_,7 @@ +@@ -79,7 +_,7 @@ } public SoundEvent getSound() { diff --git a/patches/net/minecraft/world/item/ShearsItem.java.patch b/patches/net/minecraft/world/item/ShearsItem.java.patch index 47785c1287..f23ea5f141 100644 --- a/patches/net/minecraft/world/item/ShearsItem.java.patch +++ b/patches/net/minecraft/world/item/ShearsItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java -@@ -59,6 +_,27 @@ +@@ -55,6 +_,27 @@ } @Override @@ -9,10 +9,10 @@ + if (entity.level().isClientSide) return InteractionResult.CONSUME; + BlockPos pos = entity.blockPosition(); + if (target.isShearable(stack, entity.level(), pos)) { -+ target.onSheared(player, stack, entity.level(), pos, stack.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BLOCK_FORTUNE)) ++ target.onSheared(player, stack, entity.level(), pos, stack.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FORTUNE)) + .forEach(drop -> target.spawnShearedDrop(entity.level(), pos, drop)); + entity.gameEvent(GameEvent.SHEAR, player); -+ stack.hurtAndBreak(1, player, e -> e.broadcastBreakEvent(hand)); ++ stack.hurtAndBreak(1, player, hand == net.minecraft.world.InteractionHand.MAIN_HAND ? net.minecraft.world.entity.EquipmentSlot.MAINHAND : net.minecraft.world.entity.EquipmentSlot.OFFHAND); + } + return InteractionResult.SUCCESS; + } diff --git a/patches/net/minecraft/world/item/ShieldItem.java.patch b/patches/net/minecraft/world/item/ShieldItem.java.patch index 857f951e39..8b271dd31d 100644 --- a/patches/net/minecraft/world/item/ShieldItem.java.patch +++ b/patches/net/minecraft/world/item/ShieldItem.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/item/ShieldItem.java +++ b/net/minecraft/world/item/ShieldItem.java -@@ -59,6 +_,13 @@ - return compoundtag != null ? DyeColor.byId(compoundtag.getInt("Base")) : DyeColor.WHITE; +@@ -53,6 +_,13 @@ + return p_43092_.is(ItemTags.PLANKS) || super.isValidRepairItem(p_43091_, p_43092_); } + /* ******************** FORGE START ******************** */ diff --git a/patches/net/minecraft/world/item/ShovelItem.java.patch b/patches/net/minecraft/world/item/ShovelItem.java.patch index dc8c787293..f42a9820f7 100644 --- a/patches/net/minecraft/world/item/ShovelItem.java.patch +++ b/patches/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 -@@ -43,7 +_,7 @@ +@@ -44,7 +_,7 @@ return InteractionResult.PASS; } else { Player player = p_43119_.getPlayer(); @@ -9,7 +9,7 @@ BlockState blockstate2 = null; if (blockstate1 != null && level.getBlockState(blockpos.above()).isAir()) { level.playSound(player, blockpos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); -@@ -71,5 +_,15 @@ +@@ -72,5 +_,15 @@ return InteractionResult.PASS; } } diff --git a/patches/net/minecraft/world/item/SpawnEggItem.java.patch b/patches/net/minecraft/world/item/SpawnEggItem.java.patch index d33a715f8b..039545cc2e 100644 --- a/patches/net/minecraft/world/item/SpawnEggItem.java.patch +++ b/patches/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 @@ +@@ -42,11 +_,14 @@ private final int highlightColor; private final EntityType defaultType; @@ -15,7 +15,7 @@ BY_ID.put(p_43207_, this); } -@@ -135,6 +_,8 @@ +@@ -134,6 +_,8 @@ @Nullable public static SpawnEggItem byId(@Nullable EntityType p_43214_) { @@ -24,17 +24,12 @@ return BY_ID.get(p_43214_); } -@@ -146,16 +_,16 @@ - if (p_43229_ != null && p_43229_.contains("EntityTag", 10)) { - CompoundTag compoundtag = p_43229_.getCompound("EntityTag"); - if (compoundtag.contains("id", 8)) { -- return EntityType.byString(compoundtag.getString("id")).orElse(this.defaultType); -+ return EntityType.byString(compoundtag.getString("id")).orElse(this.getDefaultType()); - } - } +@@ -143,12 +_,12 @@ -- return this.defaultType; -+ return this.getDefaultType(); + public EntityType getType(ItemStack p_330335_) { + CustomData customdata = p_330335_.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY); +- return !customdata.isEmpty() ? customdata.read(ENTITY_TYPE_FIELD_CODEC).result().orElse(this.defaultType) : this.defaultType; ++ return !customdata.isEmpty() ? customdata.read(ENTITY_TYPE_FIELD_CODEC).result().orElse(getDefaultType()) : getDefaultType(); } @Override @@ -44,7 +39,7 @@ } public Optional spawnOffspringFromSpawnEgg( -@@ -192,5 +_,9 @@ +@@ -179,5 +_,9 @@ } } } diff --git a/patches/net/minecraft/world/item/SwordItem.java.patch b/patches/net/minecraft/world/item/SwordItem.java.patch index 50e79886d6..85af2c98f1 100644 --- a/patches/net/minecraft/world/item/SwordItem.java.patch +++ b/patches/net/minecraft/world/item/SwordItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/SwordItem.java +++ b/net/minecraft/world/item/SwordItem.java -@@ -75,4 +_,9 @@ - public Multimap getDefaultAttributeModifiers(EquipmentSlot p_43274_) { - return p_43274_ == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(p_43274_); +@@ -55,4 +_,9 @@ + p_43278_.hurtAndBreak(1, p_43280_, EquipmentSlot.MAINHAND); + return true; } + + @Override diff --git a/patches/net/minecraft/world/item/Tier.java.patch b/patches/net/minecraft/world/item/Tier.java.patch deleted file mode 100644 index 0babe64aa7..0000000000 --- a/patches/net/minecraft/world/item/Tier.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/world/item/Tier.java -+++ b/net/minecraft/world/item/Tier.java -@@ -9,9 +_,12 @@ - - float getAttackDamageBonus(); - -+ @Deprecated // FORGE: Use TierSortingRegistry to define which tiers are better than others - int getLevel(); - - int getEnchantmentValue(); - - Ingredient getRepairIngredient(); -+ -+ @org.jetbrains.annotations.Nullable default net.minecraft.tags.TagKey getTag() { return null; } - } diff --git a/patches/net/minecraft/world/item/Tiers.java.patch b/patches/net/minecraft/world/item/Tiers.java.patch index f6a44f5d76..48dc1da1b8 100644 --- a/patches/net/minecraft/world/item/Tiers.java.patch +++ b/patches/net/minecraft/world/item/Tiers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Tiers.java +++ b/net/minecraft/world/item/Tiers.java -@@ -58,4 +_,6 @@ +@@ -61,4 +_,6 @@ public Ingredient getRepairIngredient() { return this.repairIngredient.get(); } diff --git a/patches/net/minecraft/world/item/TridentItem.java.patch b/patches/net/minecraft/world/item/TridentItem.java.patch index e11c6abd62..26e3ad362f 100644 --- a/patches/net/minecraft/world/item/TridentItem.java.patch +++ b/patches/net/minecraft/world/item/TridentItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/TridentItem.java +++ b/net/minecraft/world/item/TridentItem.java -@@ -151,4 +_,9 @@ - public int getEnchantmentValue() { - return 1; +@@ -160,4 +_,9 @@ + throwntrident.pickup = AbstractArrow.Pickup.ALLOWED; + return throwntrident; } + + @Override diff --git a/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch b/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch new file mode 100644 index 0000000000..9c3be6f23f --- /dev/null +++ b/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch @@ -0,0 +1,102 @@ +--- a/net/minecraft/world/item/alchemy/PotionBrewing.java ++++ b/net/minecraft/world/item/alchemy/PotionBrewing.java +@@ -19,15 +_,37 @@ + private final List containers; + private final List> potionMixes; + private final List> containerMixes; ++ private final net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry registry; + + PotionBrewing(List p_340915_, List> p_341164_, List> p_341170_) { ++ this(p_340915_, p_341164_, p_341170_, List.of()); ++ } ++ ++ PotionBrewing(List p_340915_, List> p_341164_, List> p_341170_, List recipes) { + this.containers = p_340915_; + this.potionMixes = p_341164_; + this.containerMixes = p_341170_; ++ this.registry = new net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry(recipes); + } + + public boolean isIngredient(ItemStack p_43507_) { +- return this.isContainerIngredient(p_43507_) || this.isPotionIngredient(p_43507_); ++ return this.registry.isValidIngredient(p_43507_) || this.isContainerIngredient(p_43507_) || this.isPotionIngredient(p_43507_); ++ } ++ ++ /** ++ * Checks if an item stack is a valid input for brewing, ++ * for use in the lower 3 slots where water bottles would normally go. ++ */ ++ public boolean isInput(ItemStack stack) { ++ return this.registry.isValidInput(stack) || isContainer(stack); ++ } ++ ++ /** ++ * Retrieves recipes that use the more general interface. ++ * This does NOT include the container and potion mixes. ++ */ ++ public List getRecipes() { ++ return registry.recipes(); + } + + private boolean isContainer(ItemStack p_341168_) { +@@ -71,6 +_,7 @@ + } + + public boolean hasMix(ItemStack p_43509_, ItemStack p_43510_) { ++ if (registry.hasOutput(p_43509_, p_43510_)) return true; + return !this.isContainer(p_43509_) ? false : this.hasContainerMix(p_43509_, p_43510_) || this.hasPotionMix(p_43509_, p_43510_); + } + +@@ -103,6 +_,8 @@ + if (p_43531_.isEmpty()) { + return p_43531_; + } else { ++ var customMix = registry.getOutput(p_43531_, p_43530_); // Parameters are swapped compared to what vanilla passes! ++ if (!customMix.isEmpty()) return customMix; + Optional> optional = p_43531_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (optional.isEmpty()) { + return p_43531_; +@@ -127,6 +_,7 @@ + public static PotionBrewing bootstrap(FeatureFlagSet p_341301_) { + PotionBrewing.Builder potionbrewing$builder = new PotionBrewing.Builder(p_341301_); + addVanillaMixes(potionbrewing$builder); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent(potionbrewing$builder)); + return potionbrewing$builder.build(); + } + +@@ -194,6 +_,7 @@ + private final List containers = new ArrayList<>(); + private final List> potionMixes = new ArrayList<>(); + private final List> containerMixes = new ArrayList<>(); ++ private final List recipes = new ArrayList<>(); + private final FeatureFlagSet enabledFeatures; + + public Builder(FeatureFlagSet p_340975_) { +@@ -237,8 +_,26 @@ + } + } + ++ /** ++ * Adds a new simple brewing recipe. ++ * ++ * @param input the ingredient that goes in the same slot as water bottles would ++ * @param ingredient the ingredient that goes in the same slot as nether wart would ++ * @param output the item stack that will replace the input once brewing is done ++ */ ++ public void addRecipe(Ingredient input, Ingredient ingredient, ItemStack output) { ++ addRecipe(new net.neoforged.neoforge.common.brewing.BrewingRecipe(input, ingredient, output)); ++ } ++ ++ /** ++ * Adds a new brewing recipe with custom logic. ++ */ ++ public void addRecipe(net.neoforged.neoforge.common.brewing.IBrewingRecipe recipe) { ++ this.recipes.add(recipe); ++ } ++ + public PotionBrewing build() { +- return new PotionBrewing(List.copyOf(this.containers), List.copyOf(this.potionMixes), List.copyOf(this.containerMixes)); ++ return new PotionBrewing(List.copyOf(this.containers), List.copyOf(this.potionMixes), List.copyOf(this.containerMixes), List.copyOf(this.recipes)); + } + } + diff --git a/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch b/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch new file mode 100644 index 0000000000..da064b016e --- /dev/null +++ b/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/world/item/component/FireworkExplosion.java ++++ b/net/minecraft/world/item/component/FireworkExplosion.java +@@ -107,7 +_,7 @@ + return new FireworkExplosion(this.shape, this.colors, new IntArrayList(p_330678_), this.hasTrail, this.hasTwinkle); + } + +- public static enum Shape implements StringRepresentable { ++ public static enum Shape implements StringRepresentable, net.neoforged.neoforge.common.IExtensibleEnum { + SMALL_BALL(0, "small_ball"), + LARGE_BALL(1, "large_ball"), + STAR(2, "star"), +@@ -117,8 +_,8 @@ + private static final IntFunction BY_ID = ByIdMap.continuous( + FireworkExplosion.Shape::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO + ); +- public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, FireworkExplosion.Shape::getId); +- public static final Codec CODEC = StringRepresentable.fromValues(FireworkExplosion.Shape::values); ++ public static final StreamCodec STREAM_CODEC = net.neoforged.neoforge.common.IExtensibleEnum.createStreamCodecForExtensibleEnum(Shape::values); ++ public static final Codec CODEC = net.neoforged.neoforge.common.IExtensibleEnum.createCodecForExtensibleEnum(Shape::values, Shape::getShape); + private final int id; + private final String name; + +@@ -137,6 +_,17 @@ + + public static FireworkExplosion.Shape byId(int p_330838_) { + return BY_ID.apply(p_330838_); ++ } ++ ++ public static FireworkExplosion.Shape getShape(String name) { ++ for (Shape ret : values()) ++ if (ret.name().equals(name)) ++ return ret; ++ return SMALL_BALL; ++ } ++ ++ public static Shape create(String registryName, int id, String shapeName) { ++ throw new IllegalStateException("Enum not extended"); + } + + @Override diff --git a/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch b/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch index 58770c3a12..ba676d13ae 100644 --- a/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java -@@ -79,8 +_,8 @@ - for(int i = 0; i < nonnulllist.size(); ++i) { +@@ -80,8 +_,8 @@ + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = p_43791_.getItem(i); if (!itemstack.isEmpty()) { - if (itemstack.getItem().hasCraftingRemainingItem()) { - nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); + if (itemstack.hasCraftingRemainingItem()) { + nonnulllist.set(i, itemstack.getCraftingRemainingItem()); - } else if (itemstack.hasTag() && BannerBlockEntity.getPatternCount(itemstack) > 0) { + } else if (!itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().isEmpty()) { nonnulllist.set(i, itemstack.copyWithCount(1)); } diff --git a/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch b/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch index cecf874366..8644f5f583 100644 --- a/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch @@ -1,16 +1,8 @@ --- a/net/minecraft/world/item/crafting/BookCloningRecipe.java +++ b/net/minecraft/world/item/crafting/BookCloningRecipe.java -@@ -68,6 +_,7 @@ - CompoundTag compoundtag = itemstack.getTag().copy(); - compoundtag.putInt("generation", WrittenBookItem.getGeneration(itemstack) + 1); - itemstack2.setTag(compoundtag); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - return itemstack2; - } else { - return ItemStack.EMPTY; -@@ -79,8 +_,8 @@ +@@ -84,8 +_,8 @@ - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = p_43820_.getItem(i); - if (itemstack.getItem().hasCraftingRemainingItem()) { - nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); diff --git a/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch b/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch deleted file mode 100644 index 564e8dd3d6..0000000000 --- a/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/crafting/FireworkStarRecipe.java -+++ b/net/minecraft/world/item/crafting/FireworkStarRecipe.java -@@ -118,7 +_,7 @@ - } - - compoundtag.putIntArray("Colors", list); -- compoundtag.putByte("Type", (byte)fireworkrocketitem$shape.getId()); -+ fireworkrocketitem$shape.save(compoundtag); - return itemstack; - } - diff --git a/patches/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/net/minecraft/world/item/crafting/Ingredient.java.patch index fce0977486..25e66a11cb 100644 --- a/patches/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -1,6 +1,35 @@ --- a/net/minecraft/world/item/crafting/Ingredient.java +++ b/net/minecraft/world/item/crafting/Ingredient.java -@@ -34,15 +_,36 @@ +@@ -29,22 +_,63 @@ + + public class Ingredient implements Predicate { + public static final Ingredient EMPTY = new Ingredient(Stream.empty()); +- public static final StreamCodec CONTENTS_STREAM_CODEC = ItemStack.LIST_STREAM_CODEC +- .map(p_319730_ -> fromValues(p_319730_.stream().map(Ingredient.ItemValue::new)), p_319731_ -> Arrays.asList(p_319731_.getItems())); ++ public static final StreamCodec CONTENTS_STREAM_CODEC = new StreamCodec<>() { ++ private static final StreamCodec CODEC_STREAM_CODEC = net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs.lazy(() -> net.minecraft.network.codec.ByteBufCodecs.fromCodecWithRegistries(CODEC)); ++ ++ @Override ++ public void encode(RegistryFriendlyByteBuf buf, Ingredient ingredient) { ++ if (ingredient.synchronizeWithContents()) { ++ ItemStack.LIST_STREAM_CODEC.encode(buf, Arrays.asList(ingredient.getItems())); ++ } else { ++ buf.writeVarInt(-1); ++ CODEC_STREAM_CODEC.encode(buf, ingredient); ++ } ++ } ++ ++ @Override ++ public Ingredient decode(RegistryFriendlyByteBuf buf) { ++ var size = buf.readVarInt(); ++ if (size == -1) { ++ return CODEC_STREAM_CODEC.decode(buf); ++ } ++ return fromValues(Stream.generate(() -> ItemStack.STREAM_CODEC.decode(buf)).limit(size).map(Ingredient.ItemValue::new)); ++ } ++ }; + public final Ingredient.Value[] values; + @Nullable private ItemStack[] itemStacks; @Nullable private IntList stackingIds; @@ -17,7 +46,7 @@ + public static final Codec> LIST_CODEC_NONEMPTY = CODEC_NONEMPTY.listOf(); protected Ingredient(Stream p_43907_) { -- this.values = p_43907_.toArray(p_43933_ -> new Ingredient.Value[p_43933_]); +- this.values = p_43907_.toArray(Ingredient.Value[]::new); + this(p_43907_, net.neoforged.neoforge.common.NeoForgeMod.VANILLA_INGREDIENT_TYPE); } @@ -40,16 +69,16 @@ } public ItemStack[] getItems() { -@@ -63,7 +_,7 @@ +@@ -62,7 +_,7 @@ return p_43914_.isEmpty(); } else { - for(ItemStack itemstack : this.getItems()) { + for (ItemStack itemstack : this.getItems()) { - if (itemstack.is(p_43914_.getItem())) { + if (areStacksEqual(itemstack, p_43914_)) { return true; } } -@@ -72,6 +_,10 @@ +@@ -71,6 +_,10 @@ } } @@ -60,27 +89,10 @@ public IntList getStackingIds() { if (this.stackingIds == null) { ItemStack[] aitemstack = this.getItems(); -@@ -88,11 +_,39 @@ +@@ -86,8 +_,23 @@ + return this.stackingIds; } - public final void toNetwork(FriendlyByteBuf p_43924_) { -- p_43924_.writeCollection(Arrays.asList(this.getItems()), FriendlyByteBuf::writeItem); -+ if (synchronizeWithContents()) { -+ p_43924_.writeCollection(Arrays.asList(this.getItems()), FriendlyByteBuf::writeItem); -+ } -+ else { -+ p_43924_.writeVarInt(-1); -+ p_43924_.writeWithCodec(net.minecraft.nbt.NbtOps.INSTANCE, CODEC, this); -+ } -+ } -+ -+ /** -+ * {@return if {@code true}, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the {@link #codec(boolean) codec}} -+ */ -+ public boolean synchronizeWithContents() { -+ return true; -+ } -+ + private boolean areAllStacksEmpty() { + Boolean empty = this.areAllStacksEmpty; + if (empty == null) { @@ -94,49 +106,33 @@ + this.areAllStacksEmpty = empty = allEmpty; + } + return empty; - } - ++ } ++ public boolean isEmpty() { - return this.values.length == 0; + return this.values.length == 0 || this.areAllStacksEmpty(); } @Override -@@ -100,6 +_,10 @@ +@@ -95,6 +_,17 @@ return p_301003_ instanceof Ingredient ingredient ? Arrays.equals((Object[])this.values, (Object[])ingredient.values) : false; } + public boolean isSimple() { + return true; + } ++ ++ /** ++ * {@return if {@code true}, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the {@link #codec(boolean) codec}} ++ */ ++ public boolean synchronizeWithContents() { ++ return true; ++ } + public static Ingredient fromValues(Stream p_43939_) { Ingredient ingredient = new Ingredient(p_43939_); return ingredient.isEmpty() ? EMPTY : ingredient; -@@ -125,11 +_,21 @@ - return fromValues(Stream.of(new Ingredient.TagValue(p_204133_))); - } - -+ public static Ingredient fromJson(com.google.gson.JsonElement element, boolean nonEmpty) { -+ Codec codec = nonEmpty ? CODEC : CODEC_NONEMPTY; -+ return net.minecraft.Util.getOrThrow(codec.parse(com.mojang.serialization.JsonOps.INSTANCE, element), IllegalStateException::new); -+ } -+ - public static Ingredient fromNetwork(FriendlyByteBuf p_43941_) { -- return fromValues(p_43941_.readList(FriendlyByteBuf::readItem).stream().map(Ingredient.ItemValue::new)); -+ var size = p_43941_.readVarInt(); -+ if (size == -1) { -+ return p_43941_.readWithCodecTrusted(net.minecraft.nbt.NbtOps.INSTANCE, CODEC); -+ } -+ return new Ingredient(Stream.generate(() -> new Ingredient.ItemValue(p_43941_.readItem())).limit(size)); - } - - private static Codec codec(boolean p_301074_) { -+ //PATCH: 1.20.2: Wrap in dispatch codec with fallback. - Codec codec = Codec.list(Ingredient.Value.CODEC) - .comapFlatMap( - p_300810_ -> !p_301074_ && p_300810_.size() < 1 -@@ -152,7 +_,11 @@ +@@ -143,7 +_,11 @@ ); } @@ -147,18 +143,17 @@ + } + static final Codec CODEC = RecordCodecBuilder.create( - p_311727_ -> p_311727_.group(ItemStack.SINGLE_ITEM_CODEC.fieldOf("item").forGetter(p_300919_ -> p_300919_.item)) - .apply(p_311727_, Ingredient.ItemValue::new) -@@ -164,7 +_,7 @@ - return false; - } else { - Ingredient.ItemValue ingredient$itemvalue = (Ingredient.ItemValue)p_301316_; -- return ingredient$itemvalue.item.getItem().equals(this.item.getItem()) && ingredient$itemvalue.item.getCount() == this.item.getCount(); -+ return comparator().apply(item(), ingredient$itemvalue.item()); - } + p_330109_ -> p_330109_.group(ItemStack.SIMPLE_ITEM_CODEC.fieldOf("item").forGetter(p_300919_ -> p_300919_.item)) + .apply(p_330109_, Ingredient.ItemValue::new) +@@ -153,13 +_,18 @@ + public boolean equals(Object p_301316_) { + return !(p_301316_ instanceof Ingredient.ItemValue ingredient$itemvalue) + ? false +- : ingredient$itemvalue.item.getItem().equals(this.item.getItem()) && ingredient$itemvalue.item.getCount() == this.item.getCount(); ++ : comparator().apply(item(), ingredient$itemvalue.item()); } -@@ -172,6 +_,11 @@ + @Override public Collection getItems() { return Collections.singleton(this.item); } @@ -170,17 +165,19 @@ } public static record TagValue(TagKey tag) implements Ingredient.Value { -@@ -193,6 +_,9 @@ +@@ -181,6 +_,11 @@ list.add(new ItemStack(holder)); } -+ if (list.size() == 0) { -+ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.BARRIER).setHoverName(net.minecraft.network.chat.Component.literal("Empty Tag: " + this.tag.location()))); ++ if (list.isEmpty()) { ++ net.minecraft.world.item.ItemStack itemStack = new net.minecraft.world.item.ItemStack(net.minecraft.world.level.block.Blocks.BARRIER); ++ itemStack.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, net.minecraft.network.chat.Component.literal("Empty Tag: " + this.tag.location())); ++ list.add(itemStack); + } return list; } } -@@ -210,5 +_,9 @@ +@@ -198,5 +_,9 @@ }); Collection getItems(); diff --git a/patches/net/minecraft/world/item/crafting/Recipe.java.patch b/patches/net/minecraft/world/item/crafting/Recipe.java.patch index 4741718185..f082a364c4 100644 --- a/patches/net/minecraft/world/item/crafting/Recipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/Recipe.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/item/crafting/Recipe.java +++ b/net/minecraft/world/item/crafting/Recipe.java -@@ -12,6 +_,7 @@ +@@ -16,6 +_,7 @@ public interface Recipe { Codec> CODEC = BuiltInRegistries.RECIPE_SERIALIZER.byNameCodec().dispatch(Recipe::getSerializer, RecipeSerializer::codec); + Codec>>> CONDITIONAL_CODEC = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodecWithConditions(CODEC); + StreamCodec> STREAM_CODEC = ByteBufCodecs.registry(Registries.RECIPE_SERIALIZER) + .dispatch(Recipe::getSerializer, RecipeSerializer::streamCodec); - boolean matches(C p_44002_, Level p_44003_); - -@@ -25,9 +_,9 @@ +@@ -31,9 +_,9 @@ NonNullList nonnulllist = NonNullList.withSize(p_44004_.getContainerSize(), ItemStack.EMPTY); - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { - Item item = p_44004_.getItem(i).getItem(); + ItemStack item = p_44004_.getItem(i); if (item.hasCraftingRemainingItem()) { @@ -20,7 +20,7 @@ } } -@@ -60,6 +_,6 @@ +@@ -66,6 +_,6 @@ default boolean isIncomplete() { NonNullList nonnulllist = this.getIngredients(); diff --git a/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch b/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch index 3ce8a30d40..4950a90df8 100644 --- a/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -1,47 +1,28 @@ --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -45,17 +_,23 @@ - } - - protected void apply(Map p_44037_, ResourceManager p_44038_, ProfilerFiller p_44039_) { -+ var ops = this.makeConditionalOps(); +@@ -52,17 +_,23 @@ this.hasErrors = false; Map, Builder>> map = Maps.newHashMap(); Builder> builder = ImmutableMap.builder(); +- RegistryOps registryops = this.registries.createSerializationContext(JsonOps.INSTANCE); ++ RegistryOps registryops = this.makeConditionalOps(); // Neo: add condition context - for(Entry entry : p_44037_.entrySet()) { + for (Entry entry : p_44037_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); + if (resourcelocation.getPath().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. try { -- RecipeHolder recipeholder = fromJson(resourcelocation, GsonHelper.convertToJsonObject(entry.getValue(), "top element")); -- map.computeIfAbsent(recipeholder.value().getType(), p_44075_ -> ImmutableMap.builder()).put(resourcelocation, recipeholder); -- builder.put(resourcelocation, recipeholder); -+ Optional> recipeHolderOptional = fromJson(resourcelocation, GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); -+ recipeHolderOptional.ifPresentOrElse(recipeholder -> { -+ map.computeIfAbsent(recipeholder.value().getType(), p_44075_ -> ImmutableMap.builder()).put(resourcelocation, recipeholder); -+ builder.put(resourcelocation, recipeholder); + JsonObject jsonobject = GsonHelper.convertToJsonObject(entry.getValue(), "top element"); +- Recipe recipe = Recipe.CODEC.parse(registryops, jsonobject).getOrThrow(JsonParseException::new); ++ var decoded = Recipe.CONDITIONAL_CODEC.parse(registryops, jsonobject).getOrThrow(JsonParseException::new); ++ decoded.ifPresentOrElse(r -> { ++ Recipe recipe = r.carrier(); + RecipeHolder recipeholder = new RecipeHolder<>(resourcelocation, recipe); + map.computeIfAbsent(recipe.getType(), p_44075_ -> ImmutableMap.builder()).put(resourcelocation, recipeholder); + builder.put(resourcelocation, recipeholder); + }, () -> { -+ LOGGER.debug("Skipping loading recipe {} as it's conditions were not met", resourcelocation); ++ LOGGER.debug("Skipping loading recipe {} as its conditions were not met", resourcelocation); + }); } catch (IllegalArgumentException | JsonParseException jsonparseexception) { LOGGER.error("Parsing error loading recipe {}", resourcelocation, jsonparseexception); } -@@ -136,9 +_,15 @@ - return this.recipes.values().stream().flatMap(p_220258_ -> p_220258_.keySet().stream()); - } - -+ /** @deprecated Forge: use {@linkplain #fromJson(ResourceLocation, JsonObject, com.mojang.serialization.DynamicOps) overload with context}. */ -+ @Deprecated - protected static RecipeHolder fromJson(ResourceLocation p_44046_, JsonObject p_44047_) { -- Recipe recipe = Util.getOrThrow(Recipe.CODEC.parse(JsonOps.INSTANCE, p_44047_), JsonParseException::new); -- return new RecipeHolder<>(p_44046_, recipe); -+ return fromJson(p_44046_, p_44047_, JsonOps.INSTANCE).orElseThrow(); -+ } -+ -+ public static Optional> fromJson(ResourceLocation p_44046_, JsonObject p_44047_, com.mojang.serialization.DynamicOps jsonElementOps) { -+ Optional> recipe = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Recipe.CONDITIONAL_CODEC, jsonElementOps, p_44047_); -+ return recipe.map(r -> new RecipeHolder<>(p_44046_, r)); - } - - public void replaceRecipes(Iterable> p_44025_) { diff --git a/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch b/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch index 6141870ee8..74b9961202 100644 --- a/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch @@ -1,38 +1,13 @@ --- a/net/minecraft/world/item/crafting/RepairItemRecipe.java +++ b/net/minecraft/world/item/crafting/RepairItemRecipe.java -@@ -27,7 +_,7 @@ - list.add(itemstack); - if (list.size() > 1) { - ItemStack itemstack1 = list.get(0); -- if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted() -+ if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable() - ) - { - return false; -@@ -48,7 +_,7 @@ - list.add(itemstack); - if (list.size() > 1) { - ItemStack itemstack1 = list.get(0); -- if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted() -+ if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable() - ) - { - return ItemStack.EMPTY; -@@ -60,12 +_,12 @@ - if (list.size() == 2) { - ItemStack itemstack3 = list.get(0); - ItemStack itemstack4 = list.get(1); -- if (itemstack3.is(itemstack4.getItem()) && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.getItem().canBeDepleted()) { -+ if (itemstack3.is(itemstack4.getItem()) && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.isRepairable()) { - Item item = itemstack3.getItem(); -- int j = item.getMaxDamage() - itemstack3.getDamageValue(); -- int k = item.getMaxDamage() - itemstack4.getDamageValue(); -- int l = j + k + item.getMaxDamage() * 5 / 100; -- int i1 = item.getMaxDamage() - l; -+ int j = itemstack3.getMaxDamage() - itemstack3.getDamageValue(); -+ int k = itemstack3.getMaxDamage() - itemstack4.getDamageValue(); -+ int l = j + k + itemstack3.getMaxDamage() * 5 / 100; -+ int i1 = itemstack3.getMaxDamage() - l; - if (i1 < 0) { - i1 = 0; - } +@@ -48,7 +_,9 @@ + && p_336139_.has(DataComponents.MAX_DAMAGE) + && p_335795_.has(DataComponents.MAX_DAMAGE) + && p_336139_.has(DataComponents.DAMAGE) +- && p_335795_.has(DataComponents.DAMAGE); ++ && p_335795_.has(DataComponents.DAMAGE) ++ && p_336139_.isRepairable() ++ && p_335795_.isRepairable(); + } + + public boolean matches(CraftingContainer p_44138_, Level p_44139_) { diff --git a/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch b/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch index 398aa6f445..8188e0dd08 100644 --- a/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch +++ b/patches/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 -@@ -11,7 +_,7 @@ +@@ -12,7 +_,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -9,29 +9,7 @@ final ShapedRecipePattern pattern; final ItemStack result; final String group; -@@ -41,11 +_,21 @@ - } - - @Override -+ public int getRecipeWidth() { -+ return getWidth(); -+ } -+ -+ @Override - public CraftingBookCategory category() { - return this.category; - } - - @Override -+ public int getRecipeHeight() { -+ return getHeight(); -+ } -+ -+ @Override - public ItemStack getResultItem(RegistryAccess p_266881_) { - return this.result; - } -@@ -84,7 +_,7 @@ +@@ -85,7 +_,7 @@ @Override public boolean isIncomplete() { NonNullList nonnulllist = this.getIngredients(); diff --git a/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch b/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch index 337ed94356..d85beee4b8 100644 --- a/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch @@ -31,7 +31,7 @@ public static final MapCodec MAP_CODEC = ShapedRecipePattern.Data.MAP_CODEC .flatXmap( ShapedRecipePattern::unpack, -@@ -176,16 +_,16 @@ +@@ -179,16 +_,16 @@ public static record Data(Map key, List pattern) { private static final Codec> PATTERN_CODEC = Codec.STRING.listOf().comapFlatMap(p_312085_ -> { @@ -44,7 +44,7 @@ } else { int i = p_312085_.get(0).length(); - for(String s : p_312085_) { + for (String s : p_312085_) { - if (s.length() > 3) { - return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); + if (s.length() > maxWidth) { diff --git a/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch b/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch index 36f0d04589..715c305c8f 100644 --- a/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java -@@ -19,12 +_,14 @@ +@@ -20,12 +_,14 @@ final CraftingBookCategory category; final ItemStack result; final NonNullList ingredients; @@ -15,17 +15,17 @@ } @Override -@@ -54,17 +_,20 @@ +@@ -55,17 +_,20 @@ public boolean matches(CraftingContainer p_44262_, Level p_44263_) { StackedContents stackedcontents = new StackedContents(); + java.util.List inputs = new java.util.ArrayList<>(); int i = 0; - for(int j = 0; j < p_44262_.getContainerSize(); ++j) { + for (int j = 0; j < p_44262_.getContainerSize(); j++) { ItemStack itemstack = p_44262_.getItem(j); if (!itemstack.isEmpty()) { - ++i; + i++; + if (isSimple) stackedcontents.accountStack(itemstack, 1); + else inputs.add(itemstack); @@ -36,24 +36,13 @@ + return i == this.ingredients.size() && (isSimple ? stackedcontents.canCraft(this, null) : net.neoforged.neoforge.common.util.RecipeMatcher.findMatches(inputs, this.ingredients) != null); } - public ItemStack assemble(CraftingContainer p_44260_, RegistryAccess p_266797_) { -@@ -77,6 +_,7 @@ - } - - public static class Serializer implements RecipeSerializer { -+ private static final net.minecraft.resources.ResourceLocation NAME = new net.minecraft.resources.ResourceLocation("minecraft", "crafting_shapeless"); - private static final Codec CODEC = RecordCodecBuilder.create( - p_311734_ -> p_311734_.group( - ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(p_301127_ -> p_301127_.group), -@@ -87,14 +_,13 @@ + public ItemStack assemble(CraftingContainer p_44260_, HolderLookup.Provider p_335725_) { +@@ -88,12 +_,12 @@ .fieldOf("ingredients") .flatXmap( p_301021_ -> { -- Ingredient[] aingredient = p_301021_.stream() -- .filter(p_300883_ -> !p_300883_.isEmpty()) -- .toArray(p_300865_ -> new Ingredient[p_300865_]); -+ Ingredient[] aingredient = p_301021_ -+ .toArray(Ingredient[]::new); //Forge skip the empty check and immediatly create the array. +- Ingredient[] aingredient = p_301021_.stream().filter(p_300883_ -> !p_300883_.isEmpty()).toArray(Ingredient[]::new); ++ Ingredient[] aingredient = p_301021_.toArray(Ingredient[]::new); // Neo skip the empty check and immediately create the array. if (aingredient.length == 0) { return DataResult.error(() -> "No ingredients for shapeless recipe"); } else { diff --git a/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch b/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch index a4f1004828..0b556d02aa 100644 --- a/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/item/crafting/ShulkerBoxColoring.java @@ -25,7 +_,7 @@ if (Block.byItem(itemstack.getItem()) instanceof ShulkerBoxBlock) { - ++i; + i++; } else { - if (!(itemstack.getItem() instanceof DyeItem)) { + if (!itemstack.is(net.neoforged.neoforge.common.Tags.Items.DYES)) { @@ -11,14 +11,14 @@ @@ -43,7 +_,7 @@ - public ItemStack assemble(CraftingContainer p_44322_, RegistryAccess p_266985_) { + public ItemStack assemble(CraftingContainer p_44322_, HolderLookup.Provider p_335717_) { ItemStack itemstack = ItemStack.EMPTY; - DyeItem dyeitem = (DyeItem)Items.WHITE_DYE; + net.minecraft.world.item.DyeColor dyecolor = net.minecraft.world.item.DyeColor.WHITE; - for(int i = 0; i < p_44322_.getContainerSize(); ++i) { + for (int i = 0; i < p_44322_.getContainerSize(); i++) { ItemStack itemstack1 = p_44322_.getItem(i); -@@ -51,13 +_,15 @@ +@@ -51,13 +_,14 @@ Item item = itemstack1.getItem(); if (Block.byItem(item) instanceof ShulkerBoxBlock) { itemstack = itemstack1; @@ -31,9 +31,8 @@ } } -- ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyeitem.getDyeColor()); -+ ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyecolor); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - if (itemstack.hasTag()) { - itemstack2.setTag(itemstack.getTag().copy()); - } +- Block block = ShulkerBoxBlock.getBlockByColor(dyeitem.getDyeColor()); ++ Block block = ShulkerBoxBlock.getBlockByColor(dyecolor); + return itemstack.transmuteCopy(block, 1); + } + diff --git a/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch b/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch index 2eea3b863f..090c3de77e 100644 --- a/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch +++ b/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch @@ -1,15 +1,11 @@ --- a/net/minecraft/world/item/crafting/SimpleCookingSerializer.java +++ b/net/minecraft/world/item/crafting/SimpleCookingSerializer.java -@@ -19,11 +_,7 @@ - ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(p_300832_ -> p_300832_.group), +@@ -20,7 +_,7 @@ + Codec.STRING.optionalFieldOf("group", "").forGetter(p_300832_ -> p_300832_.group), CookingBookCategory.CODEC.fieldOf("category").orElse(CookingBookCategory.MISC).forGetter(p_300828_ -> p_300828_.category), Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(p_300833_ -> p_300833_.ingredient), -- BuiltInRegistries.ITEM -- .byNameCodec() -- .xmap(ItemStack::new, ItemStack::getItem) -- .fieldOf("result") -- .forGetter(p_300827_ -> p_300827_.result), -+ net.neoforged.neoforge.common.crafting.CraftingHelper.smeltingResultCodec().fieldOf("result").forGetter(p_300827_ -> p_300827_.result), +- ItemStack.STRICT_SINGLE_ITEM_CODEC.fieldOf("result").forGetter(p_300827_ -> p_300827_.result), ++ ItemStack.CODEC.fieldOf("result").forGetter(p_300827_ -> p_300827_.result), Codec.FLOAT.fieldOf("experience").orElse(0.0F).forGetter(p_300826_ -> p_300826_.experience), Codec.INT.fieldOf("cookingtime").orElse(p_44331_).forGetter(p_300834_ -> p_300834_.cookingTime) ) diff --git a/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch b/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch index b95e850477..dfbc2f3586 100644 --- a/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java -@@ -36,6 +_,7 @@ - if (compoundtag != null) { - itemstack.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(p_267036_.getItem(1), itemstack); - - return itemstack; - } -@@ -67,7 +_,7 @@ +@@ -63,7 +_,7 @@ @Override public boolean isIncomplete() { diff --git a/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch b/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch index f3f0e069a1..e0ecd7a810 100644 --- a/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java -@@ -96,7 +_,7 @@ +@@ -92,7 +_,7 @@ @Override public boolean isIncomplete() { diff --git a/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch b/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch deleted file mode 100644 index e4c931d717..0000000000 --- a/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/enchantment/DiggingEnchantment.java -+++ b/net/minecraft/world/item/enchantment/DiggingEnchantment.java -@@ -26,6 +_,6 @@ - - @Override - public boolean canEnchant(ItemStack p_44668_) { -- return p_44668_.is(Items.SHEARS) ? true : super.canEnchant(p_44668_); -+ return p_44668_.getItem() instanceof net.minecraft.world.item.ShearsItem ? true : super.canEnchant(p_44668_); - } - } diff --git a/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch b/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch index 5aefb51533..099bffc9c8 100644 --- a/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch +++ b/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/world/item/enchantment/Enchantment.java +++ b/net/minecraft/world/item/enchantment/Enchantment.java -@@ -17,7 +_,7 @@ - import net.minecraft.world.entity.MobType; +@@ -23,7 +_,7 @@ + import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; --public abstract class Enchantment { -+public abstract class Enchantment implements net.neoforged.neoforge.common.extensions.IEnchantmentExtension { - private final EquipmentSlot[] slots; - private final Enchantment.Rarity rarity; - public final EnchantmentCategory category; -@@ -73,6 +_,7 @@ +-public class Enchantment implements FeatureElement { ++public class Enchantment implements FeatureElement, net.neoforged.neoforge.common.extensions.IEnchantmentExtension { + private final Enchantment.EnchantmentDefinition definition; + @Nullable + protected String descriptionId; +@@ -131,6 +_,7 @@ return 0; } + @Deprecated // Forge: Use ItemStack aware version in IForgeEnchantment - public float getDamageBonus(int p_44682_, MobType p_44683_) { + public float getDamageBonus(int p_44682_, @Nullable EntityType p_320800_) { return 0.0F; } -@@ -113,7 +_,7 @@ +@@ -171,7 +_,7 @@ } public boolean canEnchant(ItemStack p_44689_) { -- return this.category.canEnchant(p_44689_.getItem()); +- return p_44689_.getItem().builtInRegistryHolder().is(this.definition.supportedItems()); + return canApplyAtEnchantingTable(p_44689_); } public void doPostAttack(LivingEntity p_44686_, Entity p_44687_, int p_44688_) { -@@ -135,6 +_,24 @@ +@@ -196,6 +_,24 @@ } public boolean isDiscoverable() { diff --git a/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch b/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch deleted file mode 100644 index a04aa3c42d..0000000000 --- a/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/net/minecraft/world/item/enchantment/EnchantmentCategory.java -+++ b/net/minecraft/world/item/enchantment/EnchantmentCategory.java -@@ -13,7 +_,7 @@ - import net.minecraft.world.item.Vanishable; - import net.minecraft.world.level.block.Block; - --public enum EnchantmentCategory { -+public enum EnchantmentCategory implements net.neoforged.neoforge.common.IExtensibleEnum { - ARMOR { - @Override - public boolean canEnchant(Item p_44751_) { -@@ -115,5 +_,19 @@ - } - }; - -- public abstract boolean canEnchant(Item p_44743_); -+ private java.util.function.Predicate delegate; -+ -+ private EnchantmentCategory() {} -+ -+ private EnchantmentCategory(java.util.function.Predicate delegate) { -+ this.delegate = delegate; -+ } -+ -+ public static EnchantmentCategory create(String name, java.util.function.Predicate delegate) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ public boolean canEnchant(Item p_44743_) { -+ return this.delegate == null ? false : this.delegate.test(p_44743_); -+ } - } diff --git a/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch b/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch index 154ec355cf..852ddadac2 100644 --- a/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch +++ b/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch @@ -1,52 +1,37 @@ --- a/net/minecraft/world/item/enchantment/EnchantmentHelper.java +++ b/net/minecraft/world/item/enchantment/EnchantmentHelper.java -@@ -60,7 +_,14 @@ - return BuiltInRegistries.ENCHANTMENT.getKey(p_182433_); - } +@@ -33,9 +_,10 @@ + public class EnchantmentHelper { + private static final float SWIFT_SNEAK_EXTRA_FACTOR = 0.15F; -+ /** @deprecated forge: use {@link #getTagEnchantmentLevel(Enchantment, ItemStack)} or {@link ItemStack#getEnchantmentLevel(Enchantment)} */ ++ /** @deprecated Neo: Use {@link ItemStack#getEnchantmentLevel(Enchantment)} for gameplay logic. Use the data component when modifying the enchantments. */ + @Deprecated public static int getItemEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) { +- ItemEnchantments itemenchantments = p_44845_.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); +- return itemenchantments.getLevel(p_44844_); + return p_44845_.getEnchantmentLevel(p_44844_); -+ } -+ -+ /** Gets the enchantment level from NBT. Generally should use {@link ItemStack#getEnchantmentLevel(Enchantment)} for gameplay logic */ -+ public static int getTagEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) { - if (p_44845_.isEmpty()) { - return 0; - } else { -@@ -79,6 +_,7 @@ - } } -+ /** Gets all enchantment levels from NBT. Use {@link ItemStack#getAllEnchantments()} for gameplay logic */ - public static Map getEnchantments(ItemStack p_44832_) { - ListTag listtag = p_44832_.is(Items.ENCHANTED_BOOK) ? EnchantedBookItem.getEnchantments(p_44832_) : p_44832_.getEnchantmentTags(); - return deserializeEnchantments(listtag); -@@ -118,6 +_,13 @@ + public static ItemEnchantments updateEnchantments(ItemStack p_331034_, Consumer p_332031_) { +@@ -78,7 +_,7 @@ + } private static void runIterationOnItem(EnchantmentHelper.EnchantmentVisitor p_44851_, ItemStack p_44852_) { - if (!p_44852_.isEmpty()) { -+ if (true) { // forge: redirect enchantment logic to allow non-NBT enchants -+ for (Map.Entry entry : p_44852_.getAllEnchantments().entrySet()) { -+ p_44851_.accept(entry.getKey(), entry.getValue()); -+ } -+ return; -+ } -+ - ListTag listtag = p_44852_.getEnchantmentTags(); +- ItemEnchantments itemenchantments = p_44852_.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); ++ ItemEnchantments itemenchantments = p_44852_.getAllEnchantments(); // Neo: Allow gameplay enchantments to run too. - for(int i = 0; i < listtag.size(); ++i) { -@@ -143,7 +_,7 @@ + for (Entry> entry : itemenchantments.entrySet()) { + p_44851_.accept(entry.getKey().value(), entry.getIntValue()); +@@ -99,7 +_,7 @@ - public static float getDamageBonus(ItemStack p_44834_, MobType p_44835_) { + public static float getDamageBonus(ItemStack p_44834_, @Nullable EntityType p_320195_) { MutableFloat mutablefloat = new MutableFloat(); -- runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_44835_)), p_44834_); -+ runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_44835_, p_44834_)), p_44834_); +- runIterationOnItem((p_319741_, p_319742_) -> mutablefloat.add(p_319741_.getDamageBonus(p_319742_, p_320195_)), p_44834_); ++ runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_320195_, p_44834_)), p_44834_); return mutablefloat.floatValue(); } -@@ -158,6 +_,7 @@ +@@ -125,6 +_,7 @@ runIterationOnInventory(enchantmenthelper$enchantmentvisitor, p_44824_.getAllSlots()); } @@ -54,7 +39,7 @@ if (p_44825_ instanceof Player) { runIterationOnItem(enchantmenthelper$enchantmentvisitor, p_44824_.getMainHandItem()); } -@@ -169,6 +_,7 @@ +@@ -136,6 +_,7 @@ runIterationOnInventory(enchantmenthelper$enchantmentvisitor, p_44897_.getAllSlots()); } @@ -62,7 +47,7 @@ if (p_44897_ instanceof Player) { runIterationOnItem(enchantmenthelper$enchantmentvisitor, p_44897_.getMainHandItem()); } -@@ -290,7 +_,7 @@ +@@ -263,7 +_,7 @@ public static int getEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) { Item item = p_220291_.getItem(); @@ -71,8 +56,8 @@ if (i <= 0) { return 0; } else { -@@ -328,7 +_,7 @@ - public static List selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) { +@@ -298,7 +_,7 @@ + ) { List list = Lists.newArrayList(); Item item = p_220299_.getItem(); - int i = item.getEnchantmentValue(); @@ -80,12 +65,12 @@ if (i <= 0) { return list; } else { -@@ -383,7 +_,7 @@ - boolean flag = p_44819_.is(Items.BOOK); - - for(Enchantment enchantment : BuiltInRegistries.ENCHANTMENT) { -- if ((!enchantment.isTreasureOnly() || p_44820_) && enchantment.isDiscoverable() && (enchantment.category.canEnchant(item) || flag)) { -+ if ((!enchantment.isTreasureOnly() || p_44820_) && enchantment.isDiscoverable() && (enchantment.canApplyAtEnchantingTable(p_44819_) || (flag && enchantment.isAllowedOnBooks()))) { - for(int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) { +@@ -355,7 +_,7 @@ + if (enchantment.isEnabled(p_338712_) + && (!enchantment.isTreasureOnly() || p_44820_) + && enchantment.isDiscoverable() +- && (flag || enchantment.canEnchant(p_44819_) && enchantment.isPrimaryItem(p_44819_))) { ++ && ((flag && enchantment.isAllowedOnBooks()) || enchantment.canApplyAtEnchantingTable(p_44819_) && enchantment.isPrimaryItem(p_44819_))) { + for (int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; i--) { if (p_44818_ >= enchantment.getMinCost(i) && p_44818_ <= enchantment.getMaxCost(i)) { list.add(new EnchantmentInstance(enchantment, i)); diff --git a/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch b/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch index 580b414024..4196e69fc2 100644 --- a/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java +++ b/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java -@@ -49,7 +_,13 @@ +@@ -33,7 +_,13 @@ BlockState blockstate2 = p_45020_.getBlockState(blockpos); if (blockstate2 == FrostedIceBlock.meltsInto() && blockstate.canSurvive(p_45020_, blockpos) diff --git a/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch b/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch deleted file mode 100644 index c644be5fba..0000000000 --- a/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/item/trading/MerchantOffer.java -+++ b/net/minecraft/world/item/trading/MerchantOffer.java -@@ -90,7 +_,7 @@ - } else { - int i = this.baseCostA.getCount(); - int j = Math.max(0, Mth.floor((float)(i * this.demand) * this.priceMultiplier)); -- return this.baseCostA.copyWithCount(Mth.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getItem().getMaxStackSize())); -+ return this.baseCostA.copyWithCount(Mth.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getMaxStackSize())); - } - } - -@@ -197,7 +_,7 @@ - return true; - } else { - ItemStack itemstack = p_45366_.copy(); -- if (itemstack.getItem().canBeDepleted()) { -+ if (itemstack.getItem().isDamageable(itemstack)) { - itemstack.setDamageValue(itemstack.getDamageValue()); - } - diff --git a/patches/net/minecraft/world/level/BaseSpawner.java.patch b/patches/net/minecraft/world/level/BaseSpawner.java.patch index 966fea600b..30f6a4df8c 100644 --- a/patches/net/minecraft/world/level/BaseSpawner.java.patch +++ b/patches/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -152,14 +_,14 @@ +@@ -151,14 +_,14 @@ entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), randomsource.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { @@ -10,17 +10,17 @@ continue; } -- if (spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8)) { -- ((Mob)entity) -- .finalizeSpawn(p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null, null); +- boolean flag1 = spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8); +- if (flag1) { +- ((Mob)entity).finalizeSpawn(p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null); + // Forge: Patch in FinalizeSpawn for spawners so it may be fired unconditionally, instead of only when vanilla normally would trigger it. -+ var event = net.neoforged.neoforge.event.EventHooks.onFinalizeSpawnSpawner(mob, p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), null, compoundtag, this); ++ var event = net.neoforged.neoforge.event.EventHooks.onFinalizeSpawnSpawner(mob, p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), null, this); + if (event != null && spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8)) { -+ ((Mob)entity).finalizeSpawn(p_151312_, event.getDifficulty(), event.getSpawnType(), event.getSpawnData(), event.getSpawnTag()); ++ ((Mob)entity).finalizeSpawn(p_151312_, event.getDifficulty(), event.getSpawnType(), event.getSpawnData()); } - } -@@ -306,4 +_,12 @@ + spawndata.getEquipment().ifPresent(mob::equip); +@@ -309,4 +_,12 @@ public double getoSpin() { return this.oSpin; } diff --git a/patches/net/minecraft/world/level/Explosion.java.patch b/patches/net/minecraft/world/level/Explosion.java.patch index 7306fc7244..1ed4425e85 100644 --- a/patches/net/minecraft/world/level/Explosion.java.patch +++ b/patches/net/minecraft/world/level/Explosion.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/Explosion.java +++ b/net/minecraft/world/level/Explosion.java -@@ -267,6 +_,7 @@ +@@ -268,6 +_,7 @@ int j2 = Mth.floor(this.z - (double)f2 - 1.0); int j1 = Mth.floor(this.z + (double)f2 + 1.0); List list = this.level.getEntities(this.source, new AABB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); + net.neoforged.neoforge.event.EventHooks.onExplosionDetonate(this.level, this, list, f2); Vec3 vec3 = new Vec3(this.x, this.y, this.z); - for(Entity entity : list) { + for (Entity entity : list) { diff --git a/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch b/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch index 18578fb071..5fe433a7d5 100644 --- a/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch +++ b/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/level/ForcedChunksSavedData.java +++ b/net/minecraft/world/level/ForcedChunksSavedData.java -@@ -24,16 +_,31 @@ +@@ -25,16 +_,31 @@ } - public static ForcedChunksSavedData load(CompoundTag p_151484_) { + public static ForcedChunksSavedData load(CompoundTag p_151484_, HolderLookup.Provider p_323940_) { - return new ForcedChunksSavedData(new LongOpenHashSet(p_151484_.getLongArray("Forced"))); + ForcedChunksSavedData savedData = new ForcedChunksSavedData(new LongOpenHashSet(p_151484_.getLongArray("Forced"))); + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.readModForcedChunks(p_151484_, savedData.blockForcedChunks, savedData.entityForcedChunks); @@ -11,7 +11,7 @@ } @Override - public CompoundTag save(CompoundTag p_46120_) { + public CompoundTag save(CompoundTag p_46120_, HolderLookup.Provider p_324573_) { p_46120_.putLongArray("Forced", this.chunks.toLongArray()); + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.writeModForcedChunks(p_46120_, this.blockForcedChunks, this.entityForcedChunks); return p_46120_; diff --git a/patches/net/minecraft/world/level/Level.java.patch b/patches/net/minecraft/world/level/Level.java.patch index a1edbaaa91..b60001ceed 100644 --- a/patches/net/minecraft/world/level/Level.java.patch +++ b/patches/net/minecraft/world/level/Level.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -73,7 +_,7 @@ +@@ -75,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.Scoreboard; @@ -9,7 +9,7 @@ public static final Codec> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, new ResourceLocation("overworld")); public static final ResourceKey NETHER = ResourceKey.create(Registries.DIMENSION, new ResourceLocation("the_nether")); -@@ -112,6 +_,11 @@ +@@ -113,6 +_,11 @@ private final RegistryAccess registryAccess; private final DamageSources damageSources; private long subTickCount; @@ -129,7 +129,7 @@ } @@ -656,7 +_,7 @@ - Explosion.BlockInteraction explosion$blockinteraction = switch(p_312265_) { + Explosion.BlockInteraction explosion$blockinteraction = switch (p_312265_) { case NONE -> Explosion.BlockInteraction.KEEP; case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); - case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) @@ -139,7 +139,7 @@ case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); @@ -677,6 +_,7 @@ p_312060_, - p_311784_ + p_320283_ ); + if (net.neoforged.neoforge.event.EventHooks.onExplosionStart(this, explosion)) return explosion; explosion.explode(); @@ -159,7 +159,7 @@ + if (false) if (p_151522_ instanceof EnderDragon) { - for(EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).getSubEntities()) { + for (EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).getSubEntities()) { if (p_151522_ != p_46536_ && p_46538_.test(enderdragonpart)) { @@ -797,6 +_,11 @@ } @@ -180,7 +180,7 @@ + + if (false) if (p_261454_ instanceof EnderDragon enderdragon) { - for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { T t = p_261885_.tryCast(enderdragonpart); @@ -837,6 +_,15 @@ @@ -198,11 +198,11 @@ } @Nullable -@@ -969,16 +_,15 @@ +@@ -965,16 +_,15 @@ public abstract Scoreboard getScoreboard(); public void updateNeighbourForOutputSignal(BlockPos p_46718_, Block p_46719_) { -- for(Direction direction : Direction.Plane.HORIZONTAL) { +- for (Direction direction : Direction.Plane.HORIZONTAL) { + for(Direction direction : Direction.values()) { BlockPos blockpos = p_46718_.relative(direction); if (this.hasChunkAt(blockpos)) { @@ -219,7 +219,7 @@ this.neighborChanged(blockstate, blockpos, p_46719_, p_46718_, false); } } -@@ -1070,6 +_,24 @@ +@@ -1062,6 +_,24 @@ @Override public BiomeManager getBiomeManager() { return this.biomeManager; diff --git a/patches/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/net/minecraft/world/level/NaturalSpawner.java.patch index 7ba66045e1..34b083ee3b 100644 --- a/patches/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/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 @@ +@@ -45,6 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -8,7 +8,7 @@ public final class NaturalSpawner { private static final Logger LOGGER = LogUtils.getLogger(); private static final int MIN_SPAWN_DISTANCE = 24; -@@ -71,7 +_,7 @@ +@@ -69,7 +_,7 @@ continue; } @@ -17,8 +17,8 @@ if (mobcategory != MobCategory.MISC) { BlockPos blockpos = entity.blockPosition(); p_186527_.query( -@@ -201,7 +_,7 @@ - ++l1; +@@ -199,7 +_,7 @@ + l1++; p_47040_.addFreshEntityWithPassengers(mob); p_47044_.run(mob, p_47041_); - if (j >= mob.getMaxSpawnClusterSize()) { @@ -26,16 +26,16 @@ return; } -@@ -278,7 +_,7 @@ - && p_46993_.removeWhenFarAway(p_46994_)) { - return false; - } else { -- return p_46993_.checkSpawnRules(p_46992_, MobSpawnType.NATURAL) && p_46993_.checkSpawnObstruction(p_46992_); -+ return net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(p_46993_, p_46992_, MobSpawnType.NATURAL); - } +@@ -272,7 +_,7 @@ + return p_46994_ > (double)(p_46993_.getType().getCategory().getDespawnDistance() * p_46993_.getType().getCategory().getDespawnDistance()) + && p_46993_.removeWhenFarAway(p_46994_) + ? false +- : p_46993_.checkSpawnRules(p_46992_, MobSpawnType.NATURAL) && p_46993_.checkSpawnObstruction(p_46992_); ++ : net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(p_46993_, p_46992_, MobSpawnType.NATURAL); } -@@ -310,9 +_,14 @@ + private static Optional getRandomSpawnMobAt( +@@ -303,9 +_,14 @@ BlockPos p_220448_, @Nullable Holder p_220449_ ) { @@ -53,38 +53,7 @@ } public static boolean isInNetherFortressBounds(BlockPos p_220456_, ServerLevel p_220457_, MobCategory p_220458_, StructureManager p_220459_) { -@@ -351,6 +_,13 @@ - if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) { - return true; - } else if (p_47055_ != null && p_47053_.getWorldBorder().isWithinBounds(p_47054_)) { -+ return p_47052_.canSpawnAt(p_47053_, p_47054_, p_47055_); -+ } -+ return false; -+ } -+ -+ public static boolean canSpawnAtBody(SpawnPlacements.Type p_47052_, LevelReader p_47053_, BlockPos p_47054_, @Nullable EntityType p_47055_) { -+ { - BlockState blockstate = p_47053_.getBlockState(p_47054_); - FluidState fluidstate = p_47053_.getFluidState(p_47054_); - BlockPos blockpos = p_47054_.above(); -@@ -363,15 +_,13 @@ - case ON_GROUND: - default: - BlockState blockstate1 = p_47053_.getBlockState(blockpos1); -- if (!blockstate1.isValidSpawn(p_47053_, blockpos1, p_47055_)) { -+ if (!blockstate1.isValidSpawn(p_47053_, blockpos1, p_47052_, p_47055_)) { - return false; - } else { - return isValidEmptySpawnBlock(p_47053_, p_47054_, blockstate, fluidstate, p_47055_) - && isValidEmptySpawnBlock(p_47053_, blockpos, p_47053_.getBlockState(blockpos), p_47053_.getFluidState(blockpos), p_47055_); - } - } -- } else { -- return false; - } - } - -@@ -431,8 +_,7 @@ +@@ -392,8 +_,7 @@ entity.moveTo(d0, (double)blockpos.getY(), d1, p_220454_.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob @@ -92,5 +61,5 @@ - && mob.checkSpawnObstruction(p_220451_)) { + && net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(mob, p_220451_, MobSpawnType.CHUNK_GENERATION)) { spawngroupdata = mob.finalizeSpawn( - p_220451_, p_220451_.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, null + p_220451_, p_220451_.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.CHUNK_GENERATION, spawngroupdata ); diff --git a/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch b/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch index 3ca300683b..a2e27deb03 100644 --- a/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch +++ b/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/AbstractCauldronBlock.java +++ b/net/minecraft/world/level/block/AbstractCauldronBlock.java -@@ -102,4 +_,22 @@ +@@ -101,4 +_,22 @@ protected void receiveStalactiteDrip(BlockState p_151975_, Level p_151976_, BlockPos p_151977_, Fluid p_151978_) { } diff --git a/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch b/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch index 1363816780..7505c61bc0 100644 --- a/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch @@ -3,7 +3,7 @@ @@ -88,7 +_,7 @@ @Override - public float getDestroyProgress(BlockState p_48981_, Player p_48982_, BlockGetter p_48983_, BlockPos p_48984_) { + protected float getDestroyProgress(BlockState p_48981_, Player p_48982_, BlockGetter p_48983_, BlockPos p_48984_) { - return p_48982_.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(p_48981_, p_48982_, p_48983_, p_48984_); + return p_48982_.getMainHandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_DIG) ? 1.0F : super.getDestroyProgress(p_48981_, p_48982_, p_48983_, p_48984_); } diff --git a/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch b/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch index d0aca5073e..82c3d8dce3 100644 --- a/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch @@ -11,7 +11,7 @@ protected static final float LARGE_LEAVES_AABB_OFFSET = 5.0F; @@ -130,10 +_,11 @@ @Override - public void randomTick(BlockState p_261931_, ServerLevel p_261751_, BlockPos p_261616_, RandomSource p_261766_) { + protected void randomTick(BlockState p_261931_, ServerLevel p_261751_, BlockPos p_261616_, RandomSource p_261766_) { if (p_261931_.getValue(STAGE) == 0) { - if (p_261766_.nextInt(3) == 0 && p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { + if (p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { @@ -26,7 +26,7 @@ @@ -193,7 +_,7 @@ @Override - public float getDestroyProgress(BlockState p_261691_, Player p_262171_, BlockGetter p_261621_, BlockPos p_261500_) { + protected float getDestroyProgress(BlockState p_261691_, Player p_262171_, BlockGetter p_261621_, BlockPos p_261500_) { - return p_262171_.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(p_261691_, p_262171_, p_261621_, p_261500_); + return p_262171_.getMainHandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_DIG) ? 1.0F : super.getDestroyProgress(p_261691_, p_262171_, p_261621_, p_261500_); } diff --git a/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch index dcfb0bc2e2..c4bc4e334f 100644 --- a/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -8,10 +8,10 @@ if (optional.isPresent()) { optional.get().createPortalBlocks(); return; -@@ -189,7 +_,7 @@ +@@ -185,7 +_,7 @@ boolean flag = false; - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).is(Blocks.OBSIDIAN)) { + if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).isPortalFrame(p_49270_, blockpos$mutableblockpos)) { flag = true; diff --git a/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch b/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch index e98253961e..af4fb513e8 100644 --- a/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -11,7 +11,7 @@ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -49,6 +_,7 @@ @Override - public VoxelShape getShape(BlockState p_49403_, BlockGetter p_49404_, BlockPos p_49405_, CollisionContext p_49406_) { + protected VoxelShape getShape(BlockState p_49403_, BlockGetter p_49404_, BlockPos p_49405_, CollisionContext p_49406_) { RailShape railshape = p_49403_.is(this) ? p_49403_.getValue(this.getShapeProperty()) : null; + RailShape railShape2 = p_49403_.is(this) ? getRailDirection(p_49403_, p_49404_, p_49405_, null) : null; return railshape != null && railshape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB; @@ -19,7 +19,7 @@ @@ -76,7 +_,7 @@ @Override - public void neighborChanged(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, BlockPos p_49381_, boolean p_49382_) { + protected void neighborChanged(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, BlockPos p_49381_, boolean p_49382_) { if (!p_49378_.isClientSide && p_49378_.getBlockState(p_49379_).is(this)) { - RailShape railshape = p_49377_.getValue(this.getShapeProperty()); + RailShape railshape = getRailDirection(p_49377_, p_49378_, p_49379_, null); @@ -27,7 +27,7 @@ dropResources(p_49377_, p_49378_, p_49379_); p_49378_.removeBlock(p_49379_, p_49382_); @@ -121,7 +_,7 @@ - public void onRemove(BlockState p_49384_, Level p_49385_, BlockPos p_49386_, BlockState p_49387_, boolean p_49388_) { + protected void onRemove(BlockState p_49384_, Level p_49385_, BlockPos p_49386_, BlockState p_49387_, boolean p_49388_) { if (!p_49388_) { super.onRemove(p_49384_, p_49385_, p_49386_, p_49387_, p_49388_); - if (p_49384_.getValue(this.getShapeProperty()).isAscending()) { @@ -49,7 +49,7 @@ @Override @@ -158,5 +_,15 @@ @Override - public FluidState getFluidState(BlockState p_152158_) { + protected FluidState getFluidState(BlockState p_152158_) { return p_152158_.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(p_152158_); + } + diff --git a/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch index 6926bca196..46dc3cac7f 100644 --- a/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -124,7 +_,7 @@ +@@ -126,7 +_,7 @@ boolean flag = false; if (i >= 5) { - Item item = itemstack.getItem(); -- if (itemstack.is(Items.SHEARS)) { -+ if (itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_HARVEST)) { - p_49625_.playSound(p_49627_, p_49627_.getX(), p_49627_.getY(), p_49627_.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); - dropHoneycomb(p_49625_, p_49626_); - itemstack.hurtAndBreak(1, p_49627_, p_49571_ -> p_49571_.broadcastBreakEvent(p_49628_)); + Item item = p_316844_.getItem(); +- if (p_316844_.is(Items.SHEARS)) { ++ if (p_316844_.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_HARVEST)) { + p_316306_.playSound(p_316824_, p_316824_.getX(), p_316824_.getY(), p_316824_.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); + dropHoneycomb(p_316306_, p_316497_); + p_316844_.hurtAndBreak(1, p_316824_, LivingEntity.getSlotForHand(p_316436_)); diff --git a/patches/net/minecraft/world/level/block/Block.java.patch b/patches/net/minecraft/world/level/block/Block.java.patch index 6493bb2986..de3380cdbc 100644 --- a/patches/net/minecraft/world/level/block/Block.java.patch +++ b/patches/net/minecraft/world/level/block/Block.java.patch @@ -30,7 +30,7 @@ } public static boolean isExceptionForConnection(BlockState p_152464_) { -@@ -213,6 +_,8 @@ +@@ -209,6 +_,8 @@ BlockState blockstate = p_152446_.getBlockState(p_152449_); if (p_152445_.skipRendering(blockstate, p_152448_)) { return false; @@ -39,7 +39,7 @@ } else if (blockstate.canOcclude()) { Block.BlockStatePairKey block$blockstatepairkey = new Block.BlockStatePairKey(p_152445_, blockstate, p_152448_); Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = OCCLUSION_CACHE.get(); -@@ -305,9 +_,12 @@ +@@ -297,9 +_,12 @@ public static void dropResources( BlockState p_49882_, Level p_49883_, BlockPos p_49884_, @Nullable BlockEntity p_49885_, @Nullable Entity p_49886_, ItemStack p_49887_ ) { @@ -53,7 +53,7 @@ } } -@@ -335,7 +_,7 @@ +@@ -327,7 +_,7 @@ } private static void popResource(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { @@ -62,7 +62,7 @@ ItemEntity itementity = p_152442_.get(); itementity.setDefaultPickUpDelay(); p_152441_.addFreshEntity(itementity); -@@ -343,11 +_,12 @@ +@@ -335,11 +_,12 @@ } public void popExperience(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { @@ -76,7 +76,7 @@ public float getExplosionResistance() { return this.explosionResistance; } -@@ -366,7 +_,8 @@ +@@ -358,7 +_,8 @@ public void playerDestroy(Level p_49827_, Player p_49828_, BlockPos p_49829_, BlockState p_49830_, @Nullable BlockEntity p_49831_, ItemStack p_49832_) { p_49828_.awardStat(Stats.BLOCK_MINED.get(this)); p_49828_.causeFoodExhaustion(0.005F); @@ -86,7 +86,7 @@ } public void setPlacedBy(Level p_49847_, BlockPos p_49848_, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack p_49851_) { -@@ -394,8 +_,10 @@ +@@ -386,8 +_,10 @@ public void updateEntityAfterFallOn(BlockGetter p_49821_, Entity p_49822_) { p_49822_.setDeltaMovement(p_49822_.getDeltaMovement().multiply(1.0, 0.0, 1.0)); @@ -97,7 +97,7 @@ public ItemStack getCloneItemStack(LevelReader p_304395_, BlockPos p_49824_, BlockState p_49825_) { return new ItemStack(this); } -@@ -429,6 +_,7 @@ +@@ -421,6 +_,7 @@ public void handlePrecipitation(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) { } @@ -105,15 +105,7 @@ public boolean dropFromExplosion(Explosion p_49826_) { return true; } -@@ -464,6 +_,7 @@ - return p_152456_.setValue(p_152457_, p_152455_.getValue(p_152457_)); - } - -+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } - public SoundType getSoundType(BlockState p_49963_) { - return this.soundType; - } -@@ -498,6 +_,75 @@ +@@ -486,6 +_,75 @@ return this.stateDefinition.getPossibleStates().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), p_152459_)); } diff --git a/patches/net/minecraft/world/level/block/Blocks.java.patch b/patches/net/minecraft/world/level/block/Blocks.java.patch index 31c5d0b61a..896ab76489 100644 --- a/patches/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/net/minecraft/world/level/block/Blocks.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -756,7 +_,7 @@ +@@ -754,7 +_,7 @@ public static final Block RED_BED = register("red_bed", bed(DyeColor.RED)); public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK)); public static final Block POWERED_RAIL = register( @@ -9,10 +9,10 @@ ); public static final Block DETECTOR_RAIL = register( "detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)) -@@ -7802,7 +_,8 @@ +@@ -7829,7 +_,8 @@ static { - for(Block block : BuiltInRegistries.BLOCK) { - for(BlockState blockstate : block.getStateDefinition().getPossibleStates()) { + for (Block block : BuiltInRegistries.BLOCK) { + for (BlockState blockstate : block.getStateDefinition().getPossibleStates()) { - Block.BLOCK_STATE_REGISTRY.add(blockstate); + // Neo: comment out, it's done in NeoForgeRegistryCallbacks + //Block.BLOCK_STATE_REGISTRY.add(blockstate); diff --git a/patches/net/minecraft/world/level/block/BushBlock.java.patch b/patches/net/minecraft/world/level/block/BushBlock.java.patch index e4aabd2efc..f0d823f947 100644 --- a/patches/net/minecraft/world/level/block/BushBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BushBlock.java.patch @@ -11,7 +11,7 @@ } @@ -33,6 +_,8 @@ @Override - public boolean canSurvive(BlockState p_51028_, LevelReader p_51029_, BlockPos p_51030_) { + protected boolean canSurvive(BlockState p_51028_, LevelReader p_51029_, BlockPos p_51030_) { BlockPos blockpos = p_51030_.below(); + if (p_51028_.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + return p_51029_.getBlockState(blockpos).canSustainPlant(p_51029_, blockpos, Direction.UP, this); @@ -20,8 +20,8 @@ @@ -44,5 +_,12 @@ @Override - public boolean isPathfindable(BlockState p_51023_, BlockGetter p_51024_, BlockPos p_51025_, PathComputationType p_51026_) { - return p_51026_ == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(p_51023_, p_51024_, p_51025_, p_51026_); + protected boolean isPathfindable(BlockState p_51023_, PathComputationType p_51026_) { + return p_51026_ == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(p_51023_, p_51026_); + } + + @Override diff --git a/patches/net/minecraft/world/level/block/CactusBlock.java.patch b/patches/net/minecraft/world/level/block/CactusBlock.java.patch index cb0661b1ff..10a127e82f 100644 --- a/patches/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CactusBlock.java.patch @@ -12,7 +12,7 @@ @@ -41,6 +_,7 @@ @Override - public void tick(BlockState p_220908_, ServerLevel p_220909_, BlockPos p_220910_, RandomSource p_220911_) { + protected void tick(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_.canSurvive(p_220909_, p_220910_)) { p_220909_.destroyBlock(p_220910_, true); @@ -45,7 +45,7 @@ @Override @@ -115,5 +_,15 @@ @Override - public boolean isPathfindable(BlockState p_51143_, BlockGetter p_51144_, BlockPos p_51145_, PathComputationType p_51146_) { + protected boolean isPathfindable(BlockState p_51143_, PathComputationType p_51146_) { return false; + } + diff --git a/patches/net/minecraft/world/level/block/CampfireBlock.java.patch b/patches/net/minecraft/world/level/block/CampfireBlock.java.patch index 226b499103..148f8e6d3e 100644 --- a/patches/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -282,7 +_,7 @@ +@@ -283,7 +_,7 @@ return true; } diff --git a/patches/net/minecraft/world/level/block/CauldronBlock.java.patch b/patches/net/minecraft/world/level/block/CauldronBlock.java.patch index 8b27224d4a..c22d2458c3 100644 --- a/patches/net/minecraft/world/level/block/CauldronBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CauldronBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CauldronBlock.java +++ b/net/minecraft/world/level/block/CauldronBlock.java -@@ -60,6 +_,7 @@ +@@ -58,6 +_,7 @@ @Override protected void receiveStalactiteDrip(BlockState p_152940_, Level p_152941_, BlockPos p_152942_, Fluid p_152943_) { diff --git a/patches/net/minecraft/world/level/block/ChestBlock.java.patch b/patches/net/minecraft/world/level/block/ChestBlock.java.patch index ac6268c819..38fce1c6c0 100644 --- a/patches/net/minecraft/world/level/block/ChestBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ChestBlock.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java -@@ -374,7 +_,8 @@ +@@ -361,7 +_,8 @@ @Override - public BlockState mirror(BlockState p_51549_, Mirror p_51550_) { + protected BlockState mirror(BlockState p_51549_, Mirror p_51550_) { - return p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); + BlockState rotated = p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); + return p_51550_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests diff --git a/patches/net/minecraft/world/level/block/CocoaBlock.java.patch b/patches/net/minecraft/world/level/block/CocoaBlock.java.patch index ba98db3e30..d004d4e3d8 100644 --- a/patches/net/minecraft/world/level/block/CocoaBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CocoaBlock.java.patch @@ -3,7 +3,7 @@ @@ -64,10 +_,11 @@ @Override - public void randomTick(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { + protected void randomTick(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { - if (p_221001_.random.nextInt(5) == 0) { + if (true) { int i = p_221000_.getValue(AGE); diff --git a/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch b/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch index 5d6a79477e..c8fc89171c 100644 --- a/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch +++ b/patches/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 -@@ -204,4 +_,16 @@ +@@ -199,4 +_,16 @@ protected void createBlockStateDefinition(StateDefinition.Builder p_51887_) { p_51887_.add(FACING, MODE, POWERED); } @@ -13,7 +13,7 @@ + @Override + public void onNeighborChange(BlockState state, net.minecraft.world.level.LevelReader world, BlockPos pos, BlockPos neighbor) { + if (pos.getY() == neighbor.getY() && world instanceof Level && !((Level)world).isClientSide()) { -+ state.neighborChanged((Level)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false); ++ state.handleNeighborChanged((Level)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false); + } + } } diff --git a/patches/net/minecraft/world/level/block/ComposterBlock.java.patch b/patches/net/minecraft/world/level/block/ComposterBlock.java.patch index 1ffe618e4a..fd6fc537dc 100644 --- a/patches/net/minecraft/world/level/block/ComposterBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ComposterBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ComposterBlock.java +++ b/net/minecraft/world/level/block/ComposterBlock.java -@@ -47,6 +_,8 @@ +@@ -48,6 +_,8 @@ public static final int MIN_LEVEL = 0; public static final int MAX_LEVEL = 7; public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_COMPOSTER; @@ -9,7 +9,7 @@ public static final Object2FloatMap COMPOSTABLES = new Object2FloatOpenHashMap<>(); private static final int AABB_SIDE_THICKNESS = 2; private static final VoxelShape OUTER_SHAPE = Shapes.block(); -@@ -226,13 +_,22 @@ +@@ -227,6 +_,15 @@ if (p_51978_.getValue(LEVEL) == 7) { p_51979_.scheduleTick(p_51980_, p_51978_.getBlock(), 20); } @@ -18,22 +18,23 @@ + } + + @Override -+ public void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { ++ protected void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { + super.onRemove(p_60515_, p_60516_, p_60517_, p_60518_, p_60519_); + // Neo: Invalidate composter capabilities when a composter is removed + if (!p_60515_.is(p_60518_.getBlock())) p_60516_.invalidateCapabilities(p_60517_); } @Override - public InteractionResult use(BlockState p_51949_, Level p_51950_, BlockPos p_51951_, Player p_51952_, InteractionHand p_51953_, BlockHitResult p_51954_) { - int i = p_51949_.getValue(LEVEL); - ItemStack itemstack = p_51952_.getItemInHand(p_51953_); -- if (i < 8 && COMPOSTABLES.containsKey(itemstack.getItem())) { -+ if (i < 8 && getValue(itemstack) > 0) { - if (i < 7 && !p_51950_.isClientSide) { - BlockState blockstate = addItem(p_51952_, p_51949_, p_51950_, p_51951_, itemstack); - p_51950_.levelEvent(1500, p_51951_, p_51949_ != blockstate ? 1 : 0); -@@ -253,7 +_,7 @@ +@@ -234,7 +_,7 @@ + ItemStack p_316332_, BlockState p_316118_, Level p_316624_, BlockPos p_316660_, Player p_316715_, InteractionHand p_316472_, BlockHitResult p_316606_ + ) { + int i = p_316118_.getValue(LEVEL); +- if (i < 8 && COMPOSTABLES.containsKey(p_316332_.getItem())) { ++ if (i < 8 && getValue(p_316332_) > 0) { + if (i < 7 && !p_316624_.isClientSide) { + BlockState blockstate = addItem(p_316715_, p_316118_, p_316624_, p_316660_, p_316332_); + p_316624_.levelEvent(1500, p_316660_, p_316118_ != blockstate ? 1 : 0); +@@ -261,7 +_,7 @@ public static BlockState insertItem(Entity p_270919_, BlockState p_270087_, ServerLevel p_270284_, ItemStack p_270253_, BlockPos p_270678_) { int i = p_270087_.getValue(LEVEL); @@ -42,7 +43,7 @@ BlockState blockstate = addItem(p_270919_, p_270087_, p_270284_, p_270678_, p_270253_); p_270253_.shrink(1); return blockstate; -@@ -284,7 +_,7 @@ +@@ -292,7 +_,7 @@ static BlockState addItem(@Nullable Entity p_270464_, BlockState p_270603_, LevelAccessor p_270151_, BlockPos p_270547_, ItemStack p_270354_) { int i = p_270603_.getValue(LEVEL); @@ -51,7 +52,7 @@ if ((i != 0 || !(f > 0.0F)) && !(p_270151_.getRandom().nextDouble() < (double)f)) { return p_270603_; } else { -@@ -384,7 +_,7 @@ +@@ -392,7 +_,7 @@ @Override public boolean canPlaceItemThroughFace(int p_52028_, ItemStack p_52029_, @Nullable Direction p_52030_) { @@ -60,7 +61,7 @@ } @Override -@@ -442,5 +_,11 @@ +@@ -450,5 +_,11 @@ ComposterBlock.empty(null, this.state, this.level, this.pos); this.changed = true; } diff --git a/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch b/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch index 61c6b4be8e..30355c0220 100644 --- a/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch @@ -27,7 +27,7 @@ boolean flag = false; BlockPos.MutableBlockPos blockpos$mutableblockpos = p_52066_.mutable(); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BlockState blockstate = p_52065_.getBlockState(blockpos$mutableblockpos); - if (direction != Direction.DOWN || canSolidify(blockstate)) { + if (direction != Direction.DOWN || state.canBeHydrated(p_52065_, p_52066_, blockstate.getFluidState(), blockpos$mutableblockpos)) { @@ -41,7 +41,7 @@ @@ -76,7 +_,7 @@ @Override - public BlockState updateShape(BlockState p_52074_, Direction p_52075_, BlockState p_52076_, LevelAccessor p_52077_, BlockPos p_52078_, BlockPos p_52079_) { + protected BlockState updateShape(BlockState p_52074_, Direction p_52075_, BlockState p_52076_, LevelAccessor p_52077_, BlockPos p_52078_, BlockPos p_52079_) { - return touchesLiquid(p_52077_, p_52078_) + return touchesLiquid(p_52077_, p_52078_, p_52074_) ? this.concrete.defaultBlockState() diff --git a/patches/net/minecraft/world/level/block/CoralBlock.java.patch b/patches/net/minecraft/world/level/block/CoralBlock.java.patch index b24ed10f96..5a1ed63e3c 100644 --- a/patches/net/minecraft/world/level/block/CoralBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CoralBlock.java.patch @@ -5,7 +5,7 @@ protected boolean scanForWater(BlockGetter p_52135_, BlockPos p_52136_) { + BlockState state = p_52135_.getBlockState(p_52136_); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { FluidState fluidstate = p_52135_.getFluidState(p_52136_.relative(direction)); - if (fluidstate.is(FluidTags.WATER)) { + if (state.canBeHydrated(p_52135_, p_52136_, fluidstate, p_52136_.relative(direction))) { diff --git a/patches/net/minecraft/world/level/block/CropBlock.java.patch b/patches/net/minecraft/world/level/block/CropBlock.java.patch index 6657064977..30100c78d6 100644 --- a/patches/net/minecraft/world/level/block/CropBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CropBlock.java.patch @@ -3,7 +3,7 @@ @@ -84,12 +_,14 @@ @Override - public void randomTick(BlockState p_221050_, ServerLevel p_221051_, BlockPos p_221052_, RandomSource p_221053_) { + protected void randomTick(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_.getRawBrightness(p_221052_, 0) >= 9) { int i = this.getAge(p_221050_); @@ -17,7 +17,7 @@ } } @@ -117,9 +_,9 @@ - for(int j = -1; j <= 1; ++j) { + for (int j = -1; j <= 1; j++) { float f1 = 0.0F; BlockState blockstate = p_52274_.getBlockState(blockpos.offset(i, 0, j)); - if (blockstate.is(Blocks.FARMLAND)) { @@ -31,7 +31,7 @@ @@ -164,7 +_,7 @@ @Override - public void entityInside(BlockState p_52277_, Level p_52278_, BlockPos p_52279_, Entity p_52280_) { + protected void entityInside(BlockState p_52277_, Level p_52278_, BlockPos p_52279_, Entity p_52280_) { - if (p_52280_ instanceof Ravager && p_52278_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (p_52280_ instanceof Ravager && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_52278_, p_52280_)) { p_52278_.destroyBlock(p_52279_, true, p_52280_); diff --git a/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch b/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch index 415c4cff82..9bb6444090 100644 --- a/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch +++ b/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/DropExperienceBlock.java @@ -30,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { + protected void spawnAfterBreak(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { super.spawnAfterBreak(p_221086_, p_221087_, p_221088_, p_221089_, p_221090_); - if (p_221090_) { - this.tryDropExperience(p_221087_, p_221088_, p_221089_, this.xpRange); diff --git a/patches/net/minecraft/world/level/block/DropperBlock.java.patch b/patches/net/minecraft/world/level/block/DropperBlock.java.patch index 7ecf9aae7c..d130ce886b 100644 --- a/patches/net/minecraft/world/level/block/DropperBlock.java.patch +++ b/patches/net/minecraft/world/level/block/DropperBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/DropperBlock.java +++ b/net/minecraft/world/level/block/DropperBlock.java -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ p_52944_.levelEvent(1001, p_52945_, 0); } else { ItemStack itemstack = dispenserblockentity.getItem(i); diff --git a/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch b/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch new file mode 100644 index 0000000000..7bca3e7ddf --- /dev/null +++ b/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/block/EnchantingTableBlock.java ++++ b/net/minecraft/world/level/block/EnchantingTableBlock.java +@@ -47,7 +_,7 @@ + } + + public static boolean isValidBookShelf(Level p_340976_, BlockPos p_340984_, BlockPos p_341294_) { +- return p_340976_.getBlockState(p_340984_.offset(p_341294_)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ++ return p_340976_.getBlockState(p_340984_.offset(p_341294_)).getEnchantPowerBonus(p_340976_, p_340984_.offset(p_341294_)) != 0 + && p_340976_.getBlockState(p_340984_.offset(p_341294_.getX() / 2, p_341294_.getY(), p_341294_.getZ() / 2)) + .is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); + } diff --git a/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch b/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch deleted file mode 100644 index 8c5ee13256..0000000000 --- a/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/EnchantmentTableBlock.java -+++ b/net/minecraft/world/level/block/EnchantmentTableBlock.java -@@ -50,7 +_,7 @@ - } - - public static boolean isValidBookShelf(Level p_207910_, BlockPos p_207911_, BlockPos p_207912_) { -- return p_207910_.getBlockState(p_207911_.offset(p_207912_)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) -+ return p_207910_.getBlockState(p_207911_.offset(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.offset(p_207912_)) != 0 - && p_207910_.getBlockState(p_207911_.offset(p_207912_.getX() / 2, p_207912_.getY(), p_207912_.getZ() / 2)) - .is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); - } diff --git a/patches/net/minecraft/world/level/block/FarmBlock.java.patch b/patches/net/minecraft/world/level/block/FarmBlock.java.patch index a8abd2b11d..73a1ea523f 100644 --- a/patches/net/minecraft/world/level/block/FarmBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FarmBlock.java.patch @@ -24,7 +24,7 @@ private static boolean isNearWater(LevelReader p_53259_, BlockPos p_53260_) { + BlockState state = p_53259_.getBlockState(p_53260_); - for(BlockPos blockpos : BlockPos.betweenClosed(p_53260_.offset(-4, 0, -4), p_53260_.offset(4, 1, 4))) { + for (BlockPos blockpos : BlockPos.betweenClosed(p_53260_.offset(-4, 0, -4), p_53260_.offset(4, 1, 4))) { - if (p_53259_.getFluidState(blockpos).is(FluidTags.WATER)) { + if (state.canBeHydrated(p_53259_, p_53260_, p_53259_.getFluidState(blockpos), blockpos)) { return true; diff --git a/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch index aa22fba538..e31aaf5e23 100644 --- a/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/FenceGateBlock.java +++ b/net/minecraft/world/level/block/FenceGateBlock.java -@@ -32,7 +_,9 @@ +@@ -31,7 +_,9 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( @@ -11,7 +11,7 @@ .apply(p_308823_, FenceGateBlock::new) ); public static final BooleanProperty OPEN = BlockStateProperties.OPEN; -@@ -50,6 +_,8 @@ +@@ -49,6 +_,8 @@ protected static final VoxelShape X_OCCLUSION_SHAPE = Shapes.or(Block.box(7.0, 5.0, 0.0, 9.0, 16.0, 2.0), Block.box(7.0, 5.0, 14.0, 9.0, 16.0, 16.0)); protected static final VoxelShape Z_OCCLUSION_SHAPE_LOW = Shapes.or(Block.box(0.0, 2.0, 7.0, 2.0, 13.0, 9.0), Block.box(14.0, 2.0, 7.0, 16.0, 13.0, 9.0)); protected static final VoxelShape X_OCCLUSION_SHAPE_LOW = Shapes.or(Block.box(7.0, 2.0, 0.0, 9.0, 13.0, 2.0), Block.box(7.0, 2.0, 14.0, 9.0, 13.0, 16.0)); @@ -20,7 +20,7 @@ private final WoodType type; @Override -@@ -58,8 +_,17 @@ +@@ -57,8 +_,17 @@ } public FenceGateBlock(WoodType p_273340_, BlockBehaviour.Properties p_273352_) { @@ -40,7 +40,7 @@ this.registerDefaultState( this.stateDefinition .any() -@@ -170,7 +_,7 @@ +@@ -169,7 +_,7 @@ p_53366_.playSound( p_53368_, p_53367_, @@ -49,7 +49,7 @@ SoundSource.BLOCKS, 1.0F, p_53366_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -187,7 +_,7 @@ +@@ -186,7 +_,7 @@ p_311813_.playSound( null, p_312680_, @@ -58,7 +58,7 @@ SoundSource.BLOCKS, 1.0F, p_311813_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -208,7 +_,7 @@ +@@ -207,7 +_,7 @@ p_53373_.playSound( null, p_53374_, diff --git a/patches/net/minecraft/world/level/block/FireBlock.java.patch b/patches/net/minecraft/world/level/block/FireBlock.java.patch index d574e27836..0842498c3a 100644 --- a/patches/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FireBlock.java.patch @@ -8,7 +8,7 @@ + if (!this.canCatchFire(p_53471_, blockpos, Direction.UP) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) { BlockState blockstate1 = this.defaultBlockState(); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction); if (booleanproperty != null) { - blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canBurn(p_53471_.getBlockState(p_53472_.relative(direction))))); @@ -52,7 +52,7 @@ + this.checkBurnOut(p_221161_, p_221162_.south(), 300 + k, p_221163_, i, Direction.NORTH); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int l = -1; l <= 1; ++l) { + for (int l = -1; l <= 1; l++) { @@ -240,33 +_,32 @@ || p_53429_.isRainingAt(p_53430_.south()); } @@ -96,7 +96,7 @@ @@ -277,7 +_,7 @@ private boolean isValidFireLocation(BlockGetter p_53486_, BlockPos p_53487_) { - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (this.canBurn(p_53486_.getBlockState(p_53487_.relative(direction)))) { + if (this.canCatchFire(p_53486_, p_53487_.relative(direction), direction.getOpposite())) { return true; @@ -104,7 +104,7 @@ } @@ -293,7 +_,7 @@ - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BlockState blockstate = p_221157_.getBlockState(p_221158_.relative(direction)); - i = Math.max(this.getIgniteOdds(blockstate), i); + i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.relative(direction), direction.getOpposite()), i); diff --git a/patches/net/minecraft/world/level/block/FlowerBlock.java.patch b/patches/net/minecraft/world/level/block/FlowerBlock.java.patch deleted file mode 100644 index 848ca271d7..0000000000 --- a/patches/net/minecraft/world/level/block/FlowerBlock.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/world/level/block/FlowerBlock.java -+++ b/net/minecraft/world/level/block/FlowerBlock.java -@@ -21,20 +_,27 @@ - ); - protected static final float AABB_OFFSET = 3.0F; - protected static final VoxelShape SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 10.0, 11.0); -- private final List suspiciousStewEffects; -+ private final java.util.function.Supplier> suspiciousStewEffectSupplier; -+ -+ public FlowerBlock(java.util.function.Supplier effectSupplier, int p_53513_, BlockBehaviour.Properties p_53514_) { -+ super(p_53514_); -+ this.suspiciousStewEffectSupplier = () -> makeEffectList(effectSupplier.get(), p_53513_); -+ } - - @Override - public MapCodec codec() { - return CODEC; - } - -+ /** @deprecated FORGE: Use supplier version instead */ -+ @Deprecated - public FlowerBlock(MobEffect p_53512_, int p_53513_, BlockBehaviour.Properties p_53514_) { - this(makeEffectList(p_53512_, p_53513_), p_53514_); - } - - public FlowerBlock(List p_304513_, BlockBehaviour.Properties p_304822_) { - super(p_304822_); -- this.suspiciousStewEffects = p_304513_; -+ this.suspiciousStewEffectSupplier = () -> p_304513_; - } - - protected static List makeEffectList(MobEffect p_304981_, int p_304406_) { -@@ -56,6 +_,6 @@ - - @Override - public List getSuspiciousEffects() { -- return this.suspiciousStewEffects; -+ return this.suspiciousStewEffectSupplier.get(); - } - } diff --git a/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch index 3d349da803..fc5bc0ea45 100644 --- a/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -43,25 +43,25 @@ } @Override -@@ -62,7 +_,7 @@ - public InteractionResult use(BlockState p_53540_, Level p_53541_, BlockPos p_53542_, Player p_53543_, InteractionHand p_53544_, BlockHitResult p_53545_) { - ItemStack itemstack = p_53543_.getItemInHand(p_53544_); - Item item = itemstack.getItem(); -- BlockState blockstate = (item instanceof BlockItem ? POTTED_BY_CONTENT.getOrDefault(((BlockItem)item).getBlock(), Blocks.AIR) : Blocks.AIR) -+ BlockState blockstate = (item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(((BlockItem)item).getBlock()), () -> Blocks.AIR).get() : Blocks.AIR) +@@ -58,7 +_,7 @@ + ItemStack p_316610_, BlockState p_316240_, Level p_316456_, BlockPos p_316502_, Player p_316491_, InteractionHand p_316444_, BlockHitResult p_316826_ + ) { + BlockState blockstate = (p_316610_.getItem() instanceof BlockItem blockitem +- ? POTTED_BY_CONTENT.getOrDefault(blockitem.getBlock(), Blocks.AIR) ++ ? getEmptyPot().fullPots.getOrDefault(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(blockitem.getBlock()), () -> Blocks.AIR).get() + : Blocks.AIR) .defaultBlockState(); - boolean flag = blockstate.is(Blocks.AIR); - boolean flag1 = this.isEmpty(); -@@ -81,7 +_,7 @@ - p_53543_.drop(itemstack1, false); - } - -- p_53541_.setBlock(p_53542_, Blocks.FLOWER_POT.defaultBlockState(), 3); -+ p_53541_.setBlock(p_53542_, getEmptyPot().defaultBlockState(), 3); + if (blockstate.isAir()) { +@@ -84,7 +_,7 @@ + p_316338_.drop(itemstack, false); } - p_53541_.gameEvent(p_53543_, GameEvent.BLOCK_CHANGE, p_53542_); -@@ -108,11 +_,32 @@ +- p_316655_.setBlock(p_316654_, Blocks.FLOWER_POT.defaultBlockState(), 3); ++ p_316655_.setBlock(p_316654_, getEmptyPot().defaultBlockState(), 3); + p_316655_.gameEvent(p_316338_, GameEvent.BLOCK_CHANGE, p_316654_); + return InteractionResult.sidedSuccess(p_316655_.isClientSide); + } +@@ -107,11 +_,32 @@ } public Block getPotted() { @@ -70,7 +70,7 @@ } @Override - public boolean isPathfindable(BlockState p_53535_, BlockGetter p_53536_, BlockPos p_53537_, PathComputationType p_53538_) { + protected boolean isPathfindable(BlockState p_53535_, PathComputationType p_53538_) { return false; } + diff --git a/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch index 7feadf7529..197469ef8a 100644 --- a/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch +++ b/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch @@ -3,7 +3,7 @@ @@ -42,10 +_,11 @@ @Override - public void randomTick(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { + protected void randomTick(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { - if (p_221350_.getValue(AGE) < 25 && p_221353_.nextDouble() < this.growPerTickProbability) { + if (p_221350_.getValue(AGE) < 25 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_221351_, p_221352_.relative(this.growthDirection), p_221351_.getBlockState(p_221352_.relative(this.growthDirection)), p_221353_.nextDouble() < this.growPerTickProbability)) { BlockPos blockpos = p_221352_.relative(this.growthDirection); diff --git a/patches/net/minecraft/world/level/block/LiquidBlock.java.patch b/patches/net/minecraft/world/level/block/LiquidBlock.java.patch index 97aab8e672..e1462ae914 100644 --- a/patches/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/patches/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -41,7 +41,7 @@ @Override @@ -109,6 +_,7 @@ @Override - public FluidState getFluidState(BlockState p_54765_) { + protected FluidState getFluidState(BlockState p_54765_) { int i = p_54765_.getValue(LEVEL); + if (!fluidStateCacheInitialized) initFluidStateCache(); return this.stateCache.get(Math.min(i, 8)); @@ -50,7 +50,7 @@ @@ -134,7 +_,7 @@ @Override - public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { + protected void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { - if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { + if (!net.neoforged.neoforge.fluids.FluidInteractionRegistry.canInteract(p_54755_, p_54756_)) { p_54755_.scheduleTick(p_54756_, p_54754_.getFluidState().getType(), this.fluid.getTickDelay(p_54755_)); @@ -59,7 +59,7 @@ @@ -150,11 +_,12 @@ @Override - public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { + protected void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { - if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { + if (!net.neoforged.neoforge.fluids.FluidInteractionRegistry.canInteract(p_54710_, p_54711_)) { p_54710_.scheduleTick(p_54711_, p_54709_.getFluidState().getType(), this.fluid.getTickDelay(p_54710_)); diff --git a/patches/net/minecraft/world/level/block/MushroomBlock.java.patch b/patches/net/minecraft/world/level/block/MushroomBlock.java.patch index 5a11312d50..7c60905760 100644 --- a/patches/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java -@@ -88,7 +_,7 @@ - if (blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK)) { - return true; - } else { -- return p_54881_.getRawBrightness(p_54882_, 0) < 13 && this.mayPlaceOn(blockstate, p_54881_, blockpos); -+ return p_54881_.getRawBrightness(p_54882_, 0) < 13 && blockstate.canSustainPlant(p_54881_, blockpos, net.minecraft.core.Direction.UP, this); - } +@@ -87,7 +_,7 @@ + BlockState blockstate = p_54881_.getBlockState(blockpos); + return blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK) + ? true +- : p_54881_.getRawBrightness(p_54882_, 0) < 13 && this.mayPlaceOn(blockstate, p_54881_, blockpos); ++ : p_54881_.getRawBrightness(p_54882_, 0) < 13 && blockstate.canSustainPlant(p_54881_, blockpos, net.minecraft.core.Direction.UP, this); } -@@ -99,8 +_,10 @@ + public boolean growMushroom(ServerLevel p_221774_, BlockPos p_221775_, BlockState p_221776_, RandomSource p_221777_) { +@@ -97,8 +_,10 @@ if (optional.isEmpty()) { return false; } else { diff --git a/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch b/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch index 95735a5908..2860dd6f51 100644 --- a/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch +++ b/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/NetherWartBlock.java @@ -55,9 +_,10 @@ @Override - public void randomTick(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { + protected void randomTick(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { int i = p_221806_.getValue(AGE); - if (i < 3 && p_221809_.nextInt(10) == 0) { + if (i < 3 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_221807_, p_221808_, p_221806_, p_221809_.nextInt(10) == 0)) { diff --git a/patches/net/minecraft/world/level/block/NoteBlock.java.patch b/patches/net/minecraft/world/level/block/NoteBlock.java.patch index 01e91d43ce..5c0e59dbd2 100644 --- a/patches/net/minecraft/world/level/block/NoteBlock.java.patch +++ b/patches/net/minecraft/world/level/block/NoteBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java -@@ -104,7 +_,9 @@ - } else if (p_55035_.isClientSide) { +@@ -110,7 +_,9 @@ + if (p_316774_.isClientSide) { return InteractionResult.SUCCESS; } else { -- p_55034_ = p_55034_.cycle(NOTE); -+ int _new = net.neoforged.neoforge.common.CommonHooks.onNoteChange(p_55035_, p_55036_, p_55034_, p_55034_.getValue(NOTE), p_55034_.cycle(NOTE).getValue(NOTE)); +- p_316441_ = p_316441_.cycle(NOTE); ++ int _new = net.neoforged.neoforge.common.CommonHooks.onNoteChange(p_316774_, p_316344_, p_316441_, p_316441_.getValue(NOTE), p_316441_.cycle(NOTE).getValue(NOTE)); + if (_new == -1) return InteractionResult.FAIL; -+ p_55034_ = p_55034_.setValue(NOTE, _new); - p_55035_.setBlock(p_55036_, p_55034_, 3); - this.playNote(p_55037_, p_55034_, p_55035_, p_55036_); - p_55037_.awardStat(Stats.TUNE_NOTEBLOCK); -@@ -126,6 +_,9 @@ ++ p_316441_ = p_316441_.setValue(NOTE, _new); + p_316774_.setBlock(p_316344_, p_316441_, 3); + this.playNote(p_316884_, p_316441_, p_316774_, p_316344_); + p_316884_.awardStat(Stats.TUNE_NOTEBLOCK); +@@ -132,6 +_,9 @@ @Override - public boolean triggerEvent(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { + protected boolean triggerEvent(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { + net.neoforged.neoforge.event.level.NoteBlockEvent.Play e = new net.neoforged.neoforge.event.level.NoteBlockEvent.Play(p_55024_, p_55025_, p_55023_, p_55023_.getValue(NOTE), p_55023_.getValue(INSTRUMENT)); + if (net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(e).isCanceled()) return false; + p_55023_ = p_55023_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument()); diff --git a/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch b/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch index 93e5e043fe..433f12e7c7 100644 --- a/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch @@ -26,7 +26,7 @@ BlockPos blockpos = findTip(p_221860_, p_221861_, p_221862_, 11, false); if (blockpos != null) { if (optional.get().sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { -@@ -409,7 +_,8 @@ +@@ -411,7 +_,8 @@ double d2 = (double)((float)(p_154073_.getY() + 1) - 0.6875F) - 0.0625; double d3 = (double)p_154073_.getZ() + 0.5 + vec3.z; Fluid fluid = getDripFluid(p_154072_, p_154075_); @@ -36,7 +36,7 @@ p_154072_.addParticle(particleoptions, d1, d2, d3, 0.0, 0.0, 0.0); } -@@ -561,7 +_,7 @@ +@@ -563,7 +_,7 @@ } private static boolean canFillCauldron(Fluid p_154159_) { diff --git a/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch index 6f6a3e10d0..8f925a7093 100644 --- a/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -26,10 +26,10 @@ boolean flag = true; - RailShape railshape = p_55222_.getValue(SHAPE); + RailShape railshape = p_55222_.getValue(getShapeProperty()); - switch(railshape) { + switch (railshape) { case NORTH_SOUTH: if (p_55223_) { -@@ -112,18 +_,18 @@ +@@ -110,18 +_,18 @@ protected boolean isSameRailWithPower(Level p_55226_, BlockPos p_55227_, boolean p_55228_, int p_55229_, RailShape p_55230_) { BlockState blockstate = p_55226_.getBlockState(p_55227_); @@ -52,7 +52,7 @@ } } else { return false; -@@ -143,7 +_,7 @@ +@@ -141,7 +_,7 @@ if (flag1 != flag) { p_55233_.setBlock(p_55234_, p_55232_.setValue(POWERED, Boolean.valueOf(flag1)), 3); p_55233_.updateNeighborsAt(p_55234_.below(), this); @@ -61,7 +61,7 @@ p_55233_.updateNeighborsAt(p_55234_.above(), this); } } -@@ -175,6 +_,9 @@ +@@ -173,6 +_,9 @@ return p_55240_.setValue(SHAPE, RailShape.SOUTH_EAST); case NORTH_EAST: return p_55240_.setValue(SHAPE, RailShape.SOUTH_WEST); @@ -70,8 +70,8 @@ + return p_55240_; } case COUNTERCLOCKWISE_90: - switch((RailShape)p_55240_.getValue(SHAPE)) { -@@ -274,6 +_,10 @@ + switch ((RailShape)p_55240_.getValue(SHAPE)) { +@@ -272,6 +_,10 @@ @Override protected void createBlockStateDefinition(StateDefinition.Builder p_55243_) { diff --git a/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch b/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch index afeba8d131..961523813d 100644 --- a/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/PumpkinBlock.java +++ b/net/minecraft/world/level/block/PumpkinBlock.java -@@ -33,7 +_,7 @@ - @Override - public InteractionResult use(BlockState p_55289_, Level p_55290_, BlockPos p_55291_, Player p_55292_, InteractionHand p_55293_, BlockHitResult p_55294_) { - ItemStack itemstack = p_55292_.getItemInHand(p_55293_); -- if (itemstack.is(Items.SHEARS)) { -+ if (itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_CARVE)) { - if (!p_55290_.isClientSide) { - Direction direction = p_55294_.getDirection(); - Direction direction1 = direction.getAxis() == Direction.Axis.Y ? p_55292_.getDirection().getOpposite() : direction; +@@ -35,7 +_,7 @@ + protected ItemInteractionResult useItemOn( + ItemStack p_316383_, BlockState p_316676_, Level p_316272_, BlockPos p_316484_, Player p_316367_, InteractionHand p_316216_, BlockHitResult p_316827_ + ) { +- if (!p_316383_.is(Items.SHEARS)) { ++ if (!p_316383_.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_CARVE)) { + return super.useItemOn(p_316383_, p_316676_, p_316272_, p_316484_, p_316367_, p_316216_, p_316827_); + } else if (p_316272_.isClientSide) { + return ItemInteractionResult.sidedSuccess(p_316272_.isClientSide); diff --git a/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch index 535c54c83c..e0c787463b 100644 --- a/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch +++ b/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -87,10 +_,10 @@ +@@ -88,10 +_,10 @@ @Override - public void spawnAfterBreak(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { + protected void spawnAfterBreak(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { super.spawnAfterBreak(p_221907_, p_221908_, p_221909_, p_221910_, p_221911_); - if (p_221911_ && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_221910_) == 0) { - int i = 1 + p_221908_.random.nextInt(5); diff --git a/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch b/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch index 5514cf1208..79ce4b3f60 100644 --- a/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/patches/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 -@@ -254,7 +_,7 @@ +@@ -253,7 +_,7 @@ BlockState blockstate = p_55523_.getBlockState(blockpos); if (p_55526_) { boolean flag = blockstate.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(p_55523_, blockpos, blockstate); @@ -9,7 +9,7 @@ if (blockstate.isFaceSturdy(p_55523_, blockpos, p_55525_.getOpposite())) { return RedstoneSide.UP; } -@@ -263,10 +_,14 @@ +@@ -262,10 +_,14 @@ } } diff --git a/patches/net/minecraft/world/level/block/SaplingBlock.java.patch b/patches/net/minecraft/world/level/block/SaplingBlock.java.patch index eb57701ff0..a0b98fc1dd 100644 --- a/patches/net/minecraft/world/level/block/SaplingBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -3,7 +3,7 @@ @@ -46,6 +_,7 @@ @Override - public void randomTick(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { + protected void randomTick(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { + if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light if (p_222012_.getMaxLocalRawBrightness(p_222013_.above()) >= 9 && p_222014_.nextInt(7) == 0) { this.advanceTree(p_222012_, p_222013_, p_222011_, p_222014_); diff --git a/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch b/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch index aabd3e2e1d..ef5e723ab4 100644 --- a/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SculkCatalystBlock.java @@ -66,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { + protected void spawnAfterBreak(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { super.spawnAfterBreak(p_222109_, p_222110_, p_222111_, p_222112_, p_222113_); - if (p_222113_) { - this.tryDropExperience(p_222110_, p_222111_, p_222112_, this.xpRange); diff --git a/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch index 1ecf2b6a95..8223c95c39 100644 --- a/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -293,8 +_,11 @@ +@@ -292,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { + protected void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { super.spawnAfterBreak(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); - if (p_222146_) { - this.tryDropExperience(p_222143_, p_222144_, p_222145_, ConstantInt.of(5)); diff --git a/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch index c5f6967d3d..5cc5d1dd9c 100644 --- a/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SculkShriekerBlock.java @@ -141,9 +_,12 @@ @Override - public void spawnAfterBreak(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { + protected void spawnAfterBreak(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { super.spawnAfterBreak(p_222192_, p_222193_, p_222194_, p_222195_, p_222196_); - if (p_222196_) { - this.tryDropExperience(p_222193_, p_222194_, p_222195_, ConstantInt.of(5)); diff --git a/patches/net/minecraft/world/level/block/SoundType.java.patch b/patches/net/minecraft/world/level/block/SoundType.java.patch index c16dd647eb..0d3a12b6cd 100644 --- a/patches/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/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 -@@ -762,6 +_,7 @@ +@@ -777,6 +_,7 @@ private final SoundEvent hitSound; private final SoundEvent fallSound; diff --git a/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch b/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch index 33c7970ac9..e2a92f48c7 100644 --- a/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SpawnerBlock.java @@ -46,10 +_,12 @@ @Override - public void spawnAfterBreak(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { + protected void spawnAfterBreak(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { super.spawnAfterBreak(p_222477_, p_222478_, p_222479_, p_222480_, p_222481_); - if (p_222481_) { - int i = 15 + p_222478_.random.nextInt(15) + p_222478_.random.nextInt(15); diff --git a/patches/net/minecraft/world/level/block/SpongeBlock.java.patch b/patches/net/minecraft/world/level/block/SpongeBlock.java.patch index f14ae78fe1..69c47ae16d 100644 --- a/patches/net/minecraft/world/level/block/SpongeBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpongeBlock.java.patch @@ -16,4 +16,4 @@ + if (!spongeState.canBeHydrated(p_56808_, p_56809_, fluidstate, p_294069_)) { return false; } else { - Block block = blockstate.getBlock(); + if (blockstate.getBlock() instanceof BucketPickup bucketpickup diff --git a/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch b/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch index 16de39696c..2f24cf95b1 100644 --- a/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -42,8 +_,10 @@ @Override - public void randomTick(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { + protected void randomTick(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { if (!canBeGrass(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_.setBlockAndUpdate(p_222510_, Blocks.DIRT.defaultBlockState()); diff --git a/patches/net/minecraft/world/level/block/StairBlock.java.patch b/patches/net/minecraft/world/level/block/StairBlock.java.patch index f95eedc97a..f564a87fcf 100644 --- a/patches/net/minecraft/world/level/block/StairBlock.java.patch +++ b/patches/net/minecraft/world/level/block/StairBlock.java.patch @@ -42,18 +42,22 @@ } @Override -@@ -243,4 +_,14 @@ - public boolean isPathfindable(BlockState p_56891_, BlockGetter p_56892_, BlockPos p_56893_, PathComputationType p_56894_) { +@@ -243,4 +_,18 @@ + protected boolean isPathfindable(BlockState p_56891_, PathComputationType p_56894_) { return false; } + -+ // Forge Start ++ // NEO START ++ + private final java.util.function.Supplier stateSupplier; ++ + private Block getModelBlock() { -+ return getModelState().getBlock(); ++ return getModelState().getBlock(); + } ++ + protected BlockState getModelState() { -+ return stateSupplier.get(); ++ return stateSupplier.get(); + } -+ // Forge end ++ ++ // NEO END } diff --git a/patches/net/minecraft/world/level/block/StemBlock.java.patch b/patches/net/minecraft/world/level/block/StemBlock.java.patch index 638c17a55c..9d78d1dd4f 100644 --- a/patches/net/minecraft/world/level/block/StemBlock.java.patch +++ b/patches/net/minecraft/world/level/block/StemBlock.java.patch @@ -3,7 +3,7 @@ @@ -79,18 +_,18 @@ @Override - public void randomTick(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) { + protected void randomTick(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_.getRawBrightness(p_222540_, 0) >= 9) { float f = CropBlock.getGrowthSpeed(this, p_222539_, p_222540_); diff --git a/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch index 4aa3b4977d..170176d0de 100644 --- a/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -28,14 +28,14 @@ @@ -79,6 +_,8 @@ @Override - public boolean canSurvive(BlockState p_57175_, LevelReader p_57176_, BlockPos p_57177_) { + protected boolean canSurvive(BlockState p_57175_, LevelReader p_57176_, BlockPos p_57177_) { + BlockState soil = p_57176_.getBlockState(p_57177_.below()); + if (soil.canSustainPlant(p_57176_, p_57177_.below(), Direction.UP, this)) return true; BlockState blockstate = p_57176_.getBlockState(p_57177_.below()); if (blockstate.is(this)) { return true; @@ -89,7 +_,7 @@ - for(Direction direction : Direction.Plane.HORIZONTAL) { + for (Direction direction : Direction.Plane.HORIZONTAL) { BlockState blockstate1 = p_57176_.getBlockState(blockpos.relative(direction)); FluidState fluidstate = p_57176_.getFluidState(blockpos.relative(direction)); - if (fluidstate.is(FluidTags.WATER) || blockstate1.is(Blocks.FROSTED_ICE)) { diff --git a/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch b/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch index 05227b72b8..3c4ea82cf3 100644 --- a/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch @@ -1,15 +1,14 @@ --- a/net/minecraft/world/level/block/SweetBerryBushBlock.java +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java -@@ -68,10 +_,11 @@ +@@ -69,9 +_,10 @@ @Override - public void randomTick(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { + protected void randomTick(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { int i = p_222563_.getValue(AGE); - if (i < 3 && p_222566_.nextInt(5) == 0 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9) { + if (i < 3 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_222564_, p_222565_, p_222563_, p_222566_.nextInt(5) == 0)) { BlockState blockstate = p_222563_.setValue(AGE, Integer.valueOf(i + 1)); p_222564_.setBlock(p_222565_, blockstate, 2); - p_222564_.gameEvent(GameEvent.BLOCK_CHANGE, p_222565_, GameEvent.Context.of(blockstate)); + net.neoforged.neoforge.common.CommonHooks.onCropsGrowPost(p_222564_, p_222565_, p_222563_); + p_222564_.gameEvent(GameEvent.BLOCK_CHANGE, p_222565_, GameEvent.Context.of(blockstate)); } } - diff --git a/patches/net/minecraft/world/level/block/TntBlock.java.patch b/patches/net/minecraft/world/level/block/TntBlock.java.patch index 2b6c30c534..39d67717bc 100644 --- a/patches/net/minecraft/world/level/block/TntBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TntBlock.java.patch @@ -8,7 +8,7 @@ + explode(world, pos, igniter); + } + - public void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { + protected void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { if (!p_57469_.is(p_57466_.getBlock())) { if (p_57467_.hasNeighborSignal(p_57468_)) { - explode(p_57467_, p_57468_); @@ -18,7 +18,7 @@ } @@ -53,7 +_,7 @@ @Override - public void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) { + protected void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) { if (p_57458_.hasNeighborSignal(p_57459_)) { - explode(p_57458_, p_57459_); + onCaughtFire(p_57457_, p_57458_, p_57459_, null, null); @@ -47,16 +47,16 @@ private static void explode(Level p_57437_, BlockPos p_57438_, @Nullable LivingEntity p_57439_) { if (!p_57437_.isClientSide) { PrimedTnt primedtnt = new PrimedTnt(p_57437_, (double)p_57438_.getX() + 0.5, (double)p_57438_.getY(), (double)p_57438_.getZ() + 0.5, p_57439_); -@@ -98,7 +_,7 @@ - if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) { - return super.use(p_57450_, p_57451_, p_57452_, p_57453_, p_57454_, p_57455_); +@@ -99,7 +_,7 @@ + if (!p_316149_.is(Items.FLINT_AND_STEEL) && !p_316149_.is(Items.FIRE_CHARGE)) { + return super.useItemOn(p_316149_, p_316217_, p_316520_, p_316601_, p_316770_, p_316393_, p_316532_); } else { -- explode(p_57451_, p_57452_, p_57453_); -+ onCaughtFire(p_57450_, p_57451_, p_57452_, p_57455_.getDirection(), p_57453_); - p_57451_.setBlock(p_57452_, Blocks.AIR.defaultBlockState(), 11); - Item item = itemstack.getItem(); - if (!p_57453_.isCreative()) { -@@ -120,7 +_,7 @@ +- explode(p_316520_, p_316601_, p_316770_); ++ onCaughtFire(p_316217_, p_316520_, p_316601_, p_316532_.getDirection(), p_316770_); + p_316520_.setBlock(p_316601_, Blocks.AIR.defaultBlockState(), 11); + Item item = p_316149_.getItem(); + if (!p_316770_.isCreative()) { +@@ -121,7 +_,7 @@ BlockPos blockpos = p_57431_.getBlockPos(); Entity entity = p_57432_.getOwner(); if (p_57432_.isOnFire() && p_57432_.mayInteract(p_57429_, blockpos)) { diff --git a/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch b/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch index 5d3ca62622..84183a1c7a 100644 --- a/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java -@@ -204,6 +_,19 @@ +@@ -203,6 +_,19 @@ return super.updateShape(p_57554_, p_57555_, p_57556_, p_57557_, p_57558_, p_57559_); } diff --git a/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch b/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch index 5ef6615f8e..143ed3c617 100644 --- a/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/net/minecraft/world/level/block/TurtleEggBlock.java -@@ -177,7 +_,7 @@ - } else if (!(p_57769_ instanceof LivingEntity)) { +@@ -171,7 +_,7 @@ + if (p_57769_ instanceof Turtle || p_57769_ instanceof Bat) { return false; } else { -- return p_57769_ instanceof Player || p_57768_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ return p_57769_ instanceof Player || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_57768_, p_57769_); +- return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || p_57768_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_57768_, p_57769_); } } } diff --git a/patches/net/minecraft/world/level/block/VineBlock.java.patch b/patches/net/minecraft/world/level/block/VineBlock.java.patch index 8248ecea64..f83b32be8e 100644 --- a/patches/net/minecraft/world/level/block/VineBlock.java.patch +++ b/patches/net/minecraft/world/level/block/VineBlock.java.patch @@ -11,7 +11,7 @@ public static final BooleanProperty NORTH = PipeBlock.NORTH; @@ -183,7 +_,7 @@ @Override - public void randomTick(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { + protected void randomTick(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { if (p_222656_.getGameRules().getBoolean(GameRules.RULE_DO_VINES_SPREAD)) { - if (p_222658_.nextInt(4) == 0) { + if (p_222656_.random.nextInt(4) == 0 && p_222656_.isAreaLoaded(p_222657_, 4)) { // Forge: check area to prevent loading unloaded chunks diff --git a/patches/net/minecraft/world/level/block/WebBlock.java.patch b/patches/net/minecraft/world/level/block/WebBlock.java.patch index b9f6661710..46e92a0714 100644 --- a/patches/net/minecraft/world/level/block/WebBlock.java.patch +++ b/patches/net/minecraft/world/level/block/WebBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/WebBlock.java +++ b/net/minecraft/world/level/block/WebBlock.java -@@ -8,7 +_,7 @@ +@@ -10,7 +_,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; diff --git a/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 32bd58dd54..3afc5628b4 100644 --- a/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -59,6 +_,7 @@ +@@ -60,6 +_,7 @@ public static final int NUM_DATA_VALUES = 4; public static final int BURN_TIME_STANDARD = 200; public static final int BURN_COOL_SPEED = 2; @@ -8,9 +8,9 @@ protected NonNullList items = NonNullList.withSize(3, ItemStack.EMPTY); int litTime; int litDuration; -@@ -69,9 +_,14 @@ +@@ -72,9 +_,14 @@ public int get(int p_58431_) { - switch(p_58431_) { + switch (p_58431_) { case 0: + if (litDuration > Short.MAX_VALUE) { + // Neo: preserve litTime / litDuration ratio on the client as data slots are synced as shorts. @@ -24,21 +24,31 @@ case 2: return AbstractFurnaceBlockEntity.this.cookingProgress; case 3: -@@ -111,10 +_,29 @@ +@@ -114,18 +_,40 @@ ) { super(p_154991_, p_154992_, p_154993_); this.quickCheck = RecipeManager.createCheck((RecipeType)p_154994_); + this.recipeType = p_154994_; } + public static void invalidateCache() { + fuelCache = null; + } + + /** + * @deprecated Neo: get burn times by calling {@link net.neoforged.neoforge.common.extensions.IItemStackExtension#getBurnTime(RecipeType)} + */ + @Deprecated public static Map getFuel() { - Map map = Maps.newLinkedHashMap(); -+ buildFuels((e, time) -> e.ifRight(tag -> add(map, tag, time)).ifLeft(item -> add(map, item, time))); -+ return map; + Map map = fuelCache; + if (map != null) { + return map; + } else { + Map map1 = Maps.newLinkedHashMap(); ++ buildFuels((e, time) -> e.ifRight(tag -> add(map1, tag, time)).ifLeft(item -> add(map1, item, time))); ++ fuelCache = map1; ++ return map1; ++ } + } + + private static void add(java.util.function.ObjIntConsumer>> consumer, ItemLike item, int time) { @@ -50,22 +60,24 @@ + } + + @org.jetbrains.annotations.ApiStatus.Internal -+ public static void buildFuels(java.util.function.ObjIntConsumer>> map) { - add(map, Items.LAVA_BUCKET, 20000); - add(map, Blocks.COAL_BLOCK, 16000); - add(map, Items.BLAZE_ROD, 2400); -@@ -174,7 +_,6 @@ - add(map, Blocks.AZALEA, 100); - add(map, Blocks.FLOWERING_AZALEA, 100); - add(map, Blocks.MANGROVE_ROOTS, 300); -- return map; ++ public static void buildFuels(java.util.function.ObjIntConsumer>> map1) { ++ { + add(map1, Items.LAVA_BUCKET, 20000); + add(map1, Blocks.COAL_BLOCK, 16000); + add(map1, Items.BLAZE_ROD, 2400); +@@ -185,8 +_,6 @@ + add(map1, Blocks.AZALEA, 100); + add(map1, Blocks.FLOWERING_AZALEA, 100); + add(map1, Blocks.MANGROVE_ROOTS, 300); +- fuelCache = map1; +- return map1; + } } - private static boolean isNeverAFurnaceFuel(Item p_58398_) { -@@ -213,9 +_,9 @@ - super.load(p_155025_); +@@ -226,9 +_,9 @@ + super.loadAdditional(p_155025_, p_323468_); this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); - ContainerHelper.loadAllItems(p_155025_, this.items); + ContainerHelper.loadAllItems(p_155025_, this.items, p_323468_); - this.litTime = p_155025_.getShort("BurnTime"); - this.cookingProgress = p_155025_.getShort("CookTime"); - this.cookingTotalTime = p_155025_.getShort("CookTimeTotal"); @@ -75,20 +87,20 @@ this.litDuration = this.getBurnDuration(this.items.get(1)); CompoundTag compoundtag = p_155025_.getCompound("RecipesUsed"); -@@ -227,9 +_,9 @@ +@@ -240,9 +_,9 @@ @Override - protected void saveAdditional(CompoundTag p_187452_) { - super.saveAdditional(p_187452_); + protected void saveAdditional(CompoundTag p_187452_, HolderLookup.Provider p_323656_) { + super.saveAdditional(p_187452_, p_323656_); - p_187452_.putShort("BurnTime", (short)this.litTime); - p_187452_.putShort("CookTime", (short)this.cookingProgress); - p_187452_.putShort("CookTimeTotal", (short)this.cookingTotalTime); + p_187452_.putInt("BurnTime", this.litTime); + p_187452_.putInt("CookTime", this.cookingProgress); + p_187452_.putInt("CookTimeTotal", this.cookingTotalTime); - ContainerHelper.saveAllItems(p_187452_, this.items); + ContainerHelper.saveAllItems(p_187452_, this.items, p_323656_); CompoundTag compoundtag = new CompoundTag(); this.recipesUsed.forEach((p_187449_, p_187450_) -> compoundtag.putInt(p_187449_.toString(), p_187450_)); -@@ -255,28 +_,30 @@ +@@ -268,28 +_,30 @@ } int i = p_155017_.getMaxStackSize(); @@ -115,7 +127,7 @@ - if (p_155017_.isLit() && canBurn(p_155014_.registryAccess(), recipeholder, p_155017_.items, i)) { + if (p_155017_.isLit() && p_155017_.canBurn(p_155014_.registryAccess(), recipeholder, p_155017_.items, i)) { - ++p_155017_.cookingProgress; + p_155017_.cookingProgress++; if (p_155017_.cookingProgress == p_155017_.cookingTotalTime) { p_155017_.cookingProgress = 0; p_155017_.cookingTotalTime = getTotalCookTime(p_155014_, p_155017_); @@ -124,7 +136,7 @@ p_155017_.setRecipeUsed(recipeholder); } -@@ -300,9 +_,9 @@ +@@ -313,9 +_,9 @@ } } @@ -136,20 +148,19 @@ if (itemstack.isEmpty()) { return false; } else { -@@ -311,10 +_,10 @@ - return true; - } else if (!ItemStack.isSameItem(itemstack1, itemstack)) { +@@ -325,9 +_,9 @@ + } else if (!ItemStack.isSameItemSameComponents(itemstack1, itemstack)) { return false; -- } else if (itemstack1.getCount() < p_155008_ && itemstack1.getCount() < itemstack1.getMaxStackSize()) { -+ } else if (itemstack1.getCount() + itemstack.getCount() <= p_155008_ && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize()) { // Forge fix: make furnace respect stack sizes in furnace recipes - return true; } else { -- return itemstack1.getCount() < itemstack.getMaxStackSize(); -+ return itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes +- return itemstack1.getCount() < p_155008_ && itemstack1.getCount() < itemstack1.getMaxStackSize() ++ return itemstack1.getCount() + itemstack.getCount() <= p_155008_ && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize() // Neo fix: make furnace respect stack sizes in furnace recipes + ? true +- : itemstack1.getCount() < itemstack.getMaxStackSize(); ++ : itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Neo fix: make furnace respect stack sizes in furnace recipes } } } else { -@@ -322,15 +_,15 @@ +@@ -335,15 +_,15 @@ } } @@ -163,22 +174,23 @@ ItemStack itemstack2 = p_267073_.get(2); if (itemstack2.isEmpty()) { p_267073_.set(2, itemstack1.copy()); - } else if (itemstack2.is(itemstack1.getItem())) { + } else if (ItemStack.isSameItemSameComponents(itemstack2, itemstack1)) { - itemstack2.grow(1); + itemstack2.grow(itemstack1.getCount()); } if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !p_267073_.get(1).isEmpty() && p_267073_.get(1).is(Items.BUCKET)) { -@@ -349,7 +_,7 @@ +@@ -361,8 +_,7 @@ + if (p_58343_.isEmpty()) { return 0; } else { - Item item = p_58343_.getItem(); +- Item item = p_58343_.getItem(); - return getFuel().getOrDefault(item, 0); + return p_58343_.getBurnTime(this.recipeType); } } -@@ -358,7 +_,7 @@ +@@ -371,7 +_,7 @@ } public static boolean isFuel(ItemStack p_58400_) { @@ -187,7 +199,7 @@ } @Override -@@ -444,7 +_,7 @@ +@@ -429,7 +_,7 @@ return true; } else { ItemStack itemstack = this.items.get(1); diff --git a/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index dd7cbb07bd..2183064ba6 100644 --- a/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -132,8 +_,8 @@ - for(int i1 = 0; i1 < 10 && blockpos.getY() <= l; ++i1) { +@@ -139,8 +_,8 @@ + for (int i1 = 0; i1 < 10 && blockpos.getY() <= l; i1++) { BlockState blockstate = p_155108_.getBlockState(blockpos); Block block = blockstate.getBlock(); - if (block instanceof BeaconBeamBlock) { diff --git a/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch index b4f01478d6..de33311812 100644 --- a/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -15,7 +_,7 @@ +@@ -25,7 +_,7 @@ import net.minecraft.world.level.block.state.BlockState; import org.slf4j.Logger; @@ -9,30 +9,35 @@ private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; @Nullable -@@ -23,6 +_,7 @@ - protected final BlockPos worldPosition; +@@ -34,6 +_,8 @@ protected boolean remove; private BlockState blockState; + private DataComponentMap components = DataComponentMap.EMPTY; ++ @Nullable + private CompoundTag customPersistentData; public BlockEntity(BlockEntityType p_155228_, BlockPos p_155229_, BlockState p_155230_) { this.type = p_155228_; -@@ -48,9 +_,14 @@ +@@ -59,6 +_,8 @@ + } + + protected void loadAdditional(CompoundTag p_338466_, HolderLookup.Provider p_338445_) { ++ if (p_338466_.contains("NeoForgeData", net.minecraft.nbt.Tag.TAG_COMPOUND)) this.customPersistentData = p_338466_.getCompound("NeoForgeData"); ++ if (p_338466_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_338445_, p_338466_.getCompound(ATTACHMENTS_NBT_KEY)); } - public void load(CompoundTag p_155245_) { -+ if (p_155245_.contains("NeoForgeData", net.minecraft.nbt.Tag.TAG_COMPOUND)) this.customPersistentData = p_155245_.getCompound("NeoForgeData"); -+ if (p_155245_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_155245_.getCompound(ATTACHMENTS_NBT_KEY)); + public final void loadWithComponents(CompoundTag p_338356_, HolderLookup.Provider p_338558_) { +@@ -74,6 +_,9 @@ } - protected void saveAdditional(CompoundTag p_187471_) { + protected void saveAdditional(CompoundTag p_187471_, HolderLookup.Provider p_323635_) { + if (this.customPersistentData != null) p_187471_.put("NeoForgeData", this.customPersistentData.copy()); -+ var attachmentsTag = serializeAttachments(); ++ var attachmentsTag = serializeAttachments(p_323635_); + if (attachmentsTag != null) p_187471_.put(ATTACHMENTS_NBT_KEY, attachmentsTag); } - public final CompoundTag saveWithFullMetadata() { -@@ -161,10 +_,14 @@ + public final CompoundTag saveWithFullMetadata(HolderLookup.Provider p_323767_) { +@@ -203,10 +_,14 @@ public void setRemoved() { this.remove = true; @@ -47,7 +52,7 @@ } public boolean triggerEvent(int p_58889_, int p_58890_) { -@@ -185,6 +_,27 @@ +@@ -227,6 +_,27 @@ public BlockEntityType getType() { return this.type; diff --git a/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch b/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch index aecbef7ee5..467125fac2 100644 --- a/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/net/minecraft/world/level/block/entity/BlockEntityType.java -@@ -299,6 +_,11 @@ +@@ -301,6 +_,11 @@ return this.validBlocks.contains(p_155263_.getBlock()); } diff --git a/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index 5dae4e6ef3..3718abbc9d 100644 --- a/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,28 +1,20 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -152,6 +_,7 @@ - - private static boolean isBrewable(NonNullList p_155295_) { - ItemStack itemstack = p_155295_.get(3); -+ if (!itemstack.isEmpty()) return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.canBrew(p_155295_, itemstack, SLOTS_FOR_SIDES); // divert to VanillaBrewingRegistry - if (itemstack.isEmpty()) { - return false; - } else if (!PotionBrewing.isIngredient(itemstack)) { -@@ -169,21 +_,21 @@ +@@ -164,6 +_,7 @@ } private static void doBrew(Level p_155291_, BlockPos p_155292_, NonNullList p_155293_) { + if (net.neoforged.neoforge.event.EventHooks.onPotionAttemptBrew(p_155293_)) return; ItemStack itemstack = p_155293_.get(3); + PotionBrewing potionbrewing = p_155291_.potionBrewing(); + +@@ -171,15 +_,17 @@ + p_155293_.set(i, potionbrewing.mix(itemstack, p_155293_.get(i))); + } -- for(int i = 0; i < 3; ++i) { -- p_155293_.set(i, PotionBrewing.mix(itemstack, p_155293_.get(i))); -- } -- - itemstack.shrink(1); - if (itemstack.getItem().hasCraftingRemainingItem()) { - ItemStack itemstack1 = new ItemStack(itemstack.getItem().getCraftingRemainingItem()); -+ net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.brewPotions(p_155293_, itemstack, SLOTS_FOR_SIDES); + net.neoforged.neoforge.event.EventHooks.onPotionBrewed(p_155293_); + if (itemstack.hasCraftingRemainingItem()) { + ItemStack itemstack1 = itemstack.getCraftingRemainingItem(); @@ -37,17 +29,19 @@ p_155293_.set(3, itemstack); p_155291_.levelEvent(1035, p_155292_, 0); -@@ -236,11 +_,11 @@ +@@ -204,13 +_,13 @@ + @Override public boolean canPlaceItem(int p_59017_, ItemStack p_59018_) { ++ PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; if (p_59017_ == 3) { -- return PotionBrewing.isIngredient(p_59018_); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_59018_); - } else if (p_59017_ == 4) { - return p_59018_.is(Items.BLAZE_POWDER); +- PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; + return potionbrewing.isIngredient(p_59018_); } else { -- return (p_59018_.is(Items.POTION) || p_59018_.is(Items.SPLASH_POTION) || p_59018_.is(Items.LINGERING_POTION) || p_59018_.is(Items.GLASS_BOTTLE)) -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_59018_) - && this.getItem(p_59017_).isEmpty(); + return p_59017_ == 4 + ? p_59018_.is(Items.BLAZE_POWDER) +- : (p_59018_.is(Items.POTION) || p_59018_.is(Items.SPLASH_POTION) || p_59018_.is(Items.LINGERING_POTION) || p_59018_.is(Items.GLASS_BOTTLE)) ++ : (potionbrewing.isInput(p_59018_) || p_59018_.is(Items.GLASS_BOTTLE)) + && this.getItem(p_59017_).isEmpty(); } } diff --git a/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index 7fbeae5a6e..5657e27e33 100644 --- a/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/patches/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 -@@ -172,6 +_,17 @@ +@@ -173,6 +_,17 @@ return ChestMenu.threeRows(p_59082_, p_59083_, this); } diff --git a/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index 90be763461..8ddf54889a 100644 --- a/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java -@@ -151,10 +_,8 @@ +@@ -152,10 +_,8 @@ BlockPos blockpos1 = p_155416_.offset(j1, k1, l1); BlockState blockstate = p_155415_.getBlockState(blockpos1); -- for(Block block : VALID_BLOCKS) { +- for (Block block : VALID_BLOCKS) { - if (blockstate.is(block)) { - p_155417_.add(blockpos1); - } diff --git a/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch index b3c943fee9..f6b7d8b619 100644 --- a/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -1,25 +1,23 @@ --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -131,7 +_,8 @@ - return true; +@@ -137,6 +_,7 @@ } -- private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, BlockState p_155565_, Container p_155566_) { -+ private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, BlockState p_155565_, HopperBlockEntity p_155566_) { -+ if (net.neoforged.neoforge.items.VanillaInventoryCodeHooks.insertHook(p_155566_)) return true; - Container container = getAttachedContainer(p_155563_, p_155564_, p_155565_); + private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, HopperBlockEntity p_326256_) { ++ if (net.neoforged.neoforge.items.VanillaInventoryCodeHooks.insertHook(p_326256_)) return true; + Container container = getAttachedContainer(p_155563_, p_155564_, p_326256_); if (container == null) { return false; -@@ -176,6 +_,8 @@ - } - +@@ -214,6 +_,8 @@ public static boolean suckInItems(Level p_155553_, Hopper p_155554_) { + BlockPos blockpos = BlockPos.containing(p_155554_.getLevelX(), p_155554_.getLevelY() + 1.0, p_155554_.getLevelZ()); + BlockState blockstate = p_155553_.getBlockState(blockpos); + Boolean ret = net.neoforged.neoforge.items.VanillaInventoryCodeHooks.extractHook(p_155553_, p_155554_); + if (ret != null) return ret; - Container container = getSourceContainer(p_155553_, p_155554_); + Container container = getSourceContainer(p_155553_, p_155554_, blockpos, blockstate); if (container != null) { Direction direction = Direction.DOWN; -@@ -421,5 +_,9 @@ +@@ -470,5 +_,9 @@ @Override protected AbstractContainerMenu createMenu(int p_59312_, Inventory p_59313_) { return new HopperMenu(p_59312_, p_59313_, this); diff --git a/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch index b5fe538e57..b569d86d98 100644 --- a/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java -@@ -29,6 +_,8 @@ +@@ -30,6 +_,8 @@ p_155771_.sendBlockUpdated(p_155772_, blockstate, blockstate, 4); } } diff --git a/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch b/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch index b5745a7b27..58544d94e6 100644 --- a/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch +++ b/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java -@@ -131,6 +_,9 @@ +@@ -130,6 +_,9 @@ .registryOrThrow(Registries.CONFIGURED_FEATURE) .getHolder(resourcekey) .orElse(null); @@ -8,9 +8,9 @@ + holder = event.getFeature(); + if (event.getResult() == net.neoforged.bus.api.Event.Result.DENY) return false; if (holder != null) { - for(int i = 0; i >= -1; --i) { - for(int j = 0; j >= -1; --j) { -@@ -164,6 +_,9 @@ + for (int i = 0; i >= -1; i--) { + for (int j = 0; j >= -1; j--) { +@@ -163,6 +_,9 @@ .registryOrThrow(Registries.CONFIGURED_FEATURE) .getHolder(resourcekey1) .orElse(null); diff --git a/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index 1bcbf0b6e6..0f685960e1 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -187,6 +_,7 @@ +@@ -186,6 +_,7 @@ } if (p_60195_ == 0) { @@ -8,15 +8,15 @@ if (!this.moveBlocks(p_60193_, p_60194_, direction, true)) { return false; } -@@ -195,6 +_,7 @@ +@@ -194,6 +_,7 @@ p_60193_.playSound(null, p_60194_, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 0.5F, p_60193_.random.nextFloat() * 0.25F + 0.6F); p_60193_.gameEvent(GameEvent.BLOCK_ACTIVATE, p_60194_, GameEvent.Context.of(blockstate)); } else if (p_60195_ == 1 || p_60195_ == 2) { + if (net.neoforged.neoforge.event.EventHooks.onPistonMovePre(p_60193_, p_60194_, direction, false)) return false; - BlockEntity blockentity1 = p_60193_.getBlockEntity(p_60194_.relative(direction)); - if (blockentity1 instanceof PistonMovingBlockEntity) { - ((PistonMovingBlockEntity)blockentity1).finalTick(); -@@ -246,6 +_,7 @@ + BlockEntity blockentity = p_60193_.getBlockEntity(p_60194_.relative(direction)); + if (blockentity instanceof PistonMovingBlockEntity) { + ((PistonMovingBlockEntity)blockentity).finalTick(); +@@ -243,6 +_,7 @@ p_60193_.gameEvent(GameEvent.BLOCK_DEACTIVATE, p_60194_, GameEvent.Context.of(blockstate1)); } @@ -24,7 +24,7 @@ return true; } -@@ -317,8 +_,7 @@ +@@ -314,8 +_,7 @@ BlockState blockstate1 = p_60182_.getBlockState(blockpos2); BlockEntity blockentity = blockstate1.hasBlockEntity() ? p_60182_.getBlockEntity(blockpos2) : null; dropResources(blockstate1, p_60182_, blockpos2, blockentity); @@ -34,9 +34,9 @@ if (!blockstate1.is(BlockTags.FIRE)) { p_60182_.addDestroyBlockEffect(blockpos2, blockstate1); } -@@ -390,6 +_,10 @@ +@@ -387,6 +_,10 @@ @Override - public BlockState rotate(BlockState p_60215_, Rotation p_60216_) { + protected BlockState rotate(BlockState p_60215_, Rotation p_60216_) { return p_60215_.setValue(FACING, p_60216_.rotate(p_60215_.getValue(FACING))); + } + diff --git a/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch b/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch index 0a605926e6..94bcbb53d7 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -114,7 +_,7 @@ +@@ -115,7 +_,7 @@ List list = p_155911_.getEntities(null, PistonMath.getMovementArea(aabb, direction, d0).minmax(aabb)); if (!list.isEmpty()) { List list1 = voxelshape.toAabbs(); @@ -8,4 +8,4 @@ + boolean flag = p_155914_.movedState.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later Iterator iterator = list.iterator(); - while(true) { + while (true) { diff --git a/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch b/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch index bf8b798e08..1c478815b3 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/world/level/block/piston/PistonStructureResolver.java @@ -50,7 +_,7 @@ } else { - for(int i = 0; i < this.toPush.size(); ++i) { + for (int i = 0; i < this.toPush.size(); i++) { BlockPos blockpos = this.toPush.get(i); - if (isSticky(this.level.getBlockState(blockpos)) && !this.addBranchingBlocks(blockpos)) { + if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) { return false; } } -@@ -59,20 +_,6 @@ +@@ -59,18 +_,6 @@ } } @@ -20,21 +20,19 @@ - private static boolean canStickToEachOther(BlockState p_155940_, BlockState p_155941_) { - if (p_155940_.is(Blocks.HONEY_BLOCK) && p_155941_.is(Blocks.SLIME_BLOCK)) { - return false; -- } else if (p_155940_.is(Blocks.SLIME_BLOCK) && p_155941_.is(Blocks.HONEY_BLOCK)) { -- return false; - } else { -- return isSticky(p_155940_) || isSticky(p_155941_); +- return p_155940_.is(Blocks.SLIME_BLOCK) && p_155941_.is(Blocks.HONEY_BLOCK) ? false : isSticky(p_155940_) || isSticky(p_155941_); - } - } - private boolean addBlockLine(BlockPos p_60434_, Direction p_60435_) { BlockState blockstate = this.level.getBlockState(p_60434_); if (blockstate.isAir()) { -@@ -88,12 +_,13 @@ +@@ -86,12 +_,13 @@ if (i + this.toPush.size() > 12) { return false; } else { -- while(isSticky(blockstate)) { +- while (isSticky(blockstate)) { + BlockState oldState; + while(blockstate.isStickyBlock()) { BlockPos blockpos = p_60434_.relative(this.pushDirection.getOpposite(), i); @@ -47,16 +45,16 @@ || !PistonBaseBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) { break; -@@ -121,7 +_,7 @@ +@@ -119,7 +_,7 @@ - for(int k = 0; k <= j + l; ++k) { + for (int k = 0; k <= j + l; k++) { BlockPos blockpos2 = this.toPush.get(k); - if (isSticky(this.level.getBlockState(blockpos2)) && !this.addBranchingBlocks(blockpos2)) { + if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) { return false; } } -@@ -176,7 +_,7 @@ +@@ -174,7 +_,7 @@ if (direction.getAxis() != this.pushDirection.getAxis()) { BlockPos blockpos = p_60432_.relative(direction); BlockState blockstate1 = this.level.getBlockState(blockpos); diff --git a/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index 26f8fd790e..9455370fed 100644 --- a/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -110,6 +_,17 @@ +@@ -112,6 +_,17 @@ this.dynamicShape = p_60452_.dynamicShape; this.requiredFeatures = p_60452_.requiredFeatures; this.properties = p_60452_; -+ final ResourceLocation lootTableCache = p_60452_.drops; ++ final ResourceKey lootTableCache = p_60452_.drops; + if (lootTableCache != null) { + this.lootTableSupplier = () -> lootTableCache; + } else if (p_60452_.lootTableSupplier != null) { + this.lootTableSupplier = p_60452_.lootTableSupplier; + } else { + this.lootTableSupplier = () -> { -+ ResourceLocation registryName = BuiltInRegistries.BLOCK.getKey((Block) this); -+ return new ResourceLocation(registryName.getNamespace(), "blocks/" + registryName.getPath()); ++ ResourceLocation resourcelocation = BuiltInRegistries.BLOCK.getKey(this.asBlock()); ++ return ResourceKey.create(Registries.LOOT_TABLE, resourcelocation.withPrefix("blocks/")); + }; + } } public BlockBehaviour.Properties properties() { -@@ -165,7 +_,7 @@ +@@ -160,7 +_,7 @@ + } - @Deprecated - public void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { + protected void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { - if (p_60515_.hasBlockEntity() && !p_60515_.is(p_60518_.getBlock())) { + if (p_60515_.hasBlockEntity() && (!p_60515_.is(p_60518_.getBlock()) || !p_60518_.hasBlockEntity())) { p_60516_.removeBlockEntity(p_60517_); } } -@@ -175,7 +_,7 @@ +@@ -169,7 +_,7 @@ if (!p_311951_.isAir() && p_312925_.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { Block block = p_311951_.getBlock(); boolean flag = p_312925_.getIndirectSourceEntity() instanceof Player; @@ -36,7 +36,7 @@ BlockEntity blockentity = p_311951_.hasBlockEntity() ? p_312820_.getBlockEntity(p_312489_) : null; LootParams.Builder lootparams$builder = new LootParams.Builder(serverlevel) .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(p_312489_)) -@@ -190,8 +_,7 @@ +@@ -184,8 +_,7 @@ p_311951_.getDrops(lootparams$builder).forEach(p_311752_ -> p_312073_.accept(p_311752_, p_312489_)); } @@ -46,7 +46,7 @@ } } -@@ -365,13 +_,14 @@ +@@ -336,12 +_,13 @@ if (f == -1.0F) { return 0.0F; } else { @@ -57,23 +57,30 @@ } } - @Deprecated - public void spawnAfterBreak(BlockState p_222949_, ServerLevel p_222950_, BlockPos p_222951_, ItemStack p_222952_, boolean p_222953_) { + protected void spawnAfterBreak(BlockState p_222949_, ServerLevel p_222950_, BlockPos p_222951_, ItemStack p_222952_, boolean p_222953_) { + if (p_222953_) net.neoforged.neoforge.common.CommonHooks.dropXpForBlock(p_222949_, p_222950_, p_222951_, p_222952_); } - @Deprecated -@@ -394,8 +_,7 @@ + protected void attack(BlockState p_60499_, Level p_60500_, BlockPos p_60501_, Player p_60502_) { +@@ -360,8 +_,7 @@ - public final ResourceLocation getLootTable() { + public final ResourceKey getLootTable() { if (this.drops == null) { - ResourceLocation resourcelocation = BuiltInRegistries.BLOCK.getKey(this.asBlock()); -- this.drops = resourcelocation.withPrefix("blocks/"); +- this.drops = ResourceKey.create(Registries.LOOT_TABLE, resourcelocation.withPrefix("blocks/")); + this.drops = this.lootTableSupplier.get(); } return this.drops; -@@ -417,6 +_,14 @@ +@@ -378,6 +_,7 @@ + return this.isRandomlyTicking; + } + ++ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } + protected SoundType getSoundType(BlockState p_320941_) { + return this.soundType; + } +@@ -394,6 +_,14 @@ return this.properties.destroyTime; } @@ -82,13 +89,13 @@ + } + + /* ======================================== FORGE START ===================================== */ -+ private final java.util.function.Supplier lootTableSupplier; ++ private final java.util.function.Supplier> lootTableSupplier; + /* ========================================= FORGE END ====================================== */ + public abstract static class BlockStateBase extends StateHolder { private final int lightEmission; private final boolean useShapeForLightOcclusion; -@@ -550,12 +_,14 @@ +@@ -523,12 +_,14 @@ return this.useShapeForLightOcclusion; } @@ -104,7 +111,7 @@ } public boolean ignitedByLava() { -@@ -568,9 +_,11 @@ +@@ -541,9 +_,11 @@ } public MapColor getMapColor(BlockGetter p_285002_, BlockPos p_285293_) { @@ -117,7 +124,7 @@ public BlockState rotate(Rotation p_60718_) { return this.getBlock().rotate(this.asState(), p_60718_); } -@@ -624,6 +_,8 @@ +@@ -597,6 +_,8 @@ } public PushReaction getPistonPushReaction() { @@ -126,21 +133,29 @@ return this.pushReaction; } -@@ -751,6 +_,9 @@ +@@ -723,6 +_,9 @@ } - public InteractionResult use(Level p_60665_, Player p_60666_, InteractionHand p_60667_, BlockHitResult p_60668_) { -+ var useOnContext = new net.minecraft.world.item.context.UseOnContext(p_60665_, p_60666_, p_60667_, p_60666_.getItemInHand(p_60667_).copy(), p_60668_); + public ItemInteractionResult useItemOn(ItemStack p_316374_, Level p_316651_, Player p_316623_, InteractionHand p_316469_, BlockHitResult p_316877_) { ++ var useOnContext = new net.minecraft.world.item.context.UseOnContext(p_316651_, p_316623_, p_316469_, p_316623_.getItemInHand(p_316469_).copy(), p_316877_); + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(useOnContext, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.BLOCK)); + if (e.isCanceled()) return e.getCancellationResult(); - return this.getBlock().use(this.asState(), p_60665_, p_60668_.getBlockPos(), p_60666_, p_60667_, p_60668_); + return this.getBlock().useItemOn(p_316374_, this.asState(), p_316651_, p_316877_.getBlockPos(), p_316623_, p_316469_, p_316877_); } -@@ -982,11 +_,12 @@ +@@ -824,6 +_,7 @@ + return this.getBlock().getSeed(this.asState(), p_60727_); + } + ++ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } + public SoundType getSoundType() { + return this.getBlock().getSoundType(this.asState()); + } +@@ -958,11 +_,12 @@ PushReaction pushReaction = PushReaction.NORMAL; boolean spawnTerrainParticles = true; NoteBlockInstrument instrument = NoteBlockInstrument.HARP; -+ private java.util.function.Supplier lootTableSupplier; ++ private java.util.function.Supplier> lootTableSupplier; boolean replaceable; BlockBehaviour.StateArgumentPredicate> isValidSpawn = (p_284893_, p_284894_, p_284895_, p_284896_) -> p_284893_.isFaceSturdy( p_284894_, p_284895_, Direction.UP @@ -150,7 +165,7 @@ BlockBehaviour.StatePredicate isRedstoneConductor = (p_284888_, p_284889_, p_284890_) -> p_284888_.isCollisionShapeFullBlock(p_284889_, p_284890_); BlockBehaviour.StatePredicate isSuffocating = (p_284885_, p_284886_, p_284887_) -> p_284885_.blocksMotion() && p_284885_.isCollisionShapeFullBlock(p_284886_, p_284887_); -@@ -1127,9 +_,15 @@ +@@ -1103,9 +_,15 @@ return this; } diff --git a/patches/net/minecraft/world/level/block/state/BlockState.java.patch b/patches/net/minecraft/world/level/block/state/BlockState.java.patch index e121d76daa..bbfe37b02e 100644 --- a/patches/net/minecraft/world/level/block/state/BlockState.java.patch +++ b/patches/net/minecraft/world/level/block/state/BlockState.java.patch @@ -8,4 +8,4 @@ +public class BlockState extends BlockBehaviour.BlockStateBase implements net.neoforged.neoforge.common.extensions.IBlockStateExtension { public static final Codec CODEC = codec(BuiltInRegistries.BLOCK.byNameCodec(), Block::defaultBlockState).stable(); - public BlockState(Block p_61042_, ImmutableMap, Comparable> p_61043_, MapCodec p_61044_) { + public BlockState(Block p_61042_, Reference2ObjectArrayMap, Comparable> p_326238_, MapCodec p_61044_) { diff --git a/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch index a7067f01d2..d26d10c56d 100644 --- a/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/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 -@@ -54,7 +_,7 @@ +@@ -57,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,7 +9,7 @@ public static final int NO_FILLED_SECTION = -1; private static final Logger LOGGER = LogUtils.getLogger(); private static final LongSet EMPTY_REFERENCE_SET = new LongOpenHashSet(); -@@ -308,10 +_,19 @@ +@@ -311,10 +_,19 @@ @Override public final void findBlockLightSources(BiConsumer p_285269_) { @@ -29,10 +29,10 @@ + public void findBlocks(Predicate p_285343_, java.util.function.BiPredicate fineFilter, BiConsumer p_285030_) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int i = this.getMinSection(); i < this.getMaxSection(); ++i) { -@@ -323,8 +_,9 @@ - for(int k = 0; k < 16; ++k) { - for(int l = 0; l < 16; ++l) { + for (int i = this.getMinSection(); i < this.getMaxSection(); i++) { +@@ -326,8 +_,9 @@ + for (int k = 0; k < 16; k++) { + for (int l = 0; l < 16; l++) { BlockState blockstate = levelchunksection.getBlockState(l, j, k); - if (p_285343_.test(blockstate)) { - p_285030_.accept(blockpos$mutableblockpos.setWithOffset(blockpos, l, j, k), blockstate); @@ -42,7 +42,7 @@ } } } -@@ -469,4 +_,70 @@ +@@ -472,4 +_,70 @@ public static record TicksToSave(SerializableTickContainer blocks, SerializableTickContainer fluids) { } @@ -91,8 +91,8 @@ + */ + @org.jetbrains.annotations.ApiStatus.Internal + @Nullable -+ public final CompoundTag writeAttachmentsToNBT() { -+ return getAttachmentHolder().serializeAttachments(); ++ public final CompoundTag writeAttachmentsToNBT(HolderLookup.Provider provider) { ++ return getAttachmentHolder().serializeAttachments(provider); + } + + /** @@ -102,8 +102,8 @@ + * + */ + @org.jetbrains.annotations.ApiStatus.Internal -+ public final void readAttachmentsFromNBT(CompoundTag tag) { -+ getAttachmentHolder().deserializeInternal(tag); ++ public final void readAttachmentsFromNBT(HolderLookup.Provider provider, CompoundTag tag) { ++ getAttachmentHolder().deserializeInternal(provider, tag); + } + + @org.jetbrains.annotations.ApiStatus.Internal diff --git a/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch b/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch index e02c237651..827439587d 100644 --- a/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch +++ b/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -217,6 +_,15 @@ +@@ -219,6 +_,15 @@ } @Override @@ -16,7 +16,7 @@ public TickContainerAccess getBlockTicks() { return this.allowWrites ? this.wrapped.getBlockTicks() : BlackholeTickAccess.emptyContainer(); } -@@ -289,5 +_,10 @@ +@@ -291,5 +_,10 @@ @Override public ChunkSkyLightSources getSkyLightSources() { return this.wrapped.getSkyLightSources(); diff --git a/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch index 9abba04219..69762c227d 100644 --- a/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/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 -@@ -48,7 +_,7 @@ +@@ -50,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,15 +9,15 @@ static final Logger LOGGER = LogUtils.getLogger(); private static final TickingBlockEntity NULL_TICKER = new TickingBlockEntity() { @Override -@@ -137,6 +_,7 @@ +@@ -139,6 +_,7 @@ this.setAllStarts(p_196851_.getAllStarts()); this.setAllReferences(p_196851_.getAllReferences()); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyChunkAttachmentsOnPromotion(p_196851_.getAttachmentHolder(), this.getAttachmentHolder()); - for(Entry entry : p_196851_.getHeightmaps()) { ++ net.neoforged.neoforge.attachment.AttachmentInternals.copyChunkAttachmentsOnPromotion(p_196850_.registryAccess(), p_196851_.getAttachmentHolder(), this.getAttachmentHolder()); + for (Entry entry : p_196851_.getHeightmaps()) { if (ChunkStatus.FULL.heightmapsAfter().contains(entry.getKey())) { this.setHeightmap(entry.getKey(), entry.getValue().getRawData()); -@@ -270,14 +_,14 @@ +@@ -271,14 +_,14 @@ boolean flag2 = blockstate.hasBlockEntity(); if (!this.level.isClientSide) { blockstate.onRemove(this.level, p_62865_, p_62866_, p_62867_); @@ -34,7 +34,7 @@ p_62866_.onPlace(this.level, p_62865_, blockstate, p_62867_); } -@@ -321,6 +_,10 @@ +@@ -322,6 +_,10 @@ @Nullable public BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { BlockEntity blockentity = this.blockEntities.get(p_62868_); @@ -45,7 +45,7 @@ if (blockentity == null) { CompoundTag compoundtag = this.pendingBlockEntities.remove(p_62868_); if (compoundtag != null) { -@@ -338,9 +_,6 @@ +@@ -339,9 +_,6 @@ this.addAndRegisterBlockEntity(blockentity); } } @@ -63,7 +63,7 @@ } } -@@ -385,6 +_,7 @@ +@@ -381,6 +_,7 @@ BlockEntity blockentity = this.blockEntities.put(blockpos.immutable(), p_156374_); if (blockentity != null && blockentity != p_156374_) { blockentity.setRemoved(); @@ -71,12 +71,12 @@ } } } -@@ -394,9 +_,14 @@ - public CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_) { +@@ -390,9 +_,14 @@ + public CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_, HolderLookup.Provider p_323699_) { BlockEntity blockentity = this.getBlockEntity(p_62932_); if (blockentity != null && !blockentity.isRemoved()) { + try { - CompoundTag compoundtag1 = blockentity.saveWithFullMetadata(); + CompoundTag compoundtag1 = blockentity.saveWithFullMetadata(this.level.registryAccess()); compoundtag1.putBoolean("keepPacked", false); return compoundtag1; + } catch (Exception e) { @@ -86,7 +86,7 @@ } else { CompoundTag compoundtag = this.pendingBlockEntities.get(p_62932_); if (compoundtag != null) { -@@ -419,6 +_,7 @@ +@@ -414,6 +_,7 @@ } blockentity.setRemoved(); @@ -94,16 +94,16 @@ } } -@@ -479,7 +_,7 @@ - p_187974_.accept((p_187968_, p_187969_, p_187970_) -> { - BlockEntity blockentity = this.getBlockEntity(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE); - if (blockentity != null && p_187970_ != null && blockentity.getType() == p_187969_) { -- blockentity.load(p_187970_); -+ blockentity.handleUpdateTag(p_187970_); +@@ -474,7 +_,7 @@ + p_187974_.accept((p_338077_, p_338078_, p_338079_) -> { + BlockEntity blockentity = this.getBlockEntity(p_338077_, LevelChunk.EntityCreationType.IMMEDIATE); + if (blockentity != null && p_338079_ != null && blockentity.getType() == p_338078_) { +- blockentity.loadWithComponents(p_338079_, this.level.registryAccess()); ++ blockentity.handleUpdateTag(p_338079_, this.level.registryAccess()); } }); } -@@ -587,6 +_,7 @@ +@@ -582,6 +_,7 @@ } public void clearAllBlockEntities() { @@ -111,15 +111,15 @@ this.blockEntities.values().forEach(BlockEntity::setRemoved); this.blockEntities.clear(); this.tickersInLevel.values().forEach(p_187966_ -> p_187966_.rebind(NULL_TICKER)); -@@ -594,6 +_,7 @@ +@@ -589,6 +_,7 @@ } public void registerAllBlockEntitiesAfterLevelLoad() { + this.level.addFreshBlockEntities(this.blockEntities.values()); this.blockEntities.values().forEach(p_187988_ -> { - Level level = this.level; - if (level instanceof ServerLevel serverlevel) { -@@ -646,6 +_,15 @@ + if (this.level instanceof ServerLevel serverlevel) { + this.addGameEventListener(p_187988_, serverlevel); +@@ -640,6 +_,15 @@ return new LevelChunk.BoundTickingBlockEntity<>(p_156376_, p_156377_); } @@ -135,7 +135,7 @@ class BoundTickingBlockEntity implements TickingBlockEntity { private final T blockEntity; private final BlockEntityTicker ticker; -@@ -663,6 +_,7 @@ +@@ -657,6 +_,7 @@ if (LevelChunk.this.isTicking(blockpos)) { try { ProfilerFiller profilerfiller = LevelChunk.this.level.getProfiler(); @@ -143,7 +143,7 @@ profilerfiller.push(this::getType); BlockState blockstate = LevelChunk.this.getBlockState(blockpos); if (this.blockEntity.getType().isValid(blockstate)) { -@@ -684,6 +_,12 @@ +@@ -678,6 +_,12 @@ CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.addCategory("Block entity being ticked"); this.blockEntity.fillCrashReportCategory(crashreportcategory); @@ -156,7 +156,7 @@ throw new ReportedException(crashreport); } } -@@ -715,6 +_,11 @@ +@@ -709,6 +_,11 @@ IMMEDIATE, QUEUED, CHECK; diff --git a/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch b/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch index 382d1bc347..42b524a34a 100644 --- a/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch +++ b/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch @@ -6,18 +6,18 @@ FluidState fluidstate1 = p_62995_.getFluidState(); - if (!blockstate.isAir()) { + if (!blockstate.isEmpty()) { // Neo: Fix MC-232360 for modded blocks (Makes modded isAir blocks not be replaced with Blocks.AIR in all-air chunk sections) - --this.nonEmptyBlockCount; + this.nonEmptyBlockCount--; if (blockstate.isRandomlyTicking()) { - --this.tickingBlockCount; + this.tickingBlockCount--; @@ -76,7 +_,7 @@ - --this.tickingFluidCount; + this.tickingFluidCount--; } - if (!p_62995_.isAir()) { + if (!p_62995_.isEmpty()) { // Neo: Fix MC-232360 for modded blocks (Makes modded isAir blocks not be replaced with Blocks.AIR in all-air chunk sections) - ++this.nonEmptyBlockCount; + this.nonEmptyBlockCount++; if (p_62995_.isRandomlyTicking()) { - ++this.tickingBlockCount; + this.tickingBlockCount++; @@ -114,7 +_,7 @@ public void accept(BlockState p_204444_, int p_204445_) { diff --git a/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch b/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch index b345d9673c..23ac00f2cc 100644 --- a/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch +++ b/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -28,6 +_,7 @@ +@@ -27,6 +_,7 @@ import net.minecraft.util.ZeroBitStorage; public class PalettedContainer implements PaletteResize, PalettedContainerRO { diff --git a/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch b/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch index 25032c8d6a..c073c274d7 100644 --- a/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch +++ b/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch @@ -1,57 +1,57 @@ --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -180,6 +_,8 @@ +@@ -181,6 +_,8 @@ postLoadChunk(p_188231_, p_188234_), blendingdata ); + if (p_188234_.contains(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_LIST)) -+ Objects.requireNonNull(((LevelChunk)chunkaccess).getAuxLightManager(p_188233_)).deserializeNBT(p_188234_.getList(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)); ++ Objects.requireNonNull(((LevelChunk)chunkaccess).getAuxLightManager(p_188233_)).deserializeNBT(p_188231_.registryAccess(), p_188234_.getList(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)); } else { ProtoChunkTicks protochunkticks = ProtoChunkTicks.load( p_188234_.getList("block_ticks", 10), p_258992_ -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(p_258992_)), p_188233_ -@@ -206,6 +_,8 @@ +@@ -207,6 +_,8 @@ } } + if (p_188234_.contains(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) -+ chunkaccess.readAttachmentsFromNBT(p_188234_.getCompound(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY)); ++ chunkaccess.readAttachmentsFromNBT(p_188231_.registryAccess(), p_188234_.getCompound(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY)); chunkaccess.setLightCorrect(flag); CompoundTag compoundtag2 = p_188234_.getCompound("Heightmaps"); EnumSet enumset = EnumSet.noneOf(Heightmap.Types.class); -@@ -238,6 +_,7 @@ +@@ -239,6 +_,7 @@ } - if (chunkstatus$chunktype == ChunkStatus.ChunkType.LEVELCHUNK) { -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunkstatus$chunktype)); + if (chunktype == ChunkType.LEVELCHUNK) { ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunktype)); return new ImposterProtoChunk((LevelChunk)chunkaccess, false); } else { ProtoChunk protochunk1 = (ProtoChunk)chunkaccess; -@@ -261,6 +_,7 @@ +@@ -262,6 +_,7 @@ protochunk1.setCarvingMask(generationstep$carving, new CarvingMask(compoundtag4.getLongArray(s1), chunkaccess.getMinBuildHeight())); } -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunkstatus$chunktype)); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunktype)); return protochunk1; } } -@@ -373,6 +_,11 @@ +@@ -372,6 +_,11 @@ compoundtag.put("CarvingMasks", compoundtag4); } + else if (p_63456_ instanceof LevelChunk levelChunk){ + -+ Tag lightTag = levelChunk.getAuxLightManager(chunkpos).serializeNBT(); ++ Tag lightTag = levelChunk.getAuxLightManager(chunkpos).serializeNBT(p_63455_.registryAccess()); + if (lightTag != null) compoundtag.put(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, lightTag); + } saveTicks(p_63455_, compoundtag, p_63456_.getTicksForSerialization()); compoundtag.put("PostProcessing", packOffsets(p_63456_.getPostProcessing())); -@@ -384,6 +_,12 @@ +@@ -383,6 +_,12 @@ } } + try { -+ final CompoundTag capTag = p_63456_.writeAttachmentsToNBT(); ++ final CompoundTag capTag = p_63456_.writeAttachmentsToNBT(p_63455_.registryAccess()); + if (capTag != null) compoundtag.put(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY, capTag); + } catch (Exception exception) { + LOGGER.error("Failed to write chunk attachments. An attachment has likely thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); diff --git a/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch b/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch index 5983bcd7bc..0dab340c36 100644 --- a/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch +++ b/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -93,8 +_,12 @@ +@@ -88,8 +_,12 @@ ListTag listtag = new ListTag(); p_156559_.getEntities().forEach(p_156567_ -> { CompoundTag compoundtag1 = new CompoundTag(); diff --git a/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch b/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch index 00d964f6ea..3ad91c2b4d 100644 --- a/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -21,7 +21,7 @@ } public void addLegacyChunkEntities(Stream p_157553_) { -- p_157553_.forEach(p_157607_ -> this.addEntity(p_157607_, true)); +- p_157553_.forEach(p_157607_ -> this.addEntity((T)p_157607_, true)); + p_157553_.forEach(p_157607_ -> { + this.addEntity(p_157607_, true); + if (p_157607_ instanceof Entity entity) entity.onAddedToWorld(); @@ -29,7 +29,7 @@ } public void addWorldGenChunkEntities(Stream p_157560_) { -- p_157560_.forEach(p_157605_ -> this.addEntity(p_157605_, false)); +- p_157560_.forEach(p_157605_ -> this.addEntity((T)p_157605_, false)); + p_157560_.forEach(p_157605_ -> { + this.addEntity(p_157605_, false); + if (p_157605_ instanceof Entity entity) entity.onAddedToWorld(); @@ -40,8 +40,8 @@ @@ -228,7 +_,10 @@ private void processPendingLoads() { ChunkEntities chunkentities; - while((chunkentities = this.loadingInbox.poll()) != null) { -- chunkentities.getEntities().forEach(p_157593_ -> this.addEntity(p_157593_, true)); + while ((chunkentities = this.loadingInbox.poll()) != null) { +- chunkentities.getEntities().forEach(p_157593_ -> this.addEntity((T)p_157593_, true)); + chunkentities.getEntities().forEach(p_157593_ -> { + this.addEntity(p_157593_, true); + if (p_157593_ instanceof Entity entity) entity.onAddedToWorld(); diff --git a/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch b/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch index 8f8467945b..5f7807cc05 100644 --- a/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch +++ b/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch @@ -1,22 +1,27 @@ --- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java -@@ -48,6 +_,8 @@ - GameEvent.RESONATE_14, - GameEvent.RESONATE_15 - }; +@@ -52,6 +_,8 @@ + GameEvent.RESONATE_15.key() + ); + int DEFAULT_VIBRATION_FREQUENCY = 0; + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#VIBRATION_FREQUENCIES data map} instead. */ + @Deprecated - ToIntFunction VIBRATION_FREQUENCY_FOR_EVENT = Util.make(new Object2IntOpenHashMap<>(), p_297981_ -> { - p_297981_.defaultReturnValue(0); - p_297981_.put(GameEvent.STEP, 1); -@@ -101,7 +_,9 @@ + ToIntFunction> VIBRATION_FREQUENCY_FOR_EVENT = Util.make(new Reference2IntOpenHashMap<>(), p_316653_ -> { + p_316653_.defaultReturnValue(0); + p_316653_.put(GameEvent.STEP.key(), 1); +@@ -105,11 +_,13 @@ VibrationSystem.User getVibrationUser(); - static int getGameEventFrequency(GameEvent p_281355_) { -- return VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_281355_); -+ var data = p_281355_.builtInRegistryHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.VIBRATION_FREQUENCIES); -+ // TODO 1.20.5 - remove fallback -+ return data == null ? VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_281355_) : data.frequency(); + static int getGameEventFrequency(Holder p_316300_) { +- return p_316300_.unwrapKey().map(VibrationSystem::getGameEventFrequency).orElse(0); ++ var data = p_316300_.getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.VIBRATION_FREQUENCIES); ++ return data != null ? data.frequency() : 0; } - static GameEvent getResonanceEventByFrequency(int p_282105_) { + static int getGameEventFrequency(ResourceKey p_316800_) { +- return VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_); ++ var holder = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getHolder(p_316800_); ++ return holder.isPresent() ? getGameEventFrequency(holder.get()) : VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_); + } + + static ResourceKey getResonanceEventByFrequency(int p_282105_) { diff --git a/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch b/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch index a2355b9561..c66276f5dc 100644 --- a/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch +++ b/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/world/level/levelgen/Beardifier.java @@ -44,6 +_,11 @@ - for(StructurePiece structurepiece : p_223936_.getPieces()) { + for (StructurePiece structurepiece : p_223936_.getPieces()) { if (structurepiece.isCloseToChunk(p_223939_, 12)) { + if (structurepiece instanceof net.neoforged.neoforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { + if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { + objectlist.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); + } + } else - if (structurepiece instanceof PoolElementStructurePiece poolelementstructurepiece) { + if (structurepiece instanceof PoolElementStructurePiece) { + PoolElementStructurePiece poolelementstructurepiece = (PoolElementStructurePiece)structurepiece; StructureTemplatePool.Projection structuretemplatepool$projection = poolelementstructurepiece.getElement().getProjection(); - if (structuretemplatepool$projection == StructureTemplatePool.Projection.RIGID) { diff --git a/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch b/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch index 6835059524..a2a669ba51 100644 --- a/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch +++ b/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -42,13 +_,15 @@ - for(ServerPlayer serverplayer : p_64576_.players()) { + for (ServerPlayer serverplayer : p_64576_.players()) { if (!serverplayer.isSpectator()) { BlockPos blockpos = serverplayer.blockPosition(); - if (!p_64576_.dimensionType().hasSkyLight() || blockpos.getY() >= p_64576_.getSeaLevel() && p_64576_.canSeeSky(blockpos)) { @@ -26,5 +26,5 @@ - int l = 1 + randomsource.nextInt(difficultyinstance.getDifficulty().getId() + 1); + int l = event.getPhantomsToSpawn(); - for(int i1 = 0; i1 < l; ++i1) { + for (int i1 = 0; i1 < l; i1++) { Phantom phantom = EntityType.PHANTOM.create(p_64576_); diff --git a/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch b/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch new file mode 100644 index 0000000000..33276ce214 --- /dev/null +++ b/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/level/levelgen/WorldDimensions.java ++++ b/net/minecraft/world/level/levelgen/WorldDimensions.java +@@ -36,7 +_,8 @@ + public record WorldDimensions(Map, LevelStem> dimensions) { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + p_325905_ -> p_325905_.group( +- Codec.unboundedMap(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) ++ // FORGE: Fix MC-197860 ++ new net.neoforged.neoforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) + ) + .apply(p_325905_, p_325905_.stable(WorldDimensions::new)) + ); diff --git a/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch b/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch deleted file mode 100644 index 79eec5ad82..0000000000 --- a/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/Feature.java -+++ b/net/minecraft/world/level/levelgen/feature/Feature.java -@@ -191,7 +_,7 @@ - } - - protected static boolean isStone(BlockState p_159748_) { -- return p_159748_.is(BlockTags.BASE_STONE_OVERWORLD); -+ return p_159748_.is(net.neoforged.neoforge.common.Tags.Blocks.STONE); - } - - public static boolean isDirt(BlockState p_159760_) { diff --git a/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch b/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch index 3bdca5000f..73b5d90114 100644 --- a/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch +++ b/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java -@@ -133,6 +_,6 @@ +@@ -131,6 +_,6 @@ } private EntityType randomEntityId(RandomSource p_225154_) { diff --git a/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch b/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch index 347c9c5735..3e097518cf 100644 --- a/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch +++ b/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java -@@ -38,19 +_,20 @@ +@@ -37,19 +_,20 @@ } if (!list.isEmpty()) { @@ -16,7 +16,7 @@ + this.placeCircle(p_225969_, p_225978_.west().south(2), eventProvider); + this.placeCircle(p_225969_, p_225978_.east(2).south(2), eventProvider); - for(int j = 0; j < 5; ++j) { + for (int j = 0; j < 5; j++) { int k = p_225969_.random().nextInt(64); int l = k % 8; int i1 = k / 8; @@ -26,7 +26,7 @@ } } }); -@@ -58,20 +_,28 @@ +@@ -57,20 +_,28 @@ } private void placeCircle(TreeDecorator.Context p_225971_, BlockPos p_225972_) { @@ -34,8 +34,8 @@ + } + + private void placeCircle(TreeDecorator.Context p_225971_, BlockPos p_225972_, net.neoforged.neoforge.event.level.AlterGroundEvent.StateProvider eventProvider) { - for(int i = -2; i <= 2; ++i) { - for(int j = -2; j <= 2; ++j) { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { if (Math.abs(i) != 2 || Math.abs(j) != 2) { - this.placeBlockAt(p_225971_, p_225972_.offset(i, 0, j)); + this.placeBlockAt(p_225971_, p_225972_.offset(i, 0, j), eventProvider); @@ -49,7 +49,7 @@ + } + + private void placeBlockAt(TreeDecorator.Context p_225974_, BlockPos p_225975_, net.neoforged.neoforge.event.level.AlterGroundEvent.StateProvider eventProvider) { - for(int i = 2; i >= -3; --i) { + for (int i = 2; i >= -3; i--) { BlockPos blockpos = p_225975_.above(i); if (Feature.isGrassOrDirt(p_225974_.level(), blockpos)) { - p_225974_.setBlock(blockpos, this.provider.getState(p_225974_.random(), p_225975_)); diff --git a/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch b/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch index b91f11f7be..8cf2c5bd6d 100644 --- a/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch +++ b/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java +++ b/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java -@@ -17,7 +_,8 @@ +@@ -18,7 +_,8 @@ private final int maxSteps; - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( p_191650_ -> p_191650_.group( - Direction.VERTICAL_CODEC.fieldOf("direction_of_search").forGetter(p_191672_ -> p_191672_.directionOfSearch), + // NeoForge: Allow any direction, not just vertical. The code already handles it fine. diff --git a/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch b/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch index 776216f9e6..eaa565f8ca 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch +++ b/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch @@ -13,7 +13,7 @@ + return Structure.StructureSettings.CODEC.forGetter(p_226595_ -> p_226595_.modifiableStructureInfo().getOriginalStructureInfo().structureSettings()); // FORGE: Patch codec to ignore field redirect coremods. } - public static Codec simpleCodec(Function p_226608_) { + public static MapCodec simpleCodec(Function p_226608_) { @@ -54,6 +_,7 @@ protected Structure(Structure.StructureSettings p_226558_) { diff --git a/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 1b2ac4b713..63803d46c0 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/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 -@@ -91,6 +_,9 @@ +@@ -92,6 +_,9 @@ } public final CompoundTag createTag(StructurePieceSerializationContext p_192645_) { diff --git a/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index 5e64baec2f..dfa077d7f4 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -217,6 +_,10 @@ +@@ -219,6 +_,10 @@ return transform(p_74565_, p_74564_.getMirror(), p_74564_.getRotation(), p_74564_.getRotationPivot()); } @@ -11,16 +11,16 @@ public boolean placeInWorld( ServerLevelAccessor p_230329_, BlockPos p_230330_, BlockPos p_230331_, StructurePlaceSettings p_230332_, RandomSource p_230333_, int p_230334_ ) { -@@ -240,7 +_,7 @@ +@@ -242,7 +_,7 @@ int j1 = Integer.MIN_VALUE; - for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos( + for (StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos( - p_230329_, p_230330_, p_230331_, p_230332_, list + p_230329_, p_230330_, p_230331_, p_230332_, list, this )) { BlockPos blockpos = structuretemplate$structureblockinfo.pos; if (boundingbox == null || boundingbox.isInside(blockpos)) { -@@ -353,15 +_,7 @@ +@@ -355,15 +_,7 @@ } if (!p_230332_.isIgnoreEntities()) { @@ -37,7 +37,7 @@ } return true; -@@ -390,12 +_,20 @@ +@@ -402,12 +_,20 @@ } public static List processBlockInfos( @@ -58,16 +58,16 @@ List list = new ArrayList<>(); List list1 = new ArrayList<>(); -@@ -410,7 +_,7 @@ +@@ -422,7 +_,7 @@ - while(structuretemplate$structureblockinfo1 != null && iterator.hasNext()) { + while (structuretemplate$structureblockinfo1 != null && iterator.hasNext()) { structuretemplate$structureblockinfo1 = iterator.next() - .processBlock(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_); + .process(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_, template); } if (structuretemplate$structureblockinfo1 != null) { -@@ -426,21 +_,29 @@ +@@ -438,21 +_,29 @@ return list1; } @@ -80,7 +80,7 @@ - @Nullable BoundingBox p_74529_, - boolean p_74530_ - ) { -- for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) { +- for (StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) { - BlockPos blockpos = transform(structuretemplate$structureentityinfo.blockPos, p_74526_, p_74527_, p_74528_).offset(p_74525_); - if (p_74529_ == null || p_74529_.isInside(blockpos)) { + public static List processEntityInfos(@Nullable StructureTemplate template, LevelAccessor p_215387_0_, BlockPos p_215387_1_, StructurePlaceSettings p_215387_2_, List p_215387_3_) { @@ -111,17 +111,17 @@ ListTag listtag = new ListTag(); listtag.add(DoubleTag.valueOf(vec31.x)); listtag.add(DoubleTag.valueOf(vec31.y)); -@@ -450,10 +_,10 @@ - createEntityIgnoreException(p_74524_, compoundtag) - .ifPresent( - p_275190_ -> { -- float f = p_275190_.rotate(p_74527_); -- f += p_275190_.mirror(p_74526_) - p_275190_.getYRot(); -+ float f = p_275190_.rotate(placementIn.getRotation()); -+ f += p_275190_.mirror(placementIn.getMirror()) - p_275190_.getYRot(); - p_275190_.moveTo(vec31.x, vec31.y, vec31.z, f, p_275190_.getXRot()); -- if (p_74530_ && p_275190_ instanceof Mob) { -+ if (placementIn.shouldFinalizeEntities() && p_275190_ instanceof Mob) { - ((Mob)p_275190_) - .finalizeSpawn( - p_74524_, p_74524_.getCurrentDifficultyAt(BlockPos.containing(vec31)), MobSpawnType.STRUCTURE, null, compoundtag +@@ -460,10 +_,10 @@ + compoundtag.put("Pos", listtag); + compoundtag.remove("UUID"); + createEntityIgnoreException(p_74524_, compoundtag).ifPresent(p_275190_ -> { +- float f = p_275190_.rotate(p_74527_); +- f += p_275190_.mirror(p_74526_) - p_275190_.getYRot(); ++ float f = p_275190_.rotate(placementIn.getRotation()); ++ f += p_275190_.mirror(placementIn.getMirror()) - p_275190_.getYRot(); + p_275190_.moveTo(vec31.x, vec31.y, vec31.z, f, p_275190_.getXRot()); +- if (p_74530_ && p_275190_ instanceof Mob) { ++ if (placementIn.shouldFinalizeEntities() && p_275190_ instanceof Mob) { + ((Mob)p_275190_).finalizeSpawn(p_74524_, p_74524_.getCurrentDifficultyAt(BlockPos.containing(vec31)), MobSpawnType.STRUCTURE, null); + } + diff --git a/patches/net/minecraft/world/level/lighting/LightEngine.java.patch b/patches/net/minecraft/world/level/lighting/LightEngine.java.patch index f87408b933..63adb6e17d 100644 --- a/patches/net/minecraft/world/level/lighting/LightEngine.java.patch +++ b/patches/net/minecraft/world/level/lighting/LightEngine.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/lighting/LightEngine.java +++ b/net/minecraft/world/level/lighting/LightEngine.java -@@ -45,7 +_,7 @@ - return false; - } else { - return p_285372_.getLightBlock(p_285159_, p_284985_) != p_285110_.getLightBlock(p_285159_, p_284985_) +@@ -44,7 +_,7 @@ + return p_285372_ == p_285110_ + ? false + : p_285372_.getLightBlock(p_285159_, p_284985_) != p_285110_.getLightBlock(p_285159_, p_284985_) - || p_285372_.getLightEmission() != p_285110_.getLightEmission() + || p_285372_.getLightEmission(p_285159_, p_284985_) != p_285110_.getLightEmission(p_285159_, p_284985_) || p_285372_.useShapeForLightOcclusion() || p_285110_.useShapeForLightOcclusion(); - } + } diff --git a/patches/net/minecraft/world/level/material/FlowingFluid.java.patch b/patches/net/minecraft/world/level/material/FlowingFluid.java.patch index 209d33fca8..291782510b 100644 --- a/patches/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -6,7 +6,7 @@ if (fluidstate.getType().isSame(this) && this.canPassThroughWall(direction, p_256464_, p_76037_, p_76038_, blockpos, blockstate)) { - if (fluidstate.isSource()) { + if (fluidstate.isSource() && net.neoforged.neoforge.event.EventHooks.canCreateFluidSource(p_256464_, blockpos, blockstate, fluidstate.canConvertToSource(p_256464_, blockpos))) { - ++j; + j++; } @@ -172,7 +_,7 @@ diff --git a/patches/net/minecraft/world/level/material/LavaFluid.java.patch b/patches/net/minecraft/world/level/material/LavaFluid.java.patch index d6d69b06ad..3f0eac9ce5 100644 --- a/patches/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/net/minecraft/world/level/material/LavaFluid.java.patch @@ -23,7 +23,7 @@ @@ -111,7 +_,7 @@ private boolean hasFlammableNeighbours(LevelReader p_76228_, BlockPos p_76229_) { - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (this.isFlammable(p_76228_, p_76229_.relative(direction))) { + if (this.isFlammable(p_76228_, p_76229_.relative(direction), direction.getOpposite())) { return true; diff --git a/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch b/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch deleted file mode 100644 index 5dba9b0dcc..0000000000 --- a/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -+++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -@@ -57,7 +_,7 @@ - BlockPathTypes blockpathtypes1 = this.getCachedBlockType(this.mob, p_164677_.x, p_164677_.y, p_164677_.z); - int j; - if (this.mob.getPathfindingMalus(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.floor(Math.max(1.0F, this.mob.maxUpStep())); -+ j = Mth.floor(Math.max(1.0F, this.mob.getStepHeight())); - } else { - j = 0; - } diff --git a/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch b/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch deleted file mode 100644 index d7d0b8e25f..0000000000 --- a/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/net/minecraft/world/level/pathfinder/BlockPathTypes.java -+++ b/net/minecraft/world/level/pathfinder/BlockPathTypes.java -@@ -1,6 +_,6 @@ - package net.minecraft.world.level.pathfinder; - --public enum BlockPathTypes { -+public enum BlockPathTypes implements net.neoforged.neoforge.common.IExtensibleEnum { - BLOCKED(-1.0F), - OPEN(0.0F), - WALKABLE(0.0F), -@@ -36,5 +_,17 @@ - - public float getMalus() { - return this.malus; -+ } -+ -+ @org.jetbrains.annotations.Nullable -+ public BlockPathTypes getDanger() { -+ return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE : -+ (this == DAMAGE_OTHER || this == DANGER_OTHER ) ? DANGER_OTHER : -+ (this == LAVA) ? DAMAGE_FIRE : -+ null; -+ } -+ -+ public static BlockPathTypes create(String name, float malus) { -+ throw new IllegalArgumentException("Enum not extended"); - } - } diff --git a/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch b/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch new file mode 100644 index 0000000000..42c87e81c8 --- /dev/null +++ b/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/pathfinder/PathfindingContext.java ++++ b/net/minecraft/world/level/pathfinder/PathfindingContext.java +@@ -41,4 +_,8 @@ + public BlockPos mobPosition() { + return this.mobPosition; + } ++ ++ BlockPos currentEvalPos() { ++ return this.mutablePos; ++ } + } diff --git a/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index deea9f8720..65153f5d5e 100644 --- a/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,59 +1,42 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -126,7 +_,7 @@ - BlockPathTypes blockpathtypes = this.getCachedBlockType(this.mob, p_77641_.x, p_77641_.y + 1, p_77641_.z); - BlockPathTypes blockpathtypes1 = this.getCachedBlockType(this.mob, p_77641_.x, p_77641_.y, p_77641_.z); - if (this.mob.getPathfindingMalus(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.floor(Math.max(1.0F, this.mob.maxUpStep())); -+ j = Mth.floor(Math.max(1.0F, this.mob.getStepHeight())); - } - - double d0 = this.getFloorLevel(new BlockPos(p_77641_.x, p_77641_.y, p_77641_.z)); -@@ -338,7 +_,7 @@ - } - - private double getMobJumpHeight() { -- return Math.max(1.125, (double)this.mob.maxUpStep()); -+ return Math.max(1.125, (double)this.mob.getStepHeight()); - } - - private Node getNodeAndUpdateCostToMax(int p_230620_, int p_230621_, int p_230622_, BlockPathTypes p_230623_, float p_230624_) { -@@ -477,6 +_,11 @@ - if (l != 0 || j1 != 0) { - p_77609_.set(i + l, j + i1, k + j1); - BlockState blockstate = p_77608_.getBlockState(p_77609_); -+ BlockPathTypes blockPathType = blockstate.getAdjacentBlockPathType(p_77608_, p_77609_, null, p_77610_); +@@ -471,6 +_,12 @@ + for (int k = -1; k <= 1; k++) { + if (i != 0 || k != 0) { + PathType pathtype = p_331893_.getPathTypeFromState(p_332169_ + i, p_330433_ + j, p_331506_ + k); ++ BlockState blockState = p_331893_.level().getBlockState(p_331893_.currentEvalPos()); ++ PathType blockPathType = blockState.getAdjacentBlockPathType(p_331893_.level(), p_331893_.currentEvalPos(), null, pathtype); + if (blockPathType != null) return blockPathType; -+ FluidState fluidState = blockstate.getFluidState(); -+ BlockPathTypes fluidPathType = fluidState.getAdjacentBlockPathType(p_77608_, p_77609_, null, p_77610_); ++ net.minecraft.world.level.material.FluidState fluidState = blockState.getFluidState(); ++ PathType fluidPathType = fluidState.getAdjacentBlockPathType(p_331893_.level(), p_331893_.currentEvalPos(), null, pathtype); + if (fluidPathType != null) return fluidPathType; - if (blockstate.is(Blocks.CACTUS) || blockstate.is(Blocks.SWEET_BERRY_BUSH)) { - return BlockPathTypes.DANGER_OTHER; + if (pathtype == PathType.DAMAGE_OTHER) { + return PathType.DANGER_OTHER; } -@@ -502,6 +_,8 @@ +@@ -496,6 +_,8 @@ - protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter p_77644_, BlockPos p_77645_) { + protected static PathType getPathTypeFromState(BlockGetter p_77644_, BlockPos p_77645_) { BlockState blockstate = p_77644_.getBlockState(p_77645_); -+ BlockPathTypes type = blockstate.getBlockPathType(p_77644_, p_77645_, null); ++ PathType type = blockstate.getBlockPathType(p_77644_, p_77645_, null); + if (type != null) return type; Block block = blockstate.getBlock(); if (blockstate.isAir()) { - return BlockPathTypes.OPEN; -@@ -517,6 +_,8 @@ - return BlockPathTypes.COCOA; + return PathType.OPEN; +@@ -511,6 +_,8 @@ + return PathType.COCOA; } else if (!blockstate.is(Blocks.WITHER_ROSE) && !blockstate.is(Blocks.POINTED_DRIPSTONE)) { - FluidState fluidstate = p_77644_.getFluidState(p_77645_); -+ BlockPathTypes nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); + FluidState fluidstate = blockstate.getFluidState(); ++ PathType nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); + if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; if (fluidstate.is(FluidTags.LAVA)) { - return BlockPathTypes.LAVA; + return PathType.LAVA; } else if (isBurningBlock(blockstate)) { -@@ -537,6 +_,8 @@ - if (!blockstate.isPathfindable(p_77644_, p_77645_, PathComputationType.LAND)) { - return BlockPathTypes.BLOCKED; +@@ -531,6 +_,8 @@ + if (!blockstate.isPathfindable(PathComputationType.LAND)) { + return PathType.BLOCKED; } else { -+ BlockPathTypes loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); ++ PathType loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); + if (loggableFluidPathType != null) return loggableFluidPathType; - return fluidstate.is(FluidTags.WATER) ? BlockPathTypes.WATER : BlockPathTypes.OPEN; + return fluidstate.is(FluidTags.WATER) ? PathType.WATER : PathType.OPEN; } } else { diff --git a/patches/net/minecraft/world/level/portal/PortalForcer.java.patch b/patches/net/minecraft/world/level/portal/PortalForcer.java.patch index 9a25948b32..159d3aefba 100644 --- a/patches/net/minecraft/world/level/portal/PortalForcer.java.patch +++ b/patches/net/minecraft/world/level/portal/PortalForcer.java.patch @@ -6,6 +6,6 @@ -public class PortalForcer { +public class PortalForcer implements net.neoforged.neoforge.common.util.ITeleporter { - private static final int TICKET_RADIUS = 3; + public static final int TICKET_RADIUS = 3; private static final int SEARCH_RADIUS = 128; private static final int CREATE_RADIUS = 16; diff --git a/patches/net/minecraft/world/level/saveddata/SavedData.java.patch b/patches/net/minecraft/world/level/saveddata/SavedData.java.patch index 2e74ecdae8..b8779d52d8 100644 --- a/patches/net/minecraft/world/level/saveddata/SavedData.java.patch +++ b/patches/net/minecraft/world/level/saveddata/SavedData.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/level/saveddata/SavedData.java +++ b/net/minecraft/world/level/saveddata/SavedData.java -@@ -45,6 +_,10 @@ - } +@@ -47,7 +_,10 @@ } -- public static record Factory(Supplier constructor, Function deserializer, DataFixTypes type) { -+ public static record Factory(Supplier constructor, Function deserializer, @javax.annotation.Nullable DataFixTypes type) { // Neo: We do not have update logic compatible with DFU, several downstream patches from this record are made to support a nullable type. -+ -+ public Factory(Supplier constructor, Function deserializer) { + public static record Factory( +- Supplier constructor, BiFunction deserializer, DataFixTypes type ++ Supplier constructor, BiFunction deserializer, @javax.annotation.Nullable DataFixTypes type // Neo: We do not have update logic compatible with DFU, several downstream patches from this record are made to support a nullable type. + ) { ++ public Factory(Supplier constructor, BiFunction deserializer) { + this(constructor, deserializer, null); + } } diff --git a/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch b/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch index c1858be920..b194cb2a8d 100644 --- a/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch +++ b/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch @@ -1,31 +1,11 @@ --- a/net/minecraft/world/level/saveddata/maps/MapDecoration.java +++ b/net/minecraft/world/level/saveddata/maps/MapDecoration.java -@@ -7,13 +_,27 @@ - import net.minecraft.util.StringRepresentable; - import net.minecraft.world.level.material.MapColor; +@@ -9,7 +_,7 @@ + import net.minecraft.network.codec.StreamCodec; + import net.minecraft.resources.ResourceLocation; --public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name) { -+public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex) { -+ -+ public MapDecoration(Type type, byte x, byte y, byte rot, @Nullable Component name) { -+ this(type, x, y, rot, name, (i) -> false); -+ } -+ - public byte getImage() { - return this.type.getIcon(); - } - - public boolean renderOnFrame() { - return this.type.isRenderedOnFrame(); -+ } -+ -+ /** -+ * Renders this decoration, useful for custom sprite sheets. -+ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting -+ * @return false to run vanilla logic for this decoration, true to skip it -+ */ -+ public boolean render(int index) { -+ return shouldRenderForIndex().get(index); - } - - public static enum Type implements StringRepresentable { +-public record MapDecoration(Holder type, byte x, byte y, byte rot, Optional name) { ++public record MapDecoration(Holder type, byte x, byte y, byte rot, Optional name) { // Porting 1.20.5 this is synced now reevaluate shouldRenderForIndex + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + MapDecorationType.STREAM_CODEC, + MapDecoration::type, diff --git a/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch b/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch index 5f8c1c126e..2ecb5333a0 100644 --- a/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch +++ b/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -49,16 +_,20 @@ +@@ -54,16 +_,20 @@ @Nullable public T get(SavedData.Factory p_295091_, String p_164860_) { SavedData saveddata = this.cache.get(p_164860_); @@ -17,12 +17,12 @@ } @Nullable -- private T readSavedData(Function p_164869_, DataFixTypes p_295832_, String p_164870_) { -+ private T readSavedData(Function p_164869_, @Nullable DataFixTypes p_295832_, String p_164870_) { +- private T readSavedData(BiFunction p_324609_, DataFixTypes p_295832_, String p_164870_) { ++ private T readSavedData(BiFunction p_324609_, @Nullable DataFixTypes p_295832_, String p_164870_) { try { File file1 = this.getDataFile(p_164870_); if (file1.exists()) { -@@ -76,7 +_,7 @@ +@@ -81,7 +_,7 @@ this.cache.put(p_164856_, p_164857_); } @@ -31,7 +31,7 @@ File file1 = this.getDataFile(p_78159_); CompoundTag compoundtag1; -@@ -93,8 +_,12 @@ +@@ -98,8 +_,12 @@ } } diff --git a/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch index 9bdbcd1977..1b013d0576 100644 --- a/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -475,6 +_,18 @@ +@@ -467,6 +_,18 @@ } } @@ -19,7 +19,7 @@ public PlayerDataStorage createPlayerStorage() { this.checkLock(); return new PlayerDataStorage(this, LevelStorageSource.this.fixerUpper); -@@ -508,6 +_,7 @@ +@@ -500,6 +_,7 @@ CompoundTag compoundtag = p_78292_.createTag(p_78291_, p_78293_); CompoundTag compoundtag1 = new CompoundTag(); compoundtag1.put("Data", compoundtag); @@ -27,7 +27,7 @@ this.saveLevelData(compoundtag1); } -@@ -527,6 +_,10 @@ +@@ -519,6 +_,10 @@ public Optional getIconFile() { return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); diff --git a/patches/net/minecraft/world/level/storage/LevelSummary.java.patch b/patches/net/minecraft/world/level/storage/LevelSummary.java.patch index 588306c2b2..ffdad0cfa0 100644 --- a/patches/net/minecraft/world/level/storage/LevelSummary.java.patch +++ b/patches/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 -@@ -270,6 +_,10 @@ +@@ -275,6 +_,10 @@ } } diff --git a/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch b/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch index ac914d890d..ebd731efaa 100644 --- a/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch +++ b/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/net/minecraft/world/level/storage/PlayerDataStorage.java -@@ -35,6 +_,7 @@ +@@ -39,6 +_,7 @@ Path path2 = path.resolve(p_78434_.getStringUUID() + ".dat"); Path path3 = path.resolve(p_78434_.getStringUUID() + ".dat_old"); Util.safeReplaceFile(path2, path1, path3); @@ -8,21 +8,16 @@ } catch (Exception exception) { LOGGER.warn("Failed to save player data for {}", p_78434_.getName().getString()); } -@@ -58,6 +_,7 @@ - compoundtag = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, compoundtag, i); - p_78436_.load(compoundtag); - } -+ net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_78436_, playerDir, p_78436_.getStringUUID()); - - return compoundtag; - } -@@ -75,5 +_,9 @@ - } - - return astring; +@@ -80,7 +_,12 @@ + int i = NbtUtils.getDataVersion(p_316252_, -1); + p_316252_ = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, p_316252_, i); + p_78436_.load(p_316252_); ++ net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_78436_, playerDir, p_78436_.getStringUUID()); + return p_316252_; + }); + } + -+ public File getPlayerDataFolder() { ++ public File getPlayerDir() { + return playerDir; } } diff --git a/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch b/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch index 3e34c45ee2..e864d04004 100644 --- a/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -78,6 +_,7 @@ +@@ -74,6 +_,7 @@ private boolean wasModded; private final Set removedFeatureFlags; private final TimerQueue scheduledEvents; @@ -8,7 +8,7 @@ private PrimaryLevelData( @Nullable CompoundTag p_277888_, -@@ -212,7 +_,7 @@ +@@ -200,7 +_,7 @@ p_251864_, p_250651_, p_78538_ @@ -17,7 +17,7 @@ } @Override -@@ -287,6 +_,8 @@ +@@ -273,6 +_,8 @@ if (this.wanderingTraderId != null) { p_78547_.putUUID("WanderingTraderId", this.wanderingTraderId); } @@ -26,7 +26,7 @@ } private static ListTag stringCollectionToTag(Set p_277880_) { -@@ -616,6 +_,15 @@ +@@ -570,6 +_,15 @@ @Override public LevelSettings getLevelSettings() { return this.settings.copy(); diff --git a/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch index 4b580b813e..82dfa71a9e 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/LootContext.java +++ b/net/minecraft/world/level/storage/loot/LootContext.java -@@ -86,15 +_,43 @@ +@@ -87,15 +_,43 @@ return new LootContext.VisitedEntry<>(LootDataType.MODIFIER, p_279163_); } @@ -11,7 +11,7 @@ + + private ResourceLocation queriedLootTableId; + -+ private LootContext(LootParams p_287722_, RandomSource p_287702_, LootDataResolver p_287619_, ResourceLocation queriedLootTableId) { ++ private LootContext(LootParams p_287722_, RandomSource p_287702_, HolderGetter.Provider p_287619_, ResourceLocation queriedLootTableId) { + this(p_287722_, p_287702_, p_287619_); + this.queriedLootTableId = queriedLootTableId; + } @@ -44,7 +44,7 @@ public LootContext.Builder withOptionalRandomSeed(long p_78966_) { if (p_78966_ != 0L) { this.random = RandomSource.create(p_78966_); -@@ -103,6 +_,11 @@ +@@ -104,6 +_,11 @@ return this; } @@ -56,16 +56,16 @@ public ServerLevel getLevel() { return this.params.getLevel(); } -@@ -113,7 +_,7 @@ +@@ -114,7 +_,7 @@ RandomSource randomsource = Optional.ofNullable(this.random) .or(() -> p_298622_.map(serverlevel::getRandomSequence)) .orElseGet(serverlevel::getRandom); -- return new LootContext(this.params, randomsource, minecraftserver.getLootData()); -+ return new LootContext(this.params, randomsource, minecraftserver.getLootData(), queriedLootTableId); +- return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup()); ++ return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup(), queriedLootTableId); } } -@@ -134,6 +_,11 @@ +@@ -135,6 +_,11 @@ public LootContextParam getParam() { return this.param; diff --git a/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch b/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch deleted file mode 100644 index 526806d442..0000000000 --- a/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/net/minecraft/world/level/storage/loot/LootDataManager.java -+++ b/net/minecraft/world/level/storage/loot/LootDataManager.java -@@ -23,7 +_,7 @@ - import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; - import org.slf4j.Logger; - --public class LootDataManager implements PreparableReloadListener, LootDataResolver { -+public class LootDataManager extends net.neoforged.neoforge.resource.ContextAwareReloadListener implements PreparableReloadListener, LootDataResolver { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final Gson GSON = new GsonBuilder().create(); - public static final LootDataId EMPTY_LOOT_TABLE_KEY = new LootDataId<>(LootDataType.TABLE, BuiltInLootTables.EMPTY); -@@ -39,22 +_,33 @@ - Executor p_279148_, - Executor p_279169_ - ) { -+ var ops = this.makeConditionalOps(); - Map, Map> map = new HashMap<>(); - CompletableFuture[] completablefuture = LootDataType.values() -- .map(p_279242_ -> scheduleElementParse(p_279242_, p_279377_, p_279148_, map)) -+ .map(p_279242_ -> scheduleElementParse(p_279242_, p_279377_, p_279148_, map, ops)) - .toArray(p_279126_ -> new CompletableFuture[p_279126_]); - return CompletableFuture.allOf(completablefuture).thenCompose(p_279240_::wait).thenAcceptAsync(p_279096_ -> this.apply(map), p_279169_); - } - -+ /** -+ * @deprecated Neo: use the variant with a custom codec ops -+ */ -+ @Deprecated - private static CompletableFuture scheduleElementParse( - LootDataType p_279205_, ResourceManager p_279441_, Executor p_279233_, Map, Map> p_279241_ - ) { -+ return scheduleElementParse(p_279205_, p_279441_, p_279233_, p_279241_, com.mojang.serialization.JsonOps.INSTANCE); -+ } -+ private static CompletableFuture scheduleElementParse( -+ LootDataType p_279205_, ResourceManager p_279441_, Executor p_279233_, Map, Map> p_279241_, -+ com.mojang.serialization.DynamicOps decodeOps -+ ) { - Map map = new HashMap<>(); - p_279241_.put(p_279205_, map); - return CompletableFuture.runAsync(() -> { - Map map1 = new HashMap<>(); - SimpleJsonResourceReloadListener.scanDirectory(p_279441_, p_279205_.directory(), GSON, map1); -- map1.forEach((p_279416_, p_279151_) -> p_279205_.deserialize(p_279416_, p_279151_).ifPresent(p_279295_ -> map.put(p_279416_, p_279295_))); -+ map1.forEach((p_279416_, p_279151_) -> p_279205_.deserializeOrDefault(p_279416_, decodeOps, p_279151_).ifPresent(p_279295_ -> map.put(p_279416_, p_279295_))); - }, p_279233_); - } - diff --git a/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch b/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch index 7a49b8ff9e..cad72480b4 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch @@ -1,73 +1,60 @@ --- a/net/minecraft/world/level/storage/loot/LootDataType.java +++ b/net/minecraft/world/level/storage/loot/LootDataType.java -@@ -15,19 +_,36 @@ +@@ -17,7 +_,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemConditions; import org.slf4j.Logger; -+ -+//PATCH 1.20.2: This whole class has to be revalidated. It previously used a very uggly patch with a hack. -+//This might need to be refactored into a codec. But currently this is reverted to a clean state. - public class LootDataType { +-public record LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator) { ++public record LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator, @org.jetbrains.annotations.Nullable T defaultValue, Codec> conditionalCodec, java.util.function.BiConsumer idSetter) { private static final Logger LOGGER = LogUtils.getLogger(); - public static final LootDataType PREDICATE = new LootDataType<>(LootItemConditions.CODEC, "predicates", createSimpleValidator()); - public static final LootDataType MODIFIER = new LootDataType<>(LootItemFunctions.CODEC, "item_modifiers", createSimpleValidator()); -- public static final LootDataType TABLE = new LootDataType<>(LootTable.CODEC, "loot_tables", createLootTableValidator()); -+ public static final LootDataType TABLE = new LootDataType<>(LootTable.CODEC, "loot_tables", createLootTableValidator(), LootTable.EMPTY, LootTable::setLootTableId); - private final Codec codec; - private final String directory; - private final LootDataType.Validator validator; -+ @org.jetbrains.annotations.Nullable -+ private final T defaultValue; -+ private final Codec> conditionalCodec; -+ private final java.util.function.BiConsumer idSetter; - + public static final LootDataType PREDICATE = new LootDataType<>( + Registries.PREDICATE, LootItemConditions.DIRECT_CODEC, "predicates", createSimpleValidator() +@@ -26,17 +_,32 @@ + Registries.ITEM_MODIFIER, LootItemFunctions.ROOT_CODEC, "item_modifiers", createSimpleValidator() + ); + public static final LootDataType TABLE = new LootDataType<>( +- Registries.LOOT_TABLE, LootTable.DIRECT_CODEC, "loot_tables", createLootTableValidator() ++ Registries.LOOT_TABLE, LootTable.DIRECT_CODEC, "loot_tables", createLootTableValidator(), LootTable.EMPTY, LootTable::setLootTableId + ); ++ + /** -+ * @deprecated Neo: use the constructor {@link #LootDataType(Codec, String, Validator, T, java.util.function.BiConsumer) with a default value and id setter} to support conditions ++ * @deprecated Neo: use the constructor {@link #LootDataType(ResourceKey, Codec, String, Validator, T, java.util.function.BiConsumer) with a default value and id setter} to support conditions + */ + @Deprecated - private LootDataType(Codec p_298773_, String p_279433_, LootDataType.Validator p_279363_) { -+ this(p_298773_, p_279433_, p_279363_, null, (it, id) -> {}); ++ private LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator) { ++ this(registryKey, codec, directory, validator, null, (it, id) -> {}); ++ } ++ ++ private LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator, @org.jetbrains.annotations.Nullable T defaultValue, java.util.function.BiConsumer idSetter) { ++ this(registryKey, codec, directory, validator, defaultValue, net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(codec), idSetter); + } -+ private LootDataType(Codec p_298773_, String p_279433_, LootDataType.Validator p_279363_, @org.jetbrains.annotations.Nullable T defaultValue, java.util.function.BiConsumer idSetter) { - this.codec = p_298773_; - this.directory = p_279433_; - this.validator = p_279363_; -+ this.defaultValue = defaultValue; -+ this.idSetter = idSetter; -+ this.conditionalCodec = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(codec); - } - public String directory() { -@@ -39,9 +_,16 @@ + public void runValidation(ValidationContext p_279366_, ResourceKey p_336149_, T p_279124_) { + this.validator.run(p_279366_, p_336149_, p_279124_); } - public Optional deserialize(ResourceLocation p_279253_, JsonElement p_279330_) { -- DataResult dataresult = this.codec.parse(JsonOps.INSTANCE, p_279330_); -- dataresult.error().ifPresent(p_297991_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, p_279253_, p_297991_.message())); + public Optional deserialize(ResourceLocation p_279253_, DynamicOps p_324006_, V p_324329_) { +- DataResult dataresult = this.codec.parse(p_324006_, p_324329_); ++ var dataresult = this.conditionalCodec.parse(p_324006_, p_324329_); + dataresult.error().ifPresent(p_338121_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, p_279253_, p_338121_.message())); - return dataresult.result(); -+ return deserializeOrDefault(p_279253_, JsonOps.INSTANCE, p_279330_); -+ } -+ -+ public Optional deserializeOrDefault(ResourceLocation location, com.mojang.serialization.DynamicOps ops, C object) { -+ var dataresult = this.conditionalCodec.parse(ops, object); -+ dataresult.error().ifPresent(p_297991_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, location, p_297991_.message())); + return dataresult.result().map(it -> { -+ it.ifPresent(val -> idSetter.accept(val, location)); ++ it.ifPresent(val -> idSetter.accept(val, p_279253_)); + return it.orElse(defaultValue); + }); } public static Stream> values() { -@@ -55,9 +_,12 @@ +@@ -50,9 +_,12 @@ } private static LootDataType.Validator createLootTableValidator() { -- return (p_279333_, p_279227_, p_279406_) -> p_279406_.validate( -- p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.type().directory + ":" + p_279227_.location() + "}", p_279227_) +- return (p_339557_, p_339558_, p_339559_) -> p_339559_.validate( +- p_339557_.setParams(p_339559_.getParamSet()).enterElement("{" + p_339558_.registry() + "/" + p_339558_.location() + "}", p_339558_) + return (p_279333_, p_279227_, p_279406_) -> { + p_279406_ = net.neoforged.neoforge.event.EventHooks.loadLootTable(p_279406_.getLootTableId(), p_279406_); + p_279406_.validate( -+ p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.type().directory + ":" + p_279227_.location() + "}", p_279227_) ++ p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.registry() + ":" + p_279227_.location() + "}", p_279227_) ); + }; } diff --git a/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch b/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch index 815b56069d..16780faf29 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/storage/loot/LootPool.java +++ b/net/minecraft/world/level/storage/loot/LootPool.java @@ -34,7 +_,8 @@ - ExtraCodecs.strictOptionalField(LootItemConditions.CODEC.listOf(), "conditions", List.of()).forGetter(p_297992_ -> p_297992_.conditions), - ExtraCodecs.strictOptionalField(LootItemFunctions.CODEC.listOf(), "functions", List.of()).forGetter(p_297994_ -> p_297994_.functions), + LootItemConditions.DIRECT_CODEC.listOf().optionalFieldOf("conditions", List.of()).forGetter(p_297992_ -> p_297992_.conditions), + LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_297994_ -> p_297994_.functions), NumberProviders.CODEC.fieldOf("rolls").forGetter(p_297993_ -> p_297993_.rolls), - NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297997_ -> p_297997_.bonusRolls) + NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297997_ -> p_297997_.bonusRolls), + Codec.STRING.optionalFieldOf("name").forGetter(pool -> java.util.Optional.ofNullable(pool.name).filter(name -> !name.startsWith("custom#"))) ) - .apply(p_297996_, LootPool::new) + .apply(p_338122_, LootPool::new) ); @@ -51,7 +_,8 @@ List p_299316_, diff --git a/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch b/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch index e4d8e7d276..540e4e7c85 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java -@@ -35,8 +_,8 @@ - p_297999_ -> p_297999_.group( - LootContextParamSets.CODEC.optionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(p_298001_ -> p_298001_.paramSet), - ExtraCodecs.strictOptionalField(ResourceLocation.CODEC, "random_sequence").forGetter(p_297998_ -> p_297998_.randomSequence), -- ExtraCodecs.strictOptionalField(LootPool.CODEC.listOf(), "pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), -- ExtraCodecs.strictOptionalField(LootItemFunctions.CODEC.listOf(), "functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.CommonHooks.lootPoolsCodec(LootPool::setName), "pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.conditions.ConditionalOps.decodeListWithElementConditions(LootItemFunctions.CODEC), "functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) +@@ -38,8 +_,8 @@ + p_338123_ -> p_338123_.group( + LootContextParamSets.CODEC.lenientOptionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(p_298001_ -> p_298001_.paramSet), + ResourceLocation.CODEC.optionalFieldOf("random_sequence").forGetter(p_297998_ -> p_297998_.randomSequence), +- LootPool.CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), +- LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) ++ net.neoforged.neoforge.common.CommonHooks.lootPoolsCodec(LootPool::setName).optionalFieldOf("pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), ++ net.neoforged.neoforge.common.conditions.ConditionalOps.decodeListWithElementConditions(LootItemFunctions.ROOT_CODEC).optionalFieldOf("functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) ) - .apply(p_297999_, LootTable::new) + .apply(p_338123_, LootTable::new) ); -@@ -49,7 +_,7 @@ +@@ -53,7 +_,7 @@ LootTable(LootContextParamSet p_287716_, Optional p_299055_, List p_298390_, List p_298775_) { this.paramSet = p_287716_; this.randomSequence = p_299055_; @@ -20,7 +20,7 @@ this.functions = p_298775_; this.compositeFunction = LootItemFunctions.compose(p_298775_); } -@@ -72,10 +_,12 @@ +@@ -76,10 +_,12 @@ }; } @@ -33,7 +33,7 @@ public void getRandomItemsRaw(LootContext p_79132_, Consumer p_79133_) { LootContext.VisitedEntry visitedentry = LootContext.createVisitedEntry(this); if (p_79132_.pushVisitedElement(visitedentry)) { -@@ -92,18 +_,15 @@ +@@ -96,18 +_,15 @@ } public void getRandomItems(LootParams p_287748_, long p_287729_, Consumer p_287583_) { @@ -55,7 +55,7 @@ } public ObjectArrayList getRandomItems(LootParams p_287574_, long p_287773_) { -@@ -116,7 +_,8 @@ +@@ -120,7 +_,8 @@ private ObjectArrayList getRandomItems(LootContext p_230923_) { ObjectArrayList objectarraylist = new ObjectArrayList<>(); @@ -65,7 +65,7 @@ return objectarraylist; } -@@ -206,6 +_,50 @@ +@@ -210,6 +_,50 @@ public static LootTable.Builder lootTable() { return new LootTable.Builder(); } diff --git a/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch b/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch index ef882c48ae..a89b35fe0c 100644 --- a/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch @@ -4,11 +4,11 @@ public static final LootContextParamSet EMPTY = register("empty", p_81454_ -> { }); public static final LootContextParamSet CHEST = register( -- "chest", p_81452_ -> p_81452_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) +- "chest", p_323464_ -> p_323464_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + "chest", p_81452_ -> p_81452_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.KILLER_ENTITY) //Forge: Chest minecarts can have killer entities ); public static final LootContextParamSet COMMAND = register( - "command", p_81450_ -> p_81450_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + "command", p_330195_ -> p_330195_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) @@ -29,7 +_,7 @@ "selector", p_81442_ -> p_81442_.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY) ); diff --git a/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch b/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch index fa782ec114..08fd78e1e7 100644 --- a/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java -@@ -32,12 +_,7 @@ +@@ -33,12 +_,7 @@ } public boolean test(LootContext p_81967_) { diff --git a/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch b/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch index 69771175ba..c00e726253 100644 --- a/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java -@@ -59,7 +_,7 @@ +@@ -60,7 +_,7 @@ @Override public String getId() { diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle index 5ce6f2106e..5ec242055b 100644 --- a/projects/neoforge/build.gradle +++ b/projects/neoforge/build.gradle @@ -61,7 +61,6 @@ dependencies { installer "org.ow2.asm:asm-analysis:${project.asm_version}" installer "net.neoforged:accesstransformers:${project.accesstransformers_version}" installer "net.neoforged:bus:${project.eventbus_version}" - installer "net.neoforged.fancymodloader:spi:${project.fancy_mod_loader_version}" installer "net.neoforged:coremods:${project.coremods_version}" installer "cpw.mods:modlauncher:${project.modlauncher_version}" installer "net.minecraftforge:unsafe:${project.unsafe_version}" @@ -81,6 +80,9 @@ dependencies { installer ("net.neoforged:JarJarMetadata:${project.jarjar_version}") { exclude group: 'org.slf4j' } + // Manually override log4j since the version coming from other `installer` dependencies is outdated + installer "org.apache.logging.log4j:log4j-api:${project.log4j_version}" + installer "org.apache.logging.log4j:log4j-core:${project.log4j_version}" compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}" @@ -245,7 +247,10 @@ publishing { } } - changelog.publish(it) + if (!rootProject.isPreReleaseVersion) { + // Only publish a changelog for releases + changelog.publish(it) + } versionMapping { usage('java-api') { diff --git a/settings.gradle b/settings.gradle index 6e543e461d..2e5194886d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { } plugins { - id 'net.neoforged.gradle.platform' version '7.0.95' + id 'net.neoforged.gradle.platform' version '7.0.104' } rootProject.name = rootDir.name diff --git a/src/generated/resources/assets/c/lang/en_us.json b/src/generated/resources/assets/c/lang/en_us.json new file mode 100644 index 0000000000..da38f21791 --- /dev/null +++ b/src/generated/resources/assets/c/lang/en_us.json @@ -0,0 +1,391 @@ +{ + "tag.block.c.barrels": "Barrels", + "tag.block.c.barrels.wooden": "Wooden Barrels", + "tag.block.c.bookshelves": "Bookshelves", + "tag.block.c.budding_blocks": "Budding Blocks", + "tag.block.c.buds": "Buds", + "tag.block.c.chains": "Chains", + "tag.block.c.chests": "Chests", + "tag.block.c.chests.ender": "Ender Chests", + "tag.block.c.chests.trapped": "Trapped Chests", + "tag.block.c.chests.wooden": "Wooden Chests", + "tag.block.c.clusters": "Clusters", + "tag.block.c.cobblestones": "Cobblestones", + "tag.block.c.cobblestones.deepslate": "Deepslate Cobblestones", + "tag.block.c.cobblestones.infested": "Infested Cobblestones", + "tag.block.c.cobblestones.mossy": "Mossy Cobblestones", + "tag.block.c.cobblestones.normal": "Normal Cobblestones", + "tag.block.c.dyed": "Dyed Blocks", + "tag.block.c.dyed.black": "Black Dyed Blocks", + "tag.block.c.dyed.blue": "Blue Dyed Blocks", + "tag.block.c.dyed.brown": "Brown Dyed Blocks", + "tag.block.c.dyed.cyan": "Cyan Dyed Blocks", + "tag.block.c.dyed.gray": "Gray Dyed Blocks", + "tag.block.c.dyed.green": "Green Dyed Blocks", + "tag.block.c.dyed.light_blue": "Light_blue Dyed Blocks", + "tag.block.c.dyed.light_gray": "Light_gray Dyed Blocks", + "tag.block.c.dyed.lime": "Lime Dyed Blocks", + "tag.block.c.dyed.magenta": "Magenta Dyed Blocks", + "tag.block.c.dyed.orange": "Orange Dyed Blocks", + "tag.block.c.dyed.pink": "Pink Dyed Blocks", + "tag.block.c.dyed.purple": "Purple Dyed Blocks", + "tag.block.c.dyed.red": "Red Dyed Blocks", + "tag.block.c.dyed.white": "White Dyed Blocks", + "tag.block.c.dyed.yellow": "Yellow Dyed Blocks", + "tag.block.c.end_stones": "End Stones", + "tag.block.c.fence_gates": "Fence Gates", + "tag.block.c.fence_gates.wooden": "Wooden Fence Gates", + "tag.block.c.fences": "Fences", + "tag.block.c.fences.nether_brick": "Fences Nether Brick", + "tag.block.c.fences.wooden": "Wooden Fences", + "tag.block.c.glass_blocks": "Glass Blocks", + "tag.block.c.glass_blocks.cheap": "Silica Glass Blocks", + "tag.block.c.glass_blocks.colorless": "Colorless Glass Blocks", + "tag.block.c.glass_blocks.tinted": "Tinted Glass Blocks", + "tag.block.c.glass_panes": "Glass Panes", + "tag.block.c.glass_panes.colorless": "Colorless Glass Panes", + "tag.block.c.gravel": "Gravels", + "tag.block.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.block.c.netherrack": "Netherracks", + "tag.block.c.obsidians": "Obsidians", + "tag.block.c.ore_bearing_ground.deepslate": "Deepslate Ore Bearing Ground", + "tag.block.c.ore_bearing_ground.netherrack": "Netherrack Ore Bearing Ground", + "tag.block.c.ore_bearing_ground.stone": "Stone Ore Bearing Ground", + "tag.block.c.ore_rates.dense": "Dense Ore Rates", + "tag.block.c.ore_rates.singular": "Singular Ore Rates", + "tag.block.c.ore_rates.sparse": "Sparse Ore Rates", + "tag.block.c.ores": "Ores", + "tag.block.c.ores.coal": "Coal Ores", + "tag.block.c.ores.copper": "Copper Ores", + "tag.block.c.ores.diamond": "Diamond Ores", + "tag.block.c.ores.emerald": "Emerald Ores", + "tag.block.c.ores.gold": "Gold Ores", + "tag.block.c.ores.iron": "Iron Ores", + "tag.block.c.ores.lapis": "Lapis Ores", + "tag.block.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.block.c.ores.quartz": "Quartz Ores", + "tag.block.c.ores.redstone": "Redstone Ores", + "tag.block.c.ores_in_ground.deepslate": "Deepslate Ores In Ground", + "tag.block.c.ores_in_ground.netherrack": "Netherrack Ores In Ground", + "tag.block.c.ores_in_ground.stone": "Stone Ores In Ground", + "tag.block.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.block.c.player_workstations.furnaces": "Furnaces", + "tag.block.c.relocation_not_supported": "Relocation Not Supported", + "tag.block.c.ropes": "Ropes", + "tag.block.c.sands": "Sands", + "tag.block.c.sands.colorless": "Colorless Sands", + "tag.block.c.sands.red": "Red Sands", + "tag.block.c.sandstone.blocks": "Sandstone Blocks", + "tag.block.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.block.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.block.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.block.c.sandstone.slabs": "Sandstone Slabs", + "tag.block.c.sandstone.stairs": "Sandstone Stairs", + "tag.block.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.block.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.block.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.block.c.skulls": "Skulls", + "tag.block.c.stones": "Stones", + "tag.block.c.storage_blocks": "Storage Blocks", + "tag.block.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.block.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.block.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.block.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.block.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.block.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.block.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.block.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.block.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.block.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.block.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.block.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.block.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.block.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.block.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.block.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.block.neoforge.enderman_place_on_blacklist": "Enderman Place On Blacklist", + "tag.block.neoforge.needs_gold_tool": "Needs Gold Tools", + "tag.block.neoforge.needs_netherite_tool": "Needs Netherite Tools", + "tag.block.neoforge.needs_wood_tool": "Needs Wooden Tools", + "tag.enchantment.c.entity_auxiliary_movement_enhancements": "Entity Auxiliary Movement Enhancements", + "tag.enchantment.c.entity_defense_enhancements": "Entity Defense Enhancements", + "tag.enchantment.c.entity_speed_enhancements": "Entity Speed Enhancements", + "tag.enchantment.c.increase_block_drops": "Increase Block Drops", + "tag.enchantment.c.increase_entity_drops": "Increase Entity Drops", + "tag.enchantment.c.weapon_damage_enhancements": "Weapon Damage Enhancements", + "tag.entity_type.c.boats": "Boats", + "tag.entity_type.c.bosses": "Bosses", + "tag.entity_type.c.capturing_not_supported": "Capturing Not Supported", + "tag.entity_type.c.minecarts": "Minecarts", + "tag.entity_type.c.teleporting_not_supported": "Teleporting Not Supported", + "tag.fluid.c.beetroot_soup": "Beetroot Soup", + "tag.fluid.c.gaseous": "Gaseous", + "tag.fluid.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.fluid.c.honey": "Honey", + "tag.fluid.c.lava": "Lava", + "tag.fluid.c.milk": "Milk", + "tag.fluid.c.mushroom_stew": "Mushroom Stew", + "tag.fluid.c.potion": "Potion", + "tag.fluid.c.rabbit_stew": "Rabbit Stew", + "tag.fluid.c.suspicious_stew": "Suspicious Stew", + "tag.fluid.c.water": "Water", + "tag.item.c.armors": "Armors", + "tag.item.c.barrels": "Barrels", + "tag.item.c.barrels.wooden": "Wooden Barrels", + "tag.item.c.bones": "Bones", + "tag.item.c.bookshelves": "Bookshelves", + "tag.item.c.bricks": "Bricks", + "tag.item.c.bricks.nether": "Nether Bricks", + "tag.item.c.bricks.normal": "Normal Bricks", + "tag.item.c.budding_blocks": "Budding Blocks", + "tag.item.c.buds": "Buds", + "tag.item.c.chains": "Chains", + "tag.item.c.chests": "Chests", + "tag.item.c.chests.ender": "Ender Chests", + "tag.item.c.chests.trapped": "Trapped Chests", + "tag.item.c.chests.wooden": "Wooden Chests", + "tag.item.c.clusters": "Clusters", + "tag.item.c.cobblestones": "Cobblestones", + "tag.item.c.cobblestones.deepslate": "Deepslate Cobblestones", + "tag.item.c.cobblestones.infested": "Infested Cobblestones", + "tag.item.c.cobblestones.mossy": "Mossy Cobblestones", + "tag.item.c.cobblestones.normal": "Normal Cobblestones", + "tag.item.c.crops": "Crops", + "tag.item.c.crops.beetroot": "Beetroot Crops", + "tag.item.c.crops.carrot": "Carrot Crops", + "tag.item.c.crops.nether_wart": "Nether Wart Crops", + "tag.item.c.crops.potato": "Potato Crops", + "tag.item.c.crops.wheat": "Wheat Crops", + "tag.item.c.dusts": "Dusts", + "tag.item.c.dusts.glowstone": "Glowstone Dusts", + "tag.item.c.dusts.redstone": "Redstone Dusts", + "tag.item.c.dyed": "Dyed Items", + "tag.item.c.dyed.black": "Black Dyed Items", + "tag.item.c.dyed.blue": "Blue Dyed Items", + "tag.item.c.dyed.brown": "Brown Dyed Items", + "tag.item.c.dyed.cyan": "Cyan Dyed Items", + "tag.item.c.dyed.gray": "Gray Dyed Items", + "tag.item.c.dyed.green": "Green Dyed Items", + "tag.item.c.dyed.light_blue": "Light_blue Dyed Items", + "tag.item.c.dyed.light_gray": "Light_gray Dyed Items", + "tag.item.c.dyed.lime": "Lime Dyed Items", + "tag.item.c.dyed.magenta": "Magenta Dyed Items", + "tag.item.c.dyed.orange": "Orange Dyed Items", + "tag.item.c.dyed.pink": "Pink Dyed Items", + "tag.item.c.dyed.purple": "Purple Dyed Items", + "tag.item.c.dyed.red": "Red Dyed Items", + "tag.item.c.dyed.white": "White Dyed Items", + "tag.item.c.dyed.yellow": "Yellow Dyed Items", + "tag.item.c.eggs": "Eggs", + "tag.item.c.enchantables": "Enchantables", + "tag.item.c.end_stones": "End Stones", + "tag.item.c.ender_pearls": "Ender Pearls", + "tag.item.c.feathers": "Feathers", + "tag.item.c.fence_gates": "Fence Gates", + "tag.item.c.fence_gates.wooden": "Wooden Fence Gates", + "tag.item.c.fences": "Fences", + "tag.item.c.fences.nether_brick": "Nether Brick Fences", + "tag.item.c.fences.wooden": "Wooden Fences", + "tag.item.c.foods": "Foods", + "tag.item.c.foods.berries": "Berries", + "tag.item.c.foods.breads": "Breads", + "tag.item.c.foods.candies": "Candies", + "tag.item.c.foods.cooked_fishes": "Cooked Fishes", + "tag.item.c.foods.cooked_meats": "Cooked Meats", + "tag.item.c.foods.cookies": "Cookies", + "tag.item.c.foods.edible_when_placed": "Edible When Placed", + "tag.item.c.foods.food_poisoning": "Food Poisoning Foods", + "tag.item.c.foods.fruits": "Fruits", + "tag.item.c.foods.raw_fishes": "Raw Fishes", + "tag.item.c.foods.raw_meats": "Raw Meats", + "tag.item.c.foods.soups": "Soups", + "tag.item.c.foods.vegetables": "Vegetables", + "tag.item.c.gems": "Gems", + "tag.item.c.gems.amethyst": "Amethyst Gems", + "tag.item.c.gems.diamond": "Diamond Gems", + "tag.item.c.gems.emerald": "Emerald Gems", + "tag.item.c.gems.lapis": "Lapis Gems", + "tag.item.c.gems.prismarine": "Prismarine Gems", + "tag.item.c.gems.quartz": "Quartz Gems", + "tag.item.c.glass_blocks": "Glass Blocks", + "tag.item.c.glass_blocks.cheap": "Cheap Glass Blocks", + "tag.item.c.glass_blocks.colorless": "Colorless Glass Blocks", + "tag.item.c.glass_blocks.tinted": "Tinted Glass Blocks", + "tag.item.c.glass_panes": "Glass Panes", + "tag.item.c.glass_panes.colorless": "Colorless Glass Panes", + "tag.item.c.gravel": "Gravels", + "tag.item.c.gunpowder": "Gunpowders", + "tag.item.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.item.c.ingots": "Ingots", + "tag.item.c.ingots.copper": "Copper Ingots", + "tag.item.c.ingots.gold": "Gold Ingots", + "tag.item.c.ingots.iron": "Iron Ingots", + "tag.item.c.ingots.netherite": "Netherite Ingots", + "tag.item.c.leather": "Leathers", + "tag.item.c.mushrooms": "Mushrooms", + "tag.item.c.nether_stars": "Nether Stars", + "tag.item.c.netherrack": "Netherracks", + "tag.item.c.nuggets": "Nuggets", + "tag.item.c.nuggets.gold": "Gold Nuggets", + "tag.item.c.nuggets.iron": "Iron Nuggets", + "tag.item.c.obsidians": "Obsidians", + "tag.item.c.ore_bearing_ground.deepslate": "Deepslate Ore Bearing Ground", + "tag.item.c.ore_bearing_ground.netherrack": "Netherrack Ore Bearing Ground", + "tag.item.c.ore_bearing_ground.stone": "Stone Ore Bearing Ground", + "tag.item.c.ore_rates.dense": "Dense Ore Rates", + "tag.item.c.ore_rates.singular": "Singular Ore Rates", + "tag.item.c.ore_rates.sparse": "Sparse Ore Rates", + "tag.item.c.ores": "Ores", + "tag.item.c.ores.coal": "Coal Ores", + "tag.item.c.ores.copper": "Copper Ores", + "tag.item.c.ores.diamond": "Diamond Ores", + "tag.item.c.ores.emerald": "Emerald Ores", + "tag.item.c.ores.gold": "Gold Ores", + "tag.item.c.ores.iron": "Iron Ores", + "tag.item.c.ores.lapis": "Lapis Ores", + "tag.item.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.item.c.ores.quartz": "Quartz Ores", + "tag.item.c.ores.redstone": "Redstone Ores", + "tag.item.c.ores_in_ground.deepslate": "Deepslate Ores In Ground", + "tag.item.c.ores_in_ground.netherrack": "Netherrack Ores In Ground", + "tag.item.c.ores_in_ground.stone": "Stone Ores In Ground", + "tag.item.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.item.c.player_workstations.furnaces": "Furnaces", + "tag.item.c.raw_blocks": "Raw Blocks", + "tag.item.c.raw_blocks.copper": "Copper Raw Blocks", + "tag.item.c.raw_blocks.gold": "Gold Raw Blocks", + "tag.item.c.raw_blocks.iron": "Iron Raw Blocks", + "tag.item.c.raw_materials": "Raw Materials", + "tag.item.c.raw_materials.copper": "Copper Raw Materials", + "tag.item.c.raw_materials.gold": "Gold Raw Materials", + "tag.item.c.raw_materials.iron": "Iron Raw Materials", + "tag.item.c.rods": "Rods", + "tag.item.c.rods.blaze": "Blaze Rods", + "tag.item.c.rods.breeze": "Breeze Rods", + "tag.item.c.rods.wooden": "Wooden Rods", + "tag.item.c.ropes": "Ropes", + "tag.item.c.sands": "Sands", + "tag.item.c.sands.colorless": "Colorless Sands", + "tag.item.c.sands.red": "Red Sands", + "tag.item.c.sandstone.blocks": "Sandstone Blocks", + "tag.item.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.item.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.item.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.item.c.sandstone.slabs": "Sandstone Slabs", + "tag.item.c.sandstone.stairs": "Sandstone Stairs", + "tag.item.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.item.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.item.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.item.c.seeds": "Seeds", + "tag.item.c.seeds.beetroot": "Beetroot Seeds", + "tag.item.c.seeds.melon": "Melon Seeds", + "tag.item.c.seeds.pumpkin": "Pumpkin Seeds", + "tag.item.c.seeds.wheat": "Wheat Seeds", + "tag.item.c.slimeballs": "Slimeballs", + "tag.item.c.stones": "Stones", + "tag.item.c.storage_blocks": "Storage Blocks", + "tag.item.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.item.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.item.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.item.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.item.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.item.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.item.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.item.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.item.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.item.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.item.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.item.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.item.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.item.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.item.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.item.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.item.c.strings": "Strings", + "tag.item.c.tools": "Tools", + "tag.item.c.tools.bows": "Bows", + "tag.item.c.tools.brushes": "Brushes", + "tag.item.c.tools.crossbows": "Crossbows", + "tag.item.c.tools.fishing_rods": "Fishing Rods", + "tag.item.c.tools.shears": "Shears", + "tag.item.c.tools.shields": "Shields", + "tag.item.c.tools.spears": "Spears", + "tag.item.neoforge.enchanting_fuels": "Enchanting Fuels", + "tag.worldgen.biome.c.hidden_from_locator_selection": "Hidden From Locator's Selection", + "tag.worldgen.biome.c.is_aquatic": "Aquatic", + "tag.worldgen.biome.c.is_aquatic_icy": "Aquatic Icy", + "tag.worldgen.biome.c.is_badlands": "Badlands", + "tag.worldgen.biome.c.is_beach": "Beach", + "tag.worldgen.biome.c.is_birch_forest": "Birch Forest", + "tag.worldgen.biome.c.is_cave": "Caves", + "tag.worldgen.biome.c.is_cold": "Cold", + "tag.worldgen.biome.c.is_cold.end": "Cold End", + "tag.worldgen.biome.c.is_cold.nether": "Cold Nether", + "tag.worldgen.biome.c.is_cold.overworld": "Cold Overworld", + "tag.worldgen.biome.c.is_dead": "Dead", + "tag.worldgen.biome.c.is_deep_ocean": "Deep Ocean", + "tag.worldgen.biome.c.is_dense_vegetation": "Dense Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.end": "Dense End Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.nether": "Dense Nether Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.overworld": "Dense Overworld Vegetation", + "tag.worldgen.biome.c.is_desert": "Deserts", + "tag.worldgen.biome.c.is_dry": "Dry", + "tag.worldgen.biome.c.is_dry.end": "Dry End", + "tag.worldgen.biome.c.is_dry.nether": "Dry Nether", + "tag.worldgen.biome.c.is_dry.overworld": "Dry Overworld", + "tag.worldgen.biome.c.is_end": "Is End", + "tag.worldgen.biome.c.is_floral": "Floral", + "tag.worldgen.biome.c.is_flower_forest": "Flower Forest", + "tag.worldgen.biome.c.is_forest": "Forest", + "tag.worldgen.biome.c.is_hill": "Hills", + "tag.worldgen.biome.c.is_hot": "Hot", + "tag.worldgen.biome.c.is_hot.end": "Hot End", + "tag.worldgen.biome.c.is_hot.nether": "Hot Nether", + "tag.worldgen.biome.c.is_hot.overworld": "Hot Overworld", + "tag.worldgen.biome.c.is_icy": "Icy", + "tag.worldgen.biome.c.is_jungle": "Jungle", + "tag.worldgen.biome.c.is_lush": "Lush", + "tag.worldgen.biome.c.is_magical": "Magical", + "tag.worldgen.biome.c.is_modified": "Modified", + "tag.worldgen.biome.c.is_mountain": "Mountains", + "tag.worldgen.biome.c.is_mountain.peak": "Peaks", + "tag.worldgen.biome.c.is_mountain.slope": "Slopes", + "tag.worldgen.biome.c.is_mushroom": "Mushrooms", + "tag.worldgen.biome.c.is_nether": "Is Nether", + "tag.worldgen.biome.c.is_nether_forest": "Nether Forest", + "tag.worldgen.biome.c.is_ocean": "Ocean", + "tag.worldgen.biome.c.is_old_growth": "Old Growth", + "tag.worldgen.biome.c.is_outer_end_island": "Outer End Island", + "tag.worldgen.biome.c.is_overworld": "Is Overworld", + "tag.worldgen.biome.c.is_plains": "Plains", + "tag.worldgen.biome.c.is_plateau": "Plateaus", + "tag.worldgen.biome.c.is_rare": "Rare", + "tag.worldgen.biome.c.is_river": "River", + "tag.worldgen.biome.c.is_sandy": "Sandy", + "tag.worldgen.biome.c.is_savanna": "Savanna", + "tag.worldgen.biome.c.is_shallow_ocean": "Shallow Ocean", + "tag.worldgen.biome.c.is_snowy": "Snowy", + "tag.worldgen.biome.c.is_snowy_plains": "Snowy Plains", + "tag.worldgen.biome.c.is_sparse_vegetation": "Sparse Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.end": "Sparse End Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.nether": "Sparse Nether Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.overworld": "Sparse Overworld Vegetation", + "tag.worldgen.biome.c.is_spooky": "Spooky", + "tag.worldgen.biome.c.is_stony_shores": "Stony Shores", + "tag.worldgen.biome.c.is_swamp": "Swamps", + "tag.worldgen.biome.c.is_taiga": "Taiga", + "tag.worldgen.biome.c.is_tree.coniferous": "Coniferous Trees", + "tag.worldgen.biome.c.is_tree.deciduous": "Deciduous Trees", + "tag.worldgen.biome.c.is_tree.jungle": "Jungle Trees", + "tag.worldgen.biome.c.is_tree.savanna": "Savanna Trees", + "tag.worldgen.biome.c.is_underground": "Underground", + "tag.worldgen.biome.c.is_void": "Voids", + "tag.worldgen.biome.c.is_wasteland": "Wastelands", + "tag.worldgen.biome.c.is_wet": "Wet", + "tag.worldgen.biome.c.is_wet.end": "Wet End", + "tag.worldgen.biome.c.is_wet.nether": "Wet Nether", + "tag.worldgen.biome.c.is_wet.overworld": "Wet Overworld", + "tag.worldgen.biome.c.is_windswept": "Windswept", + "tag.worldgen.biome.c.no_default_monsters": "No Default Monsters", + "tag.worldgen.structure.c.hidden_from_displayers": "Hidden From Displayers", + "tag.worldgen.structure.c.hidden_from_locator_selection": "Hidden From Locator's Selection" +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/barrels.json b/src/generated/resources/data/c/tags/blocks/barrels.json new file mode 100644 index 0000000000..94bded15d8 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/barrels.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:barrels/wooden", + { + "id": "#forge:barrels", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/barrels/wooden.json b/src/generated/resources/data/c/tags/blocks/barrels/wooden.json new file mode 100644 index 0000000000..fedbc8ac53 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/barrels/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:barrel", + { + "id": "#forge:barrels/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/bookshelves.json b/src/generated/resources/data/c/tags/blocks/bookshelves.json new file mode 100644 index 0000000000..68f756dba9 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/bookshelves.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bookshelf", + { + "id": "#forge:bookshelves", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/budding_blocks.json b/src/generated/resources/data/c/tags/blocks/budding_blocks.json new file mode 100644 index 0000000000..86257651e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/budding_blocks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:budding_amethyst" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/buds.json b/src/generated/resources/data/c/tags/blocks/buds.json new file mode 100644 index 0000000000..708568317e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/buds.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:small_amethyst_bud", + "minecraft:medium_amethyst_bud", + "minecraft:large_amethyst_bud" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chains.json b/src/generated/resources/data/c/tags/blocks/chains.json new file mode 100644 index 0000000000..63bbe5b427 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chains.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:chain" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests.json b/src/generated/resources/data/c/tags/blocks/chests.json new file mode 100644 index 0000000000..b6a2b0d0fa --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden", + { + "id": "#forge:chests", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/ender.json b/src/generated/resources/data/c/tags/blocks/chests/ender.json new file mode 100644 index 0000000000..1e652bcf24 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/ender.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_chest", + { + "id": "#forge:chests/ender", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/trapped.json b/src/generated/resources/data/c/tags/blocks/chests/trapped.json new file mode 100644 index 0000000000..d0d8da248b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/trapped.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trapped_chest", + { + "id": "#forge:chests/trapped", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/wooden.json b/src/generated/resources/data/c/tags/blocks/chests/wooden.json new file mode 100644 index 0000000000..0659e860e6 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/wooden.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:chest", + "minecraft:trapped_chest", + { + "id": "#forge:chests/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/clusters.json b/src/generated/resources/data/c/tags/blocks/clusters.json new file mode 100644 index 0000000000..bf57e5f90d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/clusters.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:amethyst_cluster" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones.json b/src/generated/resources/data/c/tags/blocks/cobblestones.json new file mode 100644 index 0000000000..b3c480393c --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate", + { + "id": "#forge:cobblestone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json b/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json new file mode 100644 index 0000000000..34e7d23b82 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobbled_deepslate", + { + "id": "#forge:cobblestone/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json b/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json new file mode 100644 index 0000000000..2752247f3a --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:infested_cobblestone", + { + "id": "#forge:cobblestone/infested", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json b/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json new file mode 100644 index 0000000000..9a2e19c569 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mossy_cobblestone", + { + "id": "#forge:cobblestone/mossy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json b/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json new file mode 100644 index 0000000000..6cebee9d29 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobblestone", + { + "id": "#forge:cobblestone/normal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed.json b/src/generated/resources/data/c/tags/blocks/dyed.json new file mode 100644 index 0000000000..ad4584578d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyed/white", + "#c:dyed/orange", + "#c:dyed/magenta", + "#c:dyed/light_blue", + "#c:dyed/yellow", + "#c:dyed/lime", + "#c:dyed/pink", + "#c:dyed/gray", + "#c:dyed/light_gray", + "#c:dyed/cyan", + "#c:dyed/purple", + "#c:dyed/blue", + "#c:dyed/brown", + "#c:dyed/green", + "#c:dyed/red", + "#c:dyed/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/black.json b/src/generated/resources/data/c/tags/blocks/dyed/black.json new file mode 100644 index 0000000000..52e29dcd46 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/black.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:black_banner", + "minecraft:black_bed", + "minecraft:black_candle", + "minecraft:black_carpet", + "minecraft:black_concrete", + "minecraft:black_concrete_powder", + "minecraft:black_glazed_terracotta", + "minecraft:black_shulker_box", + "minecraft:black_stained_glass", + "minecraft:black_stained_glass_pane", + "minecraft:black_terracotta", + "minecraft:black_wall_banner", + "minecraft:black_wool", + { + "id": "#forge:glass/black", + "required": false + }, + { + "id": "#forge:stained_glass/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/blue.json b/src/generated/resources/data/c/tags/blocks/dyed/blue.json new file mode 100644 index 0000000000..aa6f32d07c --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/blue.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:blue_banner", + "minecraft:blue_bed", + "minecraft:blue_candle", + "minecraft:blue_carpet", + "minecraft:blue_concrete", + "minecraft:blue_concrete_powder", + "minecraft:blue_glazed_terracotta", + "minecraft:blue_shulker_box", + "minecraft:blue_stained_glass", + "minecraft:blue_stained_glass_pane", + "minecraft:blue_terracotta", + "minecraft:blue_wall_banner", + "minecraft:blue_wool", + { + "id": "#forge:glass/blue", + "required": false + }, + { + "id": "#forge:stained_glass/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/brown.json b/src/generated/resources/data/c/tags/blocks/dyed/brown.json new file mode 100644 index 0000000000..94d1d0a7c7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/brown.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:brown_banner", + "minecraft:brown_bed", + "minecraft:brown_candle", + "minecraft:brown_carpet", + "minecraft:brown_concrete", + "minecraft:brown_concrete_powder", + "minecraft:brown_glazed_terracotta", + "minecraft:brown_shulker_box", + "minecraft:brown_stained_glass", + "minecraft:brown_stained_glass_pane", + "minecraft:brown_terracotta", + "minecraft:brown_wall_banner", + "minecraft:brown_wool", + { + "id": "#forge:glass/brown", + "required": false + }, + { + "id": "#forge:stained_glass/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/cyan.json b/src/generated/resources/data/c/tags/blocks/dyed/cyan.json new file mode 100644 index 0000000000..b67187d66d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/cyan.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:cyan_banner", + "minecraft:cyan_bed", + "minecraft:cyan_candle", + "minecraft:cyan_carpet", + "minecraft:cyan_concrete", + "minecraft:cyan_concrete_powder", + "minecraft:cyan_glazed_terracotta", + "minecraft:cyan_shulker_box", + "minecraft:cyan_stained_glass", + "minecraft:cyan_stained_glass_pane", + "minecraft:cyan_terracotta", + "minecraft:cyan_wall_banner", + "minecraft:cyan_wool", + { + "id": "#forge:glass/cyan", + "required": false + }, + { + "id": "#forge:stained_glass/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/gray.json b/src/generated/resources/data/c/tags/blocks/dyed/gray.json new file mode 100644 index 0000000000..172655a1a5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/gray.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:gray_banner", + "minecraft:gray_bed", + "minecraft:gray_candle", + "minecraft:gray_carpet", + "minecraft:gray_concrete", + "minecraft:gray_concrete_powder", + "minecraft:gray_glazed_terracotta", + "minecraft:gray_shulker_box", + "minecraft:gray_stained_glass", + "minecraft:gray_stained_glass_pane", + "minecraft:gray_terracotta", + "minecraft:gray_wall_banner", + "minecraft:gray_wool", + { + "id": "#forge:glass/gray", + "required": false + }, + { + "id": "#forge:stained_glass/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/green.json b/src/generated/resources/data/c/tags/blocks/dyed/green.json new file mode 100644 index 0000000000..12dd3904fc --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/green.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:green_banner", + "minecraft:green_bed", + "minecraft:green_candle", + "minecraft:green_carpet", + "minecraft:green_concrete", + "minecraft:green_concrete_powder", + "minecraft:green_glazed_terracotta", + "minecraft:green_shulker_box", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass_pane", + "minecraft:green_terracotta", + "minecraft:green_wall_banner", + "minecraft:green_wool", + { + "id": "#forge:glass/green", + "required": false + }, + { + "id": "#forge:stained_glass/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json b/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json new file mode 100644 index 0000000000..ce884b573d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:light_blue_banner", + "minecraft:light_blue_bed", + "minecraft:light_blue_candle", + "minecraft:light_blue_carpet", + "minecraft:light_blue_concrete", + "minecraft:light_blue_concrete_powder", + "minecraft:light_blue_glazed_terracotta", + "minecraft:light_blue_shulker_box", + "minecraft:light_blue_stained_glass", + "minecraft:light_blue_stained_glass_pane", + "minecraft:light_blue_terracotta", + "minecraft:light_blue_wall_banner", + "minecraft:light_blue_wool", + { + "id": "#forge:glass/light_blue", + "required": false + }, + { + "id": "#forge:stained_glass/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json b/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json new file mode 100644 index 0000000000..439c12aec8 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:light_gray_banner", + "minecraft:light_gray_bed", + "minecraft:light_gray_candle", + "minecraft:light_gray_carpet", + "minecraft:light_gray_concrete", + "minecraft:light_gray_concrete_powder", + "minecraft:light_gray_glazed_terracotta", + "minecraft:light_gray_shulker_box", + "minecraft:light_gray_stained_glass", + "minecraft:light_gray_stained_glass_pane", + "minecraft:light_gray_terracotta", + "minecraft:light_gray_wall_banner", + "minecraft:light_gray_wool", + { + "id": "#forge:glass/light_gray", + "required": false + }, + { + "id": "#forge:stained_glass/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/lime.json b/src/generated/resources/data/c/tags/blocks/dyed/lime.json new file mode 100644 index 0000000000..17e5b7ddf5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/lime.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:lime_banner", + "minecraft:lime_bed", + "minecraft:lime_candle", + "minecraft:lime_carpet", + "minecraft:lime_concrete", + "minecraft:lime_concrete_powder", + "minecraft:lime_glazed_terracotta", + "minecraft:lime_shulker_box", + "minecraft:lime_stained_glass", + "minecraft:lime_stained_glass_pane", + "minecraft:lime_terracotta", + "minecraft:lime_wall_banner", + "minecraft:lime_wool", + { + "id": "#forge:glass/lime", + "required": false + }, + { + "id": "#forge:stained_glass/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/magenta.json b/src/generated/resources/data/c/tags/blocks/dyed/magenta.json new file mode 100644 index 0000000000..f833d1210a --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/magenta.json @@ -0,0 +1,33 @@ +{ + "values": [ + "minecraft:magenta_banner", + "minecraft:magenta_bed", + "minecraft:magenta_candle", + "minecraft:magenta_carpet", + "minecraft:magenta_concrete", + "minecraft:magenta_concrete_powder", + "minecraft:magenta_glazed_terracotta", + "minecraft:magenta_shulker_box", + "minecraft:magenta_stained_glass", + "minecraft:magenta_stained_glass_pane", + "minecraft:magenta_terracotta", + "minecraft:magenta_wall_banner", + "minecraft:magenta_wool", + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + }, + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/orange.json b/src/generated/resources/data/c/tags/blocks/dyed/orange.json new file mode 100644 index 0000000000..20076162d7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/orange.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:orange_banner", + "minecraft:orange_bed", + "minecraft:orange_candle", + "minecraft:orange_carpet", + "minecraft:orange_concrete", + "minecraft:orange_concrete_powder", + "minecraft:orange_glazed_terracotta", + "minecraft:orange_shulker_box", + "minecraft:orange_stained_glass", + "minecraft:orange_stained_glass_pane", + "minecraft:orange_terracotta", + "minecraft:orange_wall_banner", + "minecraft:orange_wool", + { + "id": "#forge:glass/orange", + "required": false + }, + { + "id": "#forge:stained_glass/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/pink.json b/src/generated/resources/data/c/tags/blocks/dyed/pink.json new file mode 100644 index 0000000000..f9bdfe6c02 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/pink.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:pink_banner", + "minecraft:pink_bed", + "minecraft:pink_candle", + "minecraft:pink_carpet", + "minecraft:pink_concrete", + "minecraft:pink_concrete_powder", + "minecraft:pink_glazed_terracotta", + "minecraft:pink_shulker_box", + "minecraft:pink_stained_glass", + "minecraft:pink_stained_glass_pane", + "minecraft:pink_terracotta", + "minecraft:pink_wall_banner", + "minecraft:pink_wool", + { + "id": "#forge:glass/pink", + "required": false + }, + { + "id": "#forge:stained_glass/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/purple.json b/src/generated/resources/data/c/tags/blocks/dyed/purple.json new file mode 100644 index 0000000000..8d443e3a8b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/purple.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:purple_banner", + "minecraft:purple_bed", + "minecraft:purple_candle", + "minecraft:purple_carpet", + "minecraft:purple_concrete", + "minecraft:purple_concrete_powder", + "minecraft:purple_glazed_terracotta", + "minecraft:purple_shulker_box", + "minecraft:purple_stained_glass", + "minecraft:purple_stained_glass_pane", + "minecraft:purple_terracotta", + "minecraft:purple_wall_banner", + "minecraft:purple_wool", + { + "id": "#forge:glass/purple", + "required": false + }, + { + "id": "#forge:stained_glass/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/red.json b/src/generated/resources/data/c/tags/blocks/dyed/red.json new file mode 100644 index 0000000000..88ae73f677 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/red.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:red_banner", + "minecraft:red_bed", + "minecraft:red_candle", + "minecraft:red_carpet", + "minecraft:red_concrete", + "minecraft:red_concrete_powder", + "minecraft:red_glazed_terracotta", + "minecraft:red_shulker_box", + "minecraft:red_stained_glass", + "minecraft:red_stained_glass_pane", + "minecraft:red_terracotta", + "minecraft:red_wall_banner", + "minecraft:red_wool", + { + "id": "#forge:glass/red", + "required": false + }, + { + "id": "#forge:stained_glass/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/white.json b/src/generated/resources/data/c/tags/blocks/dyed/white.json new file mode 100644 index 0000000000..86c2a01789 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/white.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:white_banner", + "minecraft:white_bed", + "minecraft:white_candle", + "minecraft:white_carpet", + "minecraft:white_concrete", + "minecraft:white_concrete_powder", + "minecraft:white_glazed_terracotta", + "minecraft:white_shulker_box", + "minecraft:white_stained_glass", + "minecraft:white_stained_glass_pane", + "minecraft:white_terracotta", + "minecraft:white_wall_banner", + "minecraft:white_wool", + { + "id": "#forge:glass/white", + "required": false + }, + { + "id": "#forge:stained_glass/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/yellow.json b/src/generated/resources/data/c/tags/blocks/dyed/yellow.json new file mode 100644 index 0000000000..31711d5459 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/yellow.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:yellow_banner", + "minecraft:yellow_bed", + "minecraft:yellow_candle", + "minecraft:yellow_carpet", + "minecraft:yellow_concrete", + "minecraft:yellow_concrete_powder", + "minecraft:yellow_glazed_terracotta", + "minecraft:yellow_shulker_box", + "minecraft:yellow_stained_glass", + "minecraft:yellow_stained_glass_pane", + "minecraft:yellow_terracotta", + "minecraft:yellow_wall_banner", + "minecraft:yellow_wool", + { + "id": "#forge:glass/yellow", + "required": false + }, + { + "id": "#forge:stained_glass/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/end_stones.json b/src/generated/resources/data/c/tags/blocks/end_stones.json new file mode 100644 index 0000000000..aa227f8a3b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/end_stones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:end_stone", + { + "id": "#forge:end_stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fence_gates.json b/src/generated/resources/data/c/tags/blocks/fence_gates.json new file mode 100644 index 0000000000..56c90931cc --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fence_gates.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:fence_gates/wooden", + { + "id": "#forge:fence_gates", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json b/src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json similarity index 76% rename from src/generated/resources/data/forge/tags/items/fence_gates/wooden.json rename to src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json index 88a130fa50..db55cb84ed 100644 --- a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json +++ b/src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json @@ -10,6 +10,10 @@ "minecraft:warped_fence_gate", "minecraft:mangrove_fence_gate", "minecraft:bamboo_fence_gate", - "minecraft:cherry_fence_gate" + "minecraft:cherry_fence_gate", + { + "id": "#forge:fence_gates/wooden", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences.json b/src/generated/resources/data/c/tags/blocks/fences.json new file mode 100644 index 0000000000..1e79564ade --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden", + { + "id": "#forge:fences", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json b/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json new file mode 100644 index 0000000000..30a88aea36 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick_fence", + { + "id": "#forge:fences/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences/wooden.json b/src/generated/resources/data/c/tags/blocks/fences/wooden.json new file mode 100644 index 0000000000..bf67fa132e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:wooden_fences", + { + "id": "#forge:fences/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stained_glass.json b/src/generated/resources/data/c/tags/blocks/glass_blocks.json similarity index 75% rename from src/generated/resources/data/forge/tags/items/stained_glass.json rename to src/generated/resources/data/c/tags/blocks/glass_blocks.json index 2db7aef9df..311aa195ce 100644 --- a/src/generated/resources/data/forge/tags/items/stained_glass.json +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks.json @@ -1,5 +1,8 @@ { "values": [ + "#c:glass_blocks/colorless", + "#c:glass_blocks/cheap", + "#c:glass_blocks/tinted", "minecraft:white_stained_glass", "minecraft:orange_stained_glass", "minecraft:magenta_stained_glass", @@ -15,6 +18,10 @@ "minecraft:brown_stained_glass", "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:black_stained_glass" + "minecraft:black_stained_glass", + { + "id": "#forge:glass", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/silica.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json similarity index 80% rename from src/generated/resources/data/forge/tags/items/glass/silica.json rename to src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json index 74544c770d..016e4315ef 100644 --- a/src/generated/resources/data/forge/tags/items/glass/silica.json +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json @@ -1,21 +1,26 @@ { "values": [ "minecraft:glass", - "minecraft:black_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:green_stained_glass", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", "minecraft:light_blue_stained_glass", - "minecraft:light_gray_stained_glass", + "minecraft:yellow_stained_glass", "minecraft:lime_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:orange_stained_glass", "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:white_stained_glass", - "minecraft:yellow_stained_glass" + "minecraft:black_stained_glass", + { + "id": "#forge:glass_silica", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json new file mode 100644 index 0000000000..7d2e81b6c4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass", + { + "id": "#forge:glass_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json new file mode 100644 index 0000000000..0a7d0f3f00 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:tinted_glass", + { + "id": "#forge:glass_tinted", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json b/src/generated/resources/data/c/tags/blocks/glass_panes.json similarity index 95% rename from src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json rename to src/generated/resources/data/c/tags/blocks/glass_panes.json index 65f2adb8f9..c4bdf8ea3f 100644 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json +++ b/src/generated/resources/data/c/tags/blocks/glass_panes.json @@ -1,5 +1,6 @@ { "values": [ + "#c:glass_panes/colorless", "minecraft:white_stained_glass_pane", "minecraft:orange_stained_glass_pane", "minecraft:magenta_stained_glass_pane", diff --git a/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json b/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json new file mode 100644 index 0000000000..b7d7245a6a --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass_pane", + { + "id": "#forge:glass_panes_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/gravel.json b/src/generated/resources/data/c/tags/blocks/gravel.json new file mode 100644 index 0000000000..80440dd1d4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/gravel.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gravel", + { + "id": "#forge:gravel", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json b/src/generated/resources/data/c/tags/blocks/hidden_from_recipe_viewers.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json rename to src/generated/resources/data/c/tags/blocks/hidden_from_recipe_viewers.json diff --git a/src/generated/resources/data/c/tags/blocks/netherrack.json b/src/generated/resources/data/c/tags/blocks/netherrack.json new file mode 100644 index 0000000000..21c1554741 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/obsidians.json b/src/generated/resources/data/c/tags/blocks/obsidians.json new file mode 100644 index 0000000000..aa3315f6bf --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/obsidians.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:obsidian", + { + "id": "#forge:obsidian", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json new file mode 100644 index 0000000000..e3a9322797 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:deepslate", + { + "id": "#forge:ore_bearing_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json new file mode 100644 index 0000000000..d815611551 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:ore_bearing_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json new file mode 100644 index 0000000000..08d0efdfe5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stone", + { + "id": "#forge:ore_bearing_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json b/src/generated/resources/data/c/tags/blocks/ore_rates/dense.json similarity index 64% rename from src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json rename to src/generated/resources/data/c/tags/blocks/ore_rates/dense.json index 69cfa78343..ded4e6606a 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/dense.json @@ -5,6 +5,10 @@ "minecraft:deepslate_lapis_ore", "minecraft:deepslate_redstone_ore", "minecraft:lapis_ore", - "minecraft:redstone_ore" + "minecraft:redstone_ore", + { + "id": "#forge:ore_rates/dense", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json b/src/generated/resources/data/c/tags/blocks/ore_rates/singular.json similarity index 77% rename from src/generated/resources/data/forge/tags/items/ore_rates/singular.json rename to src/generated/resources/data/c/tags/blocks/ore_rates/singular.json index 79e0f4b9a7..3a2f12d573 100644 --- a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/singular.json @@ -11,6 +11,10 @@ "minecraft:emerald_ore", "minecraft:gold_ore", "minecraft:iron_ore", - "minecraft:nether_quartz_ore" + "minecraft:nether_quartz_ore", + { + "id": "#forge:ore_rates/singular", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json b/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json new file mode 100644 index 0000000000..349b1e3d4b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + { + "id": "#forge:ore_rates/sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores.json b/src/generated/resources/data/c/tags/blocks/ores.json new file mode 100644 index 0000000000..ffce3487be --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores.json @@ -0,0 +1,18 @@ +{ + "values": [ + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", + "#c:ores/netherite_scrap", + "#c:ores/redstone", + "#c:ores/quartz", + { + "id": "#forge:ores", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/coal.json b/src/generated/resources/data/c/tags/blocks/ores/coal.json new file mode 100644 index 0000000000..2e088c7241 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:coal_ores", + { + "id": "#forge:ores/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/copper.json b/src/generated/resources/data/c/tags/blocks/ores/copper.json new file mode 100644 index 0000000000..f51e56171f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:copper_ores", + { + "id": "#forge:ores/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/diamond.json b/src/generated/resources/data/c/tags/blocks/ores/diamond.json new file mode 100644 index 0000000000..3a595fe648 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:diamond_ores", + { + "id": "#forge:ores/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/emerald.json b/src/generated/resources/data/c/tags/blocks/ores/emerald.json new file mode 100644 index 0000000000..25ec90670f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:emerald_ores", + { + "id": "#forge:ores/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/gold.json b/src/generated/resources/data/c/tags/blocks/ores/gold.json new file mode 100644 index 0000000000..ab8f217a24 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:gold_ores", + { + "id": "#forge:ores/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/iron.json b/src/generated/resources/data/c/tags/blocks/ores/iron.json new file mode 100644 index 0000000000..12fed97a89 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:iron_ores", + { + "id": "#forge:ores/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/lapis.json b/src/generated/resources/data/c/tags/blocks/ores/lapis.json new file mode 100644 index 0000000000..4609a406dc --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:lapis_ores", + { + "id": "#forge:ores/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json b/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json new file mode 100644 index 0000000000..6cc208db8e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ancient_debris", + { + "id": "#forge:ores/netherite_scrap", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/quartz.json b/src/generated/resources/data/c/tags/blocks/ores/quartz.json new file mode 100644 index 0000000000..5433b2ed6f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/redstone.json b/src/generated/resources/data/c/tags/blocks/ores/redstone.json new file mode 100644 index 0000000000..42cb0fd1ee --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:redstone_ores", + { + "id": "#forge:ores/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json similarity index 69% rename from src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json rename to src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json index 13e0c38aa1..6b172a1533 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json @@ -7,6 +7,10 @@ "minecraft:deepslate_gold_ore", "minecraft:deepslate_iron_ore", "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore" + "minecraft:deepslate_redstone_ore", + { + "id": "#forge:ores_in_ground/deepslate", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json new file mode 100644 index 0000000000..83b110ef9e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores_in_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json similarity index 66% rename from src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json rename to src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json index 568fbe7cb6..97b26721ae 100644 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json @@ -7,6 +7,10 @@ "minecraft:gold_ore", "minecraft:iron_ore", "minecraft:lapis_ore", - "minecraft:redstone_ore" + "minecraft:redstone_ore", + { + "id": "#forge:ores_in_ground/stone", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json b/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json new file mode 100644 index 0000000000..3be1c8e22e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:crafting_table" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json b/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json new file mode 100644 index 0000000000..25edfef1ca --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:furnace" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json b/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json new file mode 100644 index 0000000000..0c0cf3a08f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json @@ -0,0 +1,12 @@ +{ + "values": [ + { + "id": "#forge:relocation_not_supported", + "required": false + }, + { + "id": "#forge:immovable", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ropes.json b/src/generated/resources/data/c/tags/blocks/ropes.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ropes.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands.json b/src/generated/resources/data/c/tags/blocks/sands.json new file mode 100644 index 0000000000..43eaac83ae --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red", + { + "id": "#forge:sand", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands/colorless.json b/src/generated/resources/data/c/tags/blocks/sands/colorless.json new file mode 100644 index 0000000000..93cdef191b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sand", + { + "id": "#forge:sand/colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands/red.json b/src/generated/resources/data/c/tags/blocks/sands/red.json new file mode 100644 index 0000000000..03eba73b12 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_sand", + { + "id": "#forge:sand/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json b/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json new file mode 100644 index 0000000000..5684db6caf --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sandstone/red_blocks", + "#c:sandstone/uncolored_blocks", + { + "id": "#forge:sandstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sandstone.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json similarity index 56% rename from src/generated/resources/data/forge/tags/blocks/sandstone.json rename to src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json index bb7fb03ee3..4e72ad44cd 100644 --- a/src/generated/resources/data/forge/tags/blocks/sandstone.json +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", "minecraft:red_sandstone", "minecraft:cut_red_sandstone", "minecraft:chiseled_red_sandstone", diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json new file mode 100644 index 0000000000..a586c49087 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:red_sandstone_slab", + "minecraft:cut_red_sandstone_slab", + "minecraft:smooth_red_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json new file mode 100644 index 0000000000..8778d5dbbd --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:red_sandstone_stairs", + "minecraft:smooth_red_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json new file mode 100644 index 0000000000..92bc3f3ed9 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_slabs", + "#c:sandstone/uncolored_slabs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json new file mode 100644 index 0000000000..673f168ddf --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_stairs", + "#c:sandstone/uncolored_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json new file mode 100644 index 0000000000..4e32539b4e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:sandstone", + "minecraft:cut_sandstone", + "minecraft:chiseled_sandstone", + "minecraft:smooth_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json new file mode 100644 index 0000000000..d830f1dc1e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:sandstone_slab", + "minecraft:cut_sandstone_slab", + "minecraft:smooth_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json new file mode 100644 index 0000000000..ddb4a27f87 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sandstone_stairs", + "minecraft:smooth_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/skulls.json b/src/generated/resources/data/c/tags/blocks/skulls.json new file mode 100644 index 0000000000..a9820b074f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/skulls.json @@ -0,0 +1,18 @@ +{ + "values": [ + "minecraft:skeleton_skull", + "minecraft:skeleton_wall_skull", + "minecraft:wither_skeleton_skull", + "minecraft:wither_skeleton_wall_skull", + "minecraft:player_head", + "minecraft:player_wall_head", + "minecraft:zombie_head", + "minecraft:zombie_wall_head", + "minecraft:creeper_head", + "minecraft:creeper_wall_head", + "minecraft:piglin_head", + "minecraft:piglin_wall_head", + "minecraft:dragon_head", + "minecraft:dragon_wall_head" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/stones.json b/src/generated/resources/data/c/tags/blocks/stones.json new file mode 100644 index 0000000000..820387926d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/stones.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:andesite", + "minecraft:diorite", + "minecraft:granite", + "minecraft:stone", + "minecraft:deepslate", + "minecraft:tuff", + { + "id": "#forge:stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks.json b/src/generated/resources/data/c/tags/blocks/storage_blocks.json new file mode 100644 index 0000000000..7bf4a38117 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks.json @@ -0,0 +1,24 @@ +{ + "values": [ + "#c:storage_blocks/bone_meal", + "#c:storage_blocks/coal", + "#c:storage_blocks/copper", + "#c:storage_blocks/diamond", + "#c:storage_blocks/dried_kelp", + "#c:storage_blocks/emerald", + "#c:storage_blocks/gold", + "#c:storage_blocks/iron", + "#c:storage_blocks/lapis", + "#c:storage_blocks/netherite", + "#c:storage_blocks/raw_copper", + "#c:storage_blocks/raw_gold", + "#c:storage_blocks/raw_iron", + "#c:storage_blocks/redstone", + "#c:storage_blocks/slime", + "#c:storage_blocks/wheat", + { + "id": "#forge:storage_blocks", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json new file mode 100644 index 0000000000..98ab24a213 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bone_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json new file mode 100644 index 0000000000..b8479ced38 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:coal_block", + { + "id": "#forge:storage_blocks/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json new file mode 100644 index 0000000000..acd2a6a7a4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_block", + { + "id": "#forge:storage_blocks/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json new file mode 100644 index 0000000000..76426ba425 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond_block", + { + "id": "#forge:storage_blocks/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json new file mode 100644 index 0000000000..2609656429 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:dried_kelp_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json new file mode 100644 index 0000000000..7a41454d94 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald_block", + { + "id": "#forge:storage_blocks/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json new file mode 100644 index 0000000000..a4116fc77f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_block", + { + "id": "#forge:storage_blocks/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json new file mode 100644 index 0000000000..f0e9fcca1f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_block", + { + "id": "#forge:storage_blocks/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json new file mode 100644 index 0000000000..b5f41d8d4e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_block", + { + "id": "#forge:storage_blocks/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json new file mode 100644 index 0000000000..a3dfe0d53c --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_block", + { + "id": "#forge:storage_blocks/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json new file mode 100644 index 0000000000..8f12fb63a7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper_block", + { + "id": "#forge:storage_blocks/raw_copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json new file mode 100644 index 0000000000..dcee1e225b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold_block", + { + "id": "#forge:storage_blocks/raw_gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json new file mode 100644 index 0000000000..3f0ecf27ad --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron_block", + { + "id": "#forge:storage_blocks/raw_iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json new file mode 100644 index 0000000000..49fa7a5a26 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone_block", + { + "id": "#forge:storage_blocks/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json new file mode 100644 index 0000000000..523bdc2835 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:slime_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json new file mode 100644 index 0000000000..ea92d03cb4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:hay_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/villager_job_sites.json b/src/generated/resources/data/c/tags/blocks/villager_job_sites.json new file mode 100644 index 0000000000..859c128fce --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/villager_job_sites.json @@ -0,0 +1,20 @@ +{ + "values": [ + "minecraft:barrel", + "minecraft:blast_furnace", + "minecraft:brewing_stand", + "minecraft:cartography_table", + "minecraft:cauldron", + "minecraft:water_cauldron", + "minecraft:lava_cauldron", + "minecraft:powder_snow_cauldron", + "minecraft:composter", + "minecraft:fletching_table", + "minecraft:grindstone", + "minecraft:lectern", + "minecraft:loom", + "minecraft:smithing_table", + "minecraft:smoker", + "minecraft:stonecutter" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json new file mode 100644 index 0000000000..18527f1e0f --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:feather_falling", + "minecraft:frost_walker" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json new file mode 100644 index 0000000000..2af6d192e6 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:protection", + "minecraft:blast_protection", + "minecraft:projectile_protection", + "minecraft:fire_protection", + "minecraft:respiration", + "minecraft:feather_falling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json new file mode 100644 index 0000000000..fee12e5ec3 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:soul_speed", + "minecraft:swift_sneak", + "minecraft:depth_strider" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json b/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json new file mode 100644 index 0000000000..05cde351be --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:fortune" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json b/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json new file mode 100644 index 0000000000..4e9fde0588 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:looting" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json b/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json new file mode 100644 index 0000000000..c60666e389 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sharpness", + "minecraft:smite", + "minecraft:bane_of_arthropods", + "minecraft:power", + "minecraft:impaling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/boats.json b/src/generated/resources/data/c/tags/entity_types/boats.json new file mode 100644 index 0000000000..58e89216d1 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/boats.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:boat", + "minecraft:chest_boat", + { + "id": "#forge:boats", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/bosses.json b/src/generated/resources/data/c/tags/entity_types/bosses.json new file mode 100644 index 0000000000..5b52cfe527 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/bosses.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:ender_dragon", + "minecraft:wither", + { + "id": "#forge:bosses", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json b/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/minecarts.json b/src/generated/resources/data/c/tags/entity_types/minecarts.json new file mode 100644 index 0000000000..6b7fe052ea --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/minecarts.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:minecart", + "minecraft:chest_minecart", + "minecraft:furnace_minecart", + "minecraft:hopper_minecart", + "minecraft:spawner_minecart", + "minecraft:tnt_minecart", + "minecraft:command_block_minecart", + { + "id": "#forge:minecarts", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json b/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/beetroot_soup.json b/src/generated/resources/data/c/tags/fluids/beetroot_soup.json new file mode 100644 index 0000000000..df5cf20259 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/beetroot_soup.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:beetroot_soup", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/gaseous.json b/src/generated/resources/data/c/tags/fluids/gaseous.json new file mode 100644 index 0000000000..37a9047e11 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/gaseous.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:gaseous", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json b/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/honey.json b/src/generated/resources/data/c/tags/fluids/honey.json new file mode 100644 index 0000000000..5b2fe217e2 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/honey.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:honey", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/lava.json b/src/generated/resources/data/c/tags/fluids/lava.json new file mode 100644 index 0000000000..c4953e87f1 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/lava.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:lava", + "minecraft:flowing_lava" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/fluids/milk.json b/src/generated/resources/data/c/tags/fluids/milk.json similarity index 71% rename from src/generated/resources/data/forge/tags/fluids/milk.json rename to src/generated/resources/data/c/tags/fluids/milk.json index 3bab1951b3..5e27201a7e 100644 --- a/src/generated/resources/data/forge/tags/fluids/milk.json +++ b/src/generated/resources/data/c/tags/fluids/milk.json @@ -7,6 +7,10 @@ { "id": "minecraft:flowing_milk", "required": false + }, + { + "id": "#forge:milk", + "required": false } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/mushroom_stew.json b/src/generated/resources/data/c/tags/fluids/mushroom_stew.json new file mode 100644 index 0000000000..7f40246aad --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/mushroom_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:mushroom_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/potion.json b/src/generated/resources/data/c/tags/fluids/potion.json new file mode 100644 index 0000000000..3c851413d4 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/potion.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:potion", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/rabbit_stew.json b/src/generated/resources/data/c/tags/fluids/rabbit_stew.json new file mode 100644 index 0000000000..fb82b6b59c --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/rabbit_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:rabbit_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/suspicious_stew.json b/src/generated/resources/data/c/tags/fluids/suspicious_stew.json new file mode 100644 index 0000000000..3069b778c7 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/suspicious_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:suspicious_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/water.json b/src/generated/resources/data/c/tags/fluids/water.json new file mode 100644 index 0000000000..dbfbaa8091 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/water.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:water", + "minecraft:flowing_water" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/armors.json b/src/generated/resources/data/c/tags/items/armors.json new file mode 100644 index 0000000000..a1f3ac1ce1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/armors.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#minecraft:head_armor", + "#minecraft:chest_armor", + "#minecraft:leg_armor", + "#minecraft:foot_armor", + { + "id": "#forge:armors", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/barrels.json b/src/generated/resources/data/c/tags/items/barrels.json new file mode 100644 index 0000000000..94bded15d8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/barrels.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:barrels/wooden", + { + "id": "#forge:barrels", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/barrels/wooden.json b/src/generated/resources/data/c/tags/items/barrels/wooden.json new file mode 100644 index 0000000000..fedbc8ac53 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/barrels/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:barrel", + { + "id": "#forge:barrels/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bones.json b/src/generated/resources/data/c/tags/items/bones.json new file mode 100644 index 0000000000..883cdcc2e1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bone", + { + "id": "#forge:bones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bookshelves.json b/src/generated/resources/data/c/tags/items/bookshelves.json new file mode 100644 index 0000000000..68f756dba9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bookshelves.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bookshelf", + { + "id": "#forge:bookshelves", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks.json b/src/generated/resources/data/c/tags/items/bricks.json new file mode 100644 index 0000000000..ba6a10fc02 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:bricks/normal", + "#c:bricks/nether" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks/nether.json b/src/generated/resources/data/c/tags/items/bricks/nether.json new file mode 100644 index 0000000000..3f63a414f0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks/nether.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick", + { + "id": "#forge:ingots/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks/normal.json b/src/generated/resources/data/c/tags/items/bricks/normal.json new file mode 100644 index 0000000000..a40223a69b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:brick", + { + "id": "#forge:ingots/brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/budding_blocks.json b/src/generated/resources/data/c/tags/items/budding_blocks.json new file mode 100644 index 0000000000..86257651e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/budding_blocks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:budding_amethyst" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buds.json b/src/generated/resources/data/c/tags/items/buds.json new file mode 100644 index 0000000000..708568317e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buds.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:small_amethyst_bud", + "minecraft:medium_amethyst_bud", + "minecraft:large_amethyst_bud" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chains.json b/src/generated/resources/data/c/tags/items/chains.json new file mode 100644 index 0000000000..63bbe5b427 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chains.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:chain" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests.json b/src/generated/resources/data/c/tags/items/chests.json new file mode 100644 index 0000000000..b6a2b0d0fa --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden", + { + "id": "#forge:chests", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/ender.json b/src/generated/resources/data/c/tags/items/chests/ender.json new file mode 100644 index 0000000000..1e652bcf24 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/ender.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_chest", + { + "id": "#forge:chests/ender", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/trapped.json b/src/generated/resources/data/c/tags/items/chests/trapped.json new file mode 100644 index 0000000000..d0d8da248b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/trapped.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trapped_chest", + { + "id": "#forge:chests/trapped", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/wooden.json b/src/generated/resources/data/c/tags/items/chests/wooden.json new file mode 100644 index 0000000000..0659e860e6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/wooden.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:chest", + "minecraft:trapped_chest", + { + "id": "#forge:chests/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/clusters.json b/src/generated/resources/data/c/tags/items/clusters.json new file mode 100644 index 0000000000..bf57e5f90d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/clusters.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:amethyst_cluster" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones.json b/src/generated/resources/data/c/tags/items/cobblestones.json new file mode 100644 index 0000000000..b3c480393c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate", + { + "id": "#forge:cobblestone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json b/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json new file mode 100644 index 0000000000..34e7d23b82 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobbled_deepslate", + { + "id": "#forge:cobblestone/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/infested.json b/src/generated/resources/data/c/tags/items/cobblestones/infested.json new file mode 100644 index 0000000000..2752247f3a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/infested.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:infested_cobblestone", + { + "id": "#forge:cobblestone/infested", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/mossy.json b/src/generated/resources/data/c/tags/items/cobblestones/mossy.json new file mode 100644 index 0000000000..9a2e19c569 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/mossy.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mossy_cobblestone", + { + "id": "#forge:cobblestone/mossy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/normal.json b/src/generated/resources/data/c/tags/items/cobblestones/normal.json new file mode 100644 index 0000000000..6cebee9d29 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobblestone", + { + "id": "#forge:cobblestone/normal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops.json b/src/generated/resources/data/c/tags/items/crops.json new file mode 100644 index 0000000000..eb4402976e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops.json @@ -0,0 +1,13 @@ +{ + "values": [ + "#c:crops/beetroot", + "#c:crops/carrot", + "#c:crops/nether_wart", + "#c:crops/potato", + "#c:crops/wheat", + { + "id": "#forge:crops", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/beetroot.json b/src/generated/resources/data/c/tags/items/crops/beetroot.json new file mode 100644 index 0000000000..cc56242351 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/beetroot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:beetroot", + { + "id": "#forge:crops/beetroot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/carrot.json b/src/generated/resources/data/c/tags/items/crops/carrot.json new file mode 100644 index 0000000000..9a637ed3cc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/carrot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:carrot", + { + "id": "#forge:crops/carrot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/nether_wart.json b/src/generated/resources/data/c/tags/items/crops/nether_wart.json new file mode 100644 index 0000000000..9e8eb9e036 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/nether_wart.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_wart", + { + "id": "#forge:crops/nether_wart", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/potato.json b/src/generated/resources/data/c/tags/items/crops/potato.json new file mode 100644 index 0000000000..fca8ec880c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/potato.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:potato", + { + "id": "#forge:crops/potato", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/wheat.json b/src/generated/resources/data/c/tags/items/crops/wheat.json new file mode 100644 index 0000000000..05dac35cc1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/wheat.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:wheat", + { + "id": "#forge:crops/wheat", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts.json b/src/generated/resources/data/c/tags/items/dusts.json new file mode 100644 index 0000000000..45f697f1b0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:dusts/glowstone", + "#c:dusts/redstone", + { + "id": "#forge:dusts", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts/glowstone.json b/src/generated/resources/data/c/tags/items/dusts/glowstone.json new file mode 100644 index 0000000000..b7bd60b026 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts/glowstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glowstone_dust", + { + "id": "#forge:dusts/glowstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts/redstone.json b/src/generated/resources/data/c/tags/items/dusts/redstone.json new file mode 100644 index 0000000000..ec7a3ceb0a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone", + { + "id": "#forge:dusts/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed.json b/src/generated/resources/data/c/tags/items/dyed.json new file mode 100644 index 0000000000..ad4584578d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyed/white", + "#c:dyed/orange", + "#c:dyed/magenta", + "#c:dyed/light_blue", + "#c:dyed/yellow", + "#c:dyed/lime", + "#c:dyed/pink", + "#c:dyed/gray", + "#c:dyed/light_gray", + "#c:dyed/cyan", + "#c:dyed/purple", + "#c:dyed/blue", + "#c:dyed/brown", + "#c:dyed/green", + "#c:dyed/red", + "#c:dyed/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/black.json b/src/generated/resources/data/c/tags/items/dyed/black.json new file mode 100644 index 0000000000..493e96b6c0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/black.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:black_banner", + "minecraft:black_bed", + "minecraft:black_candle", + "minecraft:black_carpet", + "minecraft:black_concrete", + "minecraft:black_concrete_powder", + "minecraft:black_glazed_terracotta", + "minecraft:black_shulker_box", + "minecraft:black_stained_glass", + "minecraft:black_stained_glass_pane", + "minecraft:black_terracotta", + "minecraft:black_wool", + { + "id": "#forge:glass/black", + "required": false + }, + { + "id": "#forge:stained_glass/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/blue.json b/src/generated/resources/data/c/tags/items/dyed/blue.json new file mode 100644 index 0000000000..0704821f98 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/blue.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:blue_banner", + "minecraft:blue_bed", + "minecraft:blue_candle", + "minecraft:blue_carpet", + "minecraft:blue_concrete", + "minecraft:blue_concrete_powder", + "minecraft:blue_glazed_terracotta", + "minecraft:blue_shulker_box", + "minecraft:blue_stained_glass", + "minecraft:blue_stained_glass_pane", + "minecraft:blue_terracotta", + "minecraft:blue_wool", + { + "id": "#forge:glass/blue", + "required": false + }, + { + "id": "#forge:stained_glass/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/brown.json b/src/generated/resources/data/c/tags/items/dyed/brown.json new file mode 100644 index 0000000000..41b1bc3f6f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/brown.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:brown_banner", + "minecraft:brown_bed", + "minecraft:brown_candle", + "minecraft:brown_carpet", + "minecraft:brown_concrete", + "minecraft:brown_concrete_powder", + "minecraft:brown_glazed_terracotta", + "minecraft:brown_shulker_box", + "minecraft:brown_stained_glass", + "minecraft:brown_stained_glass_pane", + "minecraft:brown_terracotta", + "minecraft:brown_wool", + { + "id": "#forge:glass/brown", + "required": false + }, + { + "id": "#forge:stained_glass/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/cyan.json b/src/generated/resources/data/c/tags/items/dyed/cyan.json new file mode 100644 index 0000000000..a09984e063 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/cyan.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:cyan_banner", + "minecraft:cyan_bed", + "minecraft:cyan_candle", + "minecraft:cyan_carpet", + "minecraft:cyan_concrete", + "minecraft:cyan_concrete_powder", + "minecraft:cyan_glazed_terracotta", + "minecraft:cyan_shulker_box", + "minecraft:cyan_stained_glass", + "minecraft:cyan_stained_glass_pane", + "minecraft:cyan_terracotta", + "minecraft:cyan_wool", + { + "id": "#forge:glass/cyan", + "required": false + }, + { + "id": "#forge:stained_glass/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/gray.json b/src/generated/resources/data/c/tags/items/dyed/gray.json new file mode 100644 index 0000000000..191db19733 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/gray.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:gray_banner", + "minecraft:gray_bed", + "minecraft:gray_candle", + "minecraft:gray_carpet", + "minecraft:gray_concrete", + "minecraft:gray_concrete_powder", + "minecraft:gray_glazed_terracotta", + "minecraft:gray_shulker_box", + "minecraft:gray_stained_glass", + "minecraft:gray_stained_glass_pane", + "minecraft:gray_terracotta", + "minecraft:gray_wool", + { + "id": "#forge:glass/gray", + "required": false + }, + { + "id": "#forge:stained_glass/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/green.json b/src/generated/resources/data/c/tags/items/dyed/green.json new file mode 100644 index 0000000000..80e3b0bcd1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/green.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:green_banner", + "minecraft:green_bed", + "minecraft:green_candle", + "minecraft:green_carpet", + "minecraft:green_concrete", + "minecraft:green_concrete_powder", + "minecraft:green_glazed_terracotta", + "minecraft:green_shulker_box", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass_pane", + "minecraft:green_terracotta", + "minecraft:green_wool", + { + "id": "#forge:glass/green", + "required": false + }, + { + "id": "#forge:stained_glass/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/light_blue.json b/src/generated/resources/data/c/tags/items/dyed/light_blue.json new file mode 100644 index 0000000000..73525eab12 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/light_blue.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:light_blue_banner", + "minecraft:light_blue_bed", + "minecraft:light_blue_candle", + "minecraft:light_blue_carpet", + "minecraft:light_blue_concrete", + "minecraft:light_blue_concrete_powder", + "minecraft:light_blue_glazed_terracotta", + "minecraft:light_blue_shulker_box", + "minecraft:light_blue_stained_glass", + "minecraft:light_blue_stained_glass_pane", + "minecraft:light_blue_terracotta", + "minecraft:light_blue_wool", + { + "id": "#forge:glass/light_blue", + "required": false + }, + { + "id": "#forge:stained_glass/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/light_gray.json b/src/generated/resources/data/c/tags/items/dyed/light_gray.json new file mode 100644 index 0000000000..ddfb3e54ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/light_gray.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:light_gray_banner", + "minecraft:light_gray_bed", + "minecraft:light_gray_candle", + "minecraft:light_gray_carpet", + "minecraft:light_gray_concrete", + "minecraft:light_gray_concrete_powder", + "minecraft:light_gray_glazed_terracotta", + "minecraft:light_gray_shulker_box", + "minecraft:light_gray_stained_glass", + "minecraft:light_gray_stained_glass_pane", + "minecraft:light_gray_terracotta", + "minecraft:light_gray_wool", + { + "id": "#forge:glass/light_gray", + "required": false + }, + { + "id": "#forge:stained_glass/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/lime.json b/src/generated/resources/data/c/tags/items/dyed/lime.json new file mode 100644 index 0000000000..aa46340608 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/lime.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:lime_banner", + "minecraft:lime_bed", + "minecraft:lime_candle", + "minecraft:lime_carpet", + "minecraft:lime_concrete", + "minecraft:lime_concrete_powder", + "minecraft:lime_glazed_terracotta", + "minecraft:lime_shulker_box", + "minecraft:lime_stained_glass", + "minecraft:lime_stained_glass_pane", + "minecraft:lime_terracotta", + "minecraft:lime_wool", + { + "id": "#forge:glass/lime", + "required": false + }, + { + "id": "#forge:stained_glass/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/magenta.json b/src/generated/resources/data/c/tags/items/dyed/magenta.json new file mode 100644 index 0000000000..fe71a097ba --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/magenta.json @@ -0,0 +1,32 @@ +{ + "values": [ + "minecraft:magenta_banner", + "minecraft:magenta_bed", + "minecraft:magenta_candle", + "minecraft:magenta_carpet", + "minecraft:magenta_concrete", + "minecraft:magenta_concrete_powder", + "minecraft:magenta_glazed_terracotta", + "minecraft:magenta_shulker_box", + "minecraft:magenta_stained_glass", + "minecraft:magenta_stained_glass_pane", + "minecraft:magenta_terracotta", + "minecraft:magenta_wool", + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + }, + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/orange.json b/src/generated/resources/data/c/tags/items/dyed/orange.json new file mode 100644 index 0000000000..6641433e65 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/orange.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:orange_banner", + "minecraft:orange_bed", + "minecraft:orange_candle", + "minecraft:orange_carpet", + "minecraft:orange_concrete", + "minecraft:orange_concrete_powder", + "minecraft:orange_glazed_terracotta", + "minecraft:orange_shulker_box", + "minecraft:orange_stained_glass", + "minecraft:orange_stained_glass_pane", + "minecraft:orange_terracotta", + "minecraft:orange_wool", + { + "id": "#forge:glass/orange", + "required": false + }, + { + "id": "#forge:stained_glass/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/pink.json b/src/generated/resources/data/c/tags/items/dyed/pink.json new file mode 100644 index 0000000000..edca352827 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/pink.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:pink_banner", + "minecraft:pink_bed", + "minecraft:pink_candle", + "minecraft:pink_carpet", + "minecraft:pink_concrete", + "minecraft:pink_concrete_powder", + "minecraft:pink_glazed_terracotta", + "minecraft:pink_shulker_box", + "minecraft:pink_stained_glass", + "minecraft:pink_stained_glass_pane", + "minecraft:pink_terracotta", + "minecraft:pink_wool", + { + "id": "#forge:glass/pink", + "required": false + }, + { + "id": "#forge:stained_glass/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/purple.json b/src/generated/resources/data/c/tags/items/dyed/purple.json new file mode 100644 index 0000000000..3be40b64c6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/purple.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:purple_banner", + "minecraft:purple_bed", + "minecraft:purple_candle", + "minecraft:purple_carpet", + "minecraft:purple_concrete", + "minecraft:purple_concrete_powder", + "minecraft:purple_glazed_terracotta", + "minecraft:purple_shulker_box", + "minecraft:purple_stained_glass", + "minecraft:purple_stained_glass_pane", + "minecraft:purple_terracotta", + "minecraft:purple_wool", + { + "id": "#forge:glass/purple", + "required": false + }, + { + "id": "#forge:stained_glass/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/red.json b/src/generated/resources/data/c/tags/items/dyed/red.json new file mode 100644 index 0000000000..7dea013276 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/red.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:red_banner", + "minecraft:red_bed", + "minecraft:red_candle", + "minecraft:red_carpet", + "minecraft:red_concrete", + "minecraft:red_concrete_powder", + "minecraft:red_glazed_terracotta", + "minecraft:red_shulker_box", + "minecraft:red_stained_glass", + "minecraft:red_stained_glass_pane", + "minecraft:red_terracotta", + "minecraft:red_wool", + { + "id": "#forge:glass/red", + "required": false + }, + { + "id": "#forge:stained_glass/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/white.json b/src/generated/resources/data/c/tags/items/dyed/white.json new file mode 100644 index 0000000000..9edbf324cc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/white.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:white_banner", + "minecraft:white_bed", + "minecraft:white_candle", + "minecraft:white_carpet", + "minecraft:white_concrete", + "minecraft:white_concrete_powder", + "minecraft:white_glazed_terracotta", + "minecraft:white_shulker_box", + "minecraft:white_stained_glass", + "minecraft:white_stained_glass_pane", + "minecraft:white_terracotta", + "minecraft:white_wool", + { + "id": "#forge:glass/white", + "required": false + }, + { + "id": "#forge:stained_glass/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/yellow.json b/src/generated/resources/data/c/tags/items/dyed/yellow.json new file mode 100644 index 0000000000..57aeacb16f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/yellow.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:yellow_banner", + "minecraft:yellow_bed", + "minecraft:yellow_candle", + "minecraft:yellow_carpet", + "minecraft:yellow_concrete", + "minecraft:yellow_concrete_powder", + "minecraft:yellow_glazed_terracotta", + "minecraft:yellow_shulker_box", + "minecraft:yellow_stained_glass", + "minecraft:yellow_stained_glass_pane", + "minecraft:yellow_terracotta", + "minecraft:yellow_wool", + { + "id": "#forge:glass/yellow", + "required": false + }, + { + "id": "#forge:stained_glass/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes.json b/src/generated/resources/data/c/tags/items/dyes.json new file mode 100644 index 0000000000..24f7498948 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyes/white", + "#c:dyes/orange", + "#c:dyes/magenta", + "#c:dyes/light_blue", + "#c:dyes/yellow", + "#c:dyes/lime", + "#c:dyes/pink", + "#c:dyes/gray", + "#c:dyes/light_gray", + "#c:dyes/cyan", + "#c:dyes/purple", + "#c:dyes/blue", + "#c:dyes/brown", + "#c:dyes/green", + "#c:dyes/red", + "#c:dyes/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/black.json b/src/generated/resources/data/c/tags/items/dyes/black.json new file mode 100644 index 0000000000..516aeff755 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/black.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:black_dye", + { + "id": "#forge:dyes/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/blue.json b/src/generated/resources/data/c/tags/items/dyes/blue.json new file mode 100644 index 0000000000..d64a97e464 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/blue.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:blue_dye", + { + "id": "#forge:dyes/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/brown.json b/src/generated/resources/data/c/tags/items/dyes/brown.json new file mode 100644 index 0000000000..220ece0dfe --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/brown.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:brown_dye", + { + "id": "#forge:dyes/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/cyan.json b/src/generated/resources/data/c/tags/items/dyes/cyan.json new file mode 100644 index 0000000000..275830210e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/cyan.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cyan_dye", + { + "id": "#forge:dyes/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/gray.json b/src/generated/resources/data/c/tags/items/dyes/gray.json new file mode 100644 index 0000000000..56f595ede5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/gray.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gray_dye", + { + "id": "#forge:dyes/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/green.json b/src/generated/resources/data/c/tags/items/dyes/green.json new file mode 100644 index 0000000000..9f9a8311cf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/green.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:green_dye", + { + "id": "#forge:dyes/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/light_blue.json b/src/generated/resources/data/c/tags/items/dyes/light_blue.json new file mode 100644 index 0000000000..e5a48d1fed --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/light_blue.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:light_blue_dye", + { + "id": "#forge:dyes/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/light_gray.json b/src/generated/resources/data/c/tags/items/dyes/light_gray.json new file mode 100644 index 0000000000..6627597c69 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/light_gray.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:light_gray_dye", + { + "id": "#forge:dyes/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/lime.json b/src/generated/resources/data/c/tags/items/dyes/lime.json new file mode 100644 index 0000000000..fc0af1757b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/lime.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lime_dye", + { + "id": "#forge:dyes/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/magenta.json b/src/generated/resources/data/c/tags/items/dyes/magenta.json new file mode 100644 index 0000000000..d2032d3de2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/magenta.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:magenta_dye", + { + "id": "#forge:dyes/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/orange.json b/src/generated/resources/data/c/tags/items/dyes/orange.json new file mode 100644 index 0000000000..3534947be3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/orange.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:orange_dye", + { + "id": "#forge:dyes/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/pink.json b/src/generated/resources/data/c/tags/items/dyes/pink.json new file mode 100644 index 0000000000..f7ffc037f0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/pink.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:pink_dye", + { + "id": "#forge:dyes/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/purple.json b/src/generated/resources/data/c/tags/items/dyes/purple.json new file mode 100644 index 0000000000..38a9a29868 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/purple.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:purple_dye", + { + "id": "#forge:dyes/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/red.json b/src/generated/resources/data/c/tags/items/dyes/red.json new file mode 100644 index 0000000000..f36b684e01 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_dye", + { + "id": "#forge:dyes/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/white.json b/src/generated/resources/data/c/tags/items/dyes/white.json new file mode 100644 index 0000000000..217dfda5c3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/white.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:white_dye", + { + "id": "#forge:dyes/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/yellow.json b/src/generated/resources/data/c/tags/items/dyes/yellow.json new file mode 100644 index 0000000000..8f469111bf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/yellow.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:yellow_dye", + { + "id": "#forge:dyes/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/eggs.json b/src/generated/resources/data/c/tags/items/eggs.json similarity index 100% rename from src/generated/resources/data/forge/tags/items/eggs.json rename to src/generated/resources/data/c/tags/items/eggs.json diff --git a/src/generated/resources/data/c/tags/items/enchantables.json b/src/generated/resources/data/c/tags/items/enchantables.json new file mode 100644 index 0000000000..71d26a252b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/enchantables.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#minecraft:enchantable/armor", + "#minecraft:enchantable/equippable", + "#minecraft:enchantable/weapon", + "#minecraft:enchantable/sword", + "#minecraft:enchantable/mining", + "#minecraft:enchantable/mining_loot", + "#minecraft:enchantable/fishing", + "#minecraft:enchantable/trident", + "#minecraft:enchantable/bow", + "#minecraft:enchantable/crossbow", + "#minecraft:enchantable/fire_aspect", + "#minecraft:enchantable/durability", + { + "id": "#minecraft:enchantable/mace", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/end_stones.json b/src/generated/resources/data/c/tags/items/end_stones.json new file mode 100644 index 0000000000..aa227f8a3b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/end_stones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:end_stone", + { + "id": "#forge:end_stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ender_pearls.json b/src/generated/resources/data/c/tags/items/ender_pearls.json new file mode 100644 index 0000000000..bd8b93cf85 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ender_pearls.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_pearl", + { + "id": "#forge:ender_pearls", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/feathers.json b/src/generated/resources/data/c/tags/items/feathers.json new file mode 100644 index 0000000000..84f3dedf59 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/feathers.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:feather", + { + "id": "#forge:feathers", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fence_gates.json b/src/generated/resources/data/c/tags/items/fence_gates.json new file mode 100644 index 0000000000..56c90931cc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fence_gates.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:fence_gates/wooden", + { + "id": "#forge:fence_gates", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json b/src/generated/resources/data/c/tags/items/fence_gates/wooden.json similarity index 76% rename from src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json rename to src/generated/resources/data/c/tags/items/fence_gates/wooden.json index 88a130fa50..db55cb84ed 100644 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json +++ b/src/generated/resources/data/c/tags/items/fence_gates/wooden.json @@ -10,6 +10,10 @@ "minecraft:warped_fence_gate", "minecraft:mangrove_fence_gate", "minecraft:bamboo_fence_gate", - "minecraft:cherry_fence_gate" + "minecraft:cherry_fence_gate", + { + "id": "#forge:fence_gates/wooden", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences.json b/src/generated/resources/data/c/tags/items/fences.json new file mode 100644 index 0000000000..1e79564ade --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden", + { + "id": "#forge:fences", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences/nether_brick.json b/src/generated/resources/data/c/tags/items/fences/nether_brick.json new file mode 100644 index 0000000000..30a88aea36 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences/nether_brick.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick_fence", + { + "id": "#forge:fences/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences/wooden.json b/src/generated/resources/data/c/tags/items/fences/wooden.json new file mode 100644 index 0000000000..bf67fa132e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:wooden_fences", + { + "id": "#forge:fences/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods.json b/src/generated/resources/data/c/tags/items/foods.json new file mode 100644 index 0000000000..92dec0d386 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods.json @@ -0,0 +1,22 @@ +{ + "values": [ + "minecraft:baked_potato", + "minecraft:pumpkin_pie", + "minecraft:honey_bottle", + "minecraft:ominous_bottle", + "minecraft:dried_kelp", + "#c:foods/fruits", + "#c:foods/vegetables", + "#c:foods/berries", + "#c:foods/breads", + "#c:foods/cookies", + "#c:foods/raw_meats", + "#c:foods/raw_fishes", + "#c:foods/cooked_meats", + "#c:foods/cooked_fishes", + "#c:foods/soups", + "#c:foods/candies", + "#c:foods/edible_when_placed", + "#c:foods/food_poisoning" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/berries.json b/src/generated/resources/data/c/tags/items/foods/berries.json new file mode 100644 index 0000000000..500bd9432c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/berries.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sweet_berries", + "minecraft:glow_berries" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/breads.json b/src/generated/resources/data/c/tags/items/foods/breads.json new file mode 100644 index 0000000000..7873bb3c3f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/breads.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bread" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/candies.json b/src/generated/resources/data/c/tags/items/foods/candies.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/candies.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json b/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json new file mode 100644 index 0000000000..4e459bea9e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:cooked_cod", + "minecraft:cooked_salmon" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cooked_meats.json b/src/generated/resources/data/c/tags/items/foods/cooked_meats.json new file mode 100644 index 0000000000..fe6f7f5443 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cooked_meats.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:cooked_beef", + "minecraft:cooked_chicken", + "minecraft:cooked_rabbit", + "minecraft:cooked_mutton" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cookies.json b/src/generated/resources/data/c/tags/items/foods/cookies.json new file mode 100644 index 0000000000..a7c0dc91d8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cookies.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:cookie" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json b/src/generated/resources/data/c/tags/items/foods/edible_when_placed.json similarity index 50% rename from src/generated/resources/data/forge/tags/blocks/sand/colorless.json rename to src/generated/resources/data/c/tags/items/foods/edible_when_placed.json index af14f42f56..d1a45a9222 100644 --- a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json +++ b/src/generated/resources/data/c/tags/items/foods/edible_when_placed.json @@ -1,5 +1,5 @@ { "values": [ - "minecraft:sand" + "minecraft:cake" ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/food_poisoning.json b/src/generated/resources/data/c/tags/items/foods/food_poisoning.json new file mode 100644 index 0000000000..6b59df70e4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/food_poisoning.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:poisonous_potato", + "minecraft:pufferfish", + "minecraft:spider_eye", + "minecraft:chicken", + "minecraft:rotten_flesh" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/fruits.json b/src/generated/resources/data/c/tags/items/foods/fruits.json new file mode 100644 index 0000000000..895ad4a310 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/fruits.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:apple", + "minecraft:golden_apple", + "minecraft:enchanted_golden_apple" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/raw_fishes.json b/src/generated/resources/data/c/tags/items/foods/raw_fishes.json new file mode 100644 index 0000000000..83d056aa44 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/raw_fishes.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:cod", + "minecraft:salmon", + "minecraft:tropical_fish", + "minecraft:pufferfish" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/raw_meats.json b/src/generated/resources/data/c/tags/items/foods/raw_meats.json new file mode 100644 index 0000000000..1c57ef56bf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/raw_meats.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:beef", + "minecraft:chicken", + "minecraft:rabbit", + "minecraft:mutton" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/soups.json b/src/generated/resources/data/c/tags/items/foods/soups.json new file mode 100644 index 0000000000..5a1a339249 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/soups.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:beetroot_soup", + "minecraft:mushroom_stew", + "minecraft:rabbit_stew", + "minecraft:suspicious_stew" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/vegetables.json b/src/generated/resources/data/c/tags/items/foods/vegetables.json new file mode 100644 index 0000000000..0476304c8a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/vegetables.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:carrot", + "minecraft:golden_carrot", + "minecraft:potato", + "minecraft:melon_slice", + "minecraft:beetroot" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems.json b/src/generated/resources/data/c/tags/items/gems.json new file mode 100644 index 0000000000..6f340c553c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:gems/amethyst", + "#c:gems/diamond", + "#c:gems/emerald", + "#c:gems/lapis", + "#c:gems/prismarine", + "#c:gems/quartz", + { + "id": "#forge:gems", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/amethyst.json b/src/generated/resources/data/c/tags/items/gems/amethyst.json new file mode 100644 index 0000000000..d222353687 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/amethyst.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:amethyst_shard", + { + "id": "#forge:gems/amethyst", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/diamond.json b/src/generated/resources/data/c/tags/items/gems/diamond.json new file mode 100644 index 0000000000..1ca2673f21 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond", + { + "id": "#forge:gems/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/emerald.json b/src/generated/resources/data/c/tags/items/gems/emerald.json new file mode 100644 index 0000000000..de1e12af1b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald", + { + "id": "#forge:gems/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/lapis.json b/src/generated/resources/data/c/tags/items/gems/lapis.json new file mode 100644 index 0000000000..0e92612548 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_lazuli", + { + "id": "#forge:gems/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/prismarine.json b/src/generated/resources/data/c/tags/items/gems/prismarine.json new file mode 100644 index 0000000000..df7aa66312 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/prismarine.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:prismarine_crystals", + { + "id": "#forge:gems/prismarine", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/quartz.json b/src/generated/resources/data/c/tags/items/gems/quartz.json new file mode 100644 index 0000000000..d0604485bd --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:quartz", + { + "id": "#forge:gems/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass.json b/src/generated/resources/data/c/tags/items/glass_blocks.json similarity index 75% rename from src/generated/resources/data/forge/tags/blocks/stained_glass.json rename to src/generated/resources/data/c/tags/items/glass_blocks.json index 2db7aef9df..311aa195ce 100644 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass.json +++ b/src/generated/resources/data/c/tags/items/glass_blocks.json @@ -1,5 +1,8 @@ { "values": [ + "#c:glass_blocks/colorless", + "#c:glass_blocks/cheap", + "#c:glass_blocks/tinted", "minecraft:white_stained_glass", "minecraft:orange_stained_glass", "minecraft:magenta_stained_glass", @@ -15,6 +18,10 @@ "minecraft:brown_stained_glass", "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:black_stained_glass" + "minecraft:black_stained_glass", + { + "id": "#forge:glass", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/silica.json b/src/generated/resources/data/c/tags/items/glass_blocks/cheap.json similarity index 80% rename from src/generated/resources/data/forge/tags/blocks/glass/silica.json rename to src/generated/resources/data/c/tags/items/glass_blocks/cheap.json index 74544c770d..016e4315ef 100644 --- a/src/generated/resources/data/forge/tags/blocks/glass/silica.json +++ b/src/generated/resources/data/c/tags/items/glass_blocks/cheap.json @@ -1,21 +1,26 @@ { "values": [ "minecraft:glass", - "minecraft:black_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:green_stained_glass", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", "minecraft:light_blue_stained_glass", - "minecraft:light_gray_stained_glass", + "minecraft:yellow_stained_glass", "minecraft:lime_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:orange_stained_glass", "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass", "minecraft:red_stained_glass", - "minecraft:white_stained_glass", - "minecraft:yellow_stained_glass" + "minecraft:black_stained_glass", + { + "id": "#forge:glass_silica", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json b/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json new file mode 100644 index 0000000000..7d2e81b6c4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass", + { + "id": "#forge:glass_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json b/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json new file mode 100644 index 0000000000..0a7d0f3f00 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:tinted_glass", + { + "id": "#forge:glass_tinted", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json b/src/generated/resources/data/c/tags/items/glass_panes.json similarity index 95% rename from src/generated/resources/data/forge/tags/items/stained_glass_panes.json rename to src/generated/resources/data/c/tags/items/glass_panes.json index 65f2adb8f9..c4bdf8ea3f 100644 --- a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json +++ b/src/generated/resources/data/c/tags/items/glass_panes.json @@ -1,5 +1,6 @@ { "values": [ + "#c:glass_panes/colorless", "minecraft:white_stained_glass_pane", "minecraft:orange_stained_glass_pane", "minecraft:magenta_stained_glass_pane", diff --git a/src/generated/resources/data/c/tags/items/glass_panes/colorless.json b/src/generated/resources/data/c/tags/items/glass_panes/colorless.json new file mode 100644 index 0000000000..b7d7245a6a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_panes/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass_pane", + { + "id": "#forge:glass_panes_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gravel.json b/src/generated/resources/data/c/tags/items/gravel.json new file mode 100644 index 0000000000..80440dd1d4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gravel.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gravel", + { + "id": "#forge:gravel", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gunpowder.json b/src/generated/resources/data/c/tags/items/gunpowder.json new file mode 100644 index 0000000000..90ef8c349e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gunpowder.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gunpowder", + { + "id": "#forge:gunpowder", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json b/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots.json b/src/generated/resources/data/c/tags/items/ingots.json new file mode 100644 index 0000000000..4584668355 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:ingots/copper", + "#c:ingots/gold", + "#c:ingots/iron", + "#c:ingots/netherite", + { + "id": "#forge:ingots", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/copper.json b/src/generated/resources/data/c/tags/items/ingots/copper.json new file mode 100644 index 0000000000..2043a331d0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_ingot", + { + "id": "#forge:ingots/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/gold.json b/src/generated/resources/data/c/tags/items/ingots/gold.json new file mode 100644 index 0000000000..70299fe304 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_ingot", + { + "id": "#forge:ingots/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/iron.json b/src/generated/resources/data/c/tags/items/ingots/iron.json new file mode 100644 index 0000000000..7fa35c33e3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_ingot", + { + "id": "#forge:ingots/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/netherite.json b/src/generated/resources/data/c/tags/items/ingots/netherite.json new file mode 100644 index 0000000000..61b250abae --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_ingot", + { + "id": "#forge:ingots/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/leather.json b/src/generated/resources/data/c/tags/items/leather.json new file mode 100644 index 0000000000..71f8c03e09 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/leather.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:leather", + { + "id": "#forge:leather", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/mushrooms.json b/src/generated/resources/data/c/tags/items/mushrooms.json new file mode 100644 index 0000000000..0823f66b55 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/mushrooms.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + { + "id": "#forge:mushrooms", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nether_stars.json b/src/generated/resources/data/c/tags/items/nether_stars.json new file mode 100644 index 0000000000..3e02f9a226 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nether_stars.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_star", + { + "id": "#forge:nether_stars", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/netherrack.json b/src/generated/resources/data/c/tags/items/netherrack.json new file mode 100644 index 0000000000..21c1554741 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets.json b/src/generated/resources/data/c/tags/items/nuggets.json new file mode 100644 index 0000000000..f7a672879a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:nuggets/gold", + "#c:nuggets/iron", + { + "id": "#forge:nuggets", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets/gold.json b/src/generated/resources/data/c/tags/items/nuggets/gold.json new file mode 100644 index 0000000000..77eb151909 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_nugget", + { + "id": "#forge:nuggets/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets/iron.json b/src/generated/resources/data/c/tags/items/nuggets/iron.json new file mode 100644 index 0000000000..0f529f154f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_nugget", + { + "id": "#forge:nuggets/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/obsidians.json b/src/generated/resources/data/c/tags/items/obsidians.json new file mode 100644 index 0000000000..aa3315f6bf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/obsidians.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:obsidian", + { + "id": "#forge:obsidian", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json new file mode 100644 index 0000000000..e3a9322797 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:deepslate", + { + "id": "#forge:ore_bearing_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json new file mode 100644 index 0000000000..d815611551 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:ore_bearing_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json new file mode 100644 index 0000000000..08d0efdfe5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stone", + { + "id": "#forge:ore_bearing_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json b/src/generated/resources/data/c/tags/items/ore_rates/dense.json similarity index 64% rename from src/generated/resources/data/forge/tags/items/ore_rates/dense.json rename to src/generated/resources/data/c/tags/items/ore_rates/dense.json index 69cfa78343..ded4e6606a 100644 --- a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json +++ b/src/generated/resources/data/c/tags/items/ore_rates/dense.json @@ -5,6 +5,10 @@ "minecraft:deepslate_lapis_ore", "minecraft:deepslate_redstone_ore", "minecraft:lapis_ore", - "minecraft:redstone_ore" + "minecraft:redstone_ore", + { + "id": "#forge:ore_rates/dense", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json b/src/generated/resources/data/c/tags/items/ore_rates/singular.json similarity index 77% rename from src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json rename to src/generated/resources/data/c/tags/items/ore_rates/singular.json index 79e0f4b9a7..3a2f12d573 100644 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json +++ b/src/generated/resources/data/c/tags/items/ore_rates/singular.json @@ -11,6 +11,10 @@ "minecraft:emerald_ore", "minecraft:gold_ore", "minecraft:iron_ore", - "minecraft:nether_quartz_ore" + "minecraft:nether_quartz_ore", + { + "id": "#forge:ore_rates/singular", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_rates/sparse.json b/src/generated/resources/data/c/tags/items/ore_rates/sparse.json new file mode 100644 index 0000000000..349b1e3d4b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_rates/sparse.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + { + "id": "#forge:ore_rates/sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores.json b/src/generated/resources/data/c/tags/items/ores.json new file mode 100644 index 0000000000..ffce3487be --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores.json @@ -0,0 +1,18 @@ +{ + "values": [ + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", + "#c:ores/netherite_scrap", + "#c:ores/redstone", + "#c:ores/quartz", + { + "id": "#forge:ores", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/coal.json b/src/generated/resources/data/c/tags/items/ores/coal.json new file mode 100644 index 0000000000..2e088c7241 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:coal_ores", + { + "id": "#forge:ores/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/copper.json b/src/generated/resources/data/c/tags/items/ores/copper.json new file mode 100644 index 0000000000..f51e56171f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:copper_ores", + { + "id": "#forge:ores/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/diamond.json b/src/generated/resources/data/c/tags/items/ores/diamond.json new file mode 100644 index 0000000000..3a595fe648 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:diamond_ores", + { + "id": "#forge:ores/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/emerald.json b/src/generated/resources/data/c/tags/items/ores/emerald.json new file mode 100644 index 0000000000..25ec90670f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:emerald_ores", + { + "id": "#forge:ores/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/gold.json b/src/generated/resources/data/c/tags/items/ores/gold.json new file mode 100644 index 0000000000..ab8f217a24 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:gold_ores", + { + "id": "#forge:ores/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/iron.json b/src/generated/resources/data/c/tags/items/ores/iron.json new file mode 100644 index 0000000000..12fed97a89 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:iron_ores", + { + "id": "#forge:ores/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/lapis.json b/src/generated/resources/data/c/tags/items/ores/lapis.json new file mode 100644 index 0000000000..4609a406dc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:lapis_ores", + { + "id": "#forge:ores/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json b/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json new file mode 100644 index 0000000000..6cc208db8e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ancient_debris", + { + "id": "#forge:ores/netherite_scrap", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/quartz.json b/src/generated/resources/data/c/tags/items/ores/quartz.json new file mode 100644 index 0000000000..5433b2ed6f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/redstone.json b/src/generated/resources/data/c/tags/items/ores/redstone.json new file mode 100644 index 0000000000..42cb0fd1ee --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:redstone_ores", + { + "id": "#forge:ores/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json b/src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json similarity index 69% rename from src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json rename to src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json index 13e0c38aa1..6b172a1533 100644 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json @@ -7,6 +7,10 @@ "minecraft:deepslate_gold_ore", "minecraft:deepslate_iron_ore", "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore" + "minecraft:deepslate_redstone_ore", + { + "id": "#forge:ores_in_ground/deepslate", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json b/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json new file mode 100644 index 0000000000..83b110ef9e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores_in_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json b/src/generated/resources/data/c/tags/items/ores_in_ground/stone.json similarity index 66% rename from src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json rename to src/generated/resources/data/c/tags/items/ores_in_ground/stone.json index 568fbe7cb6..97b26721ae 100644 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/stone.json @@ -7,6 +7,10 @@ "minecraft:gold_ore", "minecraft:iron_ore", "minecraft:lapis_ore", - "minecraft:redstone_ore" + "minecraft:redstone_ore", + { + "id": "#forge:ores_in_ground/stone", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json b/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json new file mode 100644 index 0000000000..3be1c8e22e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:crafting_table" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json b/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json new file mode 100644 index 0000000000..25edfef1ca --- /dev/null +++ b/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:furnace" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_blocks.json b/src/generated/resources/data/c/tags/items/raw_blocks.json new file mode 100644 index 0000000000..fef9f55fc6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_blocks.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#c:raw_blocks/copper", + "#c:raw_blocks/gold", + "#c:raw_blocks/iron" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/items/raw_blocks/copper.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json rename to src/generated/resources/data/c/tags/items/raw_blocks/copper.json diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/items/raw_blocks/gold.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json rename to src/generated/resources/data/c/tags/items/raw_blocks/gold.json diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/items/raw_blocks/iron.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json rename to src/generated/resources/data/c/tags/items/raw_blocks/iron.json diff --git a/src/generated/resources/data/c/tags/items/raw_materials.json b/src/generated/resources/data/c/tags/items/raw_materials.json new file mode 100644 index 0000000000..de258a264b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:raw_materials/copper", + "#c:raw_materials/gold", + "#c:raw_materials/iron", + { + "id": "#forge:raw_materials", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/copper.json b/src/generated/resources/data/c/tags/items/raw_materials/copper.json new file mode 100644 index 0000000000..ce2a8c25b9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper", + { + "id": "#forge:raw_materials/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/gold.json b/src/generated/resources/data/c/tags/items/raw_materials/gold.json new file mode 100644 index 0000000000..555e287358 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold", + { + "id": "#forge:raw_materials/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/iron.json b/src/generated/resources/data/c/tags/items/raw_materials/iron.json new file mode 100644 index 0000000000..def08c1dac --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron", + { + "id": "#forge:raw_materials/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods.json b/src/generated/resources/data/c/tags/items/rods.json new file mode 100644 index 0000000000..4bf89f59ff --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:rods/wooden", + "#c:rods/blaze", + "#c:rods/breeze", + { + "id": "#forge:rods", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/blaze.json b/src/generated/resources/data/c/tags/items/rods/blaze.json new file mode 100644 index 0000000000..cda6278df8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/blaze.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:blaze_rod", + { + "id": "#forge:rods/blaze", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/breeze.json b/src/generated/resources/data/c/tags/items/rods/breeze.json new file mode 100644 index 0000000000..8290ef56cf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/breeze.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:breeze_rod" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/wooden.json b/src/generated/resources/data/c/tags/items/rods/wooden.json new file mode 100644 index 0000000000..348d18d33d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stick", + { + "id": "#forge:rods/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ropes.json b/src/generated/resources/data/c/tags/items/ropes.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ropes.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands.json b/src/generated/resources/data/c/tags/items/sands.json new file mode 100644 index 0000000000..43eaac83ae --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red", + { + "id": "#forge:sand", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands/colorless.json b/src/generated/resources/data/c/tags/items/sands/colorless.json new file mode 100644 index 0000000000..93cdef191b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sand", + { + "id": "#forge:sand/colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands/red.json b/src/generated/resources/data/c/tags/items/sands/red.json new file mode 100644 index 0000000000..03eba73b12 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_sand", + { + "id": "#forge:sand/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/blocks.json b/src/generated/resources/data/c/tags/items/sandstone/blocks.json new file mode 100644 index 0000000000..5684db6caf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/blocks.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sandstone/red_blocks", + "#c:sandstone/uncolored_blocks", + { + "id": "#forge:sandstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sandstone.json b/src/generated/resources/data/c/tags/items/sandstone/red_blocks.json similarity index 56% rename from src/generated/resources/data/forge/tags/items/sandstone.json rename to src/generated/resources/data/c/tags/items/sandstone/red_blocks.json index bb7fb03ee3..4e72ad44cd 100644 --- a/src/generated/resources/data/forge/tags/items/sandstone.json +++ b/src/generated/resources/data/c/tags/items/sandstone/red_blocks.json @@ -1,9 +1,5 @@ { "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", "minecraft:red_sandstone", "minecraft:cut_red_sandstone", "minecraft:chiseled_red_sandstone", diff --git a/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json b/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json new file mode 100644 index 0000000000..a586c49087 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:red_sandstone_slab", + "minecraft:cut_red_sandstone_slab", + "minecraft:smooth_red_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json b/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json new file mode 100644 index 0000000000..8778d5dbbd --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:red_sandstone_stairs", + "minecraft:smooth_red_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/slabs.json b/src/generated/resources/data/c/tags/items/sandstone/slabs.json new file mode 100644 index 0000000000..92bc3f3ed9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/slabs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_slabs", + "#c:sandstone/uncolored_slabs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/stairs.json b/src/generated/resources/data/c/tags/items/sandstone/stairs.json new file mode 100644 index 0000000000..673f168ddf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_stairs", + "#c:sandstone/uncolored_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json new file mode 100644 index 0000000000..4e32539b4e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:sandstone", + "minecraft:cut_sandstone", + "minecraft:chiseled_sandstone", + "minecraft:smooth_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json new file mode 100644 index 0000000000..d830f1dc1e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:sandstone_slab", + "minecraft:cut_sandstone_slab", + "minecraft:smooth_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json new file mode 100644 index 0000000000..ddb4a27f87 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sandstone_stairs", + "minecraft:smooth_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds.json b/src/generated/resources/data/c/tags/items/seeds.json new file mode 100644 index 0000000000..350c6d7383 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:seeds/beetroot", + "#c:seeds/melon", + "#c:seeds/pumpkin", + "#c:seeds/wheat", + { + "id": "#forge:seeds", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/beetroot.json b/src/generated/resources/data/c/tags/items/seeds/beetroot.json new file mode 100644 index 0000000000..54ba42f355 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/beetroot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:beetroot_seeds", + { + "id": "#forge:seeds/beetroot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/melon.json b/src/generated/resources/data/c/tags/items/seeds/melon.json new file mode 100644 index 0000000000..0def0ae263 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/melon.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:melon_seeds", + { + "id": "#forge:seeds/melon", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/pumpkin.json b/src/generated/resources/data/c/tags/items/seeds/pumpkin.json new file mode 100644 index 0000000000..d0ab847b4a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/pumpkin.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:pumpkin_seeds", + { + "id": "#forge:seeds/pumpkin", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/wheat.json b/src/generated/resources/data/c/tags/items/seeds/wheat.json new file mode 100644 index 0000000000..68fdea41a2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/wheat.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:wheat_seeds", + { + "id": "#forge:seeds/wheat", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/slimeballs.json b/src/generated/resources/data/c/tags/items/slimeballs.json new file mode 100644 index 0000000000..e81d459385 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/slimeballs.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:slime_ball", + { + "id": "#forge:slimeballs", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/stones.json b/src/generated/resources/data/c/tags/items/stones.json new file mode 100644 index 0000000000..820387926d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/stones.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:andesite", + "minecraft:diorite", + "minecraft:granite", + "minecraft:stone", + "minecraft:deepslate", + "minecraft:tuff", + { + "id": "#forge:stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks.json b/src/generated/resources/data/c/tags/items/storage_blocks.json new file mode 100644 index 0000000000..7bf4a38117 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks.json @@ -0,0 +1,24 @@ +{ + "values": [ + "#c:storage_blocks/bone_meal", + "#c:storage_blocks/coal", + "#c:storage_blocks/copper", + "#c:storage_blocks/diamond", + "#c:storage_blocks/dried_kelp", + "#c:storage_blocks/emerald", + "#c:storage_blocks/gold", + "#c:storage_blocks/iron", + "#c:storage_blocks/lapis", + "#c:storage_blocks/netherite", + "#c:storage_blocks/raw_copper", + "#c:storage_blocks/raw_gold", + "#c:storage_blocks/raw_iron", + "#c:storage_blocks/redstone", + "#c:storage_blocks/slime", + "#c:storage_blocks/wheat", + { + "id": "#forge:storage_blocks", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json b/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json new file mode 100644 index 0000000000..98ab24a213 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bone_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/coal.json b/src/generated/resources/data/c/tags/items/storage_blocks/coal.json new file mode 100644 index 0000000000..b8479ced38 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:coal_block", + { + "id": "#forge:storage_blocks/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/copper.json b/src/generated/resources/data/c/tags/items/storage_blocks/copper.json new file mode 100644 index 0000000000..acd2a6a7a4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_block", + { + "id": "#forge:storage_blocks/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json b/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json new file mode 100644 index 0000000000..76426ba425 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond_block", + { + "id": "#forge:storage_blocks/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json b/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json new file mode 100644 index 0000000000..2609656429 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:dried_kelp_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json b/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json new file mode 100644 index 0000000000..7a41454d94 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald_block", + { + "id": "#forge:storage_blocks/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/gold.json b/src/generated/resources/data/c/tags/items/storage_blocks/gold.json new file mode 100644 index 0000000000..a4116fc77f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_block", + { + "id": "#forge:storage_blocks/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/iron.json b/src/generated/resources/data/c/tags/items/storage_blocks/iron.json new file mode 100644 index 0000000000..f0e9fcca1f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_block", + { + "id": "#forge:storage_blocks/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json b/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json new file mode 100644 index 0000000000..b5f41d8d4e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_block", + { + "id": "#forge:storage_blocks/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json b/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json new file mode 100644 index 0000000000..a3dfe0d53c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_block", + { + "id": "#forge:storage_blocks/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json new file mode 100644 index 0000000000..8f12fb63a7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper_block", + { + "id": "#forge:storage_blocks/raw_copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json new file mode 100644 index 0000000000..dcee1e225b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold_block", + { + "id": "#forge:storage_blocks/raw_gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json new file mode 100644 index 0000000000..3f0ecf27ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron_block", + { + "id": "#forge:storage_blocks/raw_iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json b/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json new file mode 100644 index 0000000000..49fa7a5a26 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone_block", + { + "id": "#forge:storage_blocks/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/slime.json b/src/generated/resources/data/c/tags/items/storage_blocks/slime.json new file mode 100644 index 0000000000..523bdc2835 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/slime.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:slime_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json b/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json new file mode 100644 index 0000000000..ea92d03cb4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:hay_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/strings.json b/src/generated/resources/data/c/tags/items/strings.json new file mode 100644 index 0000000000..89b40c31c5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/strings.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:string", + { + "id": "#forge:strings", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools.json b/src/generated/resources/data/c/tags/items/tools.json new file mode 100644 index 0000000000..8b2c2aae5e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#minecraft:axes", + "#minecraft:hoes", + "#minecraft:pickaxes", + "#minecraft:shovels", + "#minecraft:swords", + "#c:tools/bows", + "#c:tools/brushes", + "#c:tools/crossbows", + "#c:tools/fishing_rods", + "#c:tools/shears", + "#c:tools/shields", + "#c:tools/spears", + { + "id": "#forge:tools", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/bows.json b/src/generated/resources/data/c/tags/items/tools/bows.json new file mode 100644 index 0000000000..e46556b3d2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/bows.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bow", + { + "id": "#forge:tools/bows", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/brushes.json b/src/generated/resources/data/c/tags/items/tools/brushes.json new file mode 100644 index 0000000000..8b2fb219ea --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/brushes.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:brush" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/crossbows.json b/src/generated/resources/data/c/tags/items/tools/crossbows.json new file mode 100644 index 0000000000..d1e63bc584 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/crossbows.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:crossbow", + { + "id": "#forge:tools/crossbows", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/fishing_rods.json b/src/generated/resources/data/c/tags/items/tools/fishing_rods.json new file mode 100644 index 0000000000..efafba4845 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/fishing_rods.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:fishing_rod", + { + "id": "#forge:tools/fishing_rods", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/shears.json b/src/generated/resources/data/c/tags/items/tools/shears.json new file mode 100644 index 0000000000..1c2ad36f72 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/shears.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:shears", + { + "id": "#forge:shears", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/shields.json b/src/generated/resources/data/c/tags/items/tools/shields.json new file mode 100644 index 0000000000..f0b441428b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/shields.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:shield", + { + "id": "#forge:tools/shields", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/spears.json b/src/generated/resources/data/c/tags/items/tools/spears.json new file mode 100644 index 0000000000..c5b8b99af6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/spears.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trident", + { + "id": "#forge:tools/tridents", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/villager_job_sites.json b/src/generated/resources/data/c/tags/items/villager_job_sites.json new file mode 100644 index 0000000000..6f11b1676a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/villager_job_sites.json @@ -0,0 +1,17 @@ +{ + "values": [ + "minecraft:barrel", + "minecraft:blast_furnace", + "minecraft:brewing_stand", + "minecraft:cartography_table", + "minecraft:cauldron", + "minecraft:composter", + "minecraft:fletching_table", + "minecraft:grindstone", + "minecraft:lectern", + "minecraft:loom", + "minecraft:smithing_table", + "minecraft:smoker", + "minecraft:stonecutter" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json b/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json new file mode 100644 index 0000000000..77bf3cac1a --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:is_ocean", + "#c:is_river", + { + "id": "#forge:is_water", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json new file mode 100644 index 0000000000..d7feec409a --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:frozen_river", + "minecraft:deep_frozen_ocean", + "minecraft:frozen_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json b/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json new file mode 100644 index 0000000000..161fcc2892 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_badlands" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json b/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json new file mode 100644 index 0000000000..b15673e3d6 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_beach" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json new file mode 100644 index 0000000000..1d080779b6 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:birch_forest", + "minecraft:old_growth_birch_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json new file mode 100644 index 0000000000..14acf097ed --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:lush_caves", + "minecraft:dripstone_caves", + "minecraft:deep_dark", + { + "id": "#forge:is_cave", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json new file mode 100644 index 0000000000..5d5826f660 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:is_cold/overworld", + { + "id": "#c:is_cold/nether", + "required": false + }, + "#c:is_cold/end", + { + "id": "#forge:is_cold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json new file mode 100644 index 0000000000..5598c65b7f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:the_end", + "minecraft:small_end_islands", + "minecraft:end_midlands", + "minecraft:end_highlands", + "minecraft:end_barrens", + { + "id": "#forge:is_cold/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json similarity index 57% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json index 75f9c80b3d..ba8ac392ff 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json @@ -1,10 +1,8 @@ { "values": [ - "#forge:is_cold/overworld", { "id": "#forge:is_cold/nether", "required": false - }, - "#forge:is_cold/end" + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json similarity index 80% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json index 4d7cf8a957..8151c7e470 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json @@ -1,19 +1,23 @@ { "values": [ "minecraft:taiga", - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", - "minecraft:snowy_beach", - "minecraft:snowy_taiga", "minecraft:old_growth_pine_taiga", + "minecraft:snowy_plains", + "minecraft:ice_spikes", "minecraft:grove", "minecraft:snowy_slopes", "minecraft:jagged_peaks", "minecraft:frozen_peaks", + "minecraft:snowy_beach", + "minecraft:snowy_taiga", + "minecraft:frozen_river", "minecraft:cold_ocean", + "minecraft:frozen_ocean", "minecraft:deep_cold_ocean", "minecraft:deep_frozen_ocean", - "minecraft:ice_spikes" + { + "id": "#forge:is_cold/overworld", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json new file mode 100644 index 0000000000..019f7a17c7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dead", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json new file mode 100644 index 0000000000..0fef9dd36a --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_deep_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json new file mode 100644 index 0000000000..761d530555 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json @@ -0,0 +1,17 @@ +{ + "values": [ + "#c:is_dense_vegetation/overworld", + { + "id": "#c:is_dense_vegetation/nether", + "required": false + }, + { + "id": "#c:is_dense_vegetation/end", + "required": false + }, + { + "id": "#forge:is_dense", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json new file mode 100644 index 0000000000..644b573965 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dense/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json new file mode 100644 index 0000000000..732488f87a --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dense/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json new file mode 100644 index 0000000000..5518ef9ccb --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:dark_forest", + "minecraft:old_growth_birch_forest", + "minecraft:old_growth_spruce_taiga", + "minecraft:jungle", + { + "id": "#forge:is_dense/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json b/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json new file mode 100644 index 0000000000..7f6b11f3b4 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:desert", + { + "id": "#forge:is_desert", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json new file mode 100644 index 0000000000..d1e491ae50 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:is_dry/overworld", + "#c:is_dry/nether", + "#c:is_dry/end", + { + "id": "#forge:is_dry", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json similarity index 59% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json index 73d3eff3b0..ce1b28ee59 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json @@ -4,6 +4,10 @@ "minecraft:small_end_islands", "minecraft:end_midlands", "minecraft:end_highlands", - "minecraft:end_barrens" + "minecraft:end_barrens", + { + "id": "#forge:is_dry/end", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json similarity index 59% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json index 340c9d161b..c490dcb1af 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json @@ -1,9 +1,13 @@ { "values": [ "minecraft:nether_wastes", - "minecraft:soul_sand_valley", "minecraft:crimson_forest", "minecraft:warped_forest", - "minecraft:basalt_deltas" + "minecraft:soul_sand_valley", + "minecraft:basalt_deltas", + { + "id": "#forge:is_dry/nether", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json new file mode 100644 index 0000000000..66049f8928 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:desert", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + { + "id": "#forge:is_dry/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_end.json new file mode 100644 index 0000000000..2e43e7a97b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_end.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_end", + { + "id": "#forge:is_end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json b/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json new file mode 100644 index 0000000000..32cfdbacc2 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:is_flower_forest", + "minecraft:sunflower_plains", + "minecraft:cherry_grove", + "minecraft:meadow", + { + "id": "#forge:is_floral", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json new file mode 100644 index 0000000000..8edd5b8da3 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:flower_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json new file mode 100644 index 0000000000..68e29235c8 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json new file mode 100644 index 0000000000..b788d9c569 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_hill" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json new file mode 100644 index 0000000000..aa9e158867 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:is_hot/overworld", + "#c:is_hot/nether", + { + "id": "#c:is_hot/end", + "required": false + }, + { + "id": "#forge:is_hot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json similarity index 60% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json index 6559f017e6..384c64e823 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json @@ -1,7 +1,5 @@ { "values": [ - "#forge:is_hot/overworld", - "#forge:is_hot/nether", { "id": "#forge:is_hot/end", "required": false diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json similarity index 59% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json index 340c9d161b..48cf5e7bec 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json @@ -1,9 +1,13 @@ { "values": [ "minecraft:nether_wastes", - "minecraft:soul_sand_valley", "minecraft:crimson_forest", "minecraft:warped_forest", - "minecraft:basalt_deltas" + "minecraft:soul_sand_valley", + "minecraft:basalt_deltas", + { + "id": "#forge:is_hot/nether", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json similarity index 70% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json index f283627eb9..7cb35fa14a 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json @@ -1,15 +1,20 @@ { "values": [ - "minecraft:desert", + "minecraft:swamp", + "minecraft:mangrove_swamp", "minecraft:jungle", + "minecraft:bamboo_jungle", "minecraft:sparse_jungle", + "minecraft:desert", + "minecraft:eroded_badlands", "minecraft:savanna", "minecraft:savanna_plateau", + "minecraft:windswept_savanna", "minecraft:stony_peaks", "minecraft:warm_ocean", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:bamboo_jungle", - "minecraft:mangrove_swamp" + { + "id": "#forge:is_hot/overworld", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json new file mode 100644 index 0000000000..46ba2aa139 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:ice_spikes", + "minecraft:frozen_peaks" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json b/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json new file mode 100644 index 0000000000..c1d3c371fe --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_jungle" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json b/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json new file mode 100644 index 0000000000..6d69742b22 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lush_caves", + { + "id": "#forge:is_lush", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json b/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json new file mode 100644 index 0000000000..790536a079 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_magical", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json b/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json new file mode 100644 index 0000000000..ce7e347ab6 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_modified", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json new file mode 100644 index 0000000000..0ad5197c18 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#minecraft:is_mountain", + "#c:is_mountain/peak", + "#c:is_mountain/slope", + { + "id": "#forge:is_mountain", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json new file mode 100644 index 0000000000..60454a4666 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:jagged_peaks", + "minecraft:frozen_peaks", + "minecraft:stony_peaks", + { + "id": "#forge:is_peak", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json new file mode 100644 index 0000000000..b534783957 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:snowy_slopes", + "minecraft:meadow", + "minecraft:grove", + "minecraft:cherry_grove", + { + "id": "#forge:is_slope", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json new file mode 100644 index 0000000000..e83f4e0c45 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mushroom_fields", + { + "id": "#forge:is_mushroom", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json new file mode 100644 index 0000000000..8775f39f6f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_nether", + { + "id": "#forge:is_nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json new file mode 100644 index 0000000000..d79f240db4 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:crimson_forest", + "minecraft:warped_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json new file mode 100644 index 0000000000..f608497e79 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#minecraft:is_ocean", + "#c:is_shallow_ocean", + "#c:is_deep_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json similarity index 65% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json index 9491a24bc8..412f42f3e5 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json @@ -1,8 +1,7 @@ { "values": [ - "minecraft:jungle", - "minecraft:dark_forest", "minecraft:old_growth_birch_forest", + "minecraft:old_growth_pine_taiga", "minecraft:old_growth_spruce_taiga" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json similarity index 64% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json index 73d3eff3b0..66a8dff71a 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json @@ -1,9 +1,7 @@ { "values": [ - "minecraft:the_end", - "minecraft:small_end_islands", - "minecraft:end_midlands", "minecraft:end_highlands", + "minecraft:end_midlands", "minecraft:end_barrens" ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json new file mode 100644 index 0000000000..e1bd80c754 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_overworld", + { + "id": "#forge:is_overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json b/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json new file mode 100644 index 0000000000..4e23e1e56f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:plains", + "minecraft:sunflower_plains", + { + "id": "#forge:is_plains", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json b/src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json similarity index 52% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json index 453f828613..c712084478 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json @@ -1,9 +1,12 @@ { "values": [ - "minecraft:savanna_plateau", "minecraft:wooded_badlands", + "minecraft:savanna_plateau", + "minecraft:cherry_grove", "minecraft:meadow", - "minecraft:grove", - "minecraft:snowy_slopes" + { + "id": "#forge:is_plateau", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json b/src/generated/resources/data/c/tags/worldgen/biome/is_rare.json similarity index 82% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_rare.json index 490abd4392..4520d941ac 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_rare.json @@ -1,17 +1,21 @@ { "values": [ - "minecraft:mushroom_fields", - "minecraft:sparse_jungle", - "minecraft:savanna_plateau", "minecraft:sunflower_plains", - "minecraft:windswept_gravelly_hills", "minecraft:flower_forest", - "minecraft:ice_spikes", "minecraft:old_growth_birch_forest", "minecraft:old_growth_spruce_taiga", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", "minecraft:bamboo_jungle", - "minecraft:deep_dark" + "minecraft:sparse_jungle", + "minecraft:eroded_badlands", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + "minecraft:ice_spikes", + "minecraft:windswept_gravelly_hills", + "minecraft:mushroom_fields", + "minecraft:deep_dark", + { + "id": "#forge:is_rare", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json b/src/generated/resources/data/c/tags/worldgen/biome/is_river.json similarity index 63% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_water.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_river.json index 800c17196b..c5435e253c 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_river.json @@ -1,6 +1,5 @@ { "values": [ - "#minecraft:is_ocean", "#minecraft:is_river" ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json new file mode 100644 index 0000000000..5fad39f73b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:desert", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", + "minecraft:beach", + { + "id": "#forge:is_sandy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json b/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json new file mode 100644 index 0000000000..966de075ce --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_savanna" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json new file mode 100644 index 0000000000..858efda8f1 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ocean", + "minecraft:lukewarm_ocean", + "minecraft:warm_ocean", + "minecraft:cold_ocean", + "minecraft:frozen_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json similarity index 70% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json index e1310e08ee..8d5168ef6c 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json @@ -1,14 +1,16 @@ { "values": [ - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", "minecraft:snowy_beach", + "minecraft:snowy_plains", + "minecraft:ice_spikes", "minecraft:snowy_taiga", "minecraft:grove", "minecraft:snowy_slopes", "minecraft:jagged_peaks", "minecraft:frozen_peaks", - "minecraft:ice_spikes" + { + "id": "#forge:is_snowy", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy_plains.json similarity index 100% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_snowy_plains.json diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json new file mode 100644 index 0000000000..f2ce1c179f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json @@ -0,0 +1,21 @@ +{ + "values": [ + "#c:is_sparse_vegetation/overworld", + { + "id": "#c:is_sparse_vegetation/nether", + "required": false + }, + { + "id": "#c:is_sparse_vegetation/end", + "required": false + }, + { + "id": "#forge:is_sparse_vegetation", + "required": false + }, + { + "id": "#forge:is_sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json new file mode 100644 index 0000000000..93863ce9c1 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json @@ -0,0 +1,12 @@ +{ + "values": [ + { + "id": "#forge:is_sparse_vegetation/end", + "required": false + }, + { + "id": "#forge:is_sparse/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json similarity index 65% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json index 7680132431..70f6d7a9a0 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json @@ -1,12 +1,11 @@ { "values": [ - "#forge:is_sparse/overworld", { - "id": "#forge:is_sparse/nether", + "id": "#forge:is_sparse_vegetation/nether", "required": false }, { - "id": "#forge:is_sparse/end", + "id": "#forge:is_sparse/nether", "required": false } ] diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json similarity index 63% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json index e9652824e6..2505597fde 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json @@ -1,15 +1,23 @@ { "values": [ - "minecraft:windswept_forest", + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", "minecraft:savanna", "minecraft:savanna_plateau", - "minecraft:wooded_badlands", + "minecraft:windswept_savanna", + "minecraft:windswept_forest", + "minecraft:windswept_hills", + "minecraft:windswept_gravelly_hills", "minecraft:snowy_slopes", "minecraft:jagged_peaks", "minecraft:frozen_peaks", - "minecraft:windswept_gravelly_hills", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:dripstone_caves" + { + "id": "#forge:is_sparse_vegetation/overworld", + "required": false + }, + { + "id": "#forge:is_sparse/overworld", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json b/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json new file mode 100644 index 0000000000..61d4740d42 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:dark_forest", + "minecraft:deep_dark", + { + "id": "#forge:is_spooky", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json b/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json new file mode 100644 index 0000000000..a6db46faf4 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:stony_shore" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json b/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json new file mode 100644 index 0000000000..7f7d1c742b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:swamp", + "minecraft:mangrove_swamp", + { + "id": "#forge:is_swamp", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json b/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json new file mode 100644 index 0000000000..1c6ed95718 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_taiga" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json new file mode 100644 index 0000000000..62d147cff9 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:is_taiga", + "minecraft:grove", + { + "id": "#forge:is_tree/coniferous", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json new file mode 100644 index 0000000000..0db7a3e9b6 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:forest", + "minecraft:flower_forest", + "minecraft:birch_forest", + "minecraft:dark_forest", + "minecraft:old_growth_birch_forest", + "minecraft:windswept_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/bows.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json similarity index 51% rename from src/generated/resources/data/forge/tags/items/tools/bows.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json index a1c8a443dc..e9d457c5e7 100644 --- a/src/generated/resources/data/forge/tags/items/tools/bows.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json @@ -1,5 +1,5 @@ { "values": [ - "minecraft:bow" + "#c:is_jungle" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/bones.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json similarity index 50% rename from src/generated/resources/data/forge/tags/items/bones.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json index 5af534fcff..3338b8b1dd 100644 --- a/src/generated/resources/data/forge/tags/items/bones.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json @@ -1,5 +1,5 @@ { "values": [ - "minecraft:bone" + "#c:is_savanna" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json b/src/generated/resources/data/c/tags/worldgen/biome/is_underground.json similarity index 50% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_underground.json index c55f2d526e..4d7c1ff442 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_underground.json @@ -1,5 +1,5 @@ { "values": [ - "#forge:is_cave" + "#c:is_cave" ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_void.json b/src/generated/resources/data/c/tags/worldgen/biome/is_void.json new file mode 100644 index 0000000000..f6048857ff --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_void.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:the_void", + { + "id": "#forge:is_void", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json new file mode 100644 index 0000000000..6d11db61bc --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_wasteland", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json new file mode 100644 index 0000000000..5903fbb204 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json @@ -0,0 +1,17 @@ +{ + "values": [ + "#c:is_wet/overworld", + { + "id": "#c:is_wet/nether", + "required": false + }, + { + "id": "#c:is_wet/end", + "required": false + }, + { + "id": "#forge:is_wet", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json similarity index 60% rename from src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json index 75f1ba31f4..6f6b6d1480 100644 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json @@ -1,5 +1,8 @@ { "values": [ - "minecraft:cobbled_deepslate" + { + "id": "#forge:is_wet/end", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json new file mode 100644 index 0000000000..90601e0731 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_wet/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json similarity index 56% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json index e5e5a885c5..6bb610406d 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json @@ -1,11 +1,16 @@ { "values": [ "minecraft:swamp", + "minecraft:mangrove_swamp", "minecraft:jungle", + "minecraft:bamboo_jungle", "minecraft:sparse_jungle", "minecraft:beach", - "minecraft:bamboo_jungle", "minecraft:lush_caves", - "minecraft:mangrove_swamp" + "minecraft:dripstone_caves", + { + "id": "#forge:is_wet/overworld", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json b/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json new file mode 100644 index 0000000000..8ee28b8409 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:windswept_hills", + "minecraft:windswept_gravelly_hills", + "minecraft:windswept_forest", + "minecraft:windswept_savanna" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json b/src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json similarity index 58% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json rename to src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json index 9255238fa6..2496ccf1e9 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json @@ -1,6 +1,6 @@ { "values": [ - "minecraft:dark_forest", + "minecraft:mushroom_fields", "minecraft:deep_dark" ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/barrels.json b/src/generated/resources/data/forge/tags/blocks/barrels.json deleted file mode 100644 index 1cfb5782c5..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json b/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json deleted file mode 100644 index b07daae1c0..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/bookshelves.json b/src/generated/resources/data/forge/tags/blocks/bookshelves.json deleted file mode 100644 index c09b2185bd..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests.json b/src/generated/resources/data/forge/tags/blocks/chests.json deleted file mode 100644 index 9afff2b15a..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/ender.json b/src/generated/resources/data/forge/tags/blocks/chests/ender.json deleted file mode 100644 index 8c0af53136..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/ender.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json b/src/generated/resources/data/forge/tags/blocks/chests/trapped.json deleted file mode 100644 index f8924f5a05..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json b/src/generated/resources/data/forge/tags/blocks/chests/wooden.json deleted file mode 100644 index 86533f935b..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone.json b/src/generated/resources/data/forge/tags/blocks/cobblestone.json deleted file mode 100644 index f0ae95b5fc..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json deleted file mode 100644 index a1d276601e..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:infested_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json deleted file mode 100644 index c32be6c962..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mossy_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json deleted file mode 100644 index dac674da5d..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/end_stones.json b/src/generated/resources/data/forge/tags/blocks/end_stones.json deleted file mode 100644 index f2d11375bc..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/end_stones.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:end_stone" - ] -} \ 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 deleted file mode 100644 index b9a57ac0ef..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fences.json b/src/generated/resources/data/forge/tags/blocks/fences.json deleted file mode 100644 index 44358edb04..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3f1aacfa7e..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick_fence" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json b/src/generated/resources/data/forge/tags/blocks/fences/wooden.json deleted file mode 100644 index 8120262114..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:wooden_fences" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass.json b/src/generated/resources/data/forge/tags/blocks/glass.json deleted file mode 100644 index fec31169ee..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/black.json b/src/generated/resources/data/forge/tags/blocks/glass/black.json deleted file mode 100644 index 9965b5e8b4..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/blue.json b/src/generated/resources/data/forge/tags/blocks/glass/blue.json deleted file mode 100644 index f59e58c6bf..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/brown.json b/src/generated/resources/data/forge/tags/blocks/glass/brown.json deleted file mode 100644 index 490015cbb5..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json b/src/generated/resources/data/forge/tags/blocks/glass/colorless.json deleted file mode 100644 index ac8b5e5086..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json b/src/generated/resources/data/forge/tags/blocks/glass/cyan.json deleted file mode 100644 index 24d84747fa..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/gray.json b/src/generated/resources/data/forge/tags/blocks/glass/gray.json deleted file mode 100644 index 2f309170ca..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/green.json b/src/generated/resources/data/forge/tags/blocks/glass/green.json deleted file mode 100644 index d7946c1aca..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file 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 deleted file mode 100644 index dc8e6b7148..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f165a46c90..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/lime.json b/src/generated/resources/data/forge/tags/blocks/glass/lime.json deleted file mode 100644 index b6bb1d9415..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json b/src/generated/resources/data/forge/tags/blocks/glass/magenta.json deleted file mode 100644 index aa6a4825e8..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/orange.json b/src/generated/resources/data/forge/tags/blocks/glass/orange.json deleted file mode 100644 index 9322f51fe4..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/pink.json b/src/generated/resources/data/forge/tags/blocks/glass/pink.json deleted file mode 100644 index 58b65891fc..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/purple.json b/src/generated/resources/data/forge/tags/blocks/glass/purple.json deleted file mode 100644 index d75a9e7308..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/red.json b/src/generated/resources/data/forge/tags/blocks/glass/red.json deleted file mode 100644 index 72af78c029..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json b/src/generated/resources/data/forge/tags/blocks/glass/tinted.json deleted file mode 100644 index 4075a1556b..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/white.json b/src/generated/resources/data/forge/tags/blocks/glass/white.json deleted file mode 100644 index fb180e703e..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json b/src/generated/resources/data/forge/tags/blocks/glass/yellow.json deleted file mode 100644 index 0831bea4cc..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes.json b/src/generated/resources/data/forge/tags/blocks/glass_panes.json deleted file mode 100644 index 4b95330d4f..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file 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 deleted file mode 100644 index ebda555dcd..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 2762890aa9..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 0b5b727491..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index eb5756f964..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9913e90a96..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9fe30b26a8..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index ab91321028..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index cd6d399022..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7be6a4ce81..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 46dec64b22..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7504bc3fa3..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 1c47e34616..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 28e36b973f..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index a3cff33a14..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 5edd855d71..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index b514a2839f..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index a293eb9dc8..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/gravel.json b/src/generated/resources/data/forge/tags/blocks/gravel.json deleted file mode 100644 index f6968bff68..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/gravel.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gravel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/netherrack.json b/src/generated/resources/data/forge/tags/blocks/netherrack.json deleted file mode 100644 index daa9c66701..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/obsidian.json b/src/generated/resources/data/forge/tags/blocks/obsidian.json deleted file mode 100644 index 170248454b..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 0012c241a3..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:deepslate" - ] -} \ No newline at end of file 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 deleted file mode 100644 index daa9c66701..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file 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 deleted file mode 100644 index c2d7c79f3e..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stone" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3caf9ffe44..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores.json b/src/generated/resources/data/forge/tags/blocks/ores.json deleted file mode 100644 index 2c4beabc55..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/coal.json b/src/generated/resources/data/forge/tags/blocks/ores/coal.json deleted file mode 100644 index c1246af516..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:coal_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/copper.json b/src/generated/resources/data/forge/tags/blocks/ores/copper.json deleted file mode 100644 index bfa31f2aed..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:copper_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json b/src/generated/resources/data/forge/tags/blocks/ores/diamond.json deleted file mode 100644 index e0fe2e9d0f..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:diamond_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json b/src/generated/resources/data/forge/tags/blocks/ores/emerald.json deleted file mode 100644 index fe8bed587c..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:emerald_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/gold.json b/src/generated/resources/data/forge/tags/blocks/ores/gold.json deleted file mode 100644 index 52f7c26ba1..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:gold_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/iron.json b/src/generated/resources/data/forge/tags/blocks/ores/iron.json deleted file mode 100644 index 9b135890e9..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:iron_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json b/src/generated/resources/data/forge/tags/blocks/ores/lapis.json deleted file mode 100644 index 901b01187c..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:lapis_ores" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 910d1fb8e6..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json b/src/generated/resources/data/forge/tags/blocks/ores/quartz.json deleted file mode 100644 index f0bc7a4657..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json b/src/generated/resources/data/forge/tags/blocks/ores/redstone.json deleted file mode 100644 index 252cdcbb38..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:redstone_ores" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 090233bd46..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand.json b/src/generated/resources/data/forge/tags/blocks/sand.json deleted file mode 100644 index 8b04916283..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand/red.json b/src/generated/resources/data/forge/tags/blocks/sand/red.json deleted file mode 100644 index 9934cb5bbc..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/sand/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stone.json b/src/generated/resources/data/forge/tags/blocks/stone.json deleted file mode 100644 index 958f6e25c7..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks.json deleted file mode 100644 index 5f2a7d417e..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7f66725ab4..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 4b7921705b..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 015bec70c3..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index acd7f52de5..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 152063ec6c..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 546dde03c9..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 01fb2965f2..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f4ca82bbd4..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 83433d44eb..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9d2533c64a..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f5fd89c541..0000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_poison.json b/src/generated/resources/data/forge/tags/damage_type/is_poison.json deleted file mode 100644 index f6d6b1ab29..0000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_poison.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "neoforge:poison" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_technical.json b/src/generated/resources/data/forge/tags/damage_type/is_technical.json deleted file mode 100644 index 5d723926e6..0000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_technical.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:generic_kill", - "minecraft:outside_border", - "minecraft:out_of_world" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_wither.json b/src/generated/resources/data/forge/tags/damage_type/is_wither.json deleted file mode 100644 index 33f6ff3bd0..0000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_wither.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:wither", - "minecraft:wither_skull" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/entity_types/bosses.json b/src/generated/resources/data/forge/tags/entity_types/bosses.json deleted file mode 100644 index 4be4cce831..0000000000 --- a/src/generated/resources/data/forge/tags/entity_types/bosses.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:ender_dragon", - "minecraft:wither" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors.json b/src/generated/resources/data/forge/tags/items/armors.json deleted file mode 100644 index 1f895dcedf..0000000000 --- a/src/generated/resources/data/forge/tags/items/armors.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:armors/helmets", - "#forge:armors/chestplates", - "#forge:armors/leggings", - "#forge:armors/boots" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/boots.json b/src/generated/resources/data/forge/tags/items/armors/boots.json deleted file mode 100644 index b68cf3908d..0000000000 --- a/src/generated/resources/data/forge/tags/items/armors/boots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_boots", - "minecraft:chainmail_boots", - "minecraft:iron_boots", - "minecraft:golden_boots", - "minecraft:diamond_boots", - "minecraft:netherite_boots" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/chestplates.json b/src/generated/resources/data/forge/tags/items/armors/chestplates.json deleted file mode 100644 index 3f17463c56..0000000000 --- a/src/generated/resources/data/forge/tags/items/armors/chestplates.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_chestplate", - "minecraft:chainmail_chestplate", - "minecraft:iron_chestplate", - "minecraft:golden_chestplate", - "minecraft:diamond_chestplate", - "minecraft:netherite_chestplate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/helmets.json b/src/generated/resources/data/forge/tags/items/armors/helmets.json deleted file mode 100644 index 9c9b657c45..0000000000 --- a/src/generated/resources/data/forge/tags/items/armors/helmets.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:leather_helmet", - "minecraft:turtle_helmet", - "minecraft:chainmail_helmet", - "minecraft:iron_helmet", - "minecraft:golden_helmet", - "minecraft:diamond_helmet", - "minecraft:netherite_helmet" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/leggings.json b/src/generated/resources/data/forge/tags/items/armors/leggings.json deleted file mode 100644 index 8969323c7c..0000000000 --- a/src/generated/resources/data/forge/tags/items/armors/leggings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_leggings", - "minecraft:chainmail_leggings", - "minecraft:iron_leggings", - "minecraft:golden_leggings", - "minecraft:diamond_leggings", - "minecraft:netherite_leggings" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/barrels.json b/src/generated/resources/data/forge/tags/items/barrels.json deleted file mode 100644 index 1cfb5782c5..0000000000 --- a/src/generated/resources/data/forge/tags/items/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/barrels/wooden.json b/src/generated/resources/data/forge/tags/items/barrels/wooden.json deleted file mode 100644 index b07daae1c0..0000000000 --- a/src/generated/resources/data/forge/tags/items/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/bookshelves.json b/src/generated/resources/data/forge/tags/items/bookshelves.json deleted file mode 100644 index c09b2185bd..0000000000 --- a/src/generated/resources/data/forge/tags/items/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests.json b/src/generated/resources/data/forge/tags/items/chests.json deleted file mode 100644 index 9afff2b15a..0000000000 --- a/src/generated/resources/data/forge/tags/items/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/ender.json b/src/generated/resources/data/forge/tags/items/chests/ender.json deleted file mode 100644 index 8c0af53136..0000000000 --- a/src/generated/resources/data/forge/tags/items/chests/ender.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/trapped.json b/src/generated/resources/data/forge/tags/items/chests/trapped.json deleted file mode 100644 index f8924f5a05..0000000000 --- a/src/generated/resources/data/forge/tags/items/chests/trapped.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/wooden.json b/src/generated/resources/data/forge/tags/items/chests/wooden.json deleted file mode 100644 index 86533f935b..0000000000 --- a/src/generated/resources/data/forge/tags/items/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone.json b/src/generated/resources/data/forge/tags/items/cobblestone.json deleted file mode 100644 index f0ae95b5fc..0000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json b/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json deleted file mode 100644 index 75f1ba31f4..0000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobbled_deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json b/src/generated/resources/data/forge/tags/items/cobblestone/infested.json deleted file mode 100644 index a1d276601e..0000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:infested_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json deleted file mode 100644 index c32be6c962..0000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mossy_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json b/src/generated/resources/data/forge/tags/items/cobblestone/normal.json deleted file mode 100644 index dac674da5d..0000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops.json b/src/generated/resources/data/forge/tags/items/crops.json deleted file mode 100644 index ae5f647fbe..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "#forge:crops/beetroot", - "#forge:crops/carrot", - "#forge:crops/nether_wart", - "#forge:crops/potato", - "#forge:crops/wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/beetroot.json b/src/generated/resources/data/forge/tags/items/crops/beetroot.json deleted file mode 100644 index b28b723c4b..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops/beetroot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:beetroot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/carrot.json b/src/generated/resources/data/forge/tags/items/crops/carrot.json deleted file mode 100644 index f9630d1347..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops/carrot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:carrot" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 5960d80cb9..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops/nether_wart.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_wart" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/potato.json b/src/generated/resources/data/forge/tags/items/crops/potato.json deleted file mode 100644 index 47fc151cd1..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops/potato.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:potato" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/wheat.json b/src/generated/resources/data/forge/tags/items/crops/wheat.json deleted file mode 100644 index 498cb445f6..0000000000 --- a/src/generated/resources/data/forge/tags/items/crops/wheat.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts.json b/src/generated/resources/data/forge/tags/items/dusts.json deleted file mode 100644 index 87f0fee447..0000000000 --- a/src/generated/resources/data/forge/tags/items/dusts.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:dusts/glowstone", - "#forge:dusts/prismarine", - "#forge:dusts/redstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json b/src/generated/resources/data/forge/tags/items/dusts/glowstone.json deleted file mode 100644 index 668258c523..0000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glowstone_dust" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json b/src/generated/resources/data/forge/tags/items/dusts/prismarine.json deleted file mode 100644 index 3773c1f116..0000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_shard" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/redstone.json b/src/generated/resources/data/forge/tags/items/dusts/redstone.json deleted file mode 100644 index a096239ec1..0000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes.json b/src/generated/resources/data/forge/tags/items/dyes.json deleted file mode 100644 index c8f72c5b6f..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "#forge:dyes/white", - "#forge:dyes/orange", - "#forge:dyes/magenta", - "#forge:dyes/light_blue", - "#forge:dyes/yellow", - "#forge:dyes/lime", - "#forge:dyes/pink", - "#forge:dyes/gray", - "#forge:dyes/light_gray", - "#forge:dyes/cyan", - "#forge:dyes/purple", - "#forge:dyes/blue", - "#forge:dyes/brown", - "#forge:dyes/green", - "#forge:dyes/red", - "#forge:dyes/black" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/black.json b/src/generated/resources/data/forge/tags/items/dyes/black.json deleted file mode 100644 index a2ecf55c46..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/blue.json b/src/generated/resources/data/forge/tags/items/dyes/blue.json deleted file mode 100644 index e7b78e12a3..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/brown.json b/src/generated/resources/data/forge/tags/items/dyes/brown.json deleted file mode 100644 index 8c7249234e..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/cyan.json b/src/generated/resources/data/forge/tags/items/dyes/cyan.json deleted file mode 100644 index f0c5a44002..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/gray.json b/src/generated/resources/data/forge/tags/items/dyes/gray.json deleted file mode 100644 index 6cdbb27a49..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/green.json b/src/generated/resources/data/forge/tags/items/dyes/green.json deleted file mode 100644 index 89fe8ccaf3..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_dye" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 76f1a7786c..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_dye" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 596b2efb37..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/lime.json b/src/generated/resources/data/forge/tags/items/dyes/lime.json deleted file mode 100644 index b0ac91f97e..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/magenta.json b/src/generated/resources/data/forge/tags/items/dyes/magenta.json deleted file mode 100644 index f6898d4c9b..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/orange.json b/src/generated/resources/data/forge/tags/items/dyes/orange.json deleted file mode 100644 index df54849c59..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/pink.json b/src/generated/resources/data/forge/tags/items/dyes/pink.json deleted file mode 100644 index d9f2898629..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/purple.json b/src/generated/resources/data/forge/tags/items/dyes/purple.json deleted file mode 100644 index b3ebfe3c26..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/red.json b/src/generated/resources/data/forge/tags/items/dyes/red.json deleted file mode 100644 index 9c6fe34671..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/white.json b/src/generated/resources/data/forge/tags/items/dyes/white.json deleted file mode 100644 index 3a30d72b10..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/yellow.json b/src/generated/resources/data/forge/tags/items/dyes/yellow.json deleted file mode 100644 index 4349959836..0000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json b/src/generated/resources/data/forge/tags/items/enchanting_fuels.json deleted file mode 100644 index 2a4a029cca..0000000000 --- a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:gems/lapis" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/end_stones.json b/src/generated/resources/data/forge/tags/items/end_stones.json deleted file mode 100644 index f2d11375bc..0000000000 --- a/src/generated/resources/data/forge/tags/items/end_stones.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:end_stone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ender_pearls.json b/src/generated/resources/data/forge/tags/items/ender_pearls.json deleted file mode 100644 index 135cd1d776..0000000000 --- a/src/generated/resources/data/forge/tags/items/ender_pearls.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_pearl" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/feathers.json b/src/generated/resources/data/forge/tags/items/feathers.json deleted file mode 100644 index 8086200700..0000000000 --- a/src/generated/resources/data/forge/tags/items/feathers.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:feather" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fence_gates.json b/src/generated/resources/data/forge/tags/items/fence_gates.json deleted file mode 100644 index b9a57ac0ef..0000000000 --- a/src/generated/resources/data/forge/tags/items/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fences.json b/src/generated/resources/data/forge/tags/items/fences.json deleted file mode 100644 index 44358edb04..0000000000 --- a/src/generated/resources/data/forge/tags/items/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3f1aacfa7e..0000000000 --- a/src/generated/resources/data/forge/tags/items/fences/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick_fence" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fences/wooden.json b/src/generated/resources/data/forge/tags/items/fences/wooden.json deleted file mode 100644 index 8120262114..0000000000 --- a/src/generated/resources/data/forge/tags/items/fences/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:wooden_fences" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems.json b/src/generated/resources/data/forge/tags/items/gems.json deleted file mode 100644 index 60af4bab68..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:gems/amethyst", - "#forge:gems/diamond", - "#forge:gems/emerald", - "#forge:gems/lapis", - "#forge:gems/prismarine", - "#forge:gems/quartz" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/amethyst.json b/src/generated/resources/data/forge/tags/items/gems/amethyst.json deleted file mode 100644 index 742ef896d5..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_shard" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/diamond.json b/src/generated/resources/data/forge/tags/items/gems/diamond.json deleted file mode 100644 index f44f30dd55..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/emerald.json b/src/generated/resources/data/forge/tags/items/gems/emerald.json deleted file mode 100644 index 07a0982118..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/lapis.json b/src/generated/resources/data/forge/tags/items/gems/lapis.json deleted file mode 100644 index 614441df46..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_lazuli" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/prismarine.json b/src/generated/resources/data/forge/tags/items/gems/prismarine.json deleted file mode 100644 index 150e7ff711..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_crystals" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/quartz.json b/src/generated/resources/data/forge/tags/items/gems/quartz.json deleted file mode 100644 index aad2eef95b..0000000000 --- a/src/generated/resources/data/forge/tags/items/gems/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass.json b/src/generated/resources/data/forge/tags/items/glass.json deleted file mode 100644 index fec31169ee..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/black.json b/src/generated/resources/data/forge/tags/items/glass/black.json deleted file mode 100644 index 9965b5e8b4..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/blue.json b/src/generated/resources/data/forge/tags/items/glass/blue.json deleted file mode 100644 index f59e58c6bf..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/brown.json b/src/generated/resources/data/forge/tags/items/glass/brown.json deleted file mode 100644 index 490015cbb5..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/colorless.json b/src/generated/resources/data/forge/tags/items/glass/colorless.json deleted file mode 100644 index ac8b5e5086..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/cyan.json b/src/generated/resources/data/forge/tags/items/glass/cyan.json deleted file mode 100644 index 24d84747fa..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/gray.json b/src/generated/resources/data/forge/tags/items/glass/gray.json deleted file mode 100644 index 2f309170ca..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/green.json b/src/generated/resources/data/forge/tags/items/glass/green.json deleted file mode 100644 index d7946c1aca..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file 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 deleted file mode 100644 index dc8e6b7148..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f165a46c90..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/lime.json b/src/generated/resources/data/forge/tags/items/glass/lime.json deleted file mode 100644 index b6bb1d9415..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/magenta.json b/src/generated/resources/data/forge/tags/items/glass/magenta.json deleted file mode 100644 index aa6a4825e8..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/orange.json b/src/generated/resources/data/forge/tags/items/glass/orange.json deleted file mode 100644 index 9322f51fe4..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/pink.json b/src/generated/resources/data/forge/tags/items/glass/pink.json deleted file mode 100644 index 58b65891fc..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/purple.json b/src/generated/resources/data/forge/tags/items/glass/purple.json deleted file mode 100644 index d75a9e7308..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/red.json b/src/generated/resources/data/forge/tags/items/glass/red.json deleted file mode 100644 index 72af78c029..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/tinted.json b/src/generated/resources/data/forge/tags/items/glass/tinted.json deleted file mode 100644 index 4075a1556b..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/white.json b/src/generated/resources/data/forge/tags/items/glass/white.json deleted file mode 100644 index fb180e703e..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/yellow.json b/src/generated/resources/data/forge/tags/items/glass/yellow.json deleted file mode 100644 index 0831bea4cc..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes.json b/src/generated/resources/data/forge/tags/items/glass_panes.json deleted file mode 100644 index 4b95330d4f..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file 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 deleted file mode 100644 index ebda555dcd..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 2762890aa9..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 0b5b727491..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index eb5756f964..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9913e90a96..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9fe30b26a8..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index ab91321028..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index cd6d399022..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7be6a4ce81..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 46dec64b22..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7504bc3fa3..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 1c47e34616..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 28e36b973f..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index a3cff33a14..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 5edd855d71..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index b514a2839f..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file 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 deleted file mode 100644 index a293eb9dc8..0000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gravel.json b/src/generated/resources/data/forge/tags/items/gravel.json deleted file mode 100644 index f6968bff68..0000000000 --- a/src/generated/resources/data/forge/tags/items/gravel.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gravel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gunpowder.json b/src/generated/resources/data/forge/tags/items/gunpowder.json deleted file mode 100644 index d5835ce7f9..0000000000 --- a/src/generated/resources/data/forge/tags/items/gunpowder.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gunpowder" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/heads.json b/src/generated/resources/data/forge/tags/items/heads.json deleted file mode 100644 index 430af37ee5..0000000000 --- a/src/generated/resources/data/forge/tags/items/heads.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:creeper_head", - "minecraft:dragon_head", - "minecraft:player_head", - "minecraft:skeleton_skull", - "minecraft:wither_skeleton_skull", - "minecraft:zombie_head" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots.json b/src/generated/resources/data/forge/tags/items/ingots.json deleted file mode 100644 index e9756bb39c..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:ingots/brick", - "#forge:ingots/copper", - "#forge:ingots/gold", - "#forge:ingots/iron", - "#forge:ingots/netherite", - "#forge:ingots/nether_brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/brick.json b/src/generated/resources/data/forge/tags/items/ingots/brick.json deleted file mode 100644 index 8f632e499a..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/copper.json b/src/generated/resources/data/forge/tags/items/ingots/copper.json deleted file mode 100644 index 1cc1f065c5..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/gold.json b/src/generated/resources/data/forge/tags/items/ingots/gold.json deleted file mode 100644 index 07e9f66a30..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/iron.json b/src/generated/resources/data/forge/tags/items/ingots/iron.json deleted file mode 100644 index c656021bdb..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_ingot" - ] -} \ No newline at end of file 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 deleted file mode 100644 index ec7ed3ee9a..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/netherite.json b/src/generated/resources/data/forge/tags/items/ingots/netherite.json deleted file mode 100644 index bd6929df75..0000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/leather.json b/src/generated/resources/data/forge/tags/items/leather.json deleted file mode 100644 index 71b797d35b..0000000000 --- a/src/generated/resources/data/forge/tags/items/leather.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:leather" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/mushrooms.json b/src/generated/resources/data/forge/tags/items/mushrooms.json deleted file mode 100644 index 471cd77f07..0000000000 --- a/src/generated/resources/data/forge/tags/items/mushrooms.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:brown_mushroom", - "minecraft:red_mushroom" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nether_stars.json b/src/generated/resources/data/forge/tags/items/nether_stars.json deleted file mode 100644 index 737a95d083..0000000000 --- a/src/generated/resources/data/forge/tags/items/nether_stars.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_star" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/netherrack.json b/src/generated/resources/data/forge/tags/items/netherrack.json deleted file mode 100644 index daa9c66701..0000000000 --- a/src/generated/resources/data/forge/tags/items/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets.json b/src/generated/resources/data/forge/tags/items/nuggets.json deleted file mode 100644 index fb0dc26ecd..0000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:nuggets/iron", - "#forge:nuggets/gold" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/gold.json b/src/generated/resources/data/forge/tags/items/nuggets/gold.json deleted file mode 100644 index 4d94345957..0000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_nugget" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/iron.json b/src/generated/resources/data/forge/tags/items/nuggets/iron.json deleted file mode 100644 index cbd20ac6e4..0000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_nugget" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/obsidian.json b/src/generated/resources/data/forge/tags/items/obsidian.json deleted file mode 100644 index 170248454b..0000000000 --- a/src/generated/resources/data/forge/tags/items/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 0012c241a3..0000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:deepslate" - ] -} \ No newline at end of file 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 deleted file mode 100644 index daa9c66701..0000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file 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 deleted file mode 100644 index c2d7c79f3e..0000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stone" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3caf9ffe44..0000000000 --- a/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores.json b/src/generated/resources/data/forge/tags/items/ores.json deleted file mode 100644 index 2c4beabc55..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/coal.json b/src/generated/resources/data/forge/tags/items/ores/coal.json deleted file mode 100644 index c1246af516..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:coal_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/copper.json b/src/generated/resources/data/forge/tags/items/ores/copper.json deleted file mode 100644 index bfa31f2aed..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:copper_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/diamond.json b/src/generated/resources/data/forge/tags/items/ores/diamond.json deleted file mode 100644 index e0fe2e9d0f..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:diamond_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/emerald.json b/src/generated/resources/data/forge/tags/items/ores/emerald.json deleted file mode 100644 index fe8bed587c..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:emerald_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/gold.json b/src/generated/resources/data/forge/tags/items/ores/gold.json deleted file mode 100644 index 52f7c26ba1..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:gold_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/iron.json b/src/generated/resources/data/forge/tags/items/ores/iron.json deleted file mode 100644 index 9b135890e9..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:iron_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/lapis.json b/src/generated/resources/data/forge/tags/items/ores/lapis.json deleted file mode 100644 index 901b01187c..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:lapis_ores" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 910d1fb8e6..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/quartz.json b/src/generated/resources/data/forge/tags/items/ores/quartz.json deleted file mode 100644 index f0bc7a4657..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/redstone.json b/src/generated/resources/data/forge/tags/items/ores/redstone.json deleted file mode 100644 index 252cdcbb38..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:redstone_ores" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 090233bd46..0000000000 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/raw_materials.json b/src/generated/resources/data/forge/tags/items/raw_materials.json deleted file mode 100644 index 35208231e0..0000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:raw_materials/copper", - "#forge:raw_materials/gold", - "#forge:raw_materials/iron" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3e03ab9ca8..0000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3d1252e5f9..0000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 8f9af48d8e..0000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods.json b/src/generated/resources/data/forge/tags/items/rods.json deleted file mode 100644 index 11b8cb3844..0000000000 --- a/src/generated/resources/data/forge/tags/items/rods.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:rods/blaze", - "#forge:rods/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods/blaze.json b/src/generated/resources/data/forge/tags/items/rods/blaze.json deleted file mode 100644 index 5d2eff8311..0000000000 --- a/src/generated/resources/data/forge/tags/items/rods/blaze.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blaze_rod" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods/wooden.json b/src/generated/resources/data/forge/tags/items/rods/wooden.json deleted file mode 100644 index 019b63dd31..0000000000 --- a/src/generated/resources/data/forge/tags/items/rods/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand.json b/src/generated/resources/data/forge/tags/items/sand.json deleted file mode 100644 index 8b04916283..0000000000 --- a/src/generated/resources/data/forge/tags/items/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand/red.json b/src/generated/resources/data/forge/tags/items/sand/red.json deleted file mode 100644 index 9934cb5bbc..0000000000 --- a/src/generated/resources/data/forge/tags/items/sand/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds.json b/src/generated/resources/data/forge/tags/items/seeds.json deleted file mode 100644 index 423d5bb52d..0000000000 --- a/src/generated/resources/data/forge/tags/items/seeds.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:seeds/beetroot", - "#forge:seeds/melon", - "#forge:seeds/pumpkin", - "#forge:seeds/wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json b/src/generated/resources/data/forge/tags/items/seeds/beetroot.json deleted file mode 100644 index da5a4ab7ef..0000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:beetroot_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/melon.json b/src/generated/resources/data/forge/tags/items/seeds/melon.json deleted file mode 100644 index 973c52ea12..0000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/melon.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:melon_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json b/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json deleted file mode 100644 index 264c06bf04..0000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pumpkin_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/wheat.json b/src/generated/resources/data/forge/tags/items/seeds/wheat.json deleted file mode 100644 index b90459c291..0000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/wheat.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:wheat_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/shears.json b/src/generated/resources/data/forge/tags/items/shears.json deleted file mode 100644 index 2400078166..0000000000 --- a/src/generated/resources/data/forge/tags/items/shears.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shears" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/slimeballs.json b/src/generated/resources/data/forge/tags/items/slimeballs.json deleted file mode 100644 index 533c25d916..0000000000 --- a/src/generated/resources/data/forge/tags/items/slimeballs.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:slime_ball" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stone.json b/src/generated/resources/data/forge/tags/items/stone.json deleted file mode 100644 index 958f6e25c7..0000000000 --- a/src/generated/resources/data/forge/tags/items/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks.json b/src/generated/resources/data/forge/tags/items/storage_blocks.json deleted file mode 100644 index 5f2a7d417e..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 7f66725ab4..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 4b7921705b..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 015bec70c3..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index acd7f52de5..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 152063ec6c..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 546dde03c9..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 01fb2965f2..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f4ca82bbd4..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 83433d44eb..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9d2533c64a..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 1a21e230ef..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 80781ce667..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 13ed9fc651..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron_block" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f5fd89c541..0000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/string.json b/src/generated/resources/data/forge/tags/items/string.json deleted file mode 100644 index d018256cf8..0000000000 --- a/src/generated/resources/data/forge/tags/items/string.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:string" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools.json b/src/generated/resources/data/forge/tags/items/tools.json deleted file mode 100644 index acbfe2ae9d..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#minecraft:swords", - "#minecraft:axes", - "#minecraft:pickaxes", - "#minecraft:shovels", - "#minecraft:hoes", - "#forge:tools/shields", - "#forge:tools/bows", - "#forge:tools/crossbows", - "#forge:tools/fishing_rods", - "#forge:tools/tridents" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/crossbows.json b/src/generated/resources/data/forge/tags/items/tools/crossbows.json deleted file mode 100644 index 848f97bc22..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/crossbows.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:crossbow" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json b/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json deleted file mode 100644 index e97941e9dc..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:fishing_rod" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/shields.json b/src/generated/resources/data/forge/tags/items/tools/shields.json deleted file mode 100644 index 0f2454ce04..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/shields.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shield" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/tridents.json b/src/generated/resources/data/forge/tags/items/tools/tridents.json deleted file mode 100644 index 7a2c450bc7..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/tridents.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trident" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json deleted file mode 100644 index 21a70cfeec..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:lush_caves", - "minecraft:dripstone_caves", - "minecraft:deep_dark" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 6c114dbc65..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:taiga", - "minecraft:snowy_taiga", - "minecraft:old_growth_pine_taiga", - "minecraft:grove" - ] -} \ No newline at end of file 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 deleted file mode 100644 index fa16b4cc6b..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_dense/overworld", - { - "id": "#forge:is_dense/nether", - "required": false - }, - { - "id": "#forge:is_dense/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json deleted file mode 100644 index f1a8ccb642..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:desert" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 28d35de201..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:is_dry/overworld", - "#forge:is_dry/nether", - "#forge:is_dry/end" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 5f0fa0bfee..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:badlands", - "minecraft:wooded_badlands", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 14035f0a54..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lush_caves" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json deleted file mode 100644 index 859b350079..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:is_peak", - "#forge:is_slope" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 05d85d951d..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mushroom_fields" - ] -} \ No newline at end of file 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 deleted file mode 100644 index c9597b86d0..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:stony_peaks" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 9028b691af..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:plains", - "minecraft:snowy_plains", - "minecraft:meadow", - "minecraft:sunflower_plains" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 2fb321e9b7..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:meadow" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 1ae7158316..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:beach", - "minecraft:badlands", - "minecraft:wooded_badlands" - ] -} \ No newline at end of file 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 deleted file mode 100644 index 0f5eb22e0c..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:swamp", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file 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 deleted file mode 100644 index f55aea6671..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:the_void" - ] -} \ No newline at end of file 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 deleted file mode 100644 index b355261275..0000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_wet/overworld", - { - "id": "#forge:is_wet/nether", - "required": false - }, - { - "id": "#forge:is_wet/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json b/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json index 6825cb6c6a..6b4c17a11d 100644 --- a/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json +++ b/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json @@ -52,8 +52,9 @@ { "condition": "minecraft:match_tool", "predicate": { - "type": "neoforge:tool_action", - "value": "axe_wax_off" + "predicates": { + "neoforge:tool_action": "axe_wax_off" + } } } ] @@ -66,8 +67,8 @@ "translate": "advancements.husbandry.wax_off.description" }, "icon": { - "item": "minecraft:stone_axe", - "nbt": "{Damage:0}" + "count": 1, + "id": "minecraft:stone_axe" }, "title": { "translate": "advancements.husbandry.wax_off.title" diff --git a/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json b/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json index 91473c2791..d95c59aea8 100644 --- a/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json +++ b/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json @@ -16,7 +16,7 @@ } ], "item": { - "tag": "minecraft:piglin_loved" + "items": "#minecraft:piglin_loved" }, "player": [ { @@ -25,7 +25,9 @@ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { - "type": "neoforge:piglin_neutral_armor" + "type_specific": { + "type": "neoforge:piglin_neutral_armor" + } } } } @@ -48,7 +50,9 @@ } ], "item": { - "type": "neoforge:piglin_currency" + "predicates": { + "neoforge:piglin_currency": {} + } }, "player": [ { @@ -57,7 +61,9 @@ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { - "type": "neoforge:piglin_neutral_armor" + "type_specific": { + "type": "neoforge:piglin_neutral_armor" + } } } } @@ -71,7 +77,8 @@ "translate": "advancements.nether.distract_piglin.description" }, "icon": { - "item": "minecraft:gold_ingot" + "count": 1, + "id": "minecraft:gold_ingot" }, "title": { "translate": "advancements.nether.distract_piglin.title" 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 053fad3dfb..ad62ade7fb 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 dafffa1f1d..84e3c81e0c 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 62f284c910..64b1e36244 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json index 2c99b22ab8..b7fbba0568 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 3ca942ab2a..99726d20d5 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 3802bb96e8..cdb767856a 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -138,14 +142,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 1a06451836..9f453208c5 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 2588c00aa3..cc5cd2dfdb 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -75,14 +77,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 b91fdd60da..891c482253 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 @@ -16,9 +16,7 @@ "offsetY": 1, "predicate": { "block": { - "blocks": [ - "minecraft:large_fern" - ], + "blocks": "minecraft:large_fern", "state": { "half": "upper" } @@ -80,9 +78,7 @@ "offsetY": -1, "predicate": { "block": { - "blocks": [ - "minecraft:large_fern" - ], + "blocks": "minecraft:large_fern", "state": { "half": "lower" } 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 index 1a43c8c755..24da39e389 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 b34adf0371..363ec89e63 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -138,14 +142,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 0de52d806c..6d8c7e4b07 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 db268a78d2..d71351c438 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 @@ -16,9 +16,7 @@ "offsetY": 1, "predicate": { "block": { - "blocks": [ - "minecraft:tall_grass" - ], + "blocks": "minecraft:tall_grass", "state": { "half": "upper" } @@ -80,9 +78,7 @@ "offsetY": -1, "predicate": { "block": { - "blocks": [ - "minecraft:tall_grass" - ], + "blocks": "minecraft:tall_grass", "state": { "half": "lower" } 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 e5f5fe4229..f44704c0c8 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json index f39588c95c..028b00e9e6 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] 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 38805e18d7..7b05c67374 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 @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json index d1a6b33e6e..2b4ea7b806 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json index f20818e69a..c677340129 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:acacia_boat" } ], "result": { - "item": "minecraft:acacia_chest_boat" + "count": 1, + "id": "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 d545c439a6..1df661b7b1 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:acacia_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:acacia_fence" + "id": "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 027948967b..01c8f1d461 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:acacia_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:acacia_fence_gate" + "count": 1, + "id": "minecraft:acacia_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_sign.json b/src/generated/resources/data/minecraft/recipes/acacia_sign.json index ab7495d12d..8591a10c68 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_sign.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:acacia_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:acacia_sign" + "id": "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 9f682df753..f3e8a6d92a 100644 --- a/src/generated/resources/data/minecraft/recipes/activator_rail.json +++ b/src/generated/resources/data/minecraft/recipes/activator_rail.json @@ -6,10 +6,10 @@ "item": "minecraft:redstone_torch" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:activator_rail" + "id": "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 4f70b2cea2..909e6271f9 100644 --- a/src/generated/resources/data/minecraft/recipes/andesite.json +++ b/src/generated/resources/data/minecraft/recipes/andesite.json @@ -6,11 +6,11 @@ "item": "minecraft:diorite" }, { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" } ], "result": { "count": 2, - "item": "minecraft:andesite" + "id": "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 33203f2d58..405668a7af 100644 --- a/src/generated/resources/data/minecraft/recipes/anvil.json +++ b/src/generated/resources/data/minecraft/recipes/anvil.json @@ -6,7 +6,7 @@ "item": "minecraft:iron_block" }, "i": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "iii" ], "result": { - "item": "minecraft:anvil" + "count": 1, + "id": "minecraft:anvil" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/armor_stand.json b/src/generated/resources/data/minecraft/recipes/armor_stand.json index 54da4b9a02..55e7dbeaff 100644 --- a/src/generated/resources/data/minecraft/recipes/armor_stand.json +++ b/src/generated/resources/data/minecraft/recipes/armor_stand.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "/": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "_": { "item": "minecraft:smooth_stone_slab" @@ -15,6 +15,7 @@ "/_/" ], "result": { - "item": "minecraft:armor_stand" + "count": 1, + "id": "minecraft:armor_stand" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/arrow.json b/src/generated/resources/data/minecraft/recipes/arrow.json index c4eba0d814..5b160e1c5a 100644 --- a/src/generated/resources/data/minecraft/recipes/arrow.json +++ b/src/generated/resources/data/minecraft/recipes/arrow.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:flint" @@ -19,6 +19,6 @@ ], "result": { "count": 4, - "item": "minecraft:arrow" + "id": "minecraft:arrow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json index b602612c1b..f50400493b 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:bamboo_raft" } ], "result": { - "item": "minecraft:bamboo_chest_raft" + "count": 1, + "id": "minecraft:bamboo_chest_raft" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json index 94bfe53d33..190c83b690 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_fence.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:bamboo_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:bamboo_fence" + "id": "minecraft:bamboo_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json index 23fdba6fe7..1d2e0f107b 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:bamboo_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:bamboo_fence_gate" + "count": 1, + "id": "minecraft:bamboo_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_sign.json b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json index 1c78cf6ddb..2ea528857f 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_sign.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:bamboo_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:bamboo_sign" + "id": "minecraft:bamboo_sign" } } \ 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 index 7fe3c649ab..6d5286ebbe 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:birch_boat" } ], "result": { - "item": "minecraft:birch_chest_boat" + "count": 1, + "id": "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 170c1c2520..fef03a747d 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:birch_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:birch_fence" + "id": "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 325773a2eb..c0f380a750 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:birch_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:birch_fence_gate" + "count": 1, + "id": "minecraft:birch_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_sign.json b/src/generated/resources/data/minecraft/recipes/birch_sign.json index 7a98a35feb..c7a1c36a77 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_sign.json +++ b/src/generated/resources/data/minecraft/recipes/birch_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:birch_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:birch_sign" + "id": "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 8f0a69aab4..26cb29a877 100644 --- a/src/generated/resources/data/minecraft/recipes/black_banner.json +++ b/src/generated/resources/data/minecraft/recipes/black_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:black_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:black_banner" + "count": 1, + "id": "minecraft:black_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/blast_furnace.json b/src/generated/resources/data/minecraft/recipes/blast_furnace.json index 1c34a6149c..6b73dce306 100644 --- a/src/generated/resources/data/minecraft/recipes/blast_furnace.json +++ b/src/generated/resources/data/minecraft/recipes/blast_furnace.json @@ -6,7 +6,7 @@ "item": "minecraft:smooth_stone" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "X": { "item": "minecraft:furnace" @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:blast_furnace" + "count": 1, + "id": "minecraft:blast_furnace" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/blue_banner.json b/src/generated/resources/data/minecraft/recipes/blue_banner.json index 2270bf926c..afb3cddb99 100644 --- a/src/generated/resources/data/minecraft/recipes/blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/blue_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:blue_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:blue_banner" + "count": 1, + "id": "minecraft:blue_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bow.json b/src/generated/resources/data/minecraft/recipes/bow.json index 6148fed74c..b531f496f4 100644 --- a/src/generated/resources/data/minecraft/recipes/bow.json +++ b/src/generated/resources/data/minecraft/recipes/bow.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -15,6 +15,7 @@ " #X" ], "result": { - "item": "minecraft:bow" + "count": 1, + "id": "minecraft:bow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/brown_banner.json b/src/generated/resources/data/minecraft/recipes/brown_banner.json index 71bb73f30a..b3b8c24a19 100644 --- a/src/generated/resources/data/minecraft/recipes/brown_banner.json +++ b/src/generated/resources/data/minecraft/recipes/brown_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:brown_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:brown_banner" + "count": 1, + "id": "minecraft:brown_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/brush.json b/src/generated/resources/data/minecraft/recipes/brush.json index 3c5b69dabe..ff366537c6 100644 --- a/src/generated/resources/data/minecraft/recipes/brush.json +++ b/src/generated/resources/data/minecraft/recipes/brush.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" }, "I": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:feather" @@ -18,6 +18,7 @@ "I" ], "result": { - "item": "minecraft:brush" + "count": 1, + "id": "minecraft:brush" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bucket.json b/src/generated/resources/data/minecraft/recipes/bucket.json index 22912ba151..6da8ba3ded 100644 --- a/src/generated/resources/data/minecraft/recipes/bucket.json +++ b/src/generated/resources/data/minecraft/recipes/bucket.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ " # " ], "result": { - "item": "minecraft:bucket" + "count": 1, + "id": "minecraft:bucket" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json index e71178e156..5cb919ad6c 100644 --- a/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json +++ b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" }, "X": { "item": "minecraft:sculk_sensor" @@ -14,6 +14,7 @@ "#X#" ], "result": { - "item": "minecraft:calibrated_sculk_sensor" + "count": 1, + "id": "minecraft:calibrated_sculk_sensor" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/campfire.json b/src/generated/resources/data/minecraft/recipes/campfire.json index d329eb4738..de8dffe49a 100644 --- a/src/generated/resources/data/minecraft/recipes/campfire.json +++ b/src/generated/resources/data/minecraft/recipes/campfire.json @@ -9,7 +9,7 @@ "tag": "minecraft:logs" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -18,6 +18,7 @@ "LLL" ], "result": { - "item": "minecraft:campfire" + "count": 1, + "id": "minecraft:campfire" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/candle.json b/src/generated/resources/data/minecraft/recipes/candle.json index add9d35c83..c19d2b0e7b 100644 --- a/src/generated/resources/data/minecraft/recipes/candle.json +++ b/src/generated/resources/data/minecraft/recipes/candle.json @@ -6,7 +6,7 @@ "item": "minecraft:honeycomb" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -14,6 +14,7 @@ "H" ], "result": { - "item": "minecraft:candle" + "count": 1, + "id": "minecraft:candle" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cauldron.json b/src/generated/resources/data/minecraft/recipes/cauldron.json index 982e8e6aa0..9fbb8b5af2 100644 --- a/src/generated/resources/data/minecraft/recipes/cauldron.json +++ b/src/generated/resources/data/minecraft/recipes/cauldron.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "###" ], "result": { - "item": "minecraft:cauldron" + "count": 1, + "id": "minecraft:cauldron" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/chain.json b/src/generated/resources/data/minecraft/recipes/chain.json index b8dc25358a..057c9304ce 100644 --- a/src/generated/resources/data/minecraft/recipes/chain.json +++ b/src/generated/resources/data/minecraft/recipes/chain.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "N": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "N" ], "result": { - "item": "minecraft:chain" + "count": 1, + "id": "minecraft:chain" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json index c8e78832c6..ee739ec5a2 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:cherry_boat" } ], "result": { - "item": "minecraft:cherry_chest_boat" + "count": 1, + "id": "minecraft:cherry_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence.json b/src/generated/resources/data/minecraft/recipes/cherry_fence.json index 7dd13ae3ac..c199386881 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_fence.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:cherry_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:cherry_fence" + "id": "minecraft:cherry_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json index 5d4ed45afc..d3f7509557 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:cherry_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:cherry_fence_gate" + "count": 1, + "id": "minecraft:cherry_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_sign.json b/src/generated/resources/data/minecraft/recipes/cherry_sign.json index 091031dca4..fbd15b6ef9 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_sign.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:cherry_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:cherry_sign" + "id": "minecraft:cherry_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/chest_minecart.json b/src/generated/resources/data/minecraft/recipes/chest_minecart.json index 99c7780621..bbf4896a30 100644 --- a/src/generated/resources/data/minecraft/recipes/chest_minecart.json +++ b/src/generated/resources/data/minecraft/recipes/chest_minecart.json @@ -3,13 +3,14 @@ "category": "misc", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:minecart" } ], "result": { - "item": "minecraft:chest_minecart" + "count": 1, + "id": "minecraft:chest_minecart" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/clock.json b/src/generated/resources/data/minecraft/recipes/clock.json index 31e02ad116..276fe557ef 100644 --- a/src/generated/resources/data/minecraft/recipes/clock.json +++ b/src/generated/resources/data/minecraft/recipes/clock.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "X": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:clock" + "count": 1, + "id": "minecraft:clock" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json index 1389c117ea..b507e536a1 100644 --- a/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:coast_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:coast_armor_trim_smithing_template" + "id": "minecraft:coast_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/compass.json b/src/generated/resources/data/minecraft/recipes/compass.json index f1b6226133..3c7cbcb015 100644 --- a/src/generated/resources/data/minecraft/recipes/compass.json +++ b/src/generated/resources/data/minecraft/recipes/compass.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "X": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:compass" + "count": 1, + "id": "minecraft:compass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_fence.json b/src/generated/resources/data/minecraft/recipes/crimson_fence.json index fd4c99174e..7b9e174282 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:crimson_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:crimson_fence" + "id": "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 b8d6cb88dd..6953799156 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:crimson_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:crimson_fence_gate" + "count": 1, + "id": "minecraft:crimson_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_sign.json b/src/generated/resources/data/minecraft/recipes/crimson_sign.json index 2d26330c3d..3bb6d2cd40 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_sign.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:crimson_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:crimson_sign" + "id": "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 bfacf24beb..87d3fb5baf 100644 --- a/src/generated/resources/data/minecraft/recipes/crossbow.json +++ b/src/generated/resources/data/minecraft/recipes/crossbow.json @@ -3,16 +3,16 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "$": { "item": "minecraft:tripwire_hook" }, "&": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -21,6 +21,7 @@ " # " ], "result": { - "item": "minecraft:crossbow" + "count": 1, + "id": "minecraft:crossbow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cyan_banner.json b/src/generated/resources/data/minecraft/recipes/cyan_banner.json index 2eae740c43..7c029672c6 100644 --- a/src/generated/resources/data/minecraft/recipes/cyan_banner.json +++ b/src/generated/resources/data/minecraft/recipes/cyan_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:cyan_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:cyan_banner" + "count": 1, + "id": "minecraft:cyan_banner" } } \ No newline at end of file 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 index 783c44a9fc..aae00295f7 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:dark_oak_boat" } ], "result": { - "item": "minecraft:dark_oak_chest_boat" + "count": 1, + "id": "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 f25b7a205a..ba37e3f888 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:dark_oak_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:dark_oak_fence" + "id": "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 53d878a102..b8365d4a28 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 @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:dark_oak_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:dark_oak_fence_gate" + "count": 1, + "id": "minecraft:dark_oak_fence_gate" } } \ No newline at end of file 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 286e275709..4d53a6d24f 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:dark_oak_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:dark_oak_sign" + "id": "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 ddafa7ab5b..97238ca6e4 100644 --- a/src/generated/resources/data/minecraft/recipes/detector_rail.json +++ b/src/generated/resources/data/minecraft/recipes/detector_rail.json @@ -9,7 +9,7 @@ "item": "minecraft:redstone" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:detector_rail" + "id": "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 fa33917a09..118f99e563 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_axe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:diamond_axe" + "count": 1, + "id": "minecraft:diamond_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_boots.json b/src/generated/resources/data/minecraft/recipes/diamond_boots.json index 0ab7eb99fe..7d6ace85e7 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_boots.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_boots" + "count": 1, + "id": "minecraft:diamond_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json index 1cd18f4c75..46ad865dff 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:diamond_chestplate" + "count": 1, + "id": "minecraft:diamond_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json index 9671c540d3..50a88a0967 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_helmet" + "count": 1, + "id": "minecraft:diamond_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json index ccd0e48768..b2bf02dd07 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:diamond_hoe" + "count": 1, + "id": "minecraft:diamond_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json index f9cbdcd738..5df5635836 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_leggings" + "count": 1, + "id": "minecraft:diamond_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json index affd0a3083..3397993a01 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:diamond_pickaxe" + "count": 1, + "id": "minecraft:diamond_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json index cb8282be2c..ae4f9eb985 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:diamond_shovel" + "count": 1, + "id": "minecraft:diamond_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_sword.json b/src/generated/resources/data/minecraft/recipes/diamond_sword.json index de7b7d161b..338ca63240 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_sword.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:diamond_sword" + "count": 1, + "id": "minecraft:diamond_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diorite.json b/src/generated/resources/data/minecraft/recipes/diorite.json index 6dfb532dcf..54714b8f40 100644 --- a/src/generated/resources/data/minecraft/recipes/diorite.json +++ b/src/generated/resources/data/minecraft/recipes/diorite.json @@ -3,7 +3,7 @@ "category": "building", "key": { "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "Q": { "item": "minecraft:quartz" @@ -15,6 +15,6 @@ ], "result": { "count": 2, - "item": "minecraft:diorite" + "id": "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 20076eae31..6ab105c14c 100644 --- a/src/generated/resources/data/minecraft/recipes/dispenser.json +++ b/src/generated/resources/data/minecraft/recipes/dispenser.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -18,6 +18,7 @@ "#R#" ], "result": { - "item": "minecraft:dispenser" + "count": 1, + "id": "minecraft:dispenser" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dropper.json b/src/generated/resources/data/minecraft/recipes/dropper.json index 76c51a4fa6..e358894ca7 100644 --- a/src/generated/resources/data/minecraft/recipes/dropper.json +++ b/src/generated/resources/data/minecraft/recipes/dropper.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ "#R#" ], "result": { - "item": "minecraft:dropper" + "count": 1, + "id": "minecraft:dropper" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json index f115d552d8..905e1f3f0d 100644 --- a/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:sandstone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:dune_armor_trim_smithing_template" + "id": "minecraft:dune_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/enchanting_table.json b/src/generated/resources/data/minecraft/recipes/enchanting_table.json index a238995fb9..0b202c954e 100644 --- a/src/generated/resources/data/minecraft/recipes/enchanting_table.json +++ b/src/generated/resources/data/minecraft/recipes/enchanting_table.json @@ -9,7 +9,7 @@ "item": "minecraft:book" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:enchanting_table" + "count": 1, + "id": "minecraft:enchanting_table" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json index 8b4a3fd515..f4183152ba 100644 --- a/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:end_stone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:eye_armor_trim_smithing_template" + "id": "minecraft:eye_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/fishing_rod.json b/src/generated/resources/data/minecraft/recipes/fishing_rod.json index 8d6a571149..72690672d3 100644 --- a/src/generated/resources/data/minecraft/recipes/fishing_rod.json +++ b/src/generated/resources/data/minecraft/recipes/fishing_rod.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -15,6 +15,7 @@ "# X" ], "result": { - "item": "minecraft:fishing_rod" + "count": 1, + "id": "minecraft:fishing_rod" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/flint_and_steel.json b/src/generated/resources/data/minecraft/recipes/flint_and_steel.json index 7181ac5d08..c1ecbca55f 100644 --- a/src/generated/resources/data/minecraft/recipes/flint_and_steel.json +++ b/src/generated/resources/data/minecraft/recipes/flint_and_steel.json @@ -3,13 +3,14 @@ "category": "equipment", "ingredients": [ { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, { "item": "minecraft:flint" } ], "result": { - "item": "minecraft:flint_and_steel" + "count": 1, + "id": "minecraft:flint_and_steel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json b/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json index 26f7685da2..52c02f8057 100644 --- a/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json +++ b/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, "X": { "item": "minecraft:melon_slice" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:glistering_melon_slice" + "count": 1, + "id": "minecraft:glistering_melon_slice" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json b/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json index 7b9dc62ee4..ca6e7b8674 100644 --- a/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json +++ b/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json @@ -4,7 +4,7 @@ "group": "gold_ingot", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" } }, "pattern": [ @@ -13,6 +13,7 @@ "###" ], "result": { - "item": "minecraft:gold_ingot" + "count": 1, + "id": "minecraft:gold_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_apple.json b/src/generated/resources/data/minecraft/recipes/golden_apple.json index 674bf883d3..6839d31d1e 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_apple.json +++ b/src/generated/resources/data/minecraft/recipes/golden_apple.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "X": { "item": "minecraft:apple" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:golden_apple" + "count": 1, + "id": "minecraft:golden_apple" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_axe.json b/src/generated/resources/data/minecraft/recipes/golden_axe.json index 4811c860ad..ed95ebdd0a 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:golden_axe" + "count": 1, + "id": "minecraft:golden_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_boots.json b/src/generated/resources/data/minecraft/recipes/golden_boots.json index d5e15bc24f..0b9010aa3c 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_boots.json +++ b/src/generated/resources/data/minecraft/recipes/golden_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:golden_boots" + "count": 1, + "id": "minecraft:golden_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_carrot.json b/src/generated/resources/data/minecraft/recipes/golden_carrot.json index 60200461d9..444588c03d 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_carrot.json +++ b/src/generated/resources/data/minecraft/recipes/golden_carrot.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, "X": { "item": "minecraft:carrot" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:golden_carrot" + "count": 1, + "id": "minecraft:golden_carrot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json index a06e7c25eb..edd79c9908 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:golden_chestplate" + "count": 1, + "id": "minecraft:golden_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_helmet.json b/src/generated/resources/data/minecraft/recipes/golden_helmet.json index 2161b20de7..f275fa7514 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/golden_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:golden_helmet" + "count": 1, + "id": "minecraft:golden_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_hoe.json b/src/generated/resources/data/minecraft/recipes/golden_hoe.json index 9626f019d7..6a305f1b18 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:golden_hoe" + "count": 1, + "id": "minecraft:golden_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_leggings.json b/src/generated/resources/data/minecraft/recipes/golden_leggings.json index a377fbc982..54c8ae061e 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/golden_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:golden_leggings" + "count": 1, + "id": "minecraft:golden_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json index b953212ba9..be94e94d06 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:golden_pickaxe" + "count": 1, + "id": "minecraft:golden_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_shovel.json b/src/generated/resources/data/minecraft/recipes/golden_shovel.json index 5e4bbd536c..b71a44cb47 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/golden_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:golden_shovel" + "count": 1, + "id": "minecraft:golden_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_sword.json b/src/generated/resources/data/minecraft/recipes/golden_sword.json index c237f1afa5..fdfc713b40 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/golden_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:golden_sword" + "count": 1, + "id": "minecraft:golden_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/gray_banner.json b/src/generated/resources/data/minecraft/recipes/gray_banner.json index 3a0bb04ef4..9a36e40aed 100644 --- a/src/generated/resources/data/minecraft/recipes/gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/gray_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:gray_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:gray_banner" + "count": 1, + "id": "minecraft:gray_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/green_banner.json b/src/generated/resources/data/minecraft/recipes/green_banner.json index 000083bcf5..3960ffd83b 100644 --- a/src/generated/resources/data/minecraft/recipes/green_banner.json +++ b/src/generated/resources/data/minecraft/recipes/green_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:green_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:green_banner" + "count": 1, + "id": "minecraft:green_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/grindstone.json b/src/generated/resources/data/minecraft/recipes/grindstone.json index beb54f35ee..234b5a8e4f 100644 --- a/src/generated/resources/data/minecraft/recipes/grindstone.json +++ b/src/generated/resources/data/minecraft/recipes/grindstone.json @@ -9,7 +9,7 @@ "item": "minecraft:stone_slab" }, "I": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,7 @@ "# #" ], "result": { - "item": "minecraft:grindstone" + "count": 1, + "id": "minecraft:grindstone" } } \ No newline at end of file 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 1ffbcccce9..ac9cd700dc 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 @@ -3,13 +3,14 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ "##" ], "result": { - "item": "minecraft:heavy_weighted_pressure_plate" + "count": 1, + "id": "minecraft:heavy_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/hopper.json b/src/generated/resources/data/minecraft/recipes/hopper.json index 31bff00da6..09424bfd07 100644 --- a/src/generated/resources/data/minecraft/recipes/hopper.json +++ b/src/generated/resources/data/minecraft/recipes/hopper.json @@ -3,10 +3,10 @@ "category": "redstone", "key": { "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " I " ], "result": { - "item": "minecraft:hopper" + "count": 1, + "id": "minecraft:hopper" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json index 12343eb0d6..f84de52ad6 100644 --- a/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:host_armor_trim_smithing_template" + "id": "minecraft:host_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_axe.json b/src/generated/resources/data/minecraft/recipes/iron_axe.json index 09ad3b86e2..950fa6ac7a 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_axe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:iron_axe" + "count": 1, + "id": "minecraft:iron_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_bars.json b/src/generated/resources/data/minecraft/recipes/iron_bars.json index 37a55f1b4d..28be431fc6 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_bars.json +++ b/src/generated/resources/data/minecraft/recipes/iron_bars.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,6 @@ ], "result": { "count": 16, - "item": "minecraft:iron_bars" + "id": "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 a5b13c1270..f489f382e6 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_boots.json +++ b/src/generated/resources/data/minecraft/recipes/iron_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:iron_boots" + "count": 1, + "id": "minecraft:iron_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json index c22d896eca..67f70bc19c 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:iron_chestplate" + "count": 1, + "id": "minecraft:iron_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_door.json b/src/generated/resources/data/minecraft/recipes/iron_door.json index f138c8898a..be3bbbf4da 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_door.json +++ b/src/generated/resources/data/minecraft/recipes/iron_door.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -13,6 +13,6 @@ ], "result": { "count": 3, - "item": "minecraft:iron_door" + "id": "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 fc376406b6..4b7326c79f 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/iron_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:iron_helmet" + "count": 1, + "id": "minecraft:iron_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_hoe.json b/src/generated/resources/data/minecraft/recipes/iron_hoe.json index d9ddbbf1a5..e175c35d0c 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:iron_hoe" + "count": 1, + "id": "minecraft:iron_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json b/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json index 8871d95165..2cf9cdfd88 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json +++ b/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json @@ -4,7 +4,7 @@ "group": "iron_ingot", "key": { "#": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -13,6 +13,7 @@ "###" ], "result": { - "item": "minecraft:iron_ingot" + "count": 1, + "id": "minecraft:iron_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_leggings.json b/src/generated/resources/data/minecraft/recipes/iron_leggings.json index 9249dfa36e..db1ad0850c 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/iron_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:iron_leggings" + "count": 1, + "id": "minecraft:iron_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json index 381e76055b..f829c9df56 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:iron_pickaxe" + "count": 1, + "id": "minecraft:iron_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_shovel.json b/src/generated/resources/data/minecraft/recipes/iron_shovel.json index fa186c42f6..5a11203af5 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/iron_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:iron_shovel" + "count": 1, + "id": "minecraft:iron_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_sword.json b/src/generated/resources/data/minecraft/recipes/iron_sword.json index d1b1fa9ff4..6f4c0a46cd 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_sword.json +++ b/src/generated/resources/data/minecraft/recipes/iron_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:iron_sword" + "count": 1, + "id": "minecraft:iron_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json index 71777b8ca6..45d3357442 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json +++ b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "##" ], "result": { - "item": "minecraft:iron_trapdoor" + "count": 1, + "id": "minecraft:iron_trapdoor" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/item_frame.json b/src/generated/resources/data/minecraft/recipes/item_frame.json index 7383dc21ac..f73e86feb5 100644 --- a/src/generated/resources/data/minecraft/recipes/item_frame.json +++ b/src/generated/resources/data/minecraft/recipes/item_frame.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:leather" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:item_frame" + "count": 1, + "id": "minecraft:item_frame" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jukebox.json b/src/generated/resources/data/minecraft/recipes/jukebox.json index 23851e3783..08f3d3b4d3 100644 --- a/src/generated/resources/data/minecraft/recipes/jukebox.json +++ b/src/generated/resources/data/minecraft/recipes/jukebox.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:jukebox" + "count": 1, + "id": "minecraft:jukebox" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json index 3d03d82aae..43b367f49d 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:jungle_boat" } ], "result": { - "item": "minecraft:jungle_chest_boat" + "count": 1, + "id": "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 28ab3e0b5b..b49a38c19a 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:jungle_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:jungle_fence" + "id": "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 eeb195ecbe..a1dcfbde01 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:jungle_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:jungle_fence_gate" + "count": 1, + "id": "minecraft:jungle_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_sign.json b/src/generated/resources/data/minecraft/recipes/jungle_sign.json index 5c14ff95ef..713c47d1fa 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_sign.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:jungle_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:jungle_sign" + "id": "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 50326bf053..8d64f336a8 100644 --- a/src/generated/resources/data/minecraft/recipes/ladder.json +++ b/src/generated/resources/data/minecraft/recipes/ladder.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -13,6 +13,6 @@ ], "result": { "count": 3, - "item": "minecraft:ladder" + "id": "minecraft:ladder" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lantern.json b/src/generated/resources/data/minecraft/recipes/lantern.json index 8e1fd1395c..d7435e4ee2 100644 --- a/src/generated/resources/data/minecraft/recipes/lantern.json +++ b/src/generated/resources/data/minecraft/recipes/lantern.json @@ -6,7 +6,7 @@ "item": "minecraft:torch" }, "X": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "XXX" ], "result": { - "item": "minecraft:lantern" + "count": 1, + "id": "minecraft:lantern" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lead.json b/src/generated/resources/data/minecraft/recipes/lead.json index 56fcc01256..57ca6d0bbc 100644 --- a/src/generated/resources/data/minecraft/recipes/lead.json +++ b/src/generated/resources/data/minecraft/recipes/lead.json @@ -6,7 +6,7 @@ "item": "minecraft:slime_ball" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 2, - "item": "minecraft:lead" + "id": "minecraft:lead" } } \ 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 23666a3173..a92056e26a 100644 --- a/src/generated/resources/data/minecraft/recipes/lever.json +++ b/src/generated/resources/data/minecraft/recipes/lever.json @@ -3,10 +3,10 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -14,6 +14,7 @@ "#" ], "result": { - "item": "minecraft:lever" + "count": 1, + "id": "minecraft:lever" } } \ No newline at end of file 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 2f7d401abc..1fb0a66d80 100644 --- a/src/generated/resources/data/minecraft/recipes/light_blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_blue_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:light_blue_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:light_blue_banner" + "count": 1, + "id": "minecraft:light_blue_banner" } } \ No newline at end of file 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 0564f26f74..35d93c6693 100644 --- a/src/generated/resources/data/minecraft/recipes/light_gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_gray_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:light_gray_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:light_gray_banner" + "count": 1, + "id": "minecraft:light_gray_banner" } } \ No newline at end of file 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 8c0044b28c..0d6eec2360 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 @@ -3,13 +3,14 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ "##" ], "result": { - "item": "minecraft:light_weighted_pressure_plate" + "count": 1, + "id": "minecraft:light_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lightning_rod.json b/src/generated/resources/data/minecraft/recipes/lightning_rod.json index 8d1a5eca19..5a2186f659 100644 --- a/src/generated/resources/data/minecraft/recipes/lightning_rod.json +++ b/src/generated/resources/data/minecraft/recipes/lightning_rod.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" } }, "pattern": [ @@ -12,6 +12,7 @@ "#" ], "result": { - "item": "minecraft:lightning_rod" + "count": 1, + "id": "minecraft:lightning_rod" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lime_banner.json b/src/generated/resources/data/minecraft/recipes/lime_banner.json index 603a2a1ae2..c076add05b 100644 --- a/src/generated/resources/data/minecraft/recipes/lime_banner.json +++ b/src/generated/resources/data/minecraft/recipes/lime_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:lime_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:lime_banner" + "count": 1, + "id": "minecraft:lime_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lodestone.json b/src/generated/resources/data/minecraft/recipes/lodestone.json index 8741c3f76e..5d1bc8a33a 100644 --- a/src/generated/resources/data/minecraft/recipes/lodestone.json +++ b/src/generated/resources/data/minecraft/recipes/lodestone.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/netherite" + "tag": "c:ingots/netherite" }, "S": { "item": "minecraft:chiseled_stone_bricks" @@ -15,6 +15,7 @@ "SSS" ], "result": { - "item": "minecraft:lodestone" + "count": 1, + "id": "minecraft:lodestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/loom.json b/src/generated/resources/data/minecraft/recipes/loom.json index 2893af442a..7fbb48dfe9 100644 --- a/src/generated/resources/data/minecraft/recipes/loom.json +++ b/src/generated/resources/data/minecraft/recipes/loom.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "@": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -14,6 +14,7 @@ "##" ], "result": { - "item": "minecraft:loom" + "count": 1, + "id": "minecraft:loom" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/magenta_banner.json b/src/generated/resources/data/minecraft/recipes/magenta_banner.json index 5b02fea383..5996580e8d 100644 --- a/src/generated/resources/data/minecraft/recipes/magenta_banner.json +++ b/src/generated/resources/data/minecraft/recipes/magenta_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:magenta_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:magenta_banner" + "count": 1, + "id": "minecraft:magenta_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json index ef18815307..233473f202 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:mangrove_boat" } ], "result": { - "item": "minecraft:mangrove_chest_boat" + "count": 1, + "id": "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 index a799b071ac..01d6d24181 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_fence.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:mangrove_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:mangrove_fence" + "id": "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 index a3bcbde9ff..3a0927be5e 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:mangrove_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:mangrove_fence_gate" + "count": 1, + "id": "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 index 9fce4bbc44..a55530fcd8 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_sign.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:mangrove_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:mangrove_sign" + "id": "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 aa5a1ea93d..15fdd90d0e 100644 --- a/src/generated/resources/data/minecraft/recipes/minecart.json +++ b/src/generated/resources/data/minecraft/recipes/minecart.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "###" ], "result": { - "item": "minecraft:minecart" + "count": 1, + "id": "minecraft:minecart" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json index a59fa3296a..80acf71a6d 100644 --- a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json +++ b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json @@ -4,13 +4,14 @@ "group": "mossy_cobblestone", "ingredients": [ { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, { "item": "minecraft:moss_block" } ], "result": { - "item": "minecraft:mossy_cobblestone" + "count": 1, + "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json index 79051c2fa1..6980c8b3a2 100644 --- a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json +++ b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json @@ -4,13 +4,14 @@ "group": "mossy_cobblestone", "ingredients": [ { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, { "item": "minecraft:vine" } ], "result": { - "item": "minecraft:mossy_cobblestone" + "count": 1, + "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/netherite_ingot.json b/src/generated/resources/data/minecraft/recipes/netherite_ingot.json index 21ffad1650..ffa224998e 100644 --- a/src/generated/resources/data/minecraft/recipes/netherite_ingot.json +++ b/src/generated/resources/data/minecraft/recipes/netherite_ingot.json @@ -16,19 +16,20 @@ "item": "minecraft:netherite_scrap" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } ], "result": { - "item": "minecraft:netherite_ingot" + "count": 1, + "id": "minecraft:netherite_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json index af5054afbd..44fc480189 100644 --- a/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:netherrack" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:netherite_upgrade_smithing_template" + "id": "minecraft:netherite_upgrade_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json index 638735a211..9c1869540b 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:oak_boat" } ], "result": { - "item": "minecraft:oak_chest_boat" + "count": 1, + "id": "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 e3f9961507..3227fa2bc7 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:oak_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:oak_fence" + "id": "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 956d67d1a1..45923171d8 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:oak_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:oak_fence_gate" + "count": 1, + "id": "minecraft:oak_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_sign.json b/src/generated/resources/data/minecraft/recipes/oak_sign.json index 13132c63a0..618d6d414a 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/oak_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:oak_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:oak_sign" + "id": "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 f9304ff07a..d48ca4adf2 100644 --- a/src/generated/resources/data/minecraft/recipes/observer.json +++ b/src/generated/resources/data/minecraft/recipes/observer.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "Q": { "item": "minecraft:quartz" @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:observer" + "count": 1, + "id": "minecraft:observer" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/orange_banner.json b/src/generated/resources/data/minecraft/recipes/orange_banner.json index c260165899..f2f3b03d6c 100644 --- a/src/generated/resources/data/minecraft/recipes/orange_banner.json +++ b/src/generated/resources/data/minecraft/recipes/orange_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:orange_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:orange_banner" + "count": 1, + "id": "minecraft:orange_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/painting.json b/src/generated/resources/data/minecraft/recipes/painting.json index dfe4ad0caa..df1b6d324d 100644 --- a/src/generated/resources/data/minecraft/recipes/painting.json +++ b/src/generated/resources/data/minecraft/recipes/painting.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:wool" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:painting" + "count": 1, + "id": "minecraft:painting" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/pink_banner.json b/src/generated/resources/data/minecraft/recipes/pink_banner.json index 1965e7dffc..951e77cedd 100644 --- a/src/generated/resources/data/minecraft/recipes/pink_banner.json +++ b/src/generated/resources/data/minecraft/recipes/pink_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:pink_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:pink_banner" + "count": 1, + "id": "minecraft:pink_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/piston.json b/src/generated/resources/data/minecraft/recipes/piston.json index 74f40060e5..b57e13cfbc 100644 --- a/src/generated/resources/data/minecraft/recipes/piston.json +++ b/src/generated/resources/data/minecraft/recipes/piston.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -12,7 +12,7 @@ "tag": "minecraft:planks" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -21,6 +21,7 @@ "#R#" ], "result": { - "item": "minecraft:piston" + "count": 1, + "id": "minecraft:piston" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json index 2163aba74f..97f277e6b1 100644 --- a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json +++ b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json @@ -3,7 +3,7 @@ "category": "building", "key": { "S": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" } }, "pattern": [ @@ -12,6 +12,6 @@ ], "result": { "count": 4, - "item": "minecraft:polished_deepslate" + "id": "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 c8b5b6e014..97f3e17964 100644 --- a/src/generated/resources/data/minecraft/recipes/powered_rail.json +++ b/src/generated/resources/data/minecraft/recipes/powered_rail.json @@ -3,13 +3,13 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "R": { "item": "minecraft:redstone" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:powered_rail" + "id": "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 9c9baa1d93..5475bffc70 100644 --- a/src/generated/resources/data/minecraft/recipes/purple_banner.json +++ b/src/generated/resources/data/minecraft/recipes/purple_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:purple_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:purple_banner" + "count": 1, + "id": "minecraft:purple_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/rail.json b/src/generated/resources/data/minecraft/recipes/rail.json index a14f5d7786..481af10ee3 100644 --- a/src/generated/resources/data/minecraft/recipes/rail.json +++ b/src/generated/resources/data/minecraft/recipes/rail.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 16, - "item": "minecraft:rail" + "id": "minecraft:rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json index 579235dae5..97a148d159 100644 --- a/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:raiser_armor_trim_smithing_template" + "id": "minecraft:raiser_armor_trim_smithing_template" } } \ 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 ece467fb8a..89b92a5470 100644 --- a/src/generated/resources/data/minecraft/recipes/red_banner.json +++ b/src/generated/resources/data/minecraft/recipes/red_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:red_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:red_banner" + "count": 1, + "id": "minecraft:red_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/redstone_torch.json b/src/generated/resources/data/minecraft/recipes/redstone_torch.json index 3fef11c1ec..378c0d7b88 100644 --- a/src/generated/resources/data/minecraft/recipes/redstone_torch.json +++ b/src/generated/resources/data/minecraft/recipes/redstone_torch.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:redstone" @@ -14,6 +14,7 @@ "#" ], "result": { - "item": "minecraft:redstone_torch" + "count": 1, + "id": "minecraft:redstone_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json index d15c589c64..6ec72db0dd 100644 --- a/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:netherrack" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:rib_armor_trim_smithing_template" + "id": "minecraft:rib_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/scaffolding.json b/src/generated/resources/data/minecraft/recipes/scaffolding.json index 9340d3da6d..c0290aba8c 100644 --- a/src/generated/resources/data/minecraft/recipes/scaffolding.json +++ b/src/generated/resources/data/minecraft/recipes/scaffolding.json @@ -6,7 +6,7 @@ "item": "minecraft:bamboo" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 6, - "item": "minecraft:scaffolding" + "id": "minecraft:scaffolding" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json index bccef0e6f5..8bfac2e3f9 100644 --- a/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:sentry_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:sentry_armor_trim_smithing_template" + "id": "minecraft:sentry_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json index e08dc1ce55..980b1d2108 100644 --- a/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:shaper_armor_trim_smithing_template" + "id": "minecraft:shaper_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shears.json b/src/generated/resources/data/minecraft/recipes/shears.json index 920ff4fd1d..cc526718eb 100644 --- a/src/generated/resources/data/minecraft/recipes/shears.json +++ b/src/generated/resources/data/minecraft/recipes/shears.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "# " ], "result": { - "item": "minecraft:shears" + "count": 1, + "id": "minecraft:shears" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shield.json b/src/generated/resources/data/minecraft/recipes/shield.json index d746ab4ede..46aa8fbe7d 100644 --- a/src/generated/resources/data/minecraft/recipes/shield.json +++ b/src/generated/resources/data/minecraft/recipes/shield.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "o": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " W " ], "result": { - "item": "minecraft:shield" + "count": 1, + "id": "minecraft:shield" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shulker_box.json b/src/generated/resources/data/minecraft/recipes/shulker_box.json index 15c67ec58d..cfa4fed9ea 100644 --- a/src/generated/resources/data/minecraft/recipes/shulker_box.json +++ b/src/generated/resources/data/minecraft/recipes/shulker_box.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "-": { "item": "minecraft:shulker_shell" @@ -15,6 +15,7 @@ "-" ], "result": { - "item": "minecraft:shulker_box" + "count": 1, + "id": "minecraft:shulker_box" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json index 9fa1c8204d..4ade3deadd 100644 --- a/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" }, "S": { "item": "minecraft:silence_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:silence_armor_trim_smithing_template" + "id": "minecraft:silence_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/smithing_table.json b/src/generated/resources/data/minecraft/recipes/smithing_table.json index e1ba2b4749..e7dadd831c 100644 --- a/src/generated/resources/data/minecraft/recipes/smithing_table.json +++ b/src/generated/resources/data/minecraft/recipes/smithing_table.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "@": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "##" ], "result": { - "item": "minecraft:smithing_table" + "count": 1, + "id": "minecraft:smithing_table" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json index 5bffa9a875..8aa0dd55c1 100644 --- a/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:blackstone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:snout_armor_trim_smithing_template" + "id": "minecraft:snout_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_campfire.json b/src/generated/resources/data/minecraft/recipes/soul_campfire.json index 4e1d80e502..e7459aa07d 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_campfire.json +++ b/src/generated/resources/data/minecraft/recipes/soul_campfire.json @@ -9,7 +9,7 @@ "tag": "minecraft:logs" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -18,6 +18,7 @@ "LLL" ], "result": { - "item": "minecraft:soul_campfire" + "count": 1, + "id": "minecraft:soul_campfire" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_lantern.json b/src/generated/resources/data/minecraft/recipes/soul_lantern.json index 1b40191176..e5f39ad8ec 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_lantern.json +++ b/src/generated/resources/data/minecraft/recipes/soul_lantern.json @@ -6,7 +6,7 @@ "item": "minecraft:soul_torch" }, "X": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "XXX" ], "result": { - "item": "minecraft:soul_lantern" + "count": 1, + "id": "minecraft:soul_lantern" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_torch.json b/src/generated/resources/data/minecraft/recipes/soul_torch.json index 55f4104c79..fc57b7b0d3 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_torch.json +++ b/src/generated/resources/data/minecraft/recipes/soul_torch.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "S": { "tag": "minecraft:soul_fire_base_blocks" @@ -24,6 +24,6 @@ ], "result": { "count": 4, - "item": "minecraft:soul_torch" + "id": "minecraft:soul_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json index d77a357eb4..4cd59d3d03 100644 --- a/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:purpur_block" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:spire_armor_trim_smithing_template" + "id": "minecraft:spire_armor_trim_smithing_template" } } \ 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 index 399ef2beab..f89eeea73e 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:spruce_boat" } ], "result": { - "item": "minecraft:spruce_chest_boat" + "count": 1, + "id": "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 b4eab9c13f..d8790bce04 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:spruce_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:spruce_fence" + "id": "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 258057d801..61815e9606 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:spruce_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:spruce_fence_gate" + "count": 1, + "id": "minecraft:spruce_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_sign.json b/src/generated/resources/data/minecraft/recipes/spruce_sign.json index fb28d8c03e..03fb28133e 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_sign.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:spruce_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:spruce_sign" + "id": "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 f649bfc44a..ea680e3fb9 100644 --- a/src/generated/resources/data/minecraft/recipes/spyglass.json +++ b/src/generated/resources/data/minecraft/recipes/spyglass.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" }, "X": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" } }, "pattern": [ @@ -15,6 +15,7 @@ " X " ], "result": { - "item": "minecraft:spyglass" + "count": 1, + "id": "minecraft:spyglass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_axe.json b/src/generated/resources/data/minecraft/recipes/stone_axe.json index 58ce1597f6..0bac2f1180 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_axe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_axe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:stone_axe" + "count": 1, + "id": "minecraft:stone_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_hoe.json b/src/generated/resources/data/minecraft/recipes/stone_hoe.json index 2827ae1eab..8c5b5eceee 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_hoe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:stone_hoe" + "count": 1, + "id": "minecraft:stone_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json index 8d02352c43..b366ac2065 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:stone_pickaxe" + "count": 1, + "id": "minecraft:stone_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_shovel.json b/src/generated/resources/data/minecraft/recipes/stone_shovel.json index 609f6e511a..d1fbdebd22 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/stone_shovel.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:stone_shovel" + "count": 1, + "id": "minecraft:stone_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_sword.json b/src/generated/resources/data/minecraft/recipes/stone_sword.json index 7afc9ceec6..559caac73d 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_sword.json +++ b/src/generated/resources/data/minecraft/recipes/stone_sword.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:stone_sword" + "count": 1, + "id": "minecraft:stone_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stonecutter.json b/src/generated/resources/data/minecraft/recipes/stonecutter.json index 4fa791814f..e0820aeedb 100644 --- a/src/generated/resources/data/minecraft/recipes/stonecutter.json +++ b/src/generated/resources/data/minecraft/recipes/stonecutter.json @@ -6,7 +6,7 @@ "item": "minecraft:stone" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -14,6 +14,7 @@ "###" ], "result": { - "item": "minecraft:stonecutter" + "count": 1, + "id": "minecraft:stonecutter" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json index 7663db553b..8292dd0993 100644 --- a/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:prismarine" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:tide_armor_trim_smithing_template" + "id": "minecraft:tide_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tinted_glass.json b/src/generated/resources/data/minecraft/recipes/tinted_glass.json index 2017014aff..99d27ab3d3 100644 --- a/src/generated/resources/data/minecraft/recipes/tinted_glass.json +++ b/src/generated/resources/data/minecraft/recipes/tinted_glass.json @@ -6,7 +6,7 @@ "item": "minecraft:glass" }, "S": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 2, - "item": "minecraft:tinted_glass" + "id": "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 71147ae0aa..031078faf0 100644 --- a/src/generated/resources/data/minecraft/recipes/torch.json +++ b/src/generated/resources/data/minecraft/recipes/torch.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": [ { @@ -20,6 +20,6 @@ ], "result": { "count": 4, - "item": "minecraft:torch" + "id": "minecraft:torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/trapped_chest.json b/src/generated/resources/data/minecraft/recipes/trapped_chest.json index 0ccc058c06..1cf84155e9 100644 --- a/src/generated/resources/data/minecraft/recipes/trapped_chest.json +++ b/src/generated/resources/data/minecraft/recipes/trapped_chest.json @@ -3,13 +3,14 @@ "category": "redstone", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:tripwire_hook" } ], "result": { - "item": "minecraft:trapped_chest" + "count": 1, + "id": "minecraft:trapped_chest" } } \ 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 a02479f770..b966ce7a63 100644 --- a/src/generated/resources/data/minecraft/recipes/tripwire_hook.json +++ b/src/generated/resources/data/minecraft/recipes/tripwire_hook.json @@ -6,10 +6,10 @@ "tag": "minecraft:planks" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:tripwire_hook" + "id": "minecraft:tripwire_hook" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json index 981c13b403..c4346ef9e4 100644 --- a/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:vex_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:vex_armor_trim_smithing_template" + "id": "minecraft:vex_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json index b263c2f356..1e6185aa9d 100644 --- a/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" }, "S": { "item": "minecraft:ward_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:ward_armor_trim_smithing_template" + "id": "minecraft:ward_armor_trim_smithing_template" } } \ 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 052fa02e71..715d558dd6 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:warped_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:warped_fence" + "id": "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 f176822579..15dcad57d5 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:warped_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:warped_fence_gate" + "count": 1, + "id": "minecraft:warped_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_sign.json b/src/generated/resources/data/minecraft/recipes/warped_sign.json index cbaa3b7b87..b0f4112a6d 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_sign.json +++ b/src/generated/resources/data/minecraft/recipes/warped_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:warped_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:warped_sign" + "id": "minecraft:warped_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json index a35c9bbf95..563776c2c5 100644 --- a/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:wayfinder_armor_trim_smithing_template" + "id": "minecraft:wayfinder_armor_trim_smithing_template" } } \ 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 9957dc5b0a..418906d5b9 100644 --- a/src/generated/resources/data/minecraft/recipes/white_banner.json +++ b/src/generated/resources/data/minecraft/recipes/white_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:white_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:white_banner" + "count": 1, + "id": "minecraft:white_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json index ed91ecb02d..8eec0dc5e9 100644 --- a/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:mossy_cobblestone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:wild_armor_trim_smithing_template" + "id": "minecraft:wild_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_axe.json b/src/generated/resources/data/minecraft/recipes/wooden_axe.json index 1f6cabc9b3..25cc73c46f 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_axe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:wooden_axe" + "count": 1, + "id": "minecraft:wooden_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json index 0faec2df65..a068c7fdc5 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:wooden_hoe" + "count": 1, + "id": "minecraft:wooden_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json index 70c46788bc..b09f9389ab 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:wooden_pickaxe" + "count": 1, + "id": "minecraft:wooden_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json index e5d95dbe8f..dd2aa5e363 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:wooden_shovel" + "count": 1, + "id": "minecraft:wooden_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_sword.json b/src/generated/resources/data/minecraft/recipes/wooden_sword.json index f16e202780..8906ea876f 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_sword.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:wooden_sword" + "count": 1, + "id": "minecraft:wooden_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/yellow_banner.json b/src/generated/resources/data/minecraft/recipes/yellow_banner.json index 80eb283553..5c1c07e88b 100644 --- a/src/generated/resources/data/minecraft/recipes/yellow_banner.json +++ b/src/generated/resources/data/minecraft/recipes/yellow_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:yellow_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:yellow_banner" + "count": 1, + "id": "minecraft:yellow_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json b/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json index 34e4ecdd11..15a3911080 100644 --- a/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json +++ b/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json @@ -3,6 +3,9 @@ "minecraft:blaze": { "sound": "minecraft:entity.parrot.imitate.blaze" }, + "minecraft:bogged": { + "sound": "minecraft:entity.parrot.imitate.bogged" + }, "minecraft:breeze": { "sound": "minecraft:entity.parrot.imitate.breeze" }, diff --git a/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json b/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json new file mode 100644 index 0000000000..fb75bfe278 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:enderman_place_on_blacklist", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_environment.json b/src/generated/resources/data/neoforge/tags/damage_type/is_environment.json similarity index 83% rename from src/generated/resources/data/forge/tags/damage_type/is_environment.json rename to src/generated/resources/data/neoforge/tags/damage_type/is_environment.json index 77b995dd5e..e351503a5c 100644 --- a/src/generated/resources/data/forge/tags/damage_type/is_environment.json +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_environment.json @@ -17,6 +17,10 @@ "minecraft:cramming", "minecraft:fly_into_wall", "minecraft:sweet_berry_bush", - "minecraft:in_wall" + "minecraft:in_wall", + { + "id": "#forge:is_environment", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_magic.json b/src/generated/resources/data/neoforge/tags/damage_type/is_magic.json similarity index 51% rename from src/generated/resources/data/forge/tags/damage_type/is_magic.json rename to src/generated/resources/data/neoforge/tags/damage_type/is_magic.json index e65624cbcb..09c4487b29 100644 --- a/src/generated/resources/data/forge/tags/damage_type/is_magic.json +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_magic.json @@ -4,7 +4,11 @@ "minecraft:indirect_magic", "minecraft:thorns", "minecraft:dragon_breath", - "#forge:is_poison", - "#forge:is_wither" + "#neoforge:is_poison", + "#neoforge:is_wither", + { + "id": "#forge:is_magic", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_physical.json b/src/generated/resources/data/neoforge/tags/damage_type/is_physical.json similarity index 85% rename from src/generated/resources/data/forge/tags/damage_type/is_physical.json rename to src/generated/resources/data/neoforge/tags/damage_type/is_physical.json index ed7aa2f6e7..3073b3807b 100644 --- a/src/generated/resources/data/forge/tags/damage_type/is_physical.json +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_physical.json @@ -19,6 +19,10 @@ "minecraft:mob_projectile", "minecraft:sonic_boom", "minecraft:in_wall", - "minecraft:generic" + "minecraft:generic", + { + "id": "#forge:is_physical", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json b/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json new file mode 100644 index 0000000000..a20ac8c9b0 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json @@ -0,0 +1,9 @@ +{ + "values": [ + "neoforge:poison", + { + "id": "#forge:is_poison", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json b/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json new file mode 100644 index 0000000000..f14aee1e66 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:generic_kill", + "minecraft:outside_border", + "minecraft:out_of_world", + { + "id": "#forge:is_technical", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json b/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json new file mode 100644 index 0000000000..178bad95f4 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:wither", + "minecraft:wither_skull", + { + "id": "#forge:is_wither", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json b/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json new file mode 100644 index 0000000000..cf630670d5 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:no_flinch", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand/colorless.json b/src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json similarity index 50% rename from src/generated/resources/data/forge/tags/items/sand/colorless.json rename to src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json index af14f42f56..9083586809 100644 --- a/src/generated/resources/data/forge/tags/items/sand/colorless.json +++ b/src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json @@ -1,5 +1,5 @@ { "values": [ - "minecraft:sand" + "#c:gems/lapis" ] } \ No newline at end of file diff --git a/src/generated/resources/pack.mcmeta b/src/generated/resources/pack.mcmeta index f556448a7b..778dd2fdd4 100644 --- a/src/generated/resources/pack.mcmeta +++ b/src/generated/resources/pack.mcmeta @@ -3,7 +3,7 @@ "description": { "translate": "pack.neoforge.description" }, - "pack_format": 26, + "pack_format": 39, "supported_formats": [ 0, 2147483647 diff --git a/src/generated/resources/reports/registry_order.json b/src/generated/resources/reports/registry_order.json index 9abf7c699d..07557e0d08 100644 --- a/src/generated/resources/reports/registry_order.json +++ b/src/generated/resources/reports/registry_order.json @@ -1,6 +1,7 @@ { "order": [ "minecraft:attribute", + "minecraft:data_component_type", "minecraft:game_event", "minecraft:sound_event", "minecraft:fluid", @@ -64,23 +65,24 @@ "minecraft:worldgen/pool_alias_binding", "minecraft:cat_variant", "minecraft:frog_variant", - "minecraft:banner_pattern", "minecraft:instrument", "minecraft:decorated_pot_patterns", "minecraft:creative_mode_tab", "minecraft:trigger_type", "minecraft:number_format_type", + "minecraft:armor_material", + "minecraft:entity_sub_predicate_type", + "minecraft:item_sub_predicate_type", + "minecraft:map_decoration_type", "neoforge:attachment_types", "neoforge:biome_modifier_serializers", "neoforge:condition_codecs", "neoforge:display_contexts", "neoforge:entity_data_serializers", - "neoforge:entity_predicates", "neoforge:fluid_type", "neoforge:global_loot_modifier_serializers", "neoforge:holder_set_type", "neoforge:ingredient_serializer", - "neoforge:item_predicates", "neoforge:structure_modifier_serializers" ] } \ No newline at end of file diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java index 502e931209..40473f5a83 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java @@ -10,6 +10,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; @@ -113,7 +114,7 @@ public Optional getExistingData(AttachmentType type) { * Returns {@code null} if there are no serializable attachments. */ @Nullable - public final CompoundTag serializeAttachments() { + public final CompoundTag serializeAttachments(HolderLookup.Provider provider) { if (attachments == null) { return null; } @@ -121,7 +122,7 @@ public final CompoundTag serializeAttachments() { for (var entry : attachments.entrySet()) { var type = entry.getKey(); if (type.serializer != null) { - Tag serialized = ((IAttachmentSerializer) type.serializer).write(entry.getValue()); + Tag serialized = ((IAttachmentSerializer) type.serializer).write(provider, entry.getValue()); if (serialized != null) { if (tag == null) tag = new CompoundTag(); @@ -133,9 +134,9 @@ public final CompoundTag serializeAttachments() { } /** - * Reads serializable attachments from a tag previously created via {@link #serializeAttachments()}. + * Reads serializable attachments from a tag previously created via {@link #serializeAttachments(HolderLookup.Provider)}. */ - protected final void deserializeAttachments(CompoundTag tag) { + protected final void deserializeAttachments(HolderLookup.Provider provider, CompoundTag tag) { for (var key : tag.getAllKeys()) { // Use tryParse to not discard valid attachment type keys, even if there is a malformed key. ResourceLocation keyLocation = ResourceLocation.tryParse(key); @@ -151,7 +152,7 @@ protected final void deserializeAttachments(CompoundTag tag) { } try { - getAttachmentMap().put(type, ((IAttachmentSerializer) type.serializer).read(getExposedHolder(), tag.get(key))); + getAttachmentMap().put(type, ((IAttachmentSerializer) type.serializer).read(provider, getExposedHolder(), tag.get(key))); } catch (Exception exception) { LOGGER.error("Failed to deserialize data attachment {}. Skipping.", key, exception); } @@ -167,7 +168,7 @@ protected final void deserializeAttachments(CompoundTag tag) { * * @return {@code true} if the attachments are compatible, {@code false} otherwise */ - public static boolean areAttachmentsCompatible(H first, H second) { + public static boolean areAttachmentsCompatible(HolderLookup.Provider provider, H first, H second) { Map, Object> firstAttachments = first.attachments != null ? first.attachments : Map.of(); Map, Object> secondAttachments = second.attachments != null ? second.attachments : Map.of(); @@ -178,7 +179,7 @@ public static boolean areAttachmentsCompatible(H fi if (otherData == null) // TODO: cache serialization of default value? otherData = type.defaultValueSupplier.apply(second.getExposedHolder()); - if (!type.comparator.areCompatible(entry.getValue(), otherData)) + if (!type.comparator.areCompatible(provider, entry.getValue(), otherData)) return false; } } @@ -189,7 +190,7 @@ public static boolean areAttachmentsCompatible(H fi if (data != null) continue; // already checked in the first loop data = type.defaultValueSupplier.apply(first.getExposedHolder()); - if (!type.comparator.areCompatible(entry.getValue(), data)) + if (!type.comparator.areCompatible(provider, entry.getValue(), data)) return false; } } @@ -213,8 +214,8 @@ IAttachmentHolder getExposedHolder() { return exposedHolder; } - public void deserializeInternal(CompoundTag tag) { - deserializeAttachments(tag); + public void deserializeInternal(HolderLookup.Provider provider, CompoundTag tag) { + deserializeAttachments(provider, tag); } } } diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java index 8043e58f81..e448bf327d 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java @@ -5,83 +5,62 @@ package net.neoforged.neoforge.attachment; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; +import java.util.function.Predicate; +import net.minecraft.core.HolderLookup; +import net.minecraft.world.entity.Entity; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.extensions.IEntityExtension; import net.neoforged.neoforge.event.entity.living.LivingConversionEvent; import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; @ApiStatus.Internal @Mod.EventBusSubscriber(modid = NeoForgeVersion.MOD_ID) public final class AttachmentInternals { /** - * Marks a stack that has attachments and an empty NBT tag ({}). - * If this marker is absent, we set the tag back to null after reading the attachments. + * Copy some attachments to another holder. */ - private static final String EMPTY_TAG_KEY = "neoforge:empty"; - - @Nullable - public static CompoundTag addAttachmentsToTag(@Nullable CompoundTag tag, ItemStack stack, boolean fullCopy) { - // Store all serializable attachments as an nbt subtag - CompoundTag attachmentsTag = stack.serializeAttachments(); - if (attachmentsTag != null) { - if (tag == null) - tag = new CompoundTag(); - else { - tag = tag.copy(); - if (tag.isEmpty()) // Make sure we can differentiate between null and empty. - tag.putBoolean(EMPTY_TAG_KEY, true); + private static void copyAttachments(HolderLookup.Provider provider, H from, H to, Predicate> filter) { + if (from.attachments == null) { + return; + } + for (var entry : from.attachments.entrySet()) { + AttachmentType type = entry.getKey(); + if (type.serializer == null) { + continue; } - tag.put(AttachmentHolder.ATTACHMENTS_NBT_KEY, attachmentsTag); - } else if (fullCopy && tag != null) - tag = tag.copy(); - return tag; + @SuppressWarnings("unchecked") + var copyHandler = (IAttachmentCopyHandler) type.copyHandler; + if (filter.test(type)) { + Object copy = copyHandler.copy(provider, to.getExposedHolder(), entry.getValue()); + if (copy != null) { + to.getAttachmentMap().put(type, copy); + } + } + } } - /** - * Perform the inverse operation of {@link #addAttachmentsToTag} on stack reception. - */ - public static ItemStack reconstructItemStack(Item item, int count, @Nullable CompoundTag tag) { - ItemStack itemstack; - if (tag != null && tag.contains(AttachmentHolder.ATTACHMENTS_NBT_KEY, Tag.TAG_COMPOUND)) { - // Read serialized caps - itemstack = new ItemStack(item, count, tag.getCompound(AttachmentHolder.ATTACHMENTS_NBT_KEY)); - tag = cleanTag(tag); - } else { - itemstack = new ItemStack(item, count); - } - itemstack.setTag(tag); - return itemstack; + public static void copyChunkAttachmentsOnPromotion(HolderLookup.Provider provider, AttachmentHolder.AsField from, AttachmentHolder.AsField to) { + copyAttachments(provider, from, to, type -> true); } /** - * Clean tag of its contained attachments (as set by {@link #addAttachmentsToTag}). + * Do not call directly, use {@link IEntityExtension#copyAttachmentsFrom(Entity, boolean)}. */ - @Nullable - public static CompoundTag cleanTag(CompoundTag tag) { - tag.remove(AttachmentHolder.ATTACHMENTS_NBT_KEY); - // If the tag is now empty and the empty marker is absent, replace by null. - if (tag.contains(EMPTY_TAG_KEY)) - tag.remove(EMPTY_TAG_KEY); - else if (tag.isEmpty()) - tag = null; - return tag; + public static void copyEntityAttachments(Entity from, Entity to, boolean isDeath) { + copyAttachments(from.registryAccess(), from, to, isDeath ? type -> type.copyOnDeath : type -> true); } @SubscribeEvent public static void onPlayerClone(PlayerEvent.Clone event) { - AttachmentUtils.copyAttachments(event.getOriginal(), event.getEntity(), event.isWasDeath() ? type -> type.copyOnDeath : type -> true); + event.getEntity().copyAttachmentsFrom(event.getOriginal(), event.isWasDeath()); } @SubscribeEvent public static void onLivingConvert(LivingConversionEvent.Post event) { - AttachmentUtils.copyAttachments(event.getEntity(), event.getOutcome(), type -> type.copyOnDeath); + event.getOutcome().copyAttachmentsFrom(event.getEntity(), true); } private AttachmentInternals() {} diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java index 25f2a710d8..1d4d70fa42 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java @@ -11,6 +11,7 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.world.entity.Entity; @@ -72,23 +73,23 @@ private AttachmentType(Builder builder) { private static IAttachmentComparator defaultComparator(@Nullable IAttachmentSerializer serializer) { if (serializer == null) { - return (first, second) -> { + return (provider, first, second) -> { throw new UnsupportedOperationException("Cannot compare non-serializable attachments"); }; } - return (first, second) -> Objects.equals(serializer.write(first), serializer.write(second)); + return (provider, first, second) -> Objects.equals(serializer.write(provider, first), serializer.write(provider, second)); } private static IAttachmentCopyHandler defaultCopyHandler(@Nullable IAttachmentSerializer serializer) { if (serializer == null) { - return (holder, attachment) -> { + return (provider, holder, attachment) -> { throw new UnsupportedOperationException("Cannot copy non-serializable attachments"); }; } - return (holder, attachment) -> { - H serialized = serializer.write(attachment); + return (provider, holder, attachment) -> { + H serialized = serializer.write(provider, attachment); if (serialized != null) { - return serializer.read(holder, serialized); + return serializer.read(provider, holder, serialized); } return null; }; @@ -141,16 +142,16 @@ public static > Builder serializ public static > Builder serializable(Function defaultValueConstructor) { return builder(defaultValueConstructor).serialize(new IAttachmentSerializer() { @Override - public T read(IAttachmentHolder holder, S tag) { + public T read(HolderLookup.Provider provider, IAttachmentHolder holder, S tag) { var ret = defaultValueConstructor.apply(holder); - ret.deserializeNBT(tag); + ret.deserializeNBT(provider, tag); return ret; } @Nullable @Override - public S write(T attachment) { - return attachment.serializeNBT(); + public S write(HolderLookup.Provider provider, T attachment) { + return attachment.serializeNBT(provider); } }); } @@ -213,13 +214,13 @@ public Builder serialize(Codec codec, Predicate shouldSerialize // TODO: better error handling return serialize(new IAttachmentSerializer<>() { @Override - public T read(IAttachmentHolder holder, Tag tag) { + public T read(HolderLookup.Provider provider, IAttachmentHolder holder, Tag tag) { return codec.parse(NbtOps.INSTANCE, tag).result().get(); } @Nullable @Override - public Tag write(T attachment) { + public Tag write(HolderLookup.Provider provider, T attachment) { return shouldSerialize.test(attachment) ? codec.encodeStart(NbtOps.INSTANCE, attachment).result().get() : null; } }); diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java deleted file mode 100644 index 3f21d26267..0000000000 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.attachment; - -import java.util.function.Predicate; -import net.minecraft.world.item.ItemStack; - -public final class AttachmentUtils { - private AttachmentUtils() {} - - /** - * Copy some attachments to another holder. - */ - public static void copyAttachments(H from, H to, Predicate> filter) { - if (from.attachments == null) { - return; - } - for (var entry : from.attachments.entrySet()) { - AttachmentType type = entry.getKey(); - if (type.serializer == null) { - continue; - } - @SuppressWarnings("unchecked") - var copyHandler = (IAttachmentCopyHandler) type.copyHandler; - if (filter.test(type)) { - Object copy = copyHandler.copy(to.getExposedHolder(), entry.getValue()); - if (copy != null) { - to.getAttachmentMap().put(type, copy); - } - } - } - } - - public static void copyStackAttachments(ItemStack from, ItemStack to) { - copyAttachments(from, to, type -> true); - } - - public static void copyChunkAttachmentsOnPromotion(AttachmentHolder.AsField from, AttachmentHolder.AsField to) { - copyAttachments(from, to, type -> true); - } -} diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java index acb8810ccb..a4a4fc4d39 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java +++ b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java @@ -5,6 +5,8 @@ package net.neoforged.neoforge.attachment; +import net.minecraft.core.HolderLookup; + /** * Custom comparator for data attachments, to improve efficiency compared to the default * {@code Objects.equals(serializer.write(first), serializer.write(second))} implementation. @@ -20,5 +22,5 @@ public interface IAttachmentComparator { * with {@code Objects.equals(serializer.write(first), serializer.write(second))}, * but will often be faster and allocate less. */ - boolean areCompatible(T first, T second); + boolean areCompatible(HolderLookup.Provider provider, T first, T second); } diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java index d390b45279..44c5b12fd0 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java +++ b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.attachment; +import net.minecraft.core.HolderLookup; import org.jetbrains.annotations.Nullable; /** @@ -20,5 +21,5 @@ public interface IAttachmentCopyHandler { * @return the copy or null if it shouldn't be copied. */ @Nullable - T copy(IAttachmentHolder holder, T attachment); + T copy(HolderLookup.Provider provider, IAttachmentHolder holder, T attachment); } diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java index 3afa5a2ac0..b749ac3691 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java +++ b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java @@ -5,24 +5,25 @@ package net.neoforged.neoforge.attachment; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.Tag; import org.jetbrains.annotations.Nullable; /** * Serializer for data attachments. * - *

The {@link #read(IAttachmentHolder, Tag)} method must be implemented by subclasses! + *

The {@link #read(HolderLookup.Provider, IAttachmentHolder, Tag)} method must be implemented by subclasses! * * @param A {@link Tag} subclass: the serialized representation. * @param The type of the data attachment. */ public interface IAttachmentSerializer { /** - * @deprecated Implement {@link #read(IAttachmentHolder, Tag)} instead. + * @deprecated Implement {@link #read(HolderLookup.Provider, IAttachmentHolder, Tag)} instead. * This method will be removed in a future version. */ @Deprecated(forRemoval = true, since = "1.20.4") - default T read(S tag) { + default T read(HolderLookup.Provider provider, S tag) { throw new RuntimeException("IAttachmentSerializer must implement the read() that accepts a holder!"); } @@ -30,18 +31,18 @@ default T read(S tag) { * Reads the attachment from NBT. * *

In a future version, the default implementation will be removed, - * but for now it exists for backwards compatibility with {@link #read(Tag)}. + * but for now it exists for backwards compatibility with {@link #read(HolderLookup.Provider, Tag)}. * * @param holder the holder for the attachment, can be cast if the subtype is known * @param tag the serialized attachment */ - default T read(IAttachmentHolder holder, S tag) { - return read(tag); + default T read(HolderLookup.Provider provider, IAttachmentHolder holder, S tag) { + return read(provider, tag); } /** * Writes the attachment to NBT, or returns null if it is should not be serialized. */ @Nullable - S write(T attachment); + S write(HolderLookup.Provider provider, T attachment); } diff --git a/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java b/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java index bba9a56595..a1c14e3ad0 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java +++ b/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.attachment; import java.util.Objects; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.saveddata.SavedData; @@ -18,7 +19,7 @@ public class LevelAttachmentsSavedData extends SavedData { public static void init(ServerLevel level) { var factory = new SavedData.Factory<>( () -> new LevelAttachmentsSavedData(level), - tag -> new LevelAttachmentsSavedData(level, tag)); + (tag, prov) -> new LevelAttachmentsSavedData(level, tag)); // Querying the attachment a single time is enough to initialize it, // and make sure it gets saved when the level is saved. level.getDataStorage().computeIfAbsent(factory, NAME); @@ -32,13 +33,13 @@ public LevelAttachmentsSavedData(ServerLevel level) { public LevelAttachmentsSavedData(ServerLevel level, CompoundTag tag) { this.level = level; - level.deserializeAttachments(tag); + level.deserializeAttachments(level.registryAccess(), tag); } @Override - public CompoundTag save(CompoundTag tag) { + public CompoundTag save(CompoundTag tag, HolderLookup.Provider provider) { // Make sure we don't return null - return Objects.requireNonNullElseGet(level.serializeAttachments(), CompoundTag::new); + return Objects.requireNonNullElseGet(level.serializeAttachments(provider), CompoundTag::new); } @Override diff --git a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java index 7a36c79ec4..7987900a03 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java @@ -45,7 +45,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; @@ -92,12 +91,9 @@ import net.minecraft.locale.Language; import net.minecraft.network.Connection; import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.ChatTypeDecoration; -import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.PlayerChatMessage; -import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.util.Mth; @@ -111,6 +107,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeManager; @@ -167,7 +164,6 @@ import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; import net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions; import net.neoforged.neoforge.client.gui.ClientTooltipComponentManager; -import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager; import net.neoforged.neoforge.client.model.data.ModelData; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForgeMod; @@ -239,9 +235,9 @@ public static float getGuiFarPlane() { return 11000.0F + 10000.0F * (1 + guiLayers.size()); } - public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EquipmentSlot slot, String type) { - String result = armor.getItem().getArmorTexture(armor, entity, slot, type); - return result != null ? result : _default; + public static ResourceLocation getArmorTexture(Entity entity, ItemStack armor, ArmorMaterial.Layer layer, boolean innerModel, EquipmentSlot slot) { + ResourceLocation result = armor.getItem().getArmorTexture(armor, entity, slot, layer, innerModel); + return result != null ? result : layer.texture(innerModel); } public static void onClientPauseUpdate(boolean paused) { @@ -262,18 +258,18 @@ public static boolean onDrawHighlight(LevelRenderer context, Camera camera, HitR } } - public static void dispatchRenderStage(RenderLevelStageEvent.Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { + public static void dispatchRenderStage(RenderLevelStageEvent.Stage stage, LevelRenderer levelRenderer, @Nullable PoseStack poseStack, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { var mc = Minecraft.getInstance(); var profiler = mc.getProfiler(); profiler.push(stage.toString()); - NeoForge.EVENT_BUS.post(new RenderLevelStageEvent(stage, levelRenderer, poseStack, projectionMatrix, renderTick, mc.getPartialTick(), camera, frustum)); + NeoForge.EVENT_BUS.post(new RenderLevelStageEvent(stage, levelRenderer, poseStack, modelViewMatrix, projectionMatrix, renderTick, mc.getPartialTick(), camera, frustum)); profiler.pop(); } - public static void dispatchRenderStage(RenderType renderType, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { + public static void dispatchRenderStage(RenderType renderType, LevelRenderer levelRenderer, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { RenderLevelStageEvent.Stage stage = RenderLevelStageEvent.Stage.fromRenderType(renderType); if (stage != null) - dispatchRenderStage(stage, levelRenderer, poseStack, projectionMatrix, renderTick, camera, frustum); + dispatchRenderStage(stage, levelRenderer, null, modelViewMatrix, projectionMatrix, renderTick, camera, frustum); } public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) { @@ -348,8 +344,8 @@ public static CalculatePlayerTurnEvent getTurnPlayerValues(double mouseSensitivi return event; } - public static double getDetachedCameraDistance(Camera camera, boolean flipped, double distance) { - var event = new CalculateDetachedCameraDistanceEvent(camera, flipped, distance); + public static double getDetachedCameraDistance(Camera camera, boolean flipped, float entityScale, double distance) { + var event = new CalculateDetachedCameraDistanceEvent(camera, flipped, entityScale, distance); NeoForge.EVENT_BUS.post(event); return event.getDistance(); } @@ -665,7 +661,7 @@ public static InputEvent.InteractionKeyMappingTriggered onClickInput(int button, public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance) { if (entity instanceof LivingEntity) { - final AttributeInstance attribute = ((LivingEntity) entity).getAttribute(NeoForgeMod.NAMETAG_DISTANCE.value()); + final AttributeInstance attribute = ((LivingEntity) entity).getAttribute(NeoForgeMod.NAMETAG_DISTANCE); if (attribute != null) { return !(squareDistance > (attribute.getValue() * attribute.getValue())); } @@ -733,13 +729,9 @@ public static Component onClientPlayerChat(ChatType.Bound boundChatType, Compone return NeoForge.EVENT_BUS.post(event).isCanceled() ? null : event.getMessage(); } - private static final ChatTypeDecoration SYSTEM_CHAT_TYPE_DECORATION = new ChatTypeDecoration("neoforge.chatType.system", List.of(ChatTypeDecoration.Parameter.CONTENT), Style.EMPTY); - private static final ChatType SYSTEM_CHAT_TYPE = new ChatType(SYSTEM_CHAT_TYPE_DECORATION, SYSTEM_CHAT_TYPE_DECORATION); - private static final ChatType.Bound SYSTEM_CHAT_TYPE_BOUND = SYSTEM_CHAT_TYPE.bind(Component.literal("System")); - @Nullable public static Component onClientSystemChat(Component message, boolean overlay) { - ClientChatReceivedEvent.System event = new ClientChatReceivedEvent.System(SYSTEM_CHAT_TYPE_BOUND, message, overlay); + ClientChatReceivedEvent.System event = new ClientChatReceivedEvent.System(message, overlay); return NeoForge.EVENT_BUS.post(event).isCanceled() ? null : event.getMessage(); } @@ -884,23 +876,6 @@ public static boolean isBlockInSolidLayer(BlockState state) { return model.getRenderTypes(state, RandomSource.create(), ModelData.EMPTY).contains(RenderType.solid()); } - public static void createWorldConfirmationScreen(Runnable doConfirmedWorldLoad) { - Component title = Component.translatable("selectWorld.backupQuestion.experimental"); - Component msg = Component.translatable("selectWorld.backupWarning.experimental") - .append("\n\n") - .append(Component.translatable("neoforge.selectWorld.backupWarning.experimental.additional")); - - Screen screen = new ConfirmScreen(confirmed -> { - if (confirmed) { - doConfirmedWorldLoad.run(); - } else { - Minecraft.getInstance().setScreen(null); - } - }, title, msg, CommonComponents.GUI_PROCEED, CommonComponents.GUI_CANCEL); - - Minecraft.getInstance().setScreen(screen); - } - public static boolean renderFireOverlay(Player player, PoseStack mat) { return renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition()); } @@ -1024,7 +999,7 @@ public static void initClientHooks(Minecraft mc, ReloadableResourceManager resou EntitySpectatorShaderManager.init(); ClientHooks.onRegisterKeyMappings(mc.options); RecipeBookManager.init(); - GuiOverlayManager.init(); + mc.gui.initModdedOverlays(); DimensionSpecialEffectsManager.init(); NamedRenderTypeManager.init(); ColorResolverManager.init(); diff --git a/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java b/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java deleted file mode 100644 index 99e3ba2eaa..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client; - -import java.util.Optional; -import java.util.function.BiFunction; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.neoforged.fml.IExtensionPoint; -import net.neoforged.fml.ModList; -import net.neoforged.neoforgespi.language.IModInfo; - -public class ConfigScreenHandler { - public record ConfigScreenFactory(BiFunction screenFunction) implements IExtensionPoint {} - - public static Optional> getScreenFactoryFor(IModInfo selectedMod) { - return ModList.get().getModContainerById(selectedMod.getModId()).flatMap(mc -> mc.getCustomExtension(ConfigScreenFactory.class).map(ConfigScreenFactory::screenFunction)); - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java b/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java index 4f984ec036..76751f2745 100644 --- a/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java +++ b/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.Map; import net.minecraft.client.particle.FireworkParticles; -import net.minecraft.world.item.FireworkRocketItem; +import net.minecraft.world.item.component.FireworkExplosion; import org.jetbrains.annotations.Nullable; /** @@ -16,18 +16,18 @@ * So sometime during your client initalization call register. */ public class FireworkShapeFactoryRegistry { - private static final Map factories = new HashMap<>(); + private static final Map factories = new HashMap<>(); public interface Factory { void build(FireworkParticles.Starter starter, boolean trail, boolean flicker, int[] colors, int[] fadeColors); } - public static void register(FireworkRocketItem.Shape shape, Factory factory) { + public static void register(FireworkExplosion.Shape shape, Factory factory) { factories.put(shape, factory); } @Nullable - public static Factory get(FireworkRocketItem.Shape shape) { + public static Factory get(FireworkExplosion.Shape shape) { return factories.get(shape); } } diff --git a/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java b/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java index eda9ae0060..8c64bc25f6 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java @@ -24,13 +24,15 @@ public class CalculateDetachedCameraDistanceEvent extends Event { private final Camera camera; private final boolean cameraFlipped; + private final float entityScale; private double distance; @ApiStatus.Internal - public CalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, double distance) { + public CalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, float entityScale, double distance) { this.camera = camera; this.cameraFlipped = cameraFlipped; + this.entityScale = entityScale; this.distance = distance; } @@ -49,14 +51,22 @@ public boolean isCameraFlipped() { } /** - * Returns the distance from the camera to the {@linkplain Camera#getEntity() camera entity}. + * Returns the scaling factor that will be applied to the final distance, + * based on the size of the {@link Camera#getEntity() camera entity}. + */ + public float getEntityScalingFactor() { + return entityScale; + } + + /** + * Returns the pre-{@linkplain #getEntityScalingFactor() scaling factor} distance from the camera to the {@linkplain Camera#getEntity() camera entity}. */ public double getDistance() { return distance; } /** - * Sets the distance from the camera to the {@linkplain Camera#getEntity() camera entity}. + * Sets the pre-{@linkplain #getEntityScalingFactor() scaling factor} distance from the camera to the {@linkplain Camera#getEntity() camera entity}. * * @param distance The new distance from the camera to the {@linkplain Camera#getEntity() camera entity} */ diff --git a/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java index 07700a1fe8..de63b372bd 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java @@ -15,6 +15,7 @@ import net.neoforged.fml.LogicalSide; import net.neoforged.neoforge.common.NeoForge; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; /** * Fired when a chat message is received on the client. @@ -30,11 +31,12 @@ */ public class ClientChatReceivedEvent extends Event implements ICancellableEvent { private Component message; + @Nullable private final ChatType.Bound boundChatType; private final UUID sender; @ApiStatus.Internal - public ClientChatReceivedEvent(ChatType.Bound boundChatType, Component message, UUID sender) { + public ClientChatReceivedEvent(@Nullable ChatType.Bound boundChatType, Component message, UUID sender) { this.boundChatType = boundChatType; this.message = message; this.sender = sender; @@ -59,7 +61,10 @@ public void setMessage(Component message) { /** * {@return the bound chat type of the chat message}. * This contains the chat type, display name of the sender, and nullable target name depending on the chat type. + *

+ * This may be {@code null} when the message doesn't have a specific source (i.e. for system messages). */ + @Nullable public ChatType.Bound getBoundChatType() { return this.boundChatType; } @@ -121,8 +126,8 @@ public static class System extends ClientChatReceivedEvent { private final boolean overlay; @ApiStatus.Internal - public System(ChatType.Bound boundChatType, Component message, boolean overlay) { - super(boundChatType, message, Util.NIL_UUID); + public System(Component message, boolean overlay) { + super(null, message, Util.NIL_UUID); this.overlay = overlay; } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java new file mode 100644 index 0000000000..15c28c31cd --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import com.google.common.base.Preconditions; +import java.util.List; +import java.util.Objects; +import java.util.stream.IntStream; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.Event; +import net.neoforged.bus.api.ICancellableEvent; +import net.neoforged.fml.LogicalSide; +import net.neoforged.fml.event.IModBusEvent; +import net.neoforged.neoforge.client.gui.GuiLayerManager; +import net.neoforged.neoforge.client.gui.VanillaGuiLayers; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +/** + * Allows users to register custom {@link LayeredDraw.Layer layers} for GUI rendering. + * + *

See also {@link RenderGuiLayerEvent} to intercept rendering of registered layers. + * + *

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

This event is fired on the mod-specific event bus, only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ +public class RegisterGuiLayersEvent extends Event implements IModBusEvent { + private final List layers; + + @ApiStatus.Internal + public RegisterGuiLayersEvent(List layers) { + this.layers = layers; + } + + /** + * Registers a layer that renders below all others. + * + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerBelowAll(ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.BEFORE, null, id, layer); + } + + /** + * Registers a layer that renders below another. + * + * @param other The id of the layer to render below. This must be a layer you have already registered or one of the + * {@link VanillaGuiLayers vanilla layers}. Do not use other mods' layers. + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerBelow(ResourceLocation other, ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.BEFORE, other, id, layer); + } + + /** + * Registers an layer that renders above another. + * + * @param other The id of the layer to render above. This must be a layer you have already registered or one of the + * {@link VanillaGuiLayers vanilla layers}. Do not use other mods' layers. + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerAbove(ResourceLocation other, ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.AFTER, other, id, layer); + } + + /** + * Registers a layer that renders above all others. + * + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerAboveAll(ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.AFTER, null, id, layer); + } + + private void register(Ordering ordering, @Nullable ResourceLocation other, ResourceLocation key, LayeredDraw.Layer layer) { + Objects.requireNonNull(key); + for (var namedLayer : layers) { + Preconditions.checkArgument(!namedLayer.name().equals(key), "Layer already registered: " + key); + } + + int insertPosition; + if (other == null) { + insertPosition = ordering == Ordering.BEFORE ? 0 : layers.size(); + } else { + var otherIndex = IntStream.range(0, layers.size()) + .filter(i -> layers.get(i).name().equals(other)) + .findFirst(); + if (otherIndex.isEmpty()) { + throw new IllegalArgumentException("Attempted to order against an unregistered layer " + other + ". Only order against vanilla's and your own."); + } + + insertPosition = otherIndex.getAsInt() + (ordering == Ordering.BEFORE ? 0 : 1); + } + + layers.add(insertPosition, new GuiLayerManager.NamedLayer(key, layer)); + } + + private enum Ordering { + BEFORE, AFTER + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java deleted file mode 100644 index 050b82337e..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.event; - -import com.google.common.base.Preconditions; -import java.util.List; -import java.util.Map; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.bus.api.Event; -import net.neoforged.bus.api.ICancellableEvent; -import net.neoforged.fml.LogicalSide; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.event.IModBusEvent; -import net.neoforged.neoforge.client.gui.overlay.IGuiOverlay; -import net.neoforged.neoforge.client.gui.overlay.VanillaGuiOverlay; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; - -/** - * Allows users to register custom {@link IGuiOverlay GUI overlays}. - * - *

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

This event is fired on the mod-specific event bus, only on the {@linkplain LogicalSide#CLIENT logical client}.

- */ -public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent { - private final Map overlays; - private final List orderedOverlays; - - @ApiStatus.Internal - public RegisterGuiOverlaysEvent(Map overlays, List orderedOverlays) { - this.overlays = overlays; - this.orderedOverlays = orderedOverlays; - } - - /** - * Registers an overlay that renders below all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerBelowAll(ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerBelowAll(String id, IGuiOverlay overlay) { - registerBelowAll(new ResourceLocation(id, ModLoadingContext.get().getActiveNamespace()), overlay); - } - - /** - * Registers an overlay that renders below all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerBelowAll(ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.BEFORE, null, id, overlay); - } - - /** - * Registers an overlay that renders below another. - * - * @param other The id of the overlay to render below. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerBelow(ResourceLocation, ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerBelow(ResourceLocation other, String id, IGuiOverlay overlay) { - registerBelow(other, new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders below another. - * - * @param other The id of the overlay to render below. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerBelow(ResourceLocation other, ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.BEFORE, other, id, overlay); - } - - /** - * Registers an overlay that renders above another. - * - * @param other The id of the overlay to render above. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerAbove(ResourceLocation, ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerAbove(ResourceLocation other, String id, IGuiOverlay overlay) { - registerAbove(other, new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders above another. - * - * @param other The id of the overlay to render above. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerAbove(ResourceLocation other, ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.AFTER, other, id, overlay); - } - - /** - * Registers an overlay that renders above all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerAboveAll(ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerAboveAll(String id, IGuiOverlay overlay) { - registerAboveAll(new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders above all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerAboveAll(ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.AFTER, null, id, overlay); - } - - private void register(Ordering ordering, @Nullable ResourceLocation other, ResourceLocation key, IGuiOverlay overlay) { - Preconditions.checkArgument(!overlays.containsKey(key), "Overlay already registered: " + key); - - int insertPosition; - if (other == null) { - insertPosition = ordering == Ordering.BEFORE ? 0 : overlays.size(); - } else { - int otherIndex = orderedOverlays.indexOf(other); - Preconditions.checkState(otherIndex >= 0, "Attempted to order against an unregistered overlay. Only order against vanilla's and your own."); - insertPosition = otherIndex + (ordering == Ordering.BEFORE ? 0 : 1); - } - - overlays.put(key, overlay); - orderedOverlays.add(insertPosition, key); - } - - private enum Ordering { - BEFORE, AFTER - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java index 8855eff8de..dbcfbd9fc3 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java @@ -6,7 +6,7 @@ package net.neoforged.neoforge.client.event; import com.google.common.collect.BiMap; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.atlas.SpriteSource; import net.minecraft.client.renderer.texture.atlas.SpriteSourceType; @@ -35,12 +35,12 @@ public RegisterSpriteSourceTypesEvent(BiMap } /** - * Registers the given {@link Codec} as SpriteSourceType under the given id. + * Registers the given {@link MapCodec} as SpriteSourceType under the given id. * * @param id The id to register the {@link SpriteSourceType} under * @param codec The codec for the {@link SpriteSourceType} to register */ - public SpriteSourceType register(ResourceLocation id, Codec codec) { + public SpriteSourceType register(ResourceLocation id, MapCodec codec) { if (this.types.containsKey(id)) { throw new IllegalStateException("Duplicate sprite source type registration " + id); } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java index e49e463b6a..c5bdc1a169 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java @@ -5,7 +5,6 @@ package net.neoforged.neoforge.client.event; -import com.mojang.blaze3d.platform.Window; import net.minecraft.client.gui.GuiGraphics; import net.neoforged.bus.api.Event; import net.neoforged.bus.api.ICancellableEvent; @@ -21,21 +20,15 @@ * @see Post */ public abstract class RenderGuiEvent extends Event { - private final Window window; private final GuiGraphics guiGraphics; private final float partialTick; @ApiStatus.Internal - protected RenderGuiEvent(Window window, GuiGraphics guiGraphics, float partialTick) { - this.window = window; + protected RenderGuiEvent(GuiGraphics guiGraphics, float partialTick) { this.guiGraphics = guiGraphics; this.partialTick = partialTick; } - public Window getWindow() { - return window; - } - public GuiGraphics getGuiGraphics() { return guiGraphics; } @@ -58,8 +51,8 @@ public float getPartialTick() { */ public static class Pre extends RenderGuiEvent implements ICancellableEvent { @ApiStatus.Internal - public Pre(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, guiGraphics, partialTick); + public Pre(GuiGraphics guiGraphics, float partialTick) { + super(guiGraphics, partialTick); } } @@ -73,8 +66,8 @@ public Pre(Window window, GuiGraphics guiGraphics, float partialTick) { */ public static class Post extends RenderGuiEvent { @ApiStatus.Internal - public Post(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, guiGraphics, partialTick); + public Post(GuiGraphics guiGraphics, float partialTick) { + super(guiGraphics, partialTick); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java similarity index 51% rename from src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java rename to src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java index 67da456b2c..d8006c7146 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java @@ -5,40 +5,37 @@ package net.neoforged.neoforge.client.event; -import com.mojang.blaze3d.platform.Window; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; import net.neoforged.bus.api.Event; import net.neoforged.bus.api.ICancellableEvent; import net.neoforged.fml.LogicalSide; -import net.neoforged.neoforge.client.gui.overlay.NamedGuiOverlay; import net.neoforged.neoforge.common.NeoForge; import org.jetbrains.annotations.ApiStatus; /** - * Fired when an overlay is rendered to the screen. + * Fired when a GUI layer is rendered to the screen. * See the two subclasses for listening to the two possible phases. * - *

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

+ *

A layer that is not normally active (for example because the player pressed F1) cannot be forced to render. + * In such cases, this event will however still fire. * * @see Pre * @see Post */ -public abstract class RenderGuiOverlayEvent extends Event { - private final Window window; +public abstract class RenderGuiLayerEvent extends Event { private final GuiGraphics guiGraphics; private final float partialTick; - private final NamedGuiOverlay overlay; + private final ResourceLocation name; + private final LayeredDraw.Layer layer; @ApiStatus.Internal - protected RenderGuiOverlayEvent(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - this.window = window; + protected RenderGuiLayerEvent(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { this.guiGraphics = guiGraphics; this.partialTick = partialTick; - this.overlay = overlay; - } - - public Window getWindow() { - return window; + this.name = name; + this.layer = layer; } public GuiGraphics getGuiGraphics() { @@ -49,15 +46,19 @@ public float getPartialTick() { return partialTick; } - public NamedGuiOverlay getOverlay() { - return overlay; + public ResourceLocation getName() { + return name; + } + + public LayeredDraw.Layer getLayer() { + return layer; } /** - * Fired before a GUI overlay is rendered to the screen. + * Fired before a GUI layer is rendered to the screen. * *

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

* *

This event is fired on the {@linkplain NeoForge#EVENT_BUS main Forge event bus}, @@ -65,25 +66,25 @@ public NamedGuiOverlay getOverlay() { * * @see Post */ - public static class Pre extends RenderGuiOverlayEvent implements ICancellableEvent { + public static class Pre extends RenderGuiLayerEvent implements ICancellableEvent { @ApiStatus.Internal - public Pre(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, guiGraphics, partialTick, overlay); + public Pre(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { + super(guiGraphics, partialTick, name, layer); } } /** - * Fired after an GUI overlay is rendered to the screen, if the corresponding {@link Pre} is not cancelled. + * Fired after a GUI layer is rendered to the screen, if the corresponding {@link Pre} is not cancelled. * *

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

* *

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

*/ - public static class Post extends RenderGuiOverlayEvent { + public static class Post extends RenderGuiLayerEvent { @ApiStatus.Internal - public Post(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, guiGraphics, partialTick, overlay); + public Post(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { + super(guiGraphics, partialTick, name, layer); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java index bb1d37bd2f..6d8eedfe9f 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java @@ -8,7 +8,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nullable; import net.minecraft.client.Camera; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; @@ -22,6 +21,7 @@ import net.neoforged.fml.event.IModBusEvent; import net.neoforged.neoforge.client.NeoForgeRenderTypes; import net.neoforged.neoforge.common.NeoForge; +import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; /** @@ -37,16 +37,18 @@ public class RenderLevelStageEvent extends Event { private final Stage stage; private final LevelRenderer levelRenderer; private final PoseStack poseStack; + private final Matrix4f modelViewMatrix; private final Matrix4f projectionMatrix; private final int renderTick; private final float partialTick; private final Camera camera; private final Frustum frustum; - public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) { + public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, @Nullable PoseStack poseStack, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) { this.stage = stage; this.levelRenderer = levelRenderer; - this.poseStack = poseStack; + this.poseStack = poseStack != null ? poseStack : new PoseStack(); + this.modelViewMatrix = modelViewMatrix; this.projectionMatrix = projectionMatrix; this.renderTick = renderTick; this.partialTick = partialTick; @@ -76,6 +78,13 @@ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the model view matrix used for rendering} + */ + public Matrix4f getModelViewMatrix() { + return modelViewMatrix; + } + /** * {@return the projection matrix} */ @@ -192,7 +201,7 @@ public static class Stage { public static final Stage AFTER_WEATHER = register("after_weather", null); /** * Use this to render after everything in the level has been rendered. - * Called after {@link LevelRenderer#renderLevel(PoseStack, float, long, boolean, Camera, GameRenderer, LightTexture, Matrix4f)} finishes. + * Called after {@link LevelRenderer#renderLevel(float, long, boolean, Camera, GameRenderer, LightTexture, Matrix4f, Matrix4f)} finishes. */ public static final Stage AFTER_LEVEL = register("after_level", null); diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java b/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java index b448e6fb17..b8253c7ba7 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java @@ -26,7 +26,7 @@ private DimensionSpecialEffects self() { * * @return true to prevent vanilla cloud rendering */ - default boolean renderClouds(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, double camX, double camY, double camZ, Matrix4f projectionMatrix) { + default boolean renderClouds(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, double camX, double camY, double camZ, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) { return false; } @@ -35,7 +35,7 @@ default boolean renderClouds(ClientLevel level, int ticks, float partialTick, Po * * @return true to prevent vanilla sky rendering */ - default boolean renderSky(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, Camera camera, Matrix4f projectionMatrix, boolean isFoggy, Runnable setupFog) { + default boolean renderSky(ClientLevel level, int ticks, float partialTick, Matrix4f modelViewMatrix, Camera camera, Matrix4f projectionMatrix, boolean isFoggy, Runnable setupFog) { return false; } diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java b/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java index e91ebbb8b2..ff0d2c3cc3 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java @@ -5,7 +5,10 @@ package net.neoforged.neoforge.client.extensions; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; /** @@ -30,6 +33,22 @@ default int getColorFromFormattingCharacter(char c, boolean isLighter) { return TEXT_COLOR_CODES[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16]; } + /** + * Draws a left-aligned string, with a scrolling effect if the string is too long. + * + * @return the rendered width of the string, never more than {@code maxX - minX} + */ + default int drawScrollingString(Font font, Component text, int minX, int maxX, int y, int color) { + int maxWidth = maxX - minX; + int textWidth = font.width(text.getVisualOrderText()); + if (textWidth <= maxWidth) { + return self().drawString(font, text, minX, y, color); + } else { + AbstractWidget.renderScrollingString(self(), font, text, minX, y, maxX, y + font.lineHeight, color); + return maxWidth; + } + } + /** * Draws a textured box of any size (smallest size is borderSize * 2 square) * based on a fixed size textured box with continuous borders and filler. diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 1471fa4198..4536df4f8c 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -148,6 +148,24 @@ default BlockEntityWithoutLevelRenderer getCustomRenderer() { return Minecraft.getInstance().getItemRenderer().getBlockEntityRenderer(); } + /** + * {@return Whether the item should bob when rendered in the world as an entity} + * + * @param stack The stack being rendered + */ + default boolean shouldBobAsEntity(ItemStack stack) { + return true; + } + + /** + * {@return Whether the item should be spread out when rendered in the world as an entity} + * + * @param stack The stack being rendered + */ + default boolean shouldSpreadAsEntity(ItemStack stack) { + return true; + } + enum FontContext { /** * Used to display the amount of items in the {@link ItemStack}. diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java index 0c6c40647e..ee81708df8 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java @@ -22,7 +22,7 @@ public interface IClientMobEffectExtensions { IClientMobEffectExtensions DEFAULT = new IClientMobEffectExtensions() {}; static IClientMobEffectExtensions of(MobEffectInstance instance) { - return of(instance.getEffect()); + return of(instance.getEffect().value()); } static IClientMobEffectExtensions of(MobEffect effect) { diff --git a/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java b/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java new file mode 100644 index 0000000000..deedaf66b0 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BooleanSupplier; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.ModLoader; +import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent; +import net.neoforged.neoforge.client.event.RenderGuiEvent; +import net.neoforged.neoforge.client.event.RenderGuiLayerEvent; +import net.neoforged.neoforge.common.NeoForge; +import org.jetbrains.annotations.ApiStatus; + +/** + * Adaptation of {@link LayeredDraw} that is used for {@link Gui} rendering specifically, + * to give layers a name and fire appropriate events. + * + *

Overlays can be registered using the {@link RegisterGuiLayersEvent} event. + */ +@ApiStatus.Internal +public class GuiLayerManager { + public static final float Z_SEPARATION = LayeredDraw.Z_SEPARATION; + private final List layers = new ArrayList<>(); + private boolean initialized = false; + + public record NamedLayer(ResourceLocation name, LayeredDraw.Layer layer) {} + + public GuiLayerManager add(ResourceLocation name, LayeredDraw.Layer layer) { + this.layers.add(new NamedLayer(name, layer)); + return this; + } + + public GuiLayerManager add(GuiLayerManager child, BooleanSupplier shouldRender) { + // Flatten the layers to allow mods to insert layers between vanilla layers. + for (var entry : child.layers) { + add(entry.name(), (guiGraphics, partialTick) -> { + if (shouldRender.getAsBoolean()) { + entry.layer().render(guiGraphics, partialTick); + } + }); + } + return this; + } + + public void render(GuiGraphics guiGraphics, float partialTick) { + if (NeoForge.EVENT_BUS.post(new RenderGuiEvent.Pre(guiGraphics, partialTick)).isCanceled()) { + return; + } + + renderInner(guiGraphics, partialTick); + + NeoForge.EVENT_BUS.post(new RenderGuiEvent.Post(guiGraphics, partialTick)); + } + + private void renderInner(GuiGraphics guiGraphics, float partialTick) { + guiGraphics.pose().pushPose(); + + for (var layer : this.layers) { + if (!NeoForge.EVENT_BUS.post(new RenderGuiLayerEvent.Pre(guiGraphics, partialTick, layer.name(), layer.layer())).isCanceled()) { + layer.layer().render(guiGraphics, partialTick); + NeoForge.EVENT_BUS.post(new RenderGuiLayerEvent.Post(guiGraphics, partialTick, layer.name(), layer.layer())); + } + + guiGraphics.pose().translate(0.0F, 0.0F, Z_SEPARATION); + } + + guiGraphics.pose().popPose(); + } + + public void initModdedLayers() { + if (initialized) { + throw new IllegalStateException("Duplicate initialization of NamedLayeredDraw"); + } + initialized = true; + ModLoader.get().postEvent(new RegisterGuiLayersEvent(this.layers)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java b/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java new file mode 100644 index 0000000000..82cf506898 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import java.util.Optional; +import java.util.function.Supplier; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.neoforged.fml.IExtensionPoint; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModList; +import net.neoforged.neoforgespi.language.IModInfo; + +/** + * Register an instance to {@link ModContainer#registerExtensionPoint(Class, Supplier)} + * to supply a config screen for your mod. + * + *

The config screen will be accessible from the mod list menu. + */ +public interface IConfigScreenFactory extends IExtensionPoint { + /** + * Creates a new config screen. The {@code modListScreen} parameter can be used for a "back" button. + */ + Screen createScreen(Minecraft minecraft, Screen modListScreen); + + static Optional getForMod(IModInfo selectedMod) { + return ModList.get().getModContainerById(selectedMod.getModId()).flatMap(m -> m.getCustomExtension(IConfigScreenFactory.class)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java index dc604428fb..43280faedc 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java @@ -15,6 +15,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map.Entry; +import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -33,8 +34,10 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.repository.Pack; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.resources.IoSupplier; import net.minecraft.util.FormattedCharSequence; import net.neoforged.fml.ModContainer; @@ -43,7 +46,6 @@ import net.neoforged.fml.loading.FMLPaths; import net.neoforged.fml.loading.StringUtils; import net.neoforged.fml.loading.moddiscovery.ModFileInfo; -import net.neoforged.neoforge.client.ConfigScreenHandler; import net.neoforged.neoforge.client.gui.widget.ModListWidget; import net.neoforged.neoforge.client.gui.widget.ScrollPanel; import net.neoforged.neoforge.common.CommonHooks; @@ -294,7 +296,7 @@ public void init() { private void displayModConfig() { if (selected == null) return; try { - ConfigScreenHandler.getScreenFactoryFor(selected.getInfo()).map(f -> f.apply(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); + IConfigScreenFactory.getForMod(selected.getInfo()).map(f -> f.createScreen(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); } catch (final Exception e) { LOGGER.error("There was a critical issue trying to build the config GUI for {}", selected.getInfo().getModId(), e); } @@ -342,14 +344,9 @@ private void resortMods(SortType newSort) { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - this.modList.render(guiGraphics, mouseX, mouseY, partialTick); - if (this.modInfo != null) - this.modInfo.render(guiGraphics, mouseX, mouseY, partialTick); - + super.render(guiGraphics, mouseX, mouseY, partialTick); Component text = Component.translatable("fml.menu.mods.search"); int x = modList.getX() + ((modList.getRight() - modList.getX()) / 2) - (getFontRenderer().width(text) / 2); - this.search.render(guiGraphics, mouseX, mouseY, partialTick); - super.render(guiGraphics, mouseX, mouseY, partialTick); guiGraphics.drawString(getFontRenderer(), text.getVisualOrderText(), x, search.getY() - getFontRenderer().lineHeight, 0xFFFFFF, false); } @@ -373,7 +370,7 @@ private void updateCache() { return; } IModInfo selectedMod = selected.getInfo(); - this.configButton.active = ConfigScreenHandler.getScreenFactoryFor(selectedMod).isPresent(); + this.configButton.active = IConfigScreenFactory.getForMod(selectedMod).isPresent(); List lines = new ArrayList<>(); VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod); @@ -382,7 +379,7 @@ private void updateCache() { TextureManager tm = this.minecraft.getTextureManager(); final Pack.ResourcesSupplier resourcePack = ResourcePackLoader.getPackFor(selectedMod.getModId()) .orElse(ResourcePackLoader.getPackFor("neoforge").orElseThrow(() -> new RuntimeException("Can't find neoforge, WHAT!"))); - try (PackResources packResources = resourcePack.openPrimary("mod:" + selectedMod.getModId())) { + try (PackResources packResources = resourcePack.openPrimary(new PackLocationInfo("mod:" + selectedMod.getModId(), Component.empty(), PackSource.BUILT_IN, Optional.empty()))) { NativeImage logo = null; IoSupplier logoResource = packResources.getRootResource(logoFile.split("[/\\\\]")); if (logoResource != null) diff --git a/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java b/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java deleted file mode 100644 index afb3f0e347..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui; - -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.api.distmarker.OnlyIn; -import net.neoforged.fml.VersionChecker; -import net.neoforged.fml.loading.FMLConfig; -import net.neoforged.neoforge.client.loading.ClientModLoader; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; - -@OnlyIn(Dist.CLIENT) -public class TitleScreenModUpdateIndicator extends Screen { - private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(NeoForgeVersion.MOD_ID, "textures/gui/version_check_icons.png"); - - private final Button modButton; - private VersionChecker.Status showNotification = null; - private boolean hasCheckedForUpdates = false; - - public TitleScreenModUpdateIndicator(Button modButton) { - super(Component.translatable("neoforge.menu.updatescreen.title")); - this.modButton = modButton; - } - - @Override - public void init() { - if (!hasCheckedForUpdates) { - if (modButton != null) { - showNotification = ClientModLoader.checkForUpdates(); - } - hasCheckedForUpdates = true; - } - } - - @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK)) { - return; - } - - int x = modButton.getX(); - int y = modButton.getY(); - int w = modButton.getWidth(); - int h = modButton.getHeight(); - - guiGraphics.blit(VERSION_CHECK_ICONS, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); - } - - public static TitleScreenModUpdateIndicator init(TitleScreen guiMainMenu, Button modButton) { - TitleScreenModUpdateIndicator titleScreenModUpdateIndicator = new TitleScreenModUpdateIndicator(modButton); - titleScreenModUpdateIndicator.resize(guiMainMenu.getMinecraft(), guiMainMenu.width, guiMainMenu.height); - titleScreenModUpdateIndicator.init(); - return titleScreenModUpdateIndicator; - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java b/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java new file mode 100644 index 0000000000..96dae62ab5 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; + +/** + * Identifiers for the vanilla {@link LayeredDraw.Layer}, in the order that they render. + * + *

The corresponding rendering code can be found in the source code of {@link Gui}. + */ +public final class VanillaGuiLayers { + public static final ResourceLocation CAMERA_OVERLAYS = new ResourceLocation("camera_overlays"); + public static final ResourceLocation CROSSHAIR = new ResourceLocation("crosshair"); + public static final ResourceLocation HOTBAR = new ResourceLocation("hotbar"); + public static final ResourceLocation JUMP_METER = new ResourceLocation("jump_meter"); + public static final ResourceLocation EXPERIENCE_BAR = new ResourceLocation("experience_bar"); + public static final ResourceLocation PLAYER_HEALTH = new ResourceLocation("player_health"); + public static final ResourceLocation ARMOR_LEVEL = new ResourceLocation("armor_level"); + public static final ResourceLocation FOOD_LEVEL = new ResourceLocation("food_level"); + public static final ResourceLocation VEHICLE_HEALTH = new ResourceLocation("vehicle_health"); + public static final ResourceLocation AIR_LEVEL = new ResourceLocation("air_level"); + public static final ResourceLocation SELECTED_ITEM_NAME = new ResourceLocation("selected_item_name"); + public static final ResourceLocation SPECTATOR_TOOLTIP = new ResourceLocation("spectator_tooltip"); + public static final ResourceLocation EXPERIENCE_LEVEL = new ResourceLocation("experience_level"); + public static final ResourceLocation EFFECTS = new ResourceLocation("effects"); + public static final ResourceLocation BOSS_OVERLAY = new ResourceLocation("boss_overlay"); + public static final ResourceLocation SLEEP_OVERLAY = new ResourceLocation("sleep_overlay"); + public static final ResourceLocation DEMO_OVERLAY = new ResourceLocation("demo_overlay"); + public static final ResourceLocation DEBUG_OVERLAY = new ResourceLocation("debug_overlay"); + public static final ResourceLocation SCOREBOARD_SIDEBAR = new ResourceLocation("scoreboard_sidebar"); + public static final ResourceLocation OVERLAY_MESSAGE = new ResourceLocation("overlay_message"); + public static final ResourceLocation TITLE = new ResourceLocation("title"); + public static final ResourceLocation CHAT = new ResourceLocation("chat"); + public static final ResourceLocation TAB_LIST = new ResourceLocation("tab_list"); + public static final ResourceLocation SUBTITLE_OVERLAY = new ResourceLocation("subtitle_overlay"); + public static final ResourceLocation SAVING_INDICATOR = new ResourceLocation("saving_indicator"); +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java deleted file mode 100644 index 8c7a1b1e40..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.PlayerRideableJumping; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.food.FoodData; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.scores.DisplaySlot; -import net.minecraft.world.scores.Objective; -import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; -import net.neoforged.neoforge.client.event.RenderGuiEvent; -import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent; -import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.common.NeoForgeMod; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * NeoForge extension of {@link Gui} to be able to render {@link IGuiOverlay HUD overlays}. - */ -public class ExtendedGui extends Gui { - private static final Logger LOGGER = LogManager.getLogger(); - - private static final int WHITE = 0xFFFFFF; - - /* - * If the Euclidean distance to the moused-over block in meters is less than this value, the "Looking at" text will appear on the debug overlay. - */ - public static double rayTraceDistance = 20.0D; - - public int leftHeight = 39; - public int rightHeight = 39; - - private Font font = null; - - public ExtendedGui(Minecraft mc) { - super(mc, mc.getItemRenderer()); - } - - public Minecraft getMinecraft() { - return minecraft; - } - - public void setupOverlayRenderState(boolean blend, boolean depthTest) { - if (blend) { - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - } else { - RenderSystem.disableBlend(); - } - - if (depthTest) { - RenderSystem.enableDepthTest(); - } else { - RenderSystem.disableDepthTest(); - } - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - } - - @Override - public void render(GuiGraphics guiGraphics, float partialTick) { - this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth(); - this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight(); - - rightHeight = 39; - leftHeight = 39; - - if (NeoForge.EVENT_BUS.post(new RenderGuiEvent.Pre(minecraft.getWindow(), guiGraphics, partialTick)).isCanceled()) { - return; - } - - font = minecraft.font; - - this.random.setSeed(tickCount * 312871L); - - GuiOverlayManager.getOverlays().forEach(entry -> { - try { - IGuiOverlay overlay = entry.overlay(); - if (pre(entry, guiGraphics)) return; - overlay.render(this, guiGraphics, partialTick, screenWidth, screenHeight); - post(entry, guiGraphics); - } catch (Exception e) { - LOGGER.error("Error rendering overlay '{}'", entry.id(), e); - } - }); - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - - NeoForge.EVENT_BUS.post(new RenderGuiEvent.Post(minecraft.getWindow(), guiGraphics, partialTick)); - } - - public boolean shouldDrawSurvivalElements() { - return minecraft.gameMode.canHurtPlayer() && minecraft.getCameraEntity() instanceof Player; - } - - public boolean shouldDrawPlayerElements() { - return minecraft.getCameraEntity() instanceof Player; - } - - protected void renderSubtitles(GuiGraphics guiGraphics) { - this.subtitleOverlay.render(guiGraphics); - } - - protected void renderBossHealth(GuiGraphics guiGraphics) { - RenderSystem.defaultBlendFunc(); - minecraft.getProfiler().push("bossHealth"); - this.bossOverlay.render(guiGraphics); - minecraft.getProfiler().pop(); - } - - void renderSpyglassOverlay(GuiGraphics guiGraphics) { - float deltaFrame = this.minecraft.getDeltaFrameTime(); - this.scopeScale = Mth.lerp(0.5F * deltaFrame, this.scopeScale, 1.125F); - if (this.minecraft.options.getCameraType().isFirstPerson()) { - if (this.minecraft.player.isScoping()) { - this.renderSpyglassOverlay(guiGraphics, this.scopeScale); - } else { - this.scopeScale = 0.5F; - } - } - } - - void renderHelmet(float partialTick, GuiGraphics guiGraphics) { - ItemStack itemstack = this.minecraft.player.getInventory().getArmor(3); - - if (this.minecraft.options.getCameraType().isFirstPerson() && !itemstack.isEmpty() && !this.minecraft.player.isScoping()) { - Item item = itemstack.getItem(); - if (item == Blocks.CARVED_PUMPKIN.asItem()) { - renderTextureOverlay(guiGraphics, PUMPKIN_BLUR_LOCATION, 1.0F); - } else { - IClientItemExtensions.of(item).renderHelmetOverlay(itemstack, minecraft.player, this.screenWidth, this.screenHeight, partialTick); - } - } - } - - void renderFrostbite(GuiGraphics guiGraphics) { - if (this.minecraft.player.getTicksFrozen() > 0) { - this.renderTextureOverlay(guiGraphics, POWDER_SNOW_OUTLINE_LOCATION, this.minecraft.player.getPercentFrozen()); - } - } - - protected void renderArmor(GuiGraphics guiGraphics, int width, int height) { - minecraft.getProfiler().push("armor"); - - RenderSystem.enableBlend(); - int left = width / 2 - 91; - int top = height - leftHeight; - - int level = minecraft.player.getArmorValue(); - for (int i = 1; level > 0 && i < 20; i += 2) { - if (i < level) { - guiGraphics.blitSprite(ARMOR_FULL_SPRITE, left, top, 9, 9); - } else if (i == level) { - guiGraphics.blitSprite(ARMOR_HALF_SPRITE, left, top, 9, 9); - } else { - guiGraphics.blitSprite(ARMOR_EMPTY_SPRITE, left, top, 9, 9); - } - left += 8; - } - leftHeight += 10; - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - @Override - protected void renderPortalOverlay(GuiGraphics guiGraphics, float alpha) { - if (alpha > 0.0F) { - super.renderPortalOverlay(guiGraphics, alpha); - } - } - - protected void renderAir(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("air"); - Player player = (Player) this.minecraft.getCameraEntity(); - RenderSystem.enableBlend(); - int left = width / 2 + 91; - int top = height - rightHeight; - - int air = player.getAirSupply(); - if (player.isEyeInFluidType(NeoForgeMod.WATER_TYPE.value()) || air < 300) { - int full = Mth.ceil((double) (air - 2) * 10.0D / 300.0D); - int partial = Mth.ceil((double) air * 10.0D / 300.0D) - full; - - for (int i = 0; i < full + partial; ++i) { - guiGraphics.blitSprite(i < full ? AIR_SPRITE : AIR_BURSTING_SPRITE, left - i * 8 - 9, top, 9, 9); - } - rightHeight += 10; - } - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - public void renderHealth(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("health"); - RenderSystem.enableBlend(); - - Player player = (Player) this.minecraft.getCameraEntity(); - int health = Mth.ceil(player.getHealth()); - boolean highlight = healthBlinkTime > (long) tickCount && (healthBlinkTime - (long) tickCount) / 3L % 2L == 1L; - - if (health < this.lastHealth && player.invulnerableTime > 0) { - this.lastHealthTime = Util.getMillis(); - this.healthBlinkTime = (long) (this.tickCount + 20); - } else if (health > this.lastHealth && player.invulnerableTime > 0) { - this.lastHealthTime = Util.getMillis(); - this.healthBlinkTime = (long) (this.tickCount + 10); - } - - if (Util.getMillis() - this.lastHealthTime > 1000L) { - this.lastHealth = health; - this.displayHealth = health; - this.lastHealthTime = Util.getMillis(); - } - - this.lastHealth = health; - int healthLast = this.displayHealth; - - AttributeInstance attrMaxHealth = player.getAttribute(Attributes.MAX_HEALTH); - float healthMax = Math.max((float) attrMaxHealth.getValue(), Math.max(healthLast, health)); - int absorb = Mth.ceil(player.getAbsorptionAmount()); - - int healthRows = Mth.ceil((healthMax + absorb) / 2.0F / 10.0F); - int rowHeight = Math.max(10 - (healthRows - 2), 3); - - this.random.setSeed((long) (tickCount * 312871)); - - int left = width / 2 - 91; - int top = height - leftHeight; - leftHeight += (healthRows * rowHeight); - if (rowHeight != 10) leftHeight += 10 - rowHeight; - - int regen = -1; - if (player.hasEffect(MobEffects.REGENERATION)) { - regen = this.tickCount % Mth.ceil(healthMax + 5.0F); - } - - this.renderHearts(guiGraphics, player, left, top, rowHeight, regen, healthMax, health, healthLast, absorb, highlight); - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - public void renderFood(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("food"); - - Player player = (Player) this.minecraft.getCameraEntity(); - RenderSystem.enableBlend(); - int left = width / 2 + 91; - int top = height - rightHeight; - rightHeight += 10; - boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic - - FoodData stats = minecraft.player.getFoodData(); - int level = stats.getFoodLevel(); - - for (int i = 0; i < 10; ++i) { - int idx = i * 2 + 1; - int x = left - i * 8 - 9; - int y = top; - - ResourceLocation empty; - ResourceLocation half; - ResourceLocation full; - if (minecraft.player.hasEffect(MobEffects.HUNGER)) { - empty = FOOD_EMPTY_HUNGER_SPRITE; - half = FOOD_HALF_HUNGER_SPRITE; - full = FOOD_FULL_HUNGER_SPRITE; - } else { - empty = FOOD_EMPTY_SPRITE; - half = FOOD_HALF_SPRITE; - full = FOOD_FULL_SPRITE; - } - - if (player.getFoodData().getSaturationLevel() <= 0.0F && tickCount % (level * 3 + 1) == 0) { - y = top + (random.nextInt(3) - 1); - } - - guiGraphics.blitSprite(empty, x, y, 9, 9); - - if (idx < level) - guiGraphics.blitSprite(full, x, y, 9, 9); - else if (idx == level) - guiGraphics.blitSprite(half, x, y, 9, 9); - } - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - protected void renderSleepFade(int width, int height, GuiGraphics guiGraphics) { - if (minecraft.player.getSleepTimer() > 0) { - minecraft.getProfiler().push("sleep"); - int sleepTime = minecraft.player.getSleepTimer(); - float opacity = (float) sleepTime / 100.0F; - - if (opacity > 1.0F) { - opacity = 1.0F - (float) (sleepTime - 100) / 10.0F; - } - - int color = (int) (220.0F * opacity) << 24 | 1052704; - guiGraphics.fill(RenderType.guiOverlay(), 0, 0, width, height, color); - minecraft.getProfiler().pop(); - } - } - - protected void renderExperience(int x, GuiGraphics guiGraphics) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - - if (minecraft.gameMode.hasExperience()) { - super.renderExperienceBar(guiGraphics, x); - } - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - public void renderJumpMeter(PlayerRideableJumping playerRideableJumping, GuiGraphics guiGraphics, int x) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - - super.renderJumpMeter(playerRideableJumping, guiGraphics, x); - - RenderSystem.enableBlend(); - minecraft.getProfiler().pop(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - } - - protected void renderRecordOverlay(int width, int height, float partialTick, GuiGraphics guiGraphics) { - if (overlayMessageTime > 0) { - minecraft.getProfiler().push("overlayMessage"); - float hue = (float) overlayMessageTime - partialTick; - int opacity = (int) (hue * 255.0F / 20.0F); - if (opacity > 255) opacity = 255; - - if (opacity > 8) { - //Include a shift based on the bar height plus the difference between the height that renderSelectedItemName - // renders at (59) and the height that the overlay/status bar renders at (68) by default - int yShift = Math.max(leftHeight, rightHeight) + (68 - 59); - guiGraphics.pose().pushPose(); - //If y shift is smaller less than the default y level, just render it at the base y level - guiGraphics.pose().translate(width / 2D, height - Math.max(yShift, 68), 0.0D); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - int color = (animateOverlayMessageColor ? Mth.hsvToRgb(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); - int messageWidth = font.width(overlayMessageString); - drawBackdrop(guiGraphics, font, -4, messageWidth, 16777215 | (opacity << 24)); - guiGraphics.drawString(font, overlayMessageString.getVisualOrderText(), -messageWidth / 2, -4, color | (opacity << 24)); - RenderSystem.disableBlend(); - guiGraphics.pose().popPose(); - } - - minecraft.getProfiler().pop(); - } - } - - protected void renderTitle(int width, int height, float partialTick, GuiGraphics guiGraphics) { - if (title != null && titleTime > 0) { - minecraft.getProfiler().push("titleAndSubtitle"); - float age = (float) this.titleTime - partialTick; - int opacity = 255; - - if (titleTime > titleFadeOutTime + titleStayTime) { - float f3 = (float) (titleFadeInTime + titleStayTime + titleFadeOutTime) - age; - opacity = (int) (f3 * 255.0F / (float) titleFadeInTime); - } - if (titleTime <= titleFadeOutTime) opacity = (int) (age * 255.0F / (float) this.titleFadeOutTime); - - opacity = Mth.clamp(opacity, 0, 255); - - if (opacity > 8) { - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(width / 2D, height / 2D, 0.0D); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - guiGraphics.pose().pushPose(); - guiGraphics.pose().scale(4.0F, 4.0F, 4.0F); - int l = opacity << 24 & -16777216; - guiGraphics.drawString(this.font, this.title.getVisualOrderText(), -this.getFont().width(this.title) / 2, -10, 16777215 | l, true); - guiGraphics.pose().popPose(); - if (this.subtitle != null) { - guiGraphics.pose().pushPose(); - guiGraphics.pose().scale(2.0F, 2.0F, 2.0F); - guiGraphics.drawString(this.font, this.subtitle.getVisualOrderText(), -this.getFont().width(this.subtitle) / 2, 5, 16777215 | l, true); - guiGraphics.pose().popPose(); - } - RenderSystem.disableBlend(); - guiGraphics.pose().popPose(); - } - - this.minecraft.getProfiler().pop(); - } - } - - protected void renderChat(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("chat"); - - Window window = minecraft.getWindow(); - var event = new CustomizeGuiOverlayEvent.Chat(window, guiGraphics, minecraft.getFrameTime(), 0, height - 40); - NeoForge.EVENT_BUS.post(event); - - guiGraphics.pose().pushPose(); - // We give the absolute Y position of the chat component in the event and account for the chat component's own offsetting here. - guiGraphics.pose().translate(event.getPosX(), (event.getPosY() - height + 40) / chat.getScale(), 0.0D); - int mouseX = Mth.floor(minecraft.mouseHandler.xpos() * window.getGuiScaledWidth() / window.getScreenWidth()); - int mouseY = Mth.floor(minecraft.mouseHandler.ypos() * window.getGuiScaledHeight() / window.getScreenHeight()); - chat.render(guiGraphics, tickCount, mouseX, mouseY); - guiGraphics.pose().popPose(); - - minecraft.getProfiler().pop(); - } - - protected void renderPlayerList(int width, int height, GuiGraphics guiGraphics) { - Objective scoreobjective = this.minecraft.level.getScoreboard().getDisplayObjective(DisplaySlot.LIST); - ClientPacketListener handler = minecraft.player.connection; - - if (minecraft.options.keyPlayerList.isDown() && (!minecraft.isLocalServer() || handler.getOnlinePlayers().size() > 1 || scoreobjective != null)) { - this.tabList.setVisible(true); - this.tabList.render(guiGraphics, width, this.minecraft.level.getScoreboard(), scoreobjective); - - } else { - this.tabList.setVisible(false); - } - } - - protected void renderHealthMount(int width, int height, GuiGraphics guiGraphics) { - Player player = (Player) minecraft.getCameraEntity(); - Entity tmp = player.getVehicle(); - if (!(tmp instanceof LivingEntity)) return; - - int left_align = width / 2 + 91; - - minecraft.getProfiler().popPush("mountHealth"); - RenderSystem.enableBlend(); - LivingEntity mount = (LivingEntity) tmp; - int health = (int) Math.ceil((double) mount.getHealth()); - float healthMax = mount.getMaxHealth(); - int hearts = (int) (healthMax + 0.5F) / 2; - - if (hearts > 30) hearts = 30; - - for (int heart = 0; hearts > 0; heart += 20) { - int top = height - rightHeight; - - int rowCount = Math.min(hearts, 10); - hearts -= rowCount; - - for (int i = 0; i < rowCount; ++i) { - int x = left_align - i * 8 - 9; - guiGraphics.blitSprite(HEART_VEHICLE_CONTAINER_SPRITE, x, top, 9, 9); - - if (i * 2 + 1 + heart < health) - guiGraphics.blitSprite(HEART_VEHICLE_FULL_SPRITE, x, top, 9, 9); - else if (i * 2 + 1 + heart == health) - guiGraphics.blitSprite(HEART_VEHICLE_HALF_SPRITE, x, top, 9, 9); - } - - rightHeight += 10; - } - RenderSystem.disableBlend(); - } - - //Helper macros - private boolean pre(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - return NeoForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Pre(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)).isCanceled(); - } - - private void post(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - NeoForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Post(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)); - } - - public void renderDebugScreenOverlay(GuiGraphics guiGraphics) { - this.getDebugOverlay().render(guiGraphics); - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java deleted file mode 100644 index cd86819edb..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.function.Function; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.fml.ModLoader; -import net.neoforged.neoforge.client.event.RegisterGuiOverlaysEvent; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; - -/** - * Manager for {@linkplain IGuiOverlay HUD overlays}. - *

- * Provides a lookup by ID, as well as all registered {@link IGuiOverlay overlays}. - */ -public final class GuiOverlayManager { - private static ImmutableList OVERLAYS; - private static ImmutableMap OVERLAYS_BY_NAME; - - /** - * Retrieves an ordered list of all registered overlays. - */ - public static ImmutableList getOverlays() { - return OVERLAYS; - } - - /** - * Finds the overlay corresponding to a given ID. - * Do not call this before {@link RegisterGuiOverlaysEvent} has finished firing. - */ - @Nullable - public static NamedGuiOverlay findOverlay(ResourceLocation id) { - return OVERLAYS_BY_NAME.get(id); - } - - @ApiStatus.Internal - public static void init() { - var overlays = new HashMap(); - var orderedOverlays = new ArrayList(); - preRegisterVanillaOverlays(overlays, orderedOverlays); - var event = new RegisterGuiOverlaysEvent(overlays, orderedOverlays); - ModLoader.get().postEventWrapContainerInModOrder(event); - OVERLAYS = orderedOverlays.stream() - .map(id -> new NamedGuiOverlay(id, overlays.get(id))) - .collect(ImmutableList.toImmutableList()); - OVERLAYS_BY_NAME = OVERLAYS.stream() - .collect(ImmutableMap.toImmutableMap(NamedGuiOverlay::id, Function.identity())); - assignVanillaOverlayTypes(); - } - - /** - * Pre-registers vanilla overlays so they are available for ordering. - */ - private static void preRegisterVanillaOverlays(HashMap overlays, ArrayList orderedOverlays) { - for (var entry : VanillaGuiOverlay.values()) { - overlays.put(entry.id(), entry.overlay); - orderedOverlays.add(entry.id()); - } - } - - private static void assignVanillaOverlayTypes() { - for (var entry : VanillaGuiOverlay.values()) - entry.type = OVERLAYS_BY_NAME.get(entry.id()); - } - - private GuiOverlayManager() {} -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java deleted file mode 100644 index 7c0f823912..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import net.minecraft.client.gui.GuiGraphics; -import net.neoforged.neoforge.client.event.RegisterGuiOverlaysEvent; - -/** - * A HUD overlay. - * - * @see RegisterGuiOverlaysEvent - */ -@FunctionalInterface -public interface IGuiOverlay { - void render(ExtendedGui gui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight); -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java deleted file mode 100644 index 4d7dd53718..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent; -import org.jetbrains.annotations.ApiStatus; - -/** - * An object representation of an {@link IGuiOverlay overlay} with a name. - *

- * Useful to identify overlays in {@link RenderGuiOverlayEvent}. - *

- * Users should not be instantiating this themselves. Retrieve from {@link GuiOverlayManager}. - */ -public record NamedGuiOverlay(ResourceLocation id, IGuiOverlay overlay) { - @ApiStatus.Internal - public NamedGuiOverlay {} -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java deleted file mode 100644 index df90516217..0000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.Minecraft; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.PlayerRideableJumping; -import net.minecraft.world.level.GameType; -import net.minecraft.world.scores.DisplaySlot; -import net.minecraft.world.scores.Objective; -import net.minecraft.world.scores.PlayerTeam; -import net.minecraft.world.scores.Scoreboard; -import org.lwjgl.opengl.GL11; - -/** - * All the vanilla {@linkplain IGuiOverlay HUD overlays} in the order that they render. - */ -public enum VanillaGuiOverlay { - VIGNETTE("vignette", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (Minecraft.useFancyGraphics()) { - gui.setupOverlayRenderState(true, false); - gui.renderVignette(guiGraphics, gui.getMinecraft().getCameraEntity()); - } - }), - SPYGLASS("spyglass", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderSpyglassOverlay(guiGraphics); - }), - HELMET("helmet", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderHelmet(partialTick, guiGraphics); - }), - FROSTBITE("frostbite", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderFrostbite(guiGraphics); - }), - PORTAL("portal", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - float f1 = Mth.lerp(partialTick, gui.getMinecraft().player.oSpinningEffectIntensity, gui.getMinecraft().player.spinningEffectIntensity); - if (f1 > 0.0F && !gui.getMinecraft().player.hasEffect(MobEffects.CONFUSION)) { - gui.setupOverlayRenderState(true, false); - gui.renderPortalOverlay(guiGraphics, f1); - } - }), - HOTBAR("hotbar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - if (gui.getMinecraft().gameMode.getPlayerMode() == GameType.SPECTATOR) { - gui.getSpectatorGui().renderHotbar(guiGraphics); - } else { - gui.renderHotbar(partialTick, guiGraphics); - } - } - }), - CROSSHAIR("crosshair", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(0, 0, -90); - gui.renderCrosshair(guiGraphics); - guiGraphics.pose().popPose(); - } - }), - BOSS_EVENT_PROGRESS("boss_event_progress", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(0, 0, -90); - gui.renderBossHealth(guiGraphics); - guiGraphics.pose().popPose(); - } - }), - PLAYER_HEALTH("player_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderHealth(screenWidth, screenHeight, guiGraphics); - } - }), - ARMOR_LEVEL("armor_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderArmor(guiGraphics, screenWidth, screenHeight); - } - }), - FOOD_LEVEL("food_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - Entity vehicle = gui.getMinecraft().player.getVehicle(); - boolean isMounted = vehicle != null && vehicle.showVehicleHealth(); - if (!isMounted && !gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderFood(screenWidth, screenHeight, guiGraphics); - } - }), - AIR_LEVEL("air_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderAir(screenWidth, screenHeight, guiGraphics); - } - }), - MOUNT_HEALTH("mount_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawPlayerElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderHealthMount(screenWidth, screenHeight, guiGraphics); - } - }), - JUMP_BAR("jump_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - PlayerRideableJumping playerRideableJumping = gui.getMinecraft().player.jumpableVehicle(); - if (playerRideableJumping != null && !gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - gui.renderJumpMeter(playerRideableJumping, guiGraphics, screenWidth / 2 - 91); - } - }), - EXPERIENCE_BAR("experience_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getMinecraft().player.jumpableVehicle() == null && !gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - gui.renderExperience(screenWidth / 2 - 91, guiGraphics); - } - }), - ITEM_NAME("item_name", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - if (gui.getMinecraft().gameMode.getPlayerMode() != GameType.SPECTATOR) { - gui.renderSelectedItemName(guiGraphics, Math.max(gui.leftHeight, gui.rightHeight)); - } else if (gui.getMinecraft().player.isSpectator()) { - gui.getSpectatorGui().renderTooltip(guiGraphics); - } - } - }), - SLEEP_FADE("sleep_fade", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.renderSleepFade(screenWidth, screenHeight, guiGraphics); - }), - DEMO_OVERLAY("demo_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getMinecraft().isDemo() && !gui.getDebugOverlay().showDebugScreen()) { - gui.renderDemoOverlay(guiGraphics); - } - }), - POTION_ICONS("potion_icons", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.renderEffects(guiGraphics); - }), - DEBUG_SCREEN("debug_screen", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getDebugOverlay().showDebugScreen()) { - gui.renderDebugScreenOverlay(guiGraphics); - } - }), - RECORD_OVERLAY("record_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, guiGraphics); - } - }), - TITLE_TEXT("title_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderTitle(screenWidth, screenHeight, partialTick, guiGraphics); - } - }), - SUBTITLES("subtitles", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderSubtitles(guiGraphics); - } - }), - SCOREBOARD("scoreboard", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - Scoreboard scoreboard = gui.getMinecraft().level.getScoreboard(); - Objective objective = null; - PlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(gui.getMinecraft().player.getScoreboardName()); - if (scoreplayerteam != null) { - DisplaySlot displayslot = DisplaySlot.teamColorToSlot(scoreplayerteam.getColor()); - if (displayslot != null) objective = scoreboard.getDisplayObjective(displayslot); - } - Objective scoreobjective1 = objective != null ? objective : scoreboard.getDisplayObjective(DisplaySlot.SIDEBAR); - if (scoreobjective1 != null) { - gui.displayScoreboardSidebar(guiGraphics, scoreobjective1); - } - }), - CHAT_PANEL("chat_panel", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - gui.renderChat(screenWidth, screenHeight, guiGraphics); - }), - PLAYER_LIST("player_list", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - gui.renderPlayerList(screenWidth, screenHeight, guiGraphics); - }); - - private final ResourceLocation id; - final IGuiOverlay overlay; - NamedGuiOverlay type; - - VanillaGuiOverlay(String id, IGuiOverlay overlay) { - this.id = new ResourceLocation("minecraft", id); - this.overlay = overlay; - } - - public ResourceLocation id() { - return id; - } - - public NamedGuiOverlay type() { - return type; - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java index d99583fe4f..0f60c187b2 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java @@ -34,7 +34,7 @@ public ModListWidget(ModListScreen parent, int listWidth, int top, int bottom) { super(parent.getMinecraftInstance(), listWidth, bottom - top, top, parent.getFontRenderer().lineHeight * 2 + 8); this.parent = parent; this.listWidth = listWidth; - this.setRenderBackground(false); + //this.setRenderBackground(false); // Porting 1.20.5 still needed? this.refreshList(); } @@ -53,12 +53,6 @@ public void refreshList() { parent.buildModList(this::addEntry, mod -> new ModEntry(mod, this.parent)); } - @Override - public void renderWidget(GuiGraphics p_282708_, int p_283242_, int p_282891_, float p_283683_) { - this.parent.renderBackground(p_282708_, p_283242_, p_282891_, p_283683_); - super.renderWidget(p_282708_, p_283242_, p_282891_, p_283683_); - } - public class ModEntry extends ObjectSelectionList.Entry { private final IModInfo modInfo; private final ModListScreen parent; diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java new file mode 100644 index 0000000000..f0835f8bc5 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui.widget; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.VersionChecker; +import net.neoforged.fml.loading.FMLConfig; +import net.neoforged.neoforge.client.loading.ClientModLoader; +import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +/** + * Custom button subclass to draw an indicator overlay on the button when updates are available. + */ +@ApiStatus.Internal +public class ModsButton extends Button { + private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(NeoForgeVersion.MOD_ID, "textures/gui/version_check_icons.png"); + + @Nullable + private VersionChecker.Status showNotification; + private boolean hasCheckedForUpdates = false; + + public ModsButton(Builder builder) { + super(builder); + } + + @Override + protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + + if (!hasCheckedForUpdates) { + showNotification = ClientModLoader.checkForUpdates(); + hasCheckedForUpdates = true; + } + + if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK)) { + return; + } + + int x = getX(); + int y = getY(); + int w = getWidth(); + int h = getHeight(); + + guiGraphics.blit( + VERSION_CHECK_ICONS, + x + w - (h / 2 + 4), + y + (h / 2 - 4), + showNotification.getSheetOffset() * 8, + (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, + 8, + 8, + 64, + 16); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java index 25ecfd50ec..f4c0c771d9 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java @@ -39,8 +39,6 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen private final int barWidth; private final int barLeft; - private final int bgColorFrom; - private final int bgColorTo; private final int barBgColor; private final int barColor; private final int barBorderColor; @@ -68,33 +66,6 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i this(client, width, height, top, left, border, 6); } - /** - * @param client the minecraft instance this ScrollPanel should use - * @param width the width - * @param height the height - * @param top the offset from the top (y coord) - * @param left the offset from the left (x coord) - * @param border the size of the border - * @param barWidth the width of the scroll bar - */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth) { - this(client, width, height, top, left, border, barWidth, 0xC0101010, 0xD0101010); - } - - /** - * @param client the minecraft instance this ScrollPanel should use - * @param width the width - * @param height the height - * @param top the offset from the top (y coord) - * @param left the offset from the left (x coord) - * @param border the size of the border - * @param barWidth the width of the scroll bar - * @param bgColor the color for the background - */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColor) { - this(client, width, height, top, left, border, barWidth, bgColor, bgColor); - } - /** * @param client the minecraft instance this ScrollPanel should use * @param width the width @@ -106,8 +77,8 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * @param bgColorFrom the start color for the background gradient * @param bgColorTo the end color for the background gradient */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo) { - this(client, width, height, top, left, border, barWidth, bgColorFrom, bgColorTo, 0xFF000000, 0xFF808080, 0xFFC0C0C0); + public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth) { + this(client, width, height, top, left, border, barWidth, 0xFF000000, 0xFF808080, 0xFFC0C0C0); } /** @@ -126,7 +97,7 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * @param barColor the color for the scroll bar handle * @param barBorderColor the border color for the scroll bar handle */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo, int barBgColor, int barColor, int barBorderColor) { + public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor) { this.client = client; this.width = width; this.height = height; @@ -137,8 +108,6 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i this.barLeft = this.left + this.width - barWidth; this.border = border; this.barWidth = barWidth; - this.bgColorFrom = bgColorFrom; - this.bgColorTo = bgColorTo; this.barBgColor = barBgColor; this.barColor = barColor; this.barBorderColor = barBorderColor; @@ -150,22 +119,7 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * Draws the background of the scroll panel. This runs AFTER Scissors are enabled. */ protected void drawBackground(GuiGraphics guiGraphics, Tesselator tess, float partialTick) { - BufferBuilder worldr = tess.getBuilder(); - - if (this.client.level != null) { - this.drawGradientRect(guiGraphics, this.left, this.top, this.right, this.bottom, bgColorFrom, bgColorTo); - } else // Draw dark dirt background - { - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); - final float texScale = 32.0F; - worldr.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - worldr.vertex(this.left, this.bottom, 0.0D).uv(this.left / texScale, (this.bottom + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.right, this.bottom, 0.0D).uv(this.right / texScale, (this.bottom + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.right, this.top, 0.0D).uv(this.right / texScale, (this.top + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.left, this.top, 0.0D).uv(this.left / texScale, (this.top + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - tess.end(); - } + Screen.renderMenuBackgroundTexture(guiGraphics, Screen.MENU_BACKGROUND, this.left, this.top, 0f, 0f, this.width, this.height); } /** diff --git a/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java b/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java index 0d0e96da7d..8cce5c5087 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java +++ b/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java @@ -15,7 +15,6 @@ import javax.annotation.Nullable; import net.minecraft.client.renderer.block.model.BlockElement; import net.minecraft.client.renderer.block.model.BlockElementFace; -import net.minecraft.util.ExtraCodecs; /** * Holds extra data that may be injected into a face.

@@ -30,7 +29,7 @@ public record ExtraFaceData(int color, int blockLight, int skyLight, boolean amb public static final ExtraFaceData DEFAULT = new ExtraFaceData(0xFFFFFFFF, 0, 0, true); - public static final Codec COLOR = new ExtraCodecs.EitherCodec<>(Codec.INT, Codec.STRING).xmap( + public static final Codec COLOR = Codec.either(Codec.INT, Codec.STRING).xmap( either -> either.map(Function.identity(), str -> (int) Long.parseLong(str, 16)), color -> Either.right(Integer.toHexString(color))); @@ -55,6 +54,6 @@ public static ExtraFaceData read(@Nullable JsonElement obj, @Nullable ExtraFaceD if (obj == null) { return fallback; } - return CODEC.parse(JsonOps.INSTANCE, obj).getOrThrow(false, JsonParseException::new); + return CODEC.parse(JsonOps.INSTANCE, obj).getOrThrow(JsonParseException::new); } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java b/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java index 3355785403..4b804da4be 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java +++ b/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java @@ -142,7 +142,7 @@ public JsonObject toJson(JsonObject json) { JsonObject layerObj = new JsonObject(); for (Int2ObjectMap.Entry entry : this.faceData.int2ObjectEntrySet()) { - layerObj.add(String.valueOf(entry.getIntKey()), ExtraFaceData.CODEC.encodeStart(JsonOps.INSTANCE, entry.getValue()).getOrThrow(false, s -> {})); + layerObj.add(String.valueOf(entry.getIntKey()), ExtraFaceData.CODEC.encodeStart(JsonOps.INSTANCE, entry.getValue()).getOrThrow()); } forgeData.add("layers", layerObj); diff --git a/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java b/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java index c6389c882f..7f579ee6c5 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java +++ b/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java @@ -119,7 +119,7 @@ public final void process(VertexConsumer consumer, PoseStack.Pose pose, BakedQua } var color = quad.isTinted() ? getColorFast(quad.getTintIndex()) : WHITE; - consumer.putBulkData(pose, quad, brightness, color[0], color[1], color[2], lightmap, overlay, true); + consumer.putBulkData(pose, quad, brightness, color[0], color[1], color[2], 1.0f, lightmap, overlay, true); } private float[] getColorFast(int tintIndex) { diff --git a/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java b/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java index 6dd7d97c6e..d4fec4b841 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java +++ b/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java @@ -50,7 +50,7 @@ public void render(PoseStack poseStack, MultiBufferSource bufferSource, ITexture Matrix4f matrix = context.getTransform(name); if (matrix != null) { poseStack.pushPose(); - poseStack.mulPoseMatrix(matrix); + poseStack.mulPose(matrix); } for (var part : children) diff --git a/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java b/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java index d606386860..33a7e2db4a 100644 --- a/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java +++ b/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java @@ -5,12 +5,16 @@ package net.neoforged.neoforge.common; +import java.util.Optional; +import net.minecraft.core.component.DataComponentPredicate; 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; import net.minecraft.world.item.Items; +import net.minecraft.world.item.trading.ItemCost; import net.minecraft.world.item.trading.MerchantOffer; +import org.jetbrains.annotations.Nullable; /** * A default, exposed implementation of ITrade. All of the other implementations of ITrade (in VillagerTrades) are not public. @@ -45,9 +49,11 @@ public BasicItemListing(int emeralds, ItemStack forSale, int maxTrades, int xp) this(new ItemStack(Items.EMERALD, emeralds), forSale, maxTrades, xp, 1); } - @org.jetbrains.annotations.Nullable + @Nullable @Override public MerchantOffer getOffer(Entity p_219693_, RandomSource p_219694_) { - return new MerchantOffer(price, price2, forSale, maxTrades, xp, priceMult); + ItemCost cost = new ItemCost(price.getItemHolder(), price.getCount(), DataComponentPredicate.EMPTY, price); // Porting 1.20.5 do something proper for the components here + ItemCost cost2 = new ItemCost(price2.getItemHolder(), price2.getCount(), DataComponentPredicate.EMPTY, price2); + return new MerchantOffer(cost, Optional.of(cost2), forSale, maxTrades, xp, priceMult); } } diff --git a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java index 699dd1490a..fd95cf15e3 100644 --- a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java +++ b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java @@ -14,6 +14,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.lang.reflect.Method; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -26,6 +27,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.regex.Matcher; @@ -33,16 +35,18 @@ import java.util.stream.Stream; import net.minecraft.ChatFormatting; import net.minecraft.ResourceLocationException; +import net.minecraft.SharedConstants; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.ChatDecorator; @@ -90,6 +94,7 @@ import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.ContainerLevelAccess; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.AdventureModePredicate; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.EnchantedBookItem; @@ -101,12 +106,14 @@ import net.minecraft.world.item.Tiers; import net.minecraft.world.item.TippedArrowItem; import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; @@ -120,6 +127,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.WorldData; @@ -343,7 +351,7 @@ public static ItemEntity onPlayerTossEvent(Player player, ItemStack item, boolea return event.getEntity(); } - public static boolean onVanillaGameEvent(Level level, GameEvent vanillaEvent, Vec3 pos, GameEvent.Context context) { + public static boolean onVanillaGameEvent(Level level, Holder vanillaEvent, Vec3 pos, GameEvent.Context context) { return !NeoForge.EVENT_BUS.post(new VanillaGameEvent(level, vanillaEvent, pos, context)).isCanceled(); } @@ -440,7 +448,7 @@ else if (end.length() > 0) } public static void dropXpForBlock(BlockState state, ServerLevel level, BlockPos pos, ItemStack stack) { - int fortuneLevel = stack.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE); + int fortuneLevel = stack.getEnchantmentLevel(Enchantments.FORTUNE); int silkTouchLevel = stack.getEnchantmentLevel(Enchantments.SILK_TOUCH); int exp = state.getExpDrop(level, level.random, pos, fortuneLevel, silkTouchLevel); if (exp > 0) @@ -460,8 +468,10 @@ public static int onBlockBreakEvent(Level level, GameType gameType, ServerPlayer preCancelEvent = true; if (!entityPlayer.mayBuild()) { - if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.registryAccess().registryOrThrow(Registries.BLOCK), new BlockInWorld(level, pos, false))) + AdventureModePredicate adventureModePredicate = itemstack.get(DataComponents.CAN_BREAK); + if (itemstack.isEmpty() || adventureModePredicate == null || !adventureModePredicate.test(new BlockInWorld(level, pos, false))) { preCancelEvent = true; + } } } @@ -498,15 +508,20 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { Level level = context.getLevel(); Player player = context.getPlayer(); - if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.registryAccess().registryOrThrow(Registries.BLOCK), new BlockInWorld(level, context.getClickedPos(), false))) - return InteractionResult.PASS; + if (player != null && !player.getAbilities().mayBuild) { + AdventureModePredicate adventureModePredicate = itemstack.get(DataComponents.CAN_PLACE_ON); + if (adventureModePredicate == null || !adventureModePredicate.test(new BlockInWorld(level, context.getClickedPos(), false))) { + return net.minecraft.world.InteractionResult.PASS; + } + } // handle all placement events here Item item = itemstack.getItem(); int size = itemstack.getCount(); - CompoundTag nbt = null; - if (itemstack.getTag() != null) - nbt = itemstack.getTag().copy(); + // Porting 1.20.5 redo this for components? + //CompoundTag nbt = null; + //if (itemstack.getTag() != null) + // nbt = itemstack.getTag().copy(); if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket level.captureBlockSnapshots = true; @@ -521,17 +536,17 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { if (ret.consumesAction()) { // save new item data int newSize = itemstack.getCount(); - CompoundTag newNBT = null; - if (itemstack.getTag() != null) { - newNBT = itemstack.getTag().copy(); - } + //CompoundTag newNBT = null; + //if (itemstack.getTag() != null) { + // newNBT = itemstack.getTag().copy(); + //} @SuppressWarnings("unchecked") List blockSnapshots = (List) level.capturedBlockSnapshots.clone(); level.capturedBlockSnapshots.clear(); // make sure to set pre-placement item data for event itemstack.setCount(size); - itemstack.setTag(nbt); + //itemstack.setTag(nbt); //TODO: Set pre-placement item attachments? Direction side = context.getClickedFace(); @@ -554,7 +569,7 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { } else { // Change the stack to its new content itemstack.setCount(newSize); - itemstack.setTag(newNBT); + //itemstack.setTag(newNBT); for (BlockSnapshot snap : blockSnapshots) { int updateFlag = snap.getFlag(); @@ -573,7 +588,7 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { return ret; } - public static boolean onAnvilChange(AnvilMenu container, ItemStack left, ItemStack right, Container outputSlot, String name, int baseCost, Player player) { + public static boolean onAnvilChange(AnvilMenu container, ItemStack left, ItemStack right, Container outputSlot, String name, long baseCost, Player player) { AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost, player); if (NeoForge.EVENT_BUS.post(e).isCanceled()) return false; @@ -810,9 +825,9 @@ public static CriticalHitEvent getCriticalHit(Player player, Entity target, bool } /** - * Hook to fire {@link ItemAttributeModifierEvent}. Modders should use {@link ItemStack#getAttributeModifiers(EquipmentSlot)} instead. + * Hook to fire {@link ItemAttributeModifierEvent}. Modders should use {@link ItemStack#forEachModifier(EquipmentSlot, BiConsumer)} instead. */ - public static Multimap getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot, Multimap attributes) { + public static Multimap, AttributeModifier> getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot, Multimap, AttributeModifier> attributes) { ItemAttributeModifierEvent event = new ItemAttributeModifierEvent(stack, equipmentSlot, attributes); NeoForge.EVENT_BUS.post(event); return event.getModifiers(); @@ -837,24 +852,25 @@ public static String getDefaultCreatorModId(ItemStack itemStack) { String modId = registryName == null ? null : registryName.getNamespace(); if ("minecraft".equals(modId)) { if (item instanceof EnchantedBookItem) { - ListTag enchantmentsNbt = EnchantedBookItem.getEnchantments(itemStack); - if (enchantmentsNbt.size() == 1) { - CompoundTag nbttagcompound = enchantmentsNbt.getCompound(0); - ResourceLocation resourceLocation = ResourceLocation.tryParse(nbttagcompound.getString("id")); - if (resourceLocation != null && BuiltInRegistries.ENCHANTMENT.containsKey(resourceLocation)) { - return resourceLocation.getNamespace(); + Set> enchantments = itemStack.getOrDefault(DataComponents.STORED_ENCHANTMENTS, ItemEnchantments.EMPTY).keySet(); + if (enchantments.size() == 1) { + Holder enchantmentHolder = enchantments.iterator().next(); + Optional> key = enchantmentHolder.unwrapKey(); + if (key.isPresent()) { + return key.get().location().getNamespace(); } } } else if (item instanceof PotionItem || item instanceof TippedArrowItem) { - Potion potionType = PotionUtils.getPotion(itemStack); - ResourceLocation resourceLocation = BuiltInRegistries.POTION.getKey(potionType); - if (resourceLocation != null) { - return resourceLocation.getNamespace(); + PotionContents potionContents = itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); + Optional> potionType = potionContents.potion(); + Optional> key = potionType.flatMap(Holder::unwrapKey); + if (key.isPresent()) { + return key.get().location().getNamespace(); } - } else if (item instanceof SpawnEggItem) { - ResourceLocation resourceLocation = BuiltInRegistries.ENTITY_TYPE.getKey(((SpawnEggItem) item).getType(null)); - if (resourceLocation != null) { - return resourceLocation.getNamespace(); + } else if (item instanceof SpawnEggItem spawnEggItem) { + Optional>> key = BuiltInRegistries.ENTITY_TYPE.getResourceKey(spawnEggItem.getType(itemStack)); + if (key.isPresent()) { + return key.get().location().getNamespace(); } } } @@ -1219,7 +1235,7 @@ public static boolean canUseEntitySelectors(SharedSuggestionProvider provider) { public static HolderLookup.RegistryLookup wrapRegistryLookup(final HolderLookup.RegistryLookup lookup) { return new HolderLookup.RegistryLookup.Delegate<>() { @Override - protected RegistryLookup parent() { + public RegistryLookup parent() { return lookup; } @@ -1282,4 +1298,72 @@ public static void onLivingBreathe(LivingEntity entity, int consumeAirAmount, in entity.stopRiding(); } } + + private static final Set> checkedComponentClasses = ConcurrentHashMap.newKeySet(); + + /** + * Marks a class as being safe to use as a {@link DataComponents data component}. + * Keep in mind that data components are compared with {@link Object#equals(Object)} + * and hashed with {@link Object#hashCode()}. + * They must also be immutable. + * + *

Only call this method if the default implementations of {@link Object#equals(Object)} + * and {@link Object#hashCode()} are suitable for this class, + * and if instances of this class are immutable. + * Typically, this is only the case for singletons such as {@link Block} instances. + */ + public static void markComponentClassAsValid(Class clazz) { + if (clazz.isRecord() || clazz.isEnum()) { + throw new IllegalArgumentException("Records and enums are always valid components"); + } + + if (overridesEqualsAndHashCode(clazz)) { + throw new IllegalArgumentException("Class " + clazz + " already overrides equals and hashCode"); + } + + checkedComponentClasses.add(clazz); + } + + static { + // Mark common singletons as valid + markComponentClassAsValid(Block.class); + markComponentClassAsValid(BlockState.class); + markComponentClassAsValid(Fluid.class); + markComponentClassAsValid(FluidState.class); + markComponentClassAsValid(Item.class); + } + + /** + * Checks that all data components override equals and hashCode. + */ + @ApiStatus.Internal + public static void validateComponent(@Nullable Object dataComponent) { + if (!SharedConstants.IS_RUNNING_IN_IDE || dataComponent == null) { + return; + } + + Class clazz = dataComponent.getClass(); + if (!checkedComponentClasses.contains(clazz)) { + if (clazz.isRecord() || clazz.isEnum()) { + checkedComponentClasses.add(clazz); + return; // records and enums are always ok + } + + if (overridesEqualsAndHashCode(clazz)) { + checkedComponentClasses.add(clazz); + } else { + throw new IllegalArgumentException("Data components must implement equals and hashCode. Keep in mind they must also be immutable. Problematic class: " + clazz); + } + } + } + + private static boolean overridesEqualsAndHashCode(Class clazz) { + try { + Method equals = clazz.getMethod("equals", Object.class); + Method hashCode = clazz.getMethod("hashCode"); + return equals.getDeclaringClass() != Object.class && hashCode.getDeclaringClass() != Object.class; + } catch (ReflectiveOperationException exception) { + throw new RuntimeException("Failed to check for component equals and hashCode", exception); + } + } } diff --git a/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java b/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java index a2924dd386..b51740f57c 100644 --- a/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java +++ b/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java @@ -58,7 +58,7 @@ protected EntityType getDefaultType() { private static final DispenseItemBehavior DEFAULT_DISPENSE_BEHAVIOR = (source, stack) -> { Direction face = source.state().getValue(DispenserBlock.FACING); - EntityType type = ((SpawnEggItem) stack.getItem()).getType(stack.getTag()); + EntityType type = ((SpawnEggItem) stack.getItem()).getType(stack); try { type.spawn(source.level(), stack, null, source.pos().relative(face), MobSpawnType.DISPENSER, face != Direction.UP, false); diff --git a/src/main/java/net/neoforged/neoforge/common/EffectCure.java b/src/main/java/net/neoforged/neoforge/common/EffectCure.java index db5f27a79f..aa29b06fce 100644 --- a/src/main/java/net/neoforged/neoforge/common/EffectCure.java +++ b/src/main/java/net/neoforged/neoforge/common/EffectCure.java @@ -6,11 +6,14 @@ package net.neoforged.neoforge.common; import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.LivingEntity; @@ -25,6 +28,7 @@ public final class EffectCure { private static final Map CURES = new ConcurrentHashMap<>(); public static Codec CODEC = Codec.STRING.xmap(EffectCure::get, EffectCure::name); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.STRING_UTF8.map(EffectCure::get, EffectCure::name); /** * {@return all registered cures} diff --git a/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java b/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java index 72ae1bd453..68b7c98484 100644 --- a/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java +++ b/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java @@ -8,8 +8,13 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; +import io.netty.buffer.ByteBuf; import java.util.function.Function; +import java.util.function.IntFunction; import java.util.function.Supplier; +import java.util.function.ToIntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.StringRepresentable; /** @@ -55,4 +60,11 @@ static & StringRepresentable> Codec createCodecForExtensib }), value -> Either.left(value.getSerializedName())); } + + /** + * Use this instead of {@link ByteBufCodecs#idMapper(IntFunction, ToIntFunction)} for extensible enums because this not cache the enum values on construction + */ + static & StringRepresentable> StreamCodec createStreamCodecForExtensibleEnum(Supplier valuesSupplier) { + return ByteBufCodecs.INT.map(i -> valuesSupplier.get()[i], Enum::ordinal); + } } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java index 7946953264..5b6c7cf701 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java @@ -68,10 +68,23 @@ public static class Server { * General configuration that doesn't need to be synchronized but needs to be available before server startup */ public static class Common { + public final ModConfigSpec.EnumValue logUntranslatedItemTagWarnings; + public final ModConfigSpec.EnumValue logLegacyTagWarnings; + Common(ModConfigSpec.Builder builder) { - builder.comment("[DEPRECATED / NO EFFECT]: General configuration settings") + builder.comment("General configuration settings") .push("general"); + logUntranslatedItemTagWarnings = builder + .comment("A config option mainly for developers. Logs out modded item tags that do not have translations when running on integrated server. Format desired is tag.item.. for the translation key. Defaults to SILENCED.") + .translation("forge.configgui.logUntranslatedItemTagWarnings") + .defineEnum("logUntranslatedItemTagWarnings", TagConventionLogWarning.LOG_WARNING_MODES.SILENCED); + + logLegacyTagWarnings = builder + .comment("A config option mainly for developers. Logs out modded tags that are using the 'forge' namespace when running on integrated server. Defaults to DEV_SHORT.") + .translation("forge.configgui.logLegacyTagWarnings") + .defineEnum("logLegacyTagWarnings", TagConventionLogWarning.LOG_WARNING_MODES.DEV_SHORT); + builder.pop(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java index 6ed7d5bd56..dd60f4f97e 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java @@ -114,7 +114,7 @@ public void onDpSync(final OnDatapackSyncEvent event) { .registry(registry); if (regOpt.isEmpty()) return; event.getRelevantPlayers().forEach(player -> { - if (!player.connection.isConnected(RegistryDataMapSyncPayload.ID)) { + if (!player.connection.isConnected(RegistryDataMapSyncPayload.TYPE)) { return; } if (player.connection.getConnection().isMemoryConnection()) { @@ -165,7 +165,6 @@ static LootModifierManager getLootModifierManager() { @SubscribeEvent public void resourceReloadListeners(AddReloadListenerEvent event) { - event.addListener(TierSortingRegistry.getReloadListener()); event.addListener(CreativeModeTabRegistry.getReloadListener()); } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java index bbb39ccb6c..2c3a184c22 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java @@ -7,7 +7,7 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; -import com.mojang.serialization.Lifecycle; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Arrays; import java.util.EnumSet; @@ -20,6 +20,8 @@ import java.util.function.Function; import java.util.function.Predicate; import net.minecraft.DetectedVersion; +import net.minecraft.advancements.critereon.EntitySubPredicate; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.commands.Commands; @@ -30,6 +32,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.RegistryCodecs; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.Registries; @@ -43,7 +46,6 @@ import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.ExtraCodecs; import net.minecraft.util.InclusiveRange; import net.minecraft.world.damagesource.DamageSources; import net.minecraft.world.damagesource.DamageType; @@ -74,16 +76,14 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.Vec3; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.CrashReportCallables; -import net.neoforged.fml.IExtensionPoint; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModLoader; -import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.ModLoadingStage; import net.neoforged.fml.ModLoadingWarning; import net.neoforged.fml.StartupMessageManager; @@ -92,11 +92,10 @@ import net.neoforged.fml.config.ModConfig; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.neoforged.fml.loading.FMLEnvironment; import net.neoforged.neoforge.capabilities.CapabilityHooks; import net.neoforged.neoforge.client.ClientCommandHandler; import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; -import net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate; -import net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate; import net.neoforged.neoforge.common.advancements.critereon.PiglinCurrencyItemPredicate; import net.neoforged.neoforge.common.advancements.critereon.PiglinNeutralArmorEntityPredicate; import net.neoforged.neoforge.common.advancements.critereon.ToolActionItemPredicate; @@ -110,26 +109,27 @@ import net.neoforged.neoforge.common.conditions.TagEmptyCondition; import net.neoforged.neoforge.common.conditions.TrueCondition; import net.neoforged.neoforge.common.crafting.CompoundIngredient; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; import net.neoforged.neoforge.common.crafting.DifferenceIngredient; import net.neoforged.neoforge.common.crafting.IngredientType; import net.neoforged.neoforge.common.crafting.IntersectionIngredient; -import net.neoforged.neoforge.common.crafting.NBTIngredient; import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.common.data.NeoForgeDamageTypeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeAdvancementProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeBiomeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeBlockTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeDataMapsProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeEnchantmentTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeEntityTypeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeFluidTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeItemTagsProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeLanguageProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeLootTableProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeRecipeProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeRegistryOrderReportProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeSpriteSourceProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeStructureTagsProvider; import net.neoforged.neoforge.common.data.internal.VanillaSoundDefinitionsProvider; -import net.neoforged.neoforge.common.extensions.IEntityExtension; -import net.neoforged.neoforge.common.extensions.IPlayerExtension; import net.neoforged.neoforge.common.loot.AddTableLootModifier; import net.neoforged.neoforge.common.loot.CanToolPerformAction; import net.neoforged.neoforge.common.loot.IGlobalLootModifier; @@ -187,9 +187,9 @@ public class NeoForgeMod { private static final DeferredRegister ATTRIBUTES = DeferredRegister.create(Registries.ATTRIBUTE, NeoForgeVersion.MOD_ID); private static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registries.COMMAND_ARGUMENT_TYPE, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> GLOBAL_LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> STRUCTURE_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> GLOBAL_LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> STRUCTURE_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); private static final DeferredRegister HOLDER_SET_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.HOLDER_SET_TYPES, NeoForgeVersion.MOD_ID); @SuppressWarnings({ "unchecked", "rawtypes" }) // Uses Holder instead of DeferredHolder as the type due to weirdness between ECJ and javac. @@ -199,15 +199,6 @@ public class NeoForgeMod { public static final Holder SWIM_SPEED = ATTRIBUTES.register("swim_speed", () -> new RangedAttribute("neoforge.swim_speed", 1.0D, 0.0D, 1024.0D).setSyncable(true)); public static final Holder NAMETAG_DISTANCE = ATTRIBUTES.register("nametag_distance", () -> new RangedAttribute("neoforge.name_tag_distance", 64.0D, 0.0D, 64.0).setSyncable(true)); - public static final Holder ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("neoforge.entity_gravity", 0.08D, -8.0D, 8.0D).setSyncable(true)); - - /** - * Reach Distance represents the distance at which a player may interact with the world. The default is 4.5 blocks. Players in creative mode have an additional 0.5 blocks of block reach. - * - * @see IPlayerExtension#getBlockReach() - * @see IPlayerExtension#canReach(BlockPos, double) - */ - public static final Holder BLOCK_REACH = ATTRIBUTES.register("block_reach", () -> new RangedAttribute("neoforge.block_reach", 4.5D, 0.0D, 1024.0D).setSyncable(true)); /** * Grants the player the ability to use creative flight when not in creative mode. @@ -228,37 +219,20 @@ public class NeoForgeMod { */ public static final Holder CREATIVE_FLIGHT = ATTRIBUTES.register("creative_flight", () -> new RangedAttribute("neoforge.creative_flight", 0D, 0D, Double.MAX_VALUE).setSyncable(true)); - /** - * Attack Range represents the distance at which a player may attack an entity. The default is 3 blocks. Players in creative mode have an additional 2 blocks of entity reach. - * The default of 3.0 is technically considered a bug by Mojang - see MC-172289 and MC-92484. However, updating this value would allow for longer-range attacks on vanilla servers, which makes some people mad. - * - * @see IPlayerExtension#getEntityReach() - * @see IPlayerExtension#canReach(Entity, double) - * @see IPlayerExtension#canReach(Vec3, double) - */ - public static final Holder ENTITY_REACH = ATTRIBUTES.register("entity_reach", () -> new RangedAttribute("neoforge.entity_reach", 3.0D, 0.0D, 1024.0D).setSyncable(true)); - - /** - * Step Height Addition modifies the amount of blocks an entity may walk up without jumping. - * - * @see IEntityExtension#getStepHeight() - */ - public static final Holder STEP_HEIGHT = ATTRIBUTES.register("step_height", () -> new RangedAttribute("neoforge.step_height", 0.0D, -512.0D, 512.0D).setSyncable(true)); - /** * Stock loot modifier type that adds loot from a subtable to the final loot. */ - public static final DeferredHolder, Codec> ADD_TABLE_LOOT_MODIFIER_TYPE = GLOBAL_LOOT_MODIFIER_SERIALIZERS.register("add_table", () -> AddTableLootModifier.CODEC); + public static final DeferredHolder, MapCodec> ADD_TABLE_LOOT_MODIFIER_TYPE = GLOBAL_LOOT_MODIFIER_SERIALIZERS.register("add_table", () -> AddTableLootModifier.CODEC); /** * Noop biome modifier. Can be used in a biome modifier json with "type": "neoforge:none". */ - public static final DeferredHolder, Codec> NONE_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("none", () -> Codec.unit(NoneBiomeModifier.INSTANCE)); + public static final DeferredHolder, MapCodec> NONE_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("none", () -> MapCodec.unit(NoneBiomeModifier.INSTANCE)); /** * Stock biome modifier for adding features to biomes. */ - public static final DeferredHolder, Codec> ADD_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_features", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> ADD_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_features", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddFeaturesBiomeModifier::biomes), @@ -269,12 +243,12 @@ public class NeoForgeMod { /** * Stock biome modifier for removing features from biomes. */ - public static final DeferredHolder, Codec> REMOVE_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_features", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> REMOVE_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_features", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(RemoveFeaturesBiomeModifier::biomes), PlacedFeature.LIST_CODEC.fieldOf("features").forGetter(RemoveFeaturesBiomeModifier::features), - new ExtraCodecs.EitherCodec, Decoration>(Decoration.CODEC.listOf(), Decoration.CODEC).>xmap( + Codec., Decoration>either(Decoration.CODEC.listOf(), Decoration.CODEC).>xmap( either -> either.map(Set::copyOf, Set::of), // convert list/singleton to set when decoding set -> set.size() == 1 ? Either.right(set.toArray(Decoration[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("steps", EnumSet.allOf(Decoration.class)).forGetter(RemoveFeaturesBiomeModifier::steps)) .apply(builder, RemoveFeaturesBiomeModifier::new))); @@ -282,13 +256,13 @@ public class NeoForgeMod { /** * Stock biome modifier for adding mob spawns to biomes. */ - public static final DeferredHolder, Codec> ADD_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> ADD_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddSpawnsBiomeModifier::biomes), // Allow either a list or single spawner, attempting to decode the list format first. // Uses the better EitherCodec that logs both errors if both formats fail to parse. - new ExtraCodecs.EitherCodec<>(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( + Codec.either(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( either -> either.map(Function.identity(), List::of), // convert list/singleton to list when decoding list -> list.size() == 1 ? Either.right(list.get(0)) : Either.left(list) // convert list to singleton/list when encoding ).fieldOf("spawners").forGetter(AddSpawnsBiomeModifier::spawners)) @@ -297,7 +271,7 @@ public class NeoForgeMod { /** * Stock biome modifier for removing mob spawns from biomes. */ - public static final DeferredHolder, Codec> REMOVE_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> REMOVE_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(RemoveSpawnsBiomeModifier::biomes), @@ -307,7 +281,7 @@ public class NeoForgeMod { /** * Stock biome modifier for adding carvers to biomes. */ - public static final DeferredHolder, Codec> ADD_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.AddCarversBiomeModifier::biomes), ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(BiomeModifiers.AddCarversBiomeModifier::carvers), GenerationStep.Carving.CODEC.fieldOf("step").forGetter(BiomeModifiers.AddCarversBiomeModifier::step)).apply(builder, BiomeModifiers.AddCarversBiomeModifier::new))); @@ -315,10 +289,10 @@ public class NeoForgeMod { /** * Stock biome modifier for removing carvers from biomes. */ - public static final DeferredHolder, Codec> REMOVE_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_carvers", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_carvers", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.RemoveCarversBiomeModifier::biomes), ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(BiomeModifiers.RemoveCarversBiomeModifier::carvers), - new ExtraCodecs.EitherCodec<>(GenerationStep.Carving.CODEC.listOf(), GenerationStep.Carving.CODEC).xmap( + Codec.either(GenerationStep.Carving.CODEC.listOf(), GenerationStep.Carving.CODEC).xmap( either -> either.map(Set::copyOf, Set::of), set -> set.size() == 1 ? Either.right(set.toArray(GenerationStep.Carving[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("steps", EnumSet.allOf(GenerationStep.Carving.class)).forGetter(BiomeModifiers.RemoveCarversBiomeModifier::steps)) .apply(builder, BiomeModifiers.RemoveCarversBiomeModifier::new))); @@ -326,7 +300,7 @@ public class NeoForgeMod { /** * Stock biome modifier for adding mob spawn costs to biomes. */ - public static final DeferredHolder, Codec> ADD_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawn_costs", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawn_costs", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::biomes), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::entityTypes), MobSpawnSettings.MobSpawnCost.CODEC.fieldOf("spawn_cost").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::spawnCost)).apply(builder, BiomeModifiers.AddSpawnCostsBiomeModifier::new))); @@ -334,23 +308,23 @@ public class NeoForgeMod { /** * Stock biome modifier for removing mob spawn costs from biomes. */ - public static final DeferredHolder, Codec> REMOVE_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawn_costs", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawn_costs", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.RemoveSpawnCostsBiomeModifier::biomes), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(BiomeModifiers.RemoveSpawnCostsBiomeModifier::entityTypes)).apply(builder, BiomeModifiers.RemoveSpawnCostsBiomeModifier::new))); /** * Noop structure modifier. Can be used in a structure modifier json with "type": "neoforge:none". */ - public static final DeferredHolder, Codec> NONE_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("none", () -> Codec.unit(NoneStructureModifier.INSTANCE)); + public static final DeferredHolder, MapCodec> NONE_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("none", () -> MapCodec.unit(NoneStructureModifier.INSTANCE)); /** * Stock structure modifier for adding mob spawns to structures. */ - public static final DeferredHolder, Codec> ADD_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.AddSpawnsStructureModifier::structures), // Allow either a list or single spawner, attempting to decode the list format first. // Uses the better EitherCodec that logs both errors if both formats fail to parse. - new ExtraCodecs.EitherCodec<>(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( + Codec.either(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( either -> either.map(Function.identity(), List::of), // convert list/singleton to list when decoding list -> list.size() == 1 ? Either.right(list.get(0)) : Either.left(list) // convert list to singleton/list when encoding ).fieldOf("spawners").forGetter(StructureModifiers.AddSpawnsStructureModifier::spawners)).apply(builder, StructureModifiers.AddSpawnsStructureModifier::new))); @@ -358,16 +332,16 @@ public class NeoForgeMod { /** * Stock structure modifier for removing mob spawns from structures. */ - public static final DeferredHolder, Codec> REMOVE_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.RemoveSpawnsStructureModifier::structures), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(StructureModifiers.RemoveSpawnsStructureModifier::entityTypes)).apply(builder, StructureModifiers.RemoveSpawnsStructureModifier::new))); /** * Stock structure modifier for removing spawn override lists from structures. */ - public static final DeferredHolder, Codec> CLEAR_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("clear_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> CLEAR_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("clear_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.ClearSpawnsStructureModifier::structures), - new ExtraCodecs.EitherCodec, MobCategory>(MobCategory.CODEC.listOf(), MobCategory.CODEC).>xmap( + Codec., MobCategory>either(MobCategory.CODEC.listOf(), MobCategory.CODEC).>xmap( either -> either.map(Set::copyOf, Set::of), // convert list/singleton to set when decoding set -> set.size() == 1 ? Either.right(set.toArray(MobCategory[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("categories", EnumSet.allOf(MobCategory.class)).forGetter(StructureModifiers.ClearSpawnsStructureModifier::categories)) .apply(builder, StructureModifiers.ClearSpawnsStructureModifier::new))); @@ -396,29 +370,30 @@ public class NeoForgeMod { private static final DeferredRegister> INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, NeoForgeVersion.MOD_ID); public static final DeferredHolder, IngredientType> COMPOUND_INGREDIENT_TYPE = INGREDIENT_TYPES.register("compound", () -> new IngredientType<>(CompoundIngredient.CODEC, CompoundIngredient.CODEC_NONEMPTY)); - public static final DeferredHolder, IngredientType> NBT_INGREDIENT_TYPE = INGREDIENT_TYPES.register("nbt", () -> new IngredientType<>(NBTIngredient.CODEC, NBTIngredient.CODEC_NONEMPTY)); + public static final DeferredHolder, IngredientType> NBT_INGREDIENT_TYPE = INGREDIENT_TYPES.register("components", () -> new IngredientType<>(DataComponentIngredient.CODEC, DataComponentIngredient.CODEC_NONEMPTY)); public static final DeferredHolder, IngredientType> DIFFERENCE_INGREDIENT_TYPE = INGREDIENT_TYPES.register("difference", () -> new IngredientType<>(DifferenceIngredient.CODEC, DifferenceIngredient.CODEC_NONEMPTY)); public static final DeferredHolder, IngredientType> INTERSECTION_INGREDIENT_TYPE = INGREDIENT_TYPES.register("intersection", () -> new IngredientType<>(IntersectionIngredient.CODEC, IntersectionIngredient.CODEC_NONEMPTY)); - private static final DeferredRegister> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> AND_CONDITION = CONDITION_CODECS.register("and", () -> AndCondition.CODEC); - public static final DeferredHolder, Codec> FALSE_CONDITION = CONDITION_CODECS.register("false", () -> FalseCondition.CODEC); - public static final DeferredHolder, Codec> ITEM_EXISTS_CONDITION = CONDITION_CODECS.register("item_exists", () -> ItemExistsCondition.CODEC); - public static final DeferredHolder, Codec> MOD_LOADED_CONDITION = CONDITION_CODECS.register("mod_loaded", () -> ModLoadedCondition.CODEC); - public static final DeferredHolder, Codec> NOT_CONDITION = CONDITION_CODECS.register("not", () -> NotCondition.CODEC); - public static final DeferredHolder, Codec> OR_CONDITION = CONDITION_CODECS.register("or", () -> OrCondition.CODEC); - public static final DeferredHolder, Codec> TAG_EMPTY_CONDITION = CONDITION_CODECS.register("tag_empty", () -> TagEmptyCondition.CODEC); - public static final DeferredHolder, Codec> TRUE_CONDITION = CONDITION_CODECS.register("true", () -> TrueCondition.CODEC); + private static final DeferredRegister> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, MapCodec> AND_CONDITION = CONDITION_CODECS.register("and", () -> AndCondition.CODEC); + public static final DeferredHolder, MapCodec> FALSE_CONDITION = CONDITION_CODECS.register("false", () -> FalseCondition.CODEC); + public static final DeferredHolder, MapCodec> ITEM_EXISTS_CONDITION = CONDITION_CODECS.register("item_exists", () -> ItemExistsCondition.CODEC); + public static final DeferredHolder, MapCodec> MOD_LOADED_CONDITION = CONDITION_CODECS.register("mod_loaded", () -> ModLoadedCondition.CODEC); + public static final DeferredHolder, MapCodec> NOT_CONDITION = CONDITION_CODECS.register("not", () -> NotCondition.CODEC); + public static final DeferredHolder, MapCodec> OR_CONDITION = CONDITION_CODECS.register("or", () -> OrCondition.CODEC); + public static final DeferredHolder, MapCodec> TAG_EMPTY_CONDITION = CONDITION_CODECS.register("tag_empty", () -> TagEmptyCondition.CODEC); + public static final DeferredHolder, MapCodec> TRUE_CONDITION = CONDITION_CODECS.register("true", () -> TrueCondition.CODEC); private static final DeferredRegister> VANILLA_INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, "minecraft"); - public static final DeferredHolder, IngredientType> VANILLA_INGREDIENT_TYPE = VANILLA_INGREDIENT_TYPES.register("item", () -> new IngredientType<>(Ingredient.VANILLA_CODEC, Ingredient.VANILLA_CODEC_NONEMPTY)); + // TODO 1.20.5: this will be gone with the custom ingredient cleanup + public static final DeferredHolder, IngredientType> VANILLA_INGREDIENT_TYPE = VANILLA_INGREDIENT_TYPES.register("item", () -> new IngredientType<>(Ingredient.VANILLA_CODEC.fieldOf("value"), Ingredient.VANILLA_CODEC_NONEMPTY.fieldOf("value"))); - private static final DeferredRegister> ENTITY_PREDICATE_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.ENTITY_PREDICATE_SERIALIZERS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> PIGLIN_NEUTRAL_ARMOR_PREDICATE = ENTITY_PREDICATE_CODECS.register("piglin_neutral_armor", () -> PiglinNeutralArmorEntityPredicate.CODEC); + private static final DeferredRegister> ENTITY_PREDICATE_CODECS = DeferredRegister.create(Registries.ENTITY_SUB_PREDICATE_TYPE, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, MapCodec> PIGLIN_NEUTRAL_ARMOR_PREDICATE = ENTITY_PREDICATE_CODECS.register("piglin_neutral_armor", () -> PiglinNeutralArmorEntityPredicate.CODEC); - private static final DeferredRegister> ITEM_PREDICATE_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.ITEM_PREDICATE_SERIALIZERS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> TOOL_ACTION_PREDICATE = ITEM_PREDICATE_CODECS.register("tool_action", () -> ToolActionItemPredicate.CODEC); - public static final DeferredHolder, Codec> PIGLIN_CURRENCY_PREDICATE = ITEM_PREDICATE_CODECS.register("piglin_currency", () -> PiglinCurrencyItemPredicate.CODEC); + private static final DeferredRegister> ITEM_SUB_PREDICATES = DeferredRegister.create(Registries.ITEM_SUB_PREDICATE_TYPE, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, ItemSubPredicate.Type> TOOL_ACTION_PREDICATE = ITEM_SUB_PREDICATES.register("tool_action", () -> ToolActionItemPredicate.TYPE); + public static final DeferredHolder, ItemSubPredicate.Type> PIGLIN_CURRENCY_PREDICATE = ITEM_SUB_PREDICATES.register("piglin_currency", () -> PiglinCurrencyItemPredicate.TYPE); private static final DeferredRegister VANILLA_FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, "minecraft"); @@ -460,7 +435,7 @@ public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos } @Override - public @Nullable BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { + public @Nullable PathType getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { return canFluidLog ? super.getBlockPathType(state, level, pos, mob, true) : null; } @@ -508,7 +483,7 @@ public int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos po .descriptionId("block.minecraft.lava") .canSwim(false) .canDrown(false) - .pathType(BlockPathTypes.LAVA) + .pathType(PathType.LAVA) .adjacentPathType(null) .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL_LAVA) .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY_LAVA) @@ -612,18 +587,16 @@ public NeoForgeMod(IEventBus modEventBus, Dist dist, ModContainer container) { VANILLA_FLUID_TYPES.register(modEventBus); VANILLA_INGREDIENT_TYPES.register(modEventBus); ENTITY_PREDICATE_CODECS.register(modEventBus); - ITEM_PREDICATE_CODECS.register(modEventBus); + ITEM_SUB_PREDICATES.register(modEventBus); INGREDIENT_TYPES.register(modEventBus); CONDITION_CODECS.register(modEventBus); GLOBAL_LOOT_MODIFIER_SERIALIZERS.register(modEventBus); NeoForge.EVENT_BUS.addListener(this::serverStopping); - ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.clientSpec); - ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, NeoForgeConfig.serverSpec); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, NeoForgeConfig.commonSpec); + container.registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.clientSpec); + container.registerConfig(ModConfig.Type.SERVER, NeoForgeConfig.serverSpec); + container.registerConfig(ModConfig.Type.COMMON, NeoForgeConfig.commonSpec); modEventBus.register(NeoForgeConfig.class); NeoForgeRegistriesSetup.setup(modEventBus); - // Forge does not display problems when the remote is not matching. - ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> "ANY", (remote, isServer) -> true)); StartupMessageManager.addModMessage("NeoForge version " + NeoForgeVersion.getVersion()); NeoForge.EVENT_BUS.addListener(VillagerTradingManager::loadTrades); @@ -631,9 +604,10 @@ public NeoForgeMod(IEventBus modEventBus, Dist dist, ModContainer container) { NeoForge.EVENT_BUS.addListener(this::registerPermissionNodes); UsernameCache.load(); - TierSortingRegistry.init(); if (dist.isClient()) ClientCommandHandler.init(); DualStackUtils.initialise(); + TagConventionLogWarning.init(); + if (FMLEnvironment.dist == Dist.CLIENT) TagConventionLogWarningClient.init(); modEventBus.addListener(CapabilityHooks::registerVanillaProviders); modEventBus.addListener(CauldronFluidContent::registerCapabilities); @@ -679,15 +653,18 @@ public void gatherData(GatherDataEvent event) { gen.addProvider(event.includeServer(), new NeoForgeItemTagsProvider(packOutput, lookupProvider, blockTags.contentsGetter(), existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeEntityTypeTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeFluidTagsProvider(packOutput, lookupProvider, existingFileHelper)); - gen.addProvider(event.includeServer(), new NeoForgeRecipeProvider(packOutput)); - gen.addProvider(event.includeServer(), new NeoForgeLootTableProvider(packOutput)); + gen.addProvider(event.includeServer(), new NeoForgeEnchantmentTagsProvider(packOutput, lookupProvider, existingFileHelper)); + gen.addProvider(event.includeServer(), new NeoForgeRecipeProvider(packOutput, lookupProvider)); + gen.addProvider(event.includeServer(), new NeoForgeLootTableProvider(packOutput, lookupProvider)); gen.addProvider(event.includeServer(), new NeoForgeBiomeTagsProvider(packOutput, lookupProvider, existingFileHelper)); + gen.addProvider(event.includeServer(), new NeoForgeStructureTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeDamageTypeTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeRegistryOrderReportProvider(packOutput)); gen.addProvider(event.includeServer(), new NeoForgeDataMapsProvider(packOutput, lookupProvider)); gen.addProvider(event.includeClient(), new NeoForgeSpriteSourceProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeClient(), new VanillaSoundDefinitionsProvider(packOutput, existingFileHelper)); + gen.addProvider(event.includeClient(), new NeoForgeLanguageProvider(packOutput)); } // done in an event instead of deferred to only enable if a mod requests it @@ -743,7 +720,7 @@ public void registerVanillaDisplayContexts(RegisterEvent event) { Arrays.stream(ItemDisplayContext.values()) .filter(Predicate.not(ItemDisplayContext::isModded)) - .forEach(ctx -> forgeRegistry.registerMapping(ctx.getId(), ResourceKey.create(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, new ResourceLocation("minecraft", ctx.getSerializedName())), ctx, Lifecycle.stable())); + .forEach(ctx -> forgeRegistry.register(ctx.getId(), ResourceKey.create(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, new ResourceLocation("minecraft", ctx.getSerializedName())), ctx, RegistrationInfo.BUILT_IN)); } public void registerLootData(RegisterEvent event) { diff --git a/src/main/java/net/neoforged/neoforge/common/SimpleTier.java b/src/main/java/net/neoforged/neoforge/common/SimpleTier.java index 4743f620de..73b4dfdd41 100644 --- a/src/main/java/net/neoforged/neoforge/common/SimpleTier.java +++ b/src/main/java/net/neoforged/neoforge/common/SimpleTier.java @@ -14,25 +14,21 @@ /** * Helper class to define a custom tier */ -public final class SimpleTier implements Tier { - private final int level; +public class SimpleTier implements Tier { + private final TagKey incorrectBlocksForDrops; private final int uses; private final float speed; private final float attackDamageBonus; private final int enchantmentValue; - - private final TagKey tag; - private final Supplier repairIngredient; - public SimpleTier(int level, int uses, float speed, float attackDamageBonus, int enchantmentValue, - TagKey tag, Supplier repairIngredient) { - this.level = level; + public SimpleTier(TagKey incorrectBlocksForDrops, int uses, float speed, float attackDamageBonus, int enchantmentValue, + Supplier repairIngredient) { + this.incorrectBlocksForDrops = incorrectBlocksForDrops; this.uses = uses; this.speed = speed; this.attackDamageBonus = attackDamageBonus; this.enchantmentValue = enchantmentValue; - this.tag = tag; this.repairIngredient = repairIngredient; } @@ -52,8 +48,8 @@ public float getAttackDamageBonus() { } @Override - public int getLevel() { - return this.level; + public TagKey getIncorrectBlocksForDrops() { + return incorrectBlocksForDrops; } @Override @@ -61,10 +57,6 @@ public int getEnchantmentValue() { return this.enchantmentValue; } - public TagKey getTag() { - return this.tag; - } - @Override public Ingredient getRepairIngredient() { return this.repairIngredient.get(); @@ -73,12 +65,11 @@ public Ingredient getRepairIngredient() { @Override public String toString() { return "SimpleTier[" + - "level=" + level + ", " + + "incorrectBlocksForDrops=" + incorrectBlocksForDrops + ", " + "uses=" + uses + ", " + "speed=" + speed + ", " + "attackDamageBonus=" + attackDamageBonus + ", " + "enchantmentValue=" + enchantmentValue + ", " + - "tag=" + tag + ", " + "repairIngredient=" + repairIngredient + ']'; } } diff --git a/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java new file mode 100644 index 0000000000..10fd9653c4 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java @@ -0,0 +1,521 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public final class TagConventionLogWarning { + private TagConventionLogWarning() {} + + protected enum LOG_WARNING_MODES { + SILENCED, + DEV_SHORT, + DEV_VERBOSE, + PROD_SHORT, + PROD_VERBOSE + } + + private static final Logger LOGGER = LogManager.getLogger(); + + /** + * Old `forge` tags that we migrated to a new tag under a new convention. + * May also contain commonly used `forge` tags that are not following convention. + */ + private static final Map, TagKey> LEGACY_FORGE_TAGS = Map., TagKey>ofEntries( + createMapEntry(Registries.BLOCK, "enderman_place_on_blacklist", Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST), + createMapEntry(Registries.BLOCK, "needs_wood_tool", Tags.Blocks.NEEDS_WOOD_TOOL), + createMapEntry(Registries.BLOCK, "needs_gold_tool", Tags.Blocks.NEEDS_GOLD_TOOL), + createMapEntry(Registries.BLOCK, "needs_netherite_tool", Tags.Blocks.NEEDS_NETHERITE_TOOL), + + createMapEntry(Registries.BLOCK, "barrels", Tags.Blocks.BARRELS), + createMapEntry(Registries.BLOCK, "barrels/wooden", Tags.Blocks.BARRELS_WOODEN), + createMapEntry(Registries.BLOCK, "bookshelves", Tags.Blocks.BOOKSHELVES), + createMapEntry(Registries.BLOCK, "chests", Tags.Blocks.CHESTS), + createMapEntry(Registries.BLOCK, "chests/ender", Tags.Blocks.CHESTS_ENDER), + createMapEntry(Registries.BLOCK, "chests/trapped", Tags.Blocks.CHESTS_TRAPPED), + createMapEntry(Registries.BLOCK, "chests/wooden", Tags.Blocks.CHESTS_WOODEN), + createMapEntry(Registries.BLOCK, "cobblestone", Tags.Blocks.COBBLESTONES), + createMapEntry(Registries.BLOCK, "cobblestone/normal", Tags.Blocks.COBBLESTONES_NORMAL), + createMapEntry(Registries.BLOCK, "cobblestone/infested", Tags.Blocks.COBBLESTONES_INFESTED), + createMapEntry(Registries.BLOCK, "cobblestone/mossy", Tags.Blocks.COBBLESTONES_MOSSY), + createMapEntry(Registries.BLOCK, "cobblestone/deepslate", Tags.Blocks.COBBLESTONES_DEEPSLATE), + createMapEntry(Registries.BLOCK, "crafting_table", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "crafting_tables", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "workbench", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "workbenches", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "end_stones", Tags.Blocks.END_STONES), + createMapEntry(Registries.BLOCK, "fence_gates", Tags.Blocks.FENCE_GATES), + createMapEntry(Registries.BLOCK, "fence_gates/wooden", Tags.Blocks.FENCE_GATES_WOODEN), + createMapEntry(Registries.BLOCK, "fences", Tags.Blocks.FENCES), + createMapEntry(Registries.BLOCK, "fences/nether_brick", Tags.Blocks.FENCES_NETHER_BRICK), + createMapEntry(Registries.BLOCK, "fences/wooden", Tags.Blocks.FENCES_WOODEN), + createMapEntry(Registries.BLOCK, "furnace", Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.BLOCK, "furnaces", Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.BLOCK, "glass", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/black", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/blue", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/brown", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/colorless", Tags.Blocks.GLASS_BLOCKS_COLORLESS), + createMapEntry(Registries.BLOCK, "glass/cyan", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/gray", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/green", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/light_blue", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/light_gray", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/lime", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/magenta", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/orange", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/pink", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/purple", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/red", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/silica", Tags.Blocks.GLASS_BLOCKS_CHEAP), + createMapEntry(Registries.BLOCK, "glass/tinted", Tags.Blocks.GLASS_BLOCKS_TINTED), + createMapEntry(Registries.BLOCK, "glass/white", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/yellow", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass_panes", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/black", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/blue", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/brown", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/colorless", Tags.Blocks.GLASS_PANES_COLORLESS), + createMapEntry(Registries.BLOCK, "glass_panes/cyan", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/gray", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/green", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/light_blue", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/light_gray", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/lime", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/magenta", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/orange", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/pink", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/purple", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/red", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/white", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/yellow", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "gravel", Tags.Blocks.GRAVELS), + createMapEntry(Registries.BLOCK, "heads", Tags.Blocks.SKULLS), + createMapEntry(Registries.BLOCK, "skulls", Tags.Blocks.SKULLS), + createMapEntry(Registries.BLOCK, "netherrack", Tags.Blocks.NETHERRACKS), + createMapEntry(Registries.BLOCK, "obsidian", Tags.Blocks.OBSIDIANS), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/deepslate", Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/netherrack", Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/stone", Tags.Blocks.ORE_BEARING_GROUND_STONE), + createMapEntry(Registries.BLOCK, "ore_rates/dense", Tags.Blocks.ORE_RATES_DENSE), + createMapEntry(Registries.BLOCK, "ore_rates/singular", Tags.Blocks.ORE_RATES_SINGULAR), + createMapEntry(Registries.BLOCK, "ore_rates/sparse", Tags.Blocks.ORE_RATES_SPARSE), + createMapEntry(Registries.BLOCK, "ores", Tags.Blocks.ORES), + createMapEntry(Registries.BLOCK, "ores/coal", Tags.Blocks.ORES_COAL), + createMapEntry(Registries.BLOCK, "ores/copper", Tags.Blocks.ORES_COPPER), + createMapEntry(Registries.BLOCK, "ores/diamond", Tags.Blocks.ORES_DIAMOND), + createMapEntry(Registries.BLOCK, "ores/emerald", Tags.Blocks.ORES_EMERALD), + createMapEntry(Registries.BLOCK, "ores/gold", Tags.Blocks.ORES_GOLD), + createMapEntry(Registries.BLOCK, "ores/iron", Tags.Blocks.ORES_IRON), + createMapEntry(Registries.BLOCK, "ores/lapis", Tags.Blocks.ORES_LAPIS), + createMapEntry(Registries.BLOCK, "ores/netherite_scrap", Tags.Blocks.ORES_NETHERITE_SCRAP), + createMapEntry(Registries.BLOCK, "ores/quartz", Tags.Blocks.ORES_QUARTZ), + createMapEntry(Registries.BLOCK, "ores/redstone", Tags.Blocks.ORES_REDSTONE), + createMapEntry(Registries.BLOCK, "ores_in_ground/deepslate", Tags.Blocks.ORES_IN_GROUND_DEEPSLATE), + createMapEntry(Registries.BLOCK, "ores_in_ground/netherrack", Tags.Blocks.ORES_IN_GROUND_NETHERRACK), + createMapEntry(Registries.BLOCK, "ores_in_ground/stone", Tags.Blocks.ORES_IN_GROUND_STONE), + createMapEntry(Registries.BLOCK, "sand", Tags.Blocks.SANDS), + createMapEntry(Registries.BLOCK, "sand/colorless", Tags.Blocks.SANDS_COLORLESS), + createMapEntry(Registries.BLOCK, "sand/red", Tags.Blocks.SANDS_RED), + createMapEntry(Registries.BLOCK, "sandstone", Tags.Blocks.SANDSTONE_BLOCKS), + createMapEntry(Registries.BLOCK, "stained_glass", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "stained_glass_panes", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "stone", Tags.Blocks.STONES), + createMapEntry(Registries.BLOCK, "storage_blocks", Tags.Blocks.STORAGE_BLOCKS), + createMapEntry(Registries.BLOCK, "storage_blocks/amethyst", "storage_blocks/amethyst"), + createMapEntry(Registries.BLOCK, "storage_blocks/coal", Tags.Blocks.STORAGE_BLOCKS_COAL), + createMapEntry(Registries.BLOCK, "storage_blocks/copper", Tags.Blocks.STORAGE_BLOCKS_COPPER), + createMapEntry(Registries.BLOCK, "storage_blocks/diamond", Tags.Blocks.STORAGE_BLOCKS_DIAMOND), + createMapEntry(Registries.BLOCK, "storage_blocks/emerald", Tags.Blocks.STORAGE_BLOCKS_EMERALD), + createMapEntry(Registries.BLOCK, "storage_blocks/gold", Tags.Blocks.STORAGE_BLOCKS_GOLD), + createMapEntry(Registries.BLOCK, "storage_blocks/iron", Tags.Blocks.STORAGE_BLOCKS_IRON), + createMapEntry(Registries.BLOCK, "storage_blocks/lapis", Tags.Blocks.STORAGE_BLOCKS_LAPIS), + createMapEntry(Registries.BLOCK, "storage_blocks/netherite", Tags.Blocks.STORAGE_BLOCKS_NETHERITE), + createMapEntry(Registries.BLOCK, "storage_blocks/quartz", "storage_blocks/quartz"), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_copper", Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_gold", Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_iron", Tags.Blocks.STORAGE_BLOCKS_RAW_IRON), + createMapEntry(Registries.BLOCK, "storage_blocks/redstone", Tags.Blocks.STORAGE_BLOCKS_REDSTONE), + + createMapEntry(Registries.BLOCK, "relocation_not_supported", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK, "immovable", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK_PREDICATE_TYPE, "relocation_not_supported", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK_PREDICATE_TYPE, "immovable", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + + createMapEntry(Registries.ENTITY_TYPE, "bosses", Tags.EntityTypes.BOSSES), + + createMapEntry(Registries.ITEM, "barrels", Tags.Items.BARRELS), + createMapEntry(Registries.ITEM, "barrels/wooden", Tags.Items.BARRELS_WOODEN), + createMapEntry(Registries.ITEM, "bones", Tags.Items.BONES), + createMapEntry(Registries.ITEM, "bookshelves", Tags.Items.BOOKSHELVES), + createMapEntry(Registries.ITEM, "chests", Tags.Items.CHESTS), + createMapEntry(Registries.ITEM, "chests/ender", Tags.Items.CHESTS_ENDER), + createMapEntry(Registries.ITEM, "chests/trapped", Tags.Items.CHESTS_TRAPPED), + createMapEntry(Registries.ITEM, "chests/wooden", Tags.Items.CHESTS_WOODEN), + createMapEntry(Registries.ITEM, "cobblestone", Tags.Items.COBBLESTONES), + createMapEntry(Registries.ITEM, "cobblestone/normal", Tags.Items.COBBLESTONES_NORMAL), + createMapEntry(Registries.ITEM, "cobblestone/infested", Tags.Items.COBBLESTONES_INFESTED), + createMapEntry(Registries.ITEM, "cobblestone/mossy", Tags.Items.COBBLESTONES_MOSSY), + createMapEntry(Registries.ITEM, "cobblestone/deepslate", Tags.Items.COBBLESTONES_DEEPSLATE), + createMapEntry(Registries.ITEM, "crafting_table", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "crafting_tables", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "workbench", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "workbenches", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "crops", Tags.Items.CROPS), + createMapEntry(Registries.ITEM, "crops/beetroot", Tags.Items.CROPS_BEETROOT), + createMapEntry(Registries.ITEM, "crops/carrot", Tags.Items.CROPS_CARROT), + createMapEntry(Registries.ITEM, "crops/nether_wart", Tags.Items.CROPS_NETHER_WART), + createMapEntry(Registries.ITEM, "crops/potato", Tags.Items.CROPS_POTATO), + createMapEntry(Registries.ITEM, "crops/wheat", Tags.Items.CROPS_WHEAT), + createMapEntry(Registries.ITEM, "dusts", Tags.Items.DUSTS), + createMapEntry(Registries.ITEM, "dusts/redstone", Tags.Items.DUSTS_REDSTONE), + createMapEntry(Registries.ITEM, "dusts/glowstone", Tags.Items.DUSTS_GLOWSTONE), + createMapEntry(Registries.ITEM, "dyes", Tags.Items.DYES), + createMapEntry(Registries.ITEM, "dyes/black", Tags.Items.DYES_BLACK), + createMapEntry(Registries.ITEM, "dyes/red", Tags.Items.DYES_RED), + createMapEntry(Registries.ITEM, "dyes/green", Tags.Items.DYES_GREEN), + createMapEntry(Registries.ITEM, "dyes/brown", Tags.Items.DYES_BROWN), + createMapEntry(Registries.ITEM, "dyes/blue", Tags.Items.DYES_BLUE), + createMapEntry(Registries.ITEM, "dyes/purple", Tags.Items.DYES_PURPLE), + createMapEntry(Registries.ITEM, "dyes/cyan", Tags.Items.DYES_CYAN), + createMapEntry(Registries.ITEM, "dyes/light_gray", Tags.Items.DYES_LIGHT_GRAY), + createMapEntry(Registries.ITEM, "dyes/gray", Tags.Items.DYES_GRAY), + createMapEntry(Registries.ITEM, "dyes/pink", Tags.Items.DYES_PINK), + createMapEntry(Registries.ITEM, "dyes/lime", Tags.Items.DYES_LIME), + createMapEntry(Registries.ITEM, "dyes/yellow", Tags.Items.DYES_YELLOW), + createMapEntry(Registries.ITEM, "dyes/light_blue", Tags.Items.DYES_LIGHT_BLUE), + createMapEntry(Registries.ITEM, "dyes/magenta", Tags.Items.DYES_MAGENTA), + createMapEntry(Registries.ITEM, "dyes/orange", Tags.Items.DYES_ORANGE), + createMapEntry(Registries.ITEM, "dyes/white", Tags.Items.DYES_WHITE), + createMapEntry(Registries.ITEM, "eggs", Tags.Items.EGGS), + createMapEntry(Registries.ITEM, "enchanting_fuels", Tags.Items.ENCHANTING_FUELS), + createMapEntry(Registries.ITEM, "end_stones", Tags.Items.END_STONES), + createMapEntry(Registries.ITEM, "ender_pearls", Tags.Items.ENDER_PEARLS), + createMapEntry(Registries.ITEM, "feathers", Tags.Items.FEATHERS), + createMapEntry(Registries.ITEM, "fence_gates", Tags.Items.FENCE_GATES), + createMapEntry(Registries.ITEM, "fence_gates/wooden", Tags.Items.FENCE_GATES_WOODEN), + createMapEntry(Registries.ITEM, "fences", Tags.Items.FENCES), + createMapEntry(Registries.ITEM, "fences/nether_brick", Tags.Items.FENCES_NETHER_BRICK), + createMapEntry(Registries.ITEM, "fences/wooden", Tags.Items.FENCES_WOODEN), + createMapEntry(Registries.ITEM, "furnace", Tags.Items.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.ITEM, "furnaces", Tags.Items.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.ITEM, "gems", Tags.Items.GEMS), + createMapEntry(Registries.ITEM, "gems/diamond", Tags.Items.GEMS_DIAMOND), + createMapEntry(Registries.ITEM, "gems/emerald", Tags.Items.GEMS_EMERALD), + createMapEntry(Registries.ITEM, "gems/amethyst", Tags.Items.GEMS_AMETHYST), + createMapEntry(Registries.ITEM, "gems/lapis", Tags.Items.GEMS_LAPIS), + createMapEntry(Registries.ITEM, "gems/prismarine", Tags.Items.GEMS_PRISMARINE), + createMapEntry(Registries.ITEM, "gems/quartz", Tags.Items.GEMS_QUARTZ), + createMapEntry(Registries.ITEM, "glass", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/black", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/blue", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/brown", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/colorless", Tags.Items.GLASS_BLOCKS_COLORLESS), + createMapEntry(Registries.ITEM, "glass/cyan", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/gray", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/green", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/light_blue", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/light_gray", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/lime", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/magenta", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/orange", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/pink", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/purple", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/red", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/silica", Tags.Items.GLASS_BLOCKS_CHEAP), + createMapEntry(Registries.ITEM, "glass/tinted", Tags.Items.GLASS_BLOCKS_TINTED), + createMapEntry(Registries.ITEM, "glass/white", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/yellow", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass_panes", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/black", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/blue", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/brown", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/colorless", Tags.Items.GLASS_PANES_COLORLESS), + createMapEntry(Registries.ITEM, "glass_panes/cyan", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/gray", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/green", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/light_blue", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/light_gray", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/lime", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/magenta", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/orange", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/pink", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/purple", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/red", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/white", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/yellow", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "gravel", Tags.Items.GRAVELS), + createMapEntry(Registries.ITEM, "gunpowder", Tags.Items.GUNPOWDERS), + createMapEntry(Registries.ITEM, "ingots", Tags.Items.INGOTS), + createMapEntry(Registries.ITEM, "ingots/brick", Tags.Items.BRICKS_NORMAL), + createMapEntry(Registries.ITEM, "ingots/copper", Tags.Items.INGOTS_COPPER), + createMapEntry(Registries.ITEM, "ingots/gold", Tags.Items.INGOTS_GOLD), + createMapEntry(Registries.ITEM, "ingots/iron", Tags.Items.INGOTS_IRON), + createMapEntry(Registries.ITEM, "ingots/netherite", Tags.Items.INGOTS_NETHERITE), + createMapEntry(Registries.ITEM, "ingots/nether_brick", Tags.Items.BRICKS_NETHER), + createMapEntry(Registries.ITEM, "leather", Tags.Items.LEATHERS), + createMapEntry(Registries.ITEM, "mushrooms", Tags.Items.MUSHROOMS), + createMapEntry(Registries.ITEM, "nether_stars", Tags.Items.NETHER_STARS), + createMapEntry(Registries.ITEM, "netherrack", Tags.Items.NETHERRACKS), + createMapEntry(Registries.ITEM, "nuggets", Tags.Items.NUGGETS), + createMapEntry(Registries.ITEM, "nuggets/gold", Tags.Items.NUGGETS_GOLD), + createMapEntry(Registries.ITEM, "nuggets/iron", Tags.Items.NUGGETS_IRON), + createMapEntry(Registries.ITEM, "obsidian", Tags.Items.OBSIDIANS), + createMapEntry(Registries.ITEM, "ore_bearing_ground/deepslate", Tags.Items.ORE_BEARING_GROUND_DEEPSLATE), + createMapEntry(Registries.ITEM, "ore_bearing_ground/netherrack", Tags.Items.ORE_BEARING_GROUND_NETHERRACK), + createMapEntry(Registries.ITEM, "ore_bearing_ground/stone", Tags.Items.ORE_BEARING_GROUND_STONE), + createMapEntry(Registries.ITEM, "ore_rates/dense", Tags.Items.ORE_RATES_DENSE), + createMapEntry(Registries.ITEM, "ore_rates/singular", Tags.Items.ORE_RATES_SINGULAR), + createMapEntry(Registries.ITEM, "ore_rates/sparse", Tags.Items.ORE_RATES_SPARSE), + createMapEntry(Registries.ITEM, "ores", Tags.Items.ORES), + createMapEntry(Registries.ITEM, "ores/coal", Tags.Items.ORES_COAL), + createMapEntry(Registries.ITEM, "ores/copper", Tags.Items.ORES_COPPER), + createMapEntry(Registries.ITEM, "ores/diamond", Tags.Items.ORES_DIAMOND), + createMapEntry(Registries.ITEM, "ores/emerald", Tags.Items.ORES_EMERALD), + createMapEntry(Registries.ITEM, "ores/gold", Tags.Items.ORES_GOLD), + createMapEntry(Registries.ITEM, "ores/iron", Tags.Items.ORES_IRON), + createMapEntry(Registries.ITEM, "ores/lapis", Tags.Items.ORES_LAPIS), + createMapEntry(Registries.ITEM, "ores/netherite_scrap", Tags.Items.ORES_NETHERITE_SCRAP), + createMapEntry(Registries.ITEM, "ores/quartz", Tags.Items.ORES_QUARTZ), + createMapEntry(Registries.ITEM, "ores/redstone", Tags.Items.ORES_REDSTONE), + createMapEntry(Registries.ITEM, "ores_in_ground/deepslate", Tags.Items.ORES_IN_GROUND_DEEPSLATE), + createMapEntry(Registries.ITEM, "ores_in_ground/netherrack", Tags.Items.ORES_IN_GROUND_NETHERRACK), + createMapEntry(Registries.ITEM, "ores_in_ground/stone", Tags.Items.ORES_IN_GROUND_STONE), + createMapEntry(Registries.ITEM, "raw_materials", Tags.Items.RAW_MATERIALS), + createMapEntry(Registries.ITEM, "raw_materials/copper", Tags.Items.RAW_MATERIALS_COPPER), + createMapEntry(Registries.ITEM, "raw_materials/gold", Tags.Items.RAW_MATERIALS_GOLD), + createMapEntry(Registries.ITEM, "raw_materials/iron", Tags.Items.RAW_MATERIALS_IRON), + createMapEntry(Registries.ITEM, "rods", Tags.Items.RODS), + createMapEntry(Registries.ITEM, "rods/blaze", Tags.Items.RODS_BLAZE), + createMapEntry(Registries.ITEM, "rods/wooden", Tags.Items.RODS_WOODEN), + createMapEntry(Registries.ITEM, "rope", Tags.Items.ROPES), + createMapEntry(Registries.ITEM, "sand", Tags.Items.SANDS), + createMapEntry(Registries.ITEM, "sand/colorless", Tags.Items.SANDS_COLORLESS), + createMapEntry(Registries.ITEM, "sand/red", Tags.Items.SANDS_RED), + createMapEntry(Registries.ITEM, "sandstone", Tags.Items.SANDSTONE_BLOCKS), + createMapEntry(Registries.ITEM, "seeds", Tags.Items.SEEDS), + createMapEntry(Registries.ITEM, "seeds/beetroot", Tags.Items.SEEDS_BEETROOT), + createMapEntry(Registries.ITEM, "seeds/melon", Tags.Items.SEEDS_MELON), + createMapEntry(Registries.ITEM, "seeds/pumpkin", Tags.Items.SEEDS_PUMPKIN), + createMapEntry(Registries.ITEM, "seeds/wheat", Tags.Items.SEEDS_WHEAT), + createMapEntry(Registries.ITEM, "shears", Tags.Items.TOOLS_SHEARS), + createMapEntry(Registries.ITEM, "slimeballs", Tags.Items.SLIMEBALLS), + createMapEntry(Registries.ITEM, "stained_glass", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "stained_glass_panes", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "stone", Tags.Items.STONES), + createMapEntry(Registries.ITEM, "storage_blocks", Tags.Items.STORAGE_BLOCKS), + createMapEntry(Registries.ITEM, "storage_blocks/amethyst", "storage_blocks/amethyst"), + createMapEntry(Registries.ITEM, "storage_blocks/coal", Tags.Items.STORAGE_BLOCKS_COAL), + createMapEntry(Registries.ITEM, "storage_blocks/copper", Tags.Items.STORAGE_BLOCKS_COPPER), + createMapEntry(Registries.ITEM, "storage_blocks/diamond", Tags.Items.STORAGE_BLOCKS_DIAMOND), + createMapEntry(Registries.ITEM, "storage_blocks/emerald", Tags.Items.STORAGE_BLOCKS_EMERALD), + createMapEntry(Registries.ITEM, "storage_blocks/gold", Tags.Items.STORAGE_BLOCKS_GOLD), + createMapEntry(Registries.ITEM, "storage_blocks/iron", Tags.Items.STORAGE_BLOCKS_IRON), + createMapEntry(Registries.ITEM, "storage_blocks/lapis", Tags.Items.STORAGE_BLOCKS_LAPIS), + createMapEntry(Registries.ITEM, "storage_blocks/netherite", Tags.Items.STORAGE_BLOCKS_NETHERITE), + createMapEntry(Registries.ITEM, "storage_blocks/quartz", "storage_blocks/quartz"), + createMapEntry(Registries.ITEM, "storage_blocks/raw_copper", Tags.Items.STORAGE_BLOCKS_RAW_COPPER), + createMapEntry(Registries.ITEM, "storage_blocks/raw_gold", Tags.Items.STORAGE_BLOCKS_RAW_GOLD), + createMapEntry(Registries.ITEM, "storage_blocks/raw_iron", Tags.Items.STORAGE_BLOCKS_RAW_IRON), + createMapEntry(Registries.ITEM, "storage_blocks/redstone", Tags.Items.STORAGE_BLOCKS_REDSTONE), + createMapEntry(Registries.ITEM, "string", Tags.Items.STRINGS), + createMapEntry(Registries.ITEM, "tools", Tags.Items.TOOLS), + createMapEntry(Registries.ITEM, "tools/shields", Tags.Items.TOOLS_SHIELDS), + createMapEntry(Registries.ITEM, "tools/bows", Tags.Items.TOOLS_BOWS), + createMapEntry(Registries.ITEM, "tools/crossbows", Tags.Items.TOOLS_CROSSBOWS), + createMapEntry(Registries.ITEM, "tools/fishing_rods", Tags.Items.TOOLS_FISHING_RODS), + createMapEntry(Registries.ITEM, "tools/tridents", Tags.Items.TOOLS_SPEARS), + createMapEntry(Registries.ITEM, "tools/brushes", Tags.Items.TOOLS_BRUSHES), + createMapEntry(Registries.ITEM, "armors", Tags.Items.ARMORS), + createMapEntry(Registries.ITEM, "armors/helmets", ItemTags.HEAD_ARMOR), + createMapEntry(Registries.ITEM, "armors/chestplates", ItemTags.CHEST_ARMOR), + createMapEntry(Registries.ITEM, "armors/leggings", ItemTags.LEG_ARMOR), + createMapEntry(Registries.ITEM, "armors/boots", ItemTags.FOOT_ARMOR), + createMapEntry(Registries.ITEM, "wrench", "tools/wrenches"), + createMapEntry(Registries.ITEM, "wrenches", "tools/wrenches"), + createMapEntry(Registries.ITEM, "tools/wrench", "tools/wrenches"), + createMapEntry(Registries.ITEM, "tools/wrenches", "tools/wrenches"), + createMapEntry(Registries.ITEM, "food", Tags.Items.FOODS), + createMapEntry(Registries.ITEM, "foods", Tags.Items.FOODS), + createMapEntry(Registries.ITEM, "fruit", Tags.Items.FOODS_FRUITS), + createMapEntry(Registries.ITEM, "fruits", Tags.Items.FOODS_FRUITS), + createMapEntry(Registries.ITEM, "vegetable", Tags.Items.FOODS_VEGETABLES), + createMapEntry(Registries.ITEM, "vegetables", Tags.Items.FOODS_VEGETABLES), + createMapEntry(Registries.ITEM, "berry", Tags.Items.FOODS_BERRIES), + createMapEntry(Registries.ITEM, "berries", Tags.Items.FOODS_BERRIES), + createMapEntry(Registries.ITEM, "bread", Tags.Items.FOODS_BREADS), + createMapEntry(Registries.ITEM, "breads", Tags.Items.FOODS_BREADS), + createMapEntry(Registries.ITEM, "cookie", Tags.Items.FOODS_COOKIES), + createMapEntry(Registries.ITEM, "cookies", Tags.Items.FOODS_COOKIES), + createMapEntry(Registries.ITEM, "raw_meat", Tags.Items.FOODS_RAW_MEATS), + createMapEntry(Registries.ITEM, "raw_meats", Tags.Items.FOODS_RAW_MEATS), + createMapEntry(Registries.ITEM, "raw_fish", Tags.Items.FOODS_RAW_FISHES), + createMapEntry(Registries.ITEM, "raw_fishes", Tags.Items.FOODS_RAW_FISHES), + createMapEntry(Registries.ITEM, "cooked_meat", Tags.Items.FOODS_COOKED_MEATS), + createMapEntry(Registries.ITEM, "cooked_meats", Tags.Items.FOODS_COOKED_MEATS), + createMapEntry(Registries.ITEM, "cooked_fish", Tags.Items.FOODS_COOKED_FISHES), + createMapEntry(Registries.ITEM, "cooked_fishes", Tags.Items.FOODS_COOKED_FISHES), + createMapEntry(Registries.ITEM, "soup", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "soups", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "stew", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "stews", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "candy", Tags.Items.FOODS_CANDIES), + createMapEntry(Registries.ITEM, "candies", Tags.Items.FOODS_CANDIES), + + createMapEntry(Registries.FLUID, "water", Tags.Fluids.WATER), + createMapEntry(Registries.FLUID, "lava", Tags.Fluids.LAVA), + createMapEntry(Registries.FLUID, "milk", Tags.Fluids.MILK), + createMapEntry(Registries.FLUID, "gaseous", Tags.Fluids.GASEOUS), + createMapEntry(Registries.FLUID, "honey", Tags.Fluids.HONEY), + createMapEntry(Registries.FLUID, "potion", Tags.Fluids.POTION), + createMapEntry(Registries.FLUID, "plantoil", "plant_oil"), + + createMapEntry(Registries.BIOME, "is_hot", Tags.Biomes.IS_HOT), + createMapEntry(Registries.BIOME, "is_hot/overworld", Tags.Biomes.IS_HOT_OVERWORLD), + createMapEntry(Registries.BIOME, "is_hot/nether", Tags.Biomes.IS_HOT_NETHER), + createMapEntry(Registries.BIOME, "is_hot/end", Tags.Biomes.IS_HOT_END), + createMapEntry(Registries.BIOME, "is_cold", Tags.Biomes.IS_COLD), + createMapEntry(Registries.BIOME, "is_cold/overworld", Tags.Biomes.IS_COLD_OVERWORLD), + createMapEntry(Registries.BIOME, "is_cold/nether", Tags.Biomes.IS_COLD_NETHER), + createMapEntry(Registries.BIOME, "is_cold/end", Tags.Biomes.IS_COLD_END), + createMapEntry(Registries.BIOME, "is_sparse", Tags.Biomes.IS_SPARSE_VEGETATION), + createMapEntry(Registries.BIOME, "is_sparse/overworld", Tags.Biomes.IS_SPARSE_VEGETATION_OVERWORLD), + createMapEntry(Registries.BIOME, "is_sparse/nether", Tags.Biomes.IS_SPARSE_VEGETATION_NETHER), + createMapEntry(Registries.BIOME, "is_sparse/end", Tags.Biomes.IS_SPARSE_VEGETATION_END), + createMapEntry(Registries.BIOME, "is_dense", Tags.Biomes.IS_DENSE_VEGETATION), + createMapEntry(Registries.BIOME, "is_dense/overworld", Tags.Biomes.IS_DENSE_VEGETATION_OVERWORLD), + createMapEntry(Registries.BIOME, "is_dense/nether", Tags.Biomes.IS_DENSE_VEGETATION_NETHER), + createMapEntry(Registries.BIOME, "is_dense/end", Tags.Biomes.IS_DENSE_VEGETATION_END), + createMapEntry(Registries.BIOME, "is_wet", Tags.Biomes.IS_WET), + createMapEntry(Registries.BIOME, "is_wet/overworld", Tags.Biomes.IS_WET_OVERWORLD), + createMapEntry(Registries.BIOME, "is_wet/nether", Tags.Biomes.IS_WET_NETHER), + createMapEntry(Registries.BIOME, "is_wet/end", Tags.Biomes.IS_WET_END), + createMapEntry(Registries.BIOME, "is_dry", Tags.Biomes.IS_DRY), + createMapEntry(Registries.BIOME, "is_dry/overworld", Tags.Biomes.IS_DRY_OVERWORLD), + createMapEntry(Registries.BIOME, "is_dry/nether", Tags.Biomes.IS_DRY_NETHER), + createMapEntry(Registries.BIOME, "is_dry/end", Tags.Biomes.IS_DRY_END), + createMapEntry(Registries.BIOME, "is_coniferous", Tags.Biomes.IS_CONIFEROUS_TREE), + createMapEntry(Registries.BIOME, "is_savanna", Tags.Biomes.IS_SAVANNA_TREE), + createMapEntry(Registries.BIOME, "is_jungle", Tags.Biomes.IS_JUNGLE_TREE), + createMapEntry(Registries.BIOME, "is_deciduous", Tags.Biomes.IS_DECIDUOUS_TREE), + createMapEntry(Registries.BIOME, "is_spooky", Tags.Biomes.IS_SPOOKY), + createMapEntry(Registries.BIOME, "is_dead", Tags.Biomes.IS_DEAD), + createMapEntry(Registries.BIOME, "is_lush", Tags.Biomes.IS_LUSH), + createMapEntry(Registries.BIOME, "is_mushroom", Tags.Biomes.IS_MUSHROOM), + createMapEntry(Registries.BIOME, "is_magical", Tags.Biomes.IS_MAGICAL), + createMapEntry(Registries.BIOME, "is_rare", Tags.Biomes.IS_RARE), + createMapEntry(Registries.BIOME, "is_plateau", Tags.Biomes.IS_PLATEAU), + createMapEntry(Registries.BIOME, "is_modified", Tags.Biomes.IS_MODIFIED), + createMapEntry(Registries.BIOME, "is_water", Tags.Biomes.IS_AQUATIC), + createMapEntry(Registries.BIOME, "is_desert", Tags.Biomes.IS_DESERT), + createMapEntry(Registries.BIOME, "is_plains", Tags.Biomes.IS_PLAINS), + createMapEntry(Registries.BIOME, "is_swamp", Tags.Biomes.IS_SWAMP), + createMapEntry(Registries.BIOME, "is_sandy", Tags.Biomes.IS_SANDY), + createMapEntry(Registries.BIOME, "is_snowy", Tags.Biomes.IS_SNOWY), + createMapEntry(Registries.BIOME, "is_wasteland", Tags.Biomes.IS_WASTELAND), + createMapEntry(Registries.BIOME, "is_void", Tags.Biomes.IS_VOID), + createMapEntry(Registries.BIOME, "is_underground", Tags.Biomes.IS_UNDERGROUND), + createMapEntry(Registries.BIOME, "is_cave", Tags.Biomes.IS_CAVE), + createMapEntry(Registries.BIOME, "is_peak", Tags.Biomes.IS_MOUNTAIN_PEAK), + createMapEntry(Registries.BIOME, "is_slope", Tags.Biomes.IS_MOUNTAIN_SLOPE), + createMapEntry(Registries.BIOME, "is_mountain", Tags.Biomes.IS_MOUNTAIN), + createMapEntry(Registries.BIOME, "is_end", Tags.Biomes.IS_END), + createMapEntry(Registries.BIOME, "is_nether", Tags.Biomes.IS_NETHER), + createMapEntry(Registries.BIOME, "is_overworld", Tags.Biomes.IS_OVERWORLD), + createMapEntry(Registries.BIOME, "no_default_monsters", Tags.Biomes.NO_DEFAULT_MONSTERS)); + + /*package private*/ + static void init() { + IEventBus forgeBus = NeoForge.EVENT_BUS; + + setupLegacyTagWarning(forgeBus); + } + + // Remove in 1.22 + private static void setupLegacyTagWarning(IEventBus forgeBus) { + // Log tags that are still using legacy 'forge' namespace + forgeBus.addListener((ServerStartingEvent serverStartingEvent) -> { + // We have to wait for server start to read the server config. + LOG_WARNING_MODES legacyTagWarningMode = NeoForgeConfig.COMMON.logLegacyTagWarnings.get(); + if (legacyTagWarningMode != LOG_WARNING_MODES.SILENCED) { + boolean isConfigSetToDev = legacyTagWarningMode == LOG_WARNING_MODES.DEV_SHORT || + legacyTagWarningMode == LOG_WARNING_MODES.DEV_VERBOSE; + + if (!FMLLoader.isProduction() == isConfigSetToDev) { + List> legacyTags = new ObjectArrayList<>(); + RegistryAccess.Frozen registryAccess = serverStartingEvent.getServer().registryAccess(); + + // We only care about vanilla registries + registryAccess.registries().forEach(registryEntry -> { + if (registryEntry.key().location().getNamespace().equals("minecraft")) { + registryEntry.value().getTagNames().forEach(tagKey -> { + // Grab tags under 'forge' namespace + if (LEGACY_FORGE_TAGS.containsKey(tagKey) || tagKey.location().getNamespace().equals("forge")) { + legacyTags.add(tagKey); + } + }); + } + }); + + if (!legacyTags.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(""" + \n Dev warning - Legacy Tags detected. Please migrate your 'forge' namespace tags to 'c' namespace! See net.neoforged.neoforge.common.Tags.java for all tags. + NOTE: Many tags have been moved around or renamed. Some new ones were added so please review the new tags. + And make sure you follow tag conventions for new tags! The convention is `c` with nouns generally being plural and adjectives being singular. + You can disable this message in Neoforge's common config by setting logLegacyTagWarnings to "SILENCED" or see individual tags with "DEV_VERBOSE". + """); + + // Print out all legacy tags when desired. + boolean isConfigSetToVerbose = legacyTagWarningMode == LOG_WARNING_MODES.DEV_VERBOSE || + legacyTagWarningMode == LOG_WARNING_MODES.PROD_VERBOSE; + + if (isConfigSetToVerbose) { + stringBuilder.append("\nLegacy tags:"); + for (TagKey tagKey : legacyTags) { + if (LEGACY_FORGE_TAGS.containsKey(tagKey)) { + TagKey replacementTagkey = LEGACY_FORGE_TAGS.get(tagKey); + stringBuilder.append("\n ").append(tagKey).append(" -> ").append(replacementTagkey); + } else { + stringBuilder.append("\n ").append(tagKey).append(" -> ").append("See similar `c` tags in Neoforge's Tags class"); + } + } + } + + LOGGER.warn(stringBuilder); + } + } + } + }); + } + + private static AbstractMap.SimpleEntry, TagKey> createMapEntry(ResourceKey> registryKey, String tagId1, String tagId2) { + return new AbstractMap.SimpleEntry<>(createTagKey(registryKey, "forge", tagId1), createTagKey(registryKey, "c", tagId2)); + } + + private static AbstractMap.SimpleEntry, TagKey> createMapEntry(ResourceKey> registryKey, String tagId1, TagKey tag2) { + return new AbstractMap.SimpleEntry<>(createTagKey(registryKey, "forge", tagId1), tag2); + } + + private static TagKey createTagKey(ResourceKey> registryKey, String namespace, String tagId) { + return TagKey.create(registryKey, new ResourceLocation(namespace, tagId)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java new file mode 100644 index 0000000000..b11e58eaf4 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.List; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public final class TagConventionLogWarningClient { + private TagConventionLogWarningClient() {} + + private static final Logger LOGGER = LogManager.getLogger(); + + /*package private*/ + static void init() { + IEventBus forgeBus = NeoForge.EVENT_BUS; + + TagConventionLogWarningClient.setupUntranslatedItemTagWarning(forgeBus); + } + + /*package private*/ + static void setupUntranslatedItemTagWarning(IEventBus forgeBus) { + // Log missing item tag translations only in integrated server so we can safely get translations. + forgeBus.addListener((ServerStartingEvent serverStartingEvent) -> { + // We have to wait for server start to read the server config. + TagConventionLogWarning.LOG_WARNING_MODES untranslatedTagWarningMode = NeoForgeConfig.COMMON.logUntranslatedItemTagWarnings.get(); + if (FMLEnvironment.dist == Dist.CLIENT && untranslatedTagWarningMode != TagConventionLogWarning.LOG_WARNING_MODES.SILENCED) { + boolean isConfigSetToDev = untranslatedTagWarningMode == TagConventionLogWarning.LOG_WARNING_MODES.DEV_SHORT || + untranslatedTagWarningMode == TagConventionLogWarning.LOG_WARNING_MODES.DEV_VERBOSE; + + if (!FMLLoader.isProduction() == isConfigSetToDev) { + Registry itemRegistry = serverStartingEvent.getServer().registryAccess().registryOrThrow(Registries.ITEM); + List> untranslatedItemTags = new ObjectArrayList<>(); + itemRegistry.getTagNames().forEach(itemTagKey -> { + // We do not translate vanilla's tags at this moment. + if (itemTagKey.location().getNamespace().equals("minecraft")) { + return; + } + + String translationKey = Tags.getTagTranslationKey(itemTagKey); + if (!I18n.exists(translationKey)) { + untranslatedItemTags.add(itemTagKey); + } + }); + + if (!untranslatedItemTags.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(""" + \n Dev warning - Untranslated Item Tags detected. Please translate your item tags so other mods such as recipe viewers can properly display your tag's name. + The format desired is tag.item.. for the translation key with slashes in path turned into periods. + You can disable this message in Neoforge's common config by setting logUntranslatedItemTagWarnings to "SILENCED" or see individual tags with "DEV_VERBOSE". + """); + + // Print out all untranslated tags when desired. + boolean isConfigSetToVerbose = untranslatedTagWarningMode == TagConventionLogWarning.LOG_WARNING_MODES.DEV_VERBOSE || + untranslatedTagWarningMode == TagConventionLogWarning.LOG_WARNING_MODES.PROD_VERBOSE; + + if (isConfigSetToVerbose) { + stringBuilder.append("\nUntranslated item tags:"); + for (TagKey tagKey : untranslatedItemTags) { + stringBuilder.append("\n ").append(tagKey.location()); + } + } + + LOGGER.warn(stringBuilder); + } + } + } + }); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/Tags.java b/src/main/java/net/neoforged/neoforge/common/Tags.java index 07b6e3464e..f6a98aa962 100644 --- a/src/main/java/net/neoforged/neoforge/common/Tags.java +++ b/src/main/java/net/neoforged/neoforge/common/Tags.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; @@ -16,78 +17,102 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.material.Fluid; public class Tags { public static class Blocks { + // `neoforge` tags for functional behavior provided by Neoforge + /** + * Controls what blocks Endermen cannot place blocks onto. + *

+ * This is patched into the following method: {@link net.minecraft.world.entity.monster.EnderMan.EndermanLeaveBlockGoal#canPlaceBlock(Level, BlockPos, BlockState, BlockState, BlockState, BlockPos)} + */ + public static final TagKey ENDERMAN_PLACE_ON_BLACKLIST = neoforgeTag("enderman_place_on_blacklist"); + public static final TagKey NEEDS_WOOD_TOOL = neoforgeTag("needs_wood_tool"); + public static final TagKey NEEDS_GOLD_TOOL = neoforgeTag("needs_gold_tool"); + public static final TagKey NEEDS_NETHERITE_TOOL = neoforgeTag("needs_netherite_tool"); + + // `c` tags for common conventions public static final TagKey BARRELS = tag("barrels"); public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); public static final TagKey BOOKSHELVES = tag("bookshelves"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final TagKey BUDDING_BLOCKS = tag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final TagKey BUDS = tag("buds"); + public static final TagKey CHAINS = tag("chains"); public static final TagKey CHESTS = tag("chests"); public static final TagKey CHESTS_ENDER = tag("chests/ender"); public static final TagKey CHESTS_TRAPPED = tag("chests/trapped"); public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); - public static final TagKey COBBLESTONE = tag("cobblestone"); - public static final TagKey COBBLESTONE_NORMAL = tag("cobblestone/normal"); - public static final TagKey COBBLESTONE_INFESTED = tag("cobblestone/infested"); - public static final TagKey COBBLESTONE_MOSSY = tag("cobblestone/mossy"); - public static final TagKey COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final TagKey CLUSTERS = tag("clusters"); + public static final TagKey COBBLESTONES = tag("cobblestones"); + public static final TagKey COBBLESTONES_NORMAL = tag("cobblestones/normal"); + public static final TagKey COBBLESTONES_INFESTED = tag("cobblestones/infested"); + public static final TagKey COBBLESTONES_MOSSY = tag("cobblestones/mossy"); + public static final TagKey COBBLESTONES_DEEPSLATE = tag("cobblestones/deepslate"); + + /** + * Tag that holds all blocks that can be dyed a specific color. + * (Does not include color blending blocks that would behave similar to leather armor item) + */ + public static final TagKey DYED = tag("dyed"); + public static final TagKey DYED_BLACK = tag("dyed/black"); + public static final TagKey DYED_BLUE = tag("dyed/blue"); + public static final TagKey DYED_BROWN = tag("dyed/brown"); + public static final TagKey DYED_CYAN = tag("dyed/cyan"); + public static final TagKey DYED_GRAY = tag("dyed/gray"); + public static final TagKey DYED_GREEN = tag("dyed/green"); + public static final TagKey DYED_LIGHT_BLUE = tag("dyed/light_blue"); + public static final TagKey DYED_LIGHT_GRAY = tag("dyed/light_gray"); + public static final TagKey DYED_LIME = tag("dyed/lime"); + public static final TagKey DYED_MAGENTA = tag("dyed/magenta"); + public static final TagKey DYED_ORANGE = tag("dyed/orange"); + public static final TagKey DYED_PINK = tag("dyed/pink"); + public static final TagKey DYED_PURPLE = tag("dyed/purple"); + public static final TagKey DYED_RED = tag("dyed/red"); + public static final TagKey DYED_WHITE = tag("dyed/white"); + public static final TagKey DYED_YELLOW = tag("dyed/yellow"); public static final TagKey END_STONES = tag("end_stones"); - public static final TagKey ENDERMAN_PLACE_ON_BLACKLIST = tag("enderman_place_on_blacklist"); public static final TagKey FENCE_GATES = tag("fence_gates"); public static final TagKey FENCE_GATES_WOODEN = tag("fence_gates/wooden"); public static final TagKey FENCES = tag("fences"); public static final TagKey FENCES_NETHER_BRICK = tag("fences/nether_brick"); public static final TagKey FENCES_WOODEN = tag("fences/wooden"); - public static final TagKey GLASS = tag("glass"); - public static final TagKey GLASS_BLACK = tag("glass/black"); - public static final TagKey GLASS_BLUE = tag("glass/blue"); - public static final TagKey GLASS_BROWN = tag("glass/brown"); - public static final TagKey GLASS_COLORLESS = tag("glass/colorless"); - public static final TagKey GLASS_CYAN = tag("glass/cyan"); - public static final TagKey GLASS_GRAY = tag("glass/gray"); - public static final TagKey GLASS_GREEN = tag("glass/green"); - public static final TagKey GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final TagKey GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final TagKey GLASS_LIME = tag("glass/lime"); - public static final TagKey GLASS_MAGENTA = tag("glass/magenta"); - public static final TagKey GLASS_ORANGE = tag("glass/orange"); - public static final TagKey GLASS_PINK = tag("glass/pink"); - public static final TagKey GLASS_PURPLE = tag("glass/purple"); - public static final TagKey GLASS_RED = tag("glass/red"); - /** - * Glass which is made from sand and only minor additional ingredients like dyes - */ - public static final TagKey GLASS_SILICA = tag("glass/silica"); - public static final TagKey GLASS_TINTED = tag("glass/tinted"); - public static final TagKey GLASS_WHITE = tag("glass/white"); - public static final TagKey GLASS_YELLOW = tag("glass/yellow"); + public static final TagKey GLASS_BLOCKS = tag("glass_blocks"); + public static final TagKey GLASS_BLOCKS_COLORLESS = tag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final TagKey GLASS_BLOCKS_CHEAP = tag("glass_blocks/cheap"); + public static final TagKey GLASS_BLOCKS_TINTED = tag("glass_blocks/tinted"); public static final TagKey GLASS_PANES = tag("glass_panes"); - public static final TagKey GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final TagKey GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final TagKey GLASS_PANES_BROWN = tag("glass_panes/brown"); public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final TagKey GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final TagKey GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final TagKey GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final TagKey GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final TagKey GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final TagKey GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final TagKey GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final TagKey GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final TagKey GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final TagKey GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final TagKey GLASS_PANES_RED = tag("glass_panes/red"); - public static final TagKey GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final TagKey GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - - public static final TagKey GRAVEL = tag("gravel"); - public static final TagKey NETHERRACK = tag("netherrack"); - public static final TagKey OBSIDIAN = tag("obsidian"); + + public static final TagKey GRAVELS = tag("gravel"); + /** + * Tag that holds all blocks that recipe viewers should not show to users. + * Recipe viewers may use this to automatically find the corresponding BlockItem to hide. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); + public static final TagKey NETHERRACKS = tag("netherrack"); + public static final TagKey OBSIDIANS = tag("obsidians"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ @@ -135,62 +160,135 @@ public static class Blocks { * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ public static final TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = tag("player_workstations/crafting_tables"); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = tag("player_workstations/furnaces"); + /** + * Blocks should be included in this tag if their movement/relocation can cause serious issues such + * as world corruption upon being moved or for balance reason where the block should not be able to be relocated. + * Example: Chunk loaders or pipes where other mods that move blocks do not respect + * {@link BlockBehaviour.BlockStateBase#getPistonPushReaction}. + */ + public static final TagKey RELOCATION_NOT_SUPPORTED = tag("relocation_not_supported"); + public static final TagKey ROPES = tag("ropes"); - public static final TagKey SAND = tag("sand"); - public static final TagKey SAND_COLORLESS = tag("sand/colorless"); - public static final TagKey SAND_RED = tag("sand/red"); + public static final TagKey SANDS = tag("sands"); + public static final TagKey SANDS_COLORLESS = tag("sands/colorless"); + public static final TagKey SANDS_RED = tag("sands/red"); - public static final TagKey SANDSTONE = tag("sandstone"); - public static final TagKey STAINED_GLASS = tag("stained_glass"); - public static final TagKey STAINED_GLASS_PANES = tag("stained_glass_panes"); - public static final TagKey STONE = tag("stone"); + public static final TagKey SANDSTONE_BLOCKS = tag("sandstone/blocks"); + public static final TagKey SANDSTONE_SLABS = tag("sandstone/slabs"); + public static final TagKey SANDSTONE_STAIRS = tag("sandstone/stairs"); + public static final TagKey SANDSTONE_RED_BLOCKS = tag("sandstone/red_blocks"); + public static final TagKey SANDSTONE_RED_SLABS = tag("sandstone/red_slabs"); + public static final TagKey SANDSTONE_RED_STAIRS = tag("sandstone/red_stairs"); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = tag("sandstone/uncolored_blocks"); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = tag("sandstone/uncolored_slabs"); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = tag("sandstone/uncolored_stairs"); + /** + * Tag that holds all head based blocks such as Skeleton Skull or Player Head. (Named skulls to match minecraft:skulls item tag) + */ + public static final TagKey SKULLS = tag("skulls"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final TagKey STONES = tag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = tag("storage_blocks/bone_meal"); public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = tag("storage_blocks/dried_kelp"); public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - - public static final TagKey NEEDS_WOOD_TOOL = tag("needs_wood_tool"); - public static final TagKey NEEDS_GOLD_TOOL = tag("needs_gold_tool"); - public static final TagKey NEEDS_NETHERITE_TOOL = tag("needs_netherite_tool"); + public static final TagKey STORAGE_BLOCKS_SLIME = tag("storage_blocks/slime"); + public static final TagKey STORAGE_BLOCKS_WHEAT = tag("storage_blocks/wheat"); + public static final TagKey VILLAGER_JOB_SITES = tag("villager_job_sites"); private static TagKey tag(String name) { - return BlockTags.create(new ResourceLocation("forge", name)); + return BlockTags.create(new ResourceLocation("c", name)); + } + + private static TagKey neoforgeTag(String name) { + return BlockTags.create(new ResourceLocation("neoforge", name)); } } public static class EntityTypes { public static final TagKey> BOSSES = tag("bosses"); + public static final TagKey> MINECARTS = tag("minecarts"); + public static final TagKey> BOATS = tag("boats"); + + /** + * Entities should be included in this tag if they are not allowed to be picked up by items or grabbed in a way + * that a player can easily move the entity to anywhere they want. Ideal for special entities that should not + * be able to be put into a mob jar for example. + */ + public static final TagKey> CAPTURING_NOT_SUPPORTED = tag("capturing_not_supported"); + + /** + * Entities should be included in this tag if they are not allowed to be teleported in any way. + * This is more for mods that allow teleporting entities within the same dimension. Any mod that is + * teleporting entities to new dimensions should be checking canChangeDimensions method on the entity itself. + */ + public static final TagKey> TELEPORTING_NOT_SUPPORTED = tag("teleporting_not_supported"); private static TagKey> tag(String name) { - return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("forge", name)); + return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("c", name)); } } public static class Items { + // `neoforge` tags for functional behavior provided by Neoforge + /** + * Controls what items can be consumed for enchanting such as Enchanting Tables. + * This tag defaults to {@link net.minecraft.world.item.Items#LAPIS_LAZULI} when not present in any datapacks, including forge client on vanilla server + */ + public static final TagKey ENCHANTING_FUELS = neoforgeTag("enchanting_fuels"); + + // `c` tags for common conventions public static final TagKey BARRELS = tag("barrels"); public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); public static final TagKey BONES = tag("bones"); public static final TagKey BOOKSHELVES = tag("bookshelves"); + public static final TagKey BRICKS = tag("bricks"); + public static final TagKey BRICKS_NORMAL = tag("bricks/normal"); + public static final TagKey BRICKS_NETHER = tag("bricks/nether"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final TagKey BUDDING_BLOCKS = tag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final TagKey BUDS = tag("buds"); + public static final TagKey CHAINS = tag("chains"); public static final TagKey CHESTS = tag("chests"); public static final TagKey CHESTS_ENDER = tag("chests/ender"); public static final TagKey CHESTS_TRAPPED = tag("chests/trapped"); public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); - public static final TagKey COBBLESTONE = tag("cobblestone"); - public static final TagKey COBBLESTONE_NORMAL = tag("cobblestone/normal"); - public static final TagKey COBBLESTONE_INFESTED = tag("cobblestone/infested"); - public static final TagKey COBBLESTONE_MOSSY = tag("cobblestone/mossy"); - public static final TagKey COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); + public static final TagKey COBBLESTONES = tag("cobblestones"); + public static final TagKey COBBLESTONES_NORMAL = tag("cobblestones/normal"); + public static final TagKey COBBLESTONES_INFESTED = tag("cobblestones/infested"); + public static final TagKey COBBLESTONES_MOSSY = tag("cobblestones/mossy"); + public static final TagKey COBBLESTONES_DEEPSLATE = tag("cobblestones/deepslate"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final TagKey CLUSTERS = tag("clusters"); public static final TagKey CROPS = tag("crops"); public static final TagKey CROPS_BEETROOT = tag("crops/beetroot"); public static final TagKey CROPS_CARROT = tag("crops/carrot"); @@ -198,10 +296,37 @@ public static class Items { public static final TagKey CROPS_POTATO = tag("crops/potato"); public static final TagKey CROPS_WHEAT = tag("crops/wheat"); public static final TagKey DUSTS = tag("dusts"); - public static final TagKey DUSTS_PRISMARINE = tag("dusts/prismarine"); public static final TagKey DUSTS_REDSTONE = tag("dusts/redstone"); public static final TagKey DUSTS_GLOWSTONE = tag("dusts/glowstone"); + /** + * Tag that holds all blocks and items that can be dyed a specific color. + * (Does not include color blending items like leather armor + * Use {@link net.minecraft.tags.ItemTags#DYEABLE} tag instead for color blending items) + *

+ * Note: Use custom ingredients in recipes to do tag intersections and/or tag exclusions + * to make more powerful recipes utilizing multiple tags such as dyed tags for an ingredient. + * See {@link net.neoforged.neoforge.common.crafting.DifferenceIngredient} and {@link net.neoforged.neoforge.common.crafting.CompoundIngredient} + * for various custom ingredients available that can also be used in data generation. + */ + public static final TagKey DYED = tag("dyed"); + public static final TagKey DYED_BLACK = tag("dyed/black"); + public static final TagKey DYED_BLUE = tag("dyed/blue"); + public static final TagKey DYED_BROWN = tag("dyed/brown"); + public static final TagKey DYED_CYAN = tag("dyed/cyan"); + public static final TagKey DYED_GRAY = tag("dyed/gray"); + public static final TagKey DYED_GREEN = tag("dyed/green"); + public static final TagKey DYED_LIGHT_BLUE = tag("dyed/light_blue"); + public static final TagKey DYED_LIGHT_GRAY = tag("dyed/light_gray"); + public static final TagKey DYED_LIME = tag("dyed/lime"); + public static final TagKey DYED_MAGENTA = tag("dyed/magenta"); + public static final TagKey DYED_ORANGE = tag("dyed/orange"); + public static final TagKey DYED_PINK = tag("dyed/pink"); + public static final TagKey DYED_PURPLE = tag("dyed/purple"); + public static final TagKey DYED_RED = tag("dyed/red"); + public static final TagKey DYED_WHITE = tag("dyed/white"); + public static final TagKey DYED_YELLOW = tag("dyed/yellow"); + public static final TagKey DYES = tag("dyes"); public static final TagKey DYES_BLACK = DyeColor.BLACK.getTag(); public static final TagKey DYES_RED = DyeColor.RED.getTag(); @@ -221,11 +346,6 @@ public static class Items { public static final TagKey DYES_WHITE = DyeColor.WHITE.getTag(); public static final TagKey EGGS = tag("eggs"); - /** - * @deprecated Avoid using this tag, especially on the client side, as optional tags, for now, do not exist after the registry rework. - */ - @Deprecated - public static final TagKey ENCHANTING_FUELS = tag("enchanting_fuels"); public static final TagKey END_STONES = tag("end_stones"); public static final TagKey ENDER_PEARLS = tag("ender_pearls"); public static final TagKey FEATHERS = tag("feathers"); @@ -234,6 +354,44 @@ public static class Items { public static final TagKey FENCES = tag("fences"); public static final TagKey FENCES_NETHER_BRICK = tag("fences/nether_brick"); public static final TagKey FENCES_WOODEN = tag("fences/wooden"); + public static final TagKey FOODS = tag("foods"); + /** + * Apples and other foods that are considered fruits in the culinary field belong in this tag. + * Cherries would go here as they are considered a "stone fruit" within culinary fields. + */ + public static final TagKey FOODS_FRUITS = tag("foods/fruits"); + /** + * Tomatoes and other foods that are considered vegetables in the culinary field belong in this tag. + */ + public static final TagKey FOODS_VEGETABLES = tag("foods/vegetables"); + /** + * Strawberries, raspberries, and other berry foods belong in this tag. + * Cherries would NOT go here as they are considered a "stone fruit" within culinary fields. + */ + public static final TagKey FOODS_BERRIES = tag("foods/berries"); + public static final TagKey FOODS_BREADS = tag("foods/breads"); + public static final TagKey FOODS_COOKIES = tag("foods/cookies"); + public static final TagKey FOODS_RAW_MEATS = tag("foods/raw_meats"); + public static final TagKey FOODS_COOKED_MEATS = tag("foods/cooked_meats"); + public static final TagKey FOODS_RAW_FISHES = tag("foods/raw_fishes"); + public static final TagKey FOODS_COOKED_FISHES = tag("foods/cooked_fishes"); + /** + * Soups, stews, and other liquid food in bowls belongs in this tag. + */ + public static final TagKey FOODS_SOUPS = tag("foods/soups"); + /** + * Sweets and candies like lollipops or chocolate belong in this tag. + */ + public static final TagKey FOODS_CANDIES = tag("foods/candies"); + /** + * Foods like cake that can be eaten when placed in the world belong in this tag. + */ + public static final TagKey FOODS_EDIBLE_WHEN_PLACED = tag("foods/edible_when_placed"); + /** + * For foods that inflict food poisoning-like effects. + * Examples are Rotten Flesh's Hunger or Pufferfish's Nausea, or Poisonous Potato's Poison. + */ + public static final TagKey FOODS_FOOD_POISONING = tag("foods/food_poisoning"); public static final TagKey GEMS = tag("gems"); public static final TagKey GEMS_DIAMOND = tag("gems/diamond"); public static final TagKey GEMS_EMERALD = tag("gems/emerald"); @@ -242,67 +400,36 @@ public static class Items { public static final TagKey GEMS_PRISMARINE = tag("gems/prismarine"); public static final TagKey GEMS_QUARTZ = tag("gems/quartz"); - public static final TagKey GLASS = tag("glass"); - public static final TagKey GLASS_BLACK = tag("glass/black"); - public static final TagKey GLASS_BLUE = tag("glass/blue"); - public static final TagKey GLASS_BROWN = tag("glass/brown"); - public static final TagKey GLASS_COLORLESS = tag("glass/colorless"); - public static final TagKey GLASS_CYAN = tag("glass/cyan"); - public static final TagKey GLASS_GRAY = tag("glass/gray"); - public static final TagKey GLASS_GREEN = tag("glass/green"); - public static final TagKey GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final TagKey GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final TagKey GLASS_LIME = tag("glass/lime"); - public static final TagKey GLASS_MAGENTA = tag("glass/magenta"); - public static final TagKey GLASS_ORANGE = tag("glass/orange"); - public static final TagKey GLASS_PINK = tag("glass/pink"); - public static final TagKey GLASS_PURPLE = tag("glass/purple"); - public static final TagKey GLASS_RED = tag("glass/red"); - /** - * Glass which is made from sand and only minor additional ingredients like dyes - */ - public static final TagKey GLASS_SILICA = tag("glass/silica"); - public static final TagKey GLASS_TINTED = tag("glass/tinted"); - public static final TagKey GLASS_WHITE = tag("glass/white"); - public static final TagKey GLASS_YELLOW = tag("glass/yellow"); + public static final TagKey GLASS_BLOCKS = tag("glass_blocks"); + public static final TagKey GLASS_BLOCKS_COLORLESS = tag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final TagKey GLASS_BLOCKS_CHEAP = tag("glass_blocks/cheap"); + public static final TagKey GLASS_BLOCKS_TINTED = tag("glass_blocks/tinted"); public static final TagKey GLASS_PANES = tag("glass_panes"); - public static final TagKey GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final TagKey GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final TagKey GLASS_PANES_BROWN = tag("glass_panes/brown"); public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final TagKey GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final TagKey GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final TagKey GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final TagKey GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final TagKey GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final TagKey GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final TagKey GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final TagKey GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final TagKey GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final TagKey GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final TagKey GLASS_PANES_RED = tag("glass_panes/red"); - public static final TagKey GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final TagKey GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - - public static final TagKey GRAVEL = tag("gravel"); - public static final TagKey GUNPOWDER = tag("gunpowder"); - public static final TagKey HEADS = tag("heads"); + + public static final TagKey GRAVELS = tag("gravel"); + public static final TagKey GUNPOWDERS = tag("gunpowder"); + /** + * Tag that holds all items that recipe viewers should not show to users. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); public static final TagKey INGOTS = tag("ingots"); - public static final TagKey INGOTS_BRICK = tag("ingots/brick"); public static final TagKey INGOTS_COPPER = tag("ingots/copper"); public static final TagKey INGOTS_GOLD = tag("ingots/gold"); public static final TagKey INGOTS_IRON = tag("ingots/iron"); public static final TagKey INGOTS_NETHERITE = tag("ingots/netherite"); - public static final TagKey INGOTS_NETHER_BRICK = tag("ingots/nether_brick"); - public static final TagKey LEATHER = tag("leather"); + public static final TagKey LEATHERS = tag("leather"); public static final TagKey MUSHROOMS = tag("mushrooms"); public static final TagKey NETHER_STARS = tag("nether_stars"); - public static final TagKey NETHERRACK = tag("netherrack"); + public static final TagKey NETHERRACKS = tag("netherrack"); public static final TagKey NUGGETS = tag("nuggets"); public static final TagKey NUGGETS_GOLD = tag("nuggets/gold"); public static final TagKey NUGGETS_IRON = tag("nuggets/iron"); - public static final TagKey OBSIDIAN = tag("obsidian"); + public static final TagKey OBSIDIANS = tag("obsidians"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ @@ -350,126 +477,180 @@ public static class Items { * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ public static final TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = tag("player_workstations/crafting_tables"); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = tag("player_workstations/furnaces"); + public static final TagKey RAW_BLOCKS = tag("raw_blocks"); + public static final TagKey RAW_BLOCKS_COPPER = tag("raw_blocks/copper"); + public static final TagKey RAW_BLOCKS_GOLD = tag("raw_blocks/gold"); + public static final TagKey RAW_BLOCKS_IRON = tag("raw_blocks/iron"); public static final TagKey RAW_MATERIALS = tag("raw_materials"); public static final TagKey RAW_MATERIALS_COPPER = tag("raw_materials/copper"); public static final TagKey RAW_MATERIALS_GOLD = tag("raw_materials/gold"); public static final TagKey RAW_MATERIALS_IRON = tag("raw_materials/iron"); + /** + * For rod-like materials to be used in recipes. + */ public static final TagKey RODS = tag("rods"); public static final TagKey RODS_BLAZE = tag("rods/blaze"); + public static final TagKey RODS_BREEZE = tag("rods/breeze"); + /** + * For stick-like materials to be used in recipes. + * One example is a mod adds stick variants such as Spruce Sticks but would like stick recipes to be able to use it. + */ public static final TagKey RODS_WOODEN = tag("rods/wooden"); + public static final TagKey ROPES = tag("ropes"); - public static final TagKey SAND = tag("sand"); - public static final TagKey SAND_COLORLESS = tag("sand/colorless"); - public static final TagKey SAND_RED = tag("sand/red"); + public static final TagKey SANDS = tag("sands"); + public static final TagKey SANDS_COLORLESS = tag("sands/colorless"); + public static final TagKey SANDS_RED = tag("sands/red"); + + public static final TagKey SANDSTONE_BLOCKS = tag("sandstone/blocks"); + public static final TagKey SANDSTONE_SLABS = tag("sandstone/slabs"); + public static final TagKey SANDSTONE_STAIRS = tag("sandstone/stairs"); + public static final TagKey SANDSTONE_RED_BLOCKS = tag("sandstone/red_blocks"); + public static final TagKey SANDSTONE_RED_SLABS = tag("sandstone/red_slabs"); + public static final TagKey SANDSTONE_RED_STAIRS = tag("sandstone/red_stairs"); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = tag("sandstone/uncolored_blocks"); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = tag("sandstone/uncolored_slabs"); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = tag("sandstone/uncolored_stairs"); - public static final TagKey SANDSTONE = tag("sandstone"); public static final TagKey SEEDS = tag("seeds"); public static final TagKey SEEDS_BEETROOT = tag("seeds/beetroot"); public static final TagKey SEEDS_MELON = tag("seeds/melon"); public static final TagKey SEEDS_PUMPKIN = tag("seeds/pumpkin"); public static final TagKey SEEDS_WHEAT = tag("seeds/wheat"); - public static final TagKey SHEARS = tag("shears"); public static final TagKey SLIMEBALLS = tag("slimeballs"); - public static final TagKey STAINED_GLASS = tag("stained_glass"); - public static final TagKey STAINED_GLASS_PANES = tag("stained_glass_panes"); - public static final TagKey STONE = tag("stone"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final TagKey STONES = tag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); - public static final TagKey STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); + public static final TagKey STORAGE_BLOCKS_BONE_MEAL = tag("storage_blocks/bone_meal"); public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); + public static final TagKey STORAGE_BLOCKS_DRIED_KELP = tag("storage_blocks/dried_kelp"); public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final TagKey STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - public static final TagKey STRING = tag("string"); + public static final TagKey STORAGE_BLOCKS_SLIME = tag("storage_blocks/slime"); + public static final TagKey STORAGE_BLOCKS_WHEAT = tag("storage_blocks/wheat"); + public static final TagKey STRINGS = tag("strings"); + public static final TagKey VILLAGER_JOB_SITES = tag("villager_job_sites"); + + // Tools and Armors /** - * A tag containing all existing tools. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing tools. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS = tag("tools"); /** - * A tag containing all existing shields. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing shields. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS_SHIELDS = tag("tools/shields"); /** - * A tag containing all existing bows. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing bows. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS_BOWS = tag("tools/bows"); /** - * A tag containing all existing crossbows. + * A tag containing all existing crossbows. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. - * - * @see ToolAction - * @see ToolActions + * @see net.neoforged.neoforge.common.ToolAction + * @see net.neoforged.neoforge.common.ToolActions */ public static final TagKey TOOLS_CROSSBOWS = tag("tools/crossbows"); /** - * A tag containing all existing fishing rods. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing fishing rods. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * - * @see ToolAction - * @see ToolActions + * @see net.neoforged.neoforge.common.ToolAction + * @see net.neoforged.neoforge.common.ToolActions */ public static final TagKey TOOLS_FISHING_RODS = tag("tools/fishing_rods"); /** - * A tag containing all existing tridents. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing spears. Other tools such as throwing knives or boomerangs + * should not be put into this tag and should be put into their own tool tags. + * Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ - public static final TagKey TOOLS_TRIDENTS = tag("tools/tridents"); + public static final TagKey TOOLS_SPEARS = tag("tools/spears"); /** - * A tag containing all existing armors. - */ - public static final TagKey ARMORS = tag("armors"); - /** - * A tag containing all existing helmets. + * A tag containing all existing shears. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. + * + * @see ToolAction + * @see ToolActions */ - public static final TagKey ARMORS_HELMETS = tag("armors/helmets"); + public static final TagKey TOOLS_SHEARS = tag("tools/shears"); /** - * A tag containing all chestplates. + * A tag containing all existing brushes. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. + * + * @see ToolAction + * @see ToolActions */ - public static final TagKey ARMORS_CHESTPLATES = tag("armors/chestplates"); + public static final TagKey TOOLS_BRUSHES = tag("tools/brushes"); /** - * A tag containing all existing leggings. + * Collects the 4 vanilla armor tags into one parent collection for ease. */ - public static final TagKey ARMORS_LEGGINGS = tag("armors/leggings"); + public static final TagKey ARMORS = tag("armors"); /** - * A tag containing all existing boots. + * Collects the many enchantable tags into one parent collection for ease. */ - public static final TagKey ARMORS_BOOTS = tag("armors/boots"); + public static final TagKey ENCHANTABLES = tag("enchantables"); private static TagKey tag(String name) { - return ItemTags.create(new ResourceLocation("forge", name)); + return ItemTags.create(new ResourceLocation("c", name)); + } + + private static TagKey neoforgeTag(String name) { + return ItemTags.create(new ResourceLocation("neoforge", name)); } } + /** + * Note, fluid tags should not be plural to match the vanilla standard. + * This is the only tag category exempted from many-different-types plural rule. + */ public static class Fluids { + /** + * Holds all fluids related to water. + * This tag is done to help out multi-loader mods/datapacks where the vanilla water tag has attached behaviors outside Neo. + */ + public static final TagKey WATER = tag("water"); + /** + * Holds all fluids related to lava. + * This tag is done to help out multi-loader mods/datapacks where the vanilla lava tag has attached behaviors outside Neo. + */ + public static final TagKey LAVA = tag("lava"); /** * Holds all fluids related to milk. */ @@ -478,13 +659,98 @@ public static class Fluids { * Holds all fluids that are gaseous at room temperature. */ public static final TagKey GASEOUS = tag("gaseous"); + /** + * Holds all fluids related to honey.

+ * (Standard unit for honey bottle is 250mb per bottle) + */ + public static final TagKey HONEY = tag("honey"); + /** + * Holds all fluids related to potions. The effects of the potion fluid should be read from NBT. + * The effects and color of the potion fluid should be read from {@link net.minecraft.core.component.DataComponents#POTION_CONTENTS} + * component that people should be attaching to the fluidstack of this fluid.

+ * (Standard unit for potions is 250mb per bottle) + */ + public static final TagKey POTION = tag("potion"); + /** + * Holds all fluids related to Suspicious Stew. + * The effects of the suspicious stew fluid should be read from {@link net.minecraft.core.component.DataComponents#SUSPICIOUS_STEW_EFFECTS} + * component that people should be attaching to the fluidstack of this fluid.

+ * (Standard unit for suspicious stew is 250mb per bowl) + */ + public static final TagKey SUSPICIOUS_STEW = tag("suspicious_stew"); + /** + * Holds all fluids related to Mushroom Stew.

+ * (Standard unit for mushroom stew is 250mb per bowl) + */ + public static final TagKey MUSHROOM_STEW = tag("mushroom_stew"); + /** + * Holds all fluids related to Rabbit Stew.

+ * (Standard unit for rabbit stew is 250mb per bowl) + */ + public static final TagKey RABBIT_STEW = tag("rabbit_stew"); + /** + * Holds all fluids related to Beetroot Soup.

+ * (Standard unit for beetroot soup is 250mb per bowl) + */ + public static final TagKey BEETROOT_SOUP = tag("beetroot_soup"); + /** + * Tag that holds all fluids that recipe viewers should not show to users. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); private static TagKey tag(String name) { - return FluidTags.create(new ResourceLocation("forge", name)); + return FluidTags.create(new ResourceLocation("c", name)); + } + } + + public static class Enchantments { + /** + * A tag containing enchantments that increase the amount or + * quality of drops from blocks, such as {@link net.minecraft.world.item.enchantment.Enchantments#FORTUNE}. + */ + public static final TagKey INCREASE_BLOCK_DROPS = tag("increase_block_drops"); + /** + * A tag containing enchantments that increase the amount or + * quality of drops from entities, such as {@link net.minecraft.world.item.enchantment.Enchantments#LOOTING}. + */ + public static final TagKey INCREASE_ENTITY_DROPS = tag("increase_entity_drops"); + /** + * For enchantments that increase the damage dealt by an item. + */ + public static final TagKey WEAPON_DAMAGE_ENHANCEMENTS = tag("weapon_damage_enhancements"); + /** + * For enchantments that increase movement speed for entity wearing armor enchanted with it. + */ + public static final TagKey ENTITY_SPEED_ENHANCEMENTS = tag("entity_speed_enhancements"); + /** + * For enchantments that applies movement-based benefits unrelated to speed for the entity wearing armor enchanted with it. + * Example: Reducing falling speeds ({@link net.minecraft.world.item.enchantment.Enchantments#FEATHER_FALLING}) or allowing walking on water ({@link net.minecraft.world.item.enchantment.Enchantments#FROST_WALKER}) + */ + public static final TagKey ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS = tag("entity_auxiliary_movement_enhancements"); + /** + * For enchantments that decrease damage taken or otherwise benefit, in regard to damage, the entity wearing armor enchanted with it. + */ + public static final TagKey ENTITY_DEFENSE_ENHANCEMENTS = tag("entity_defense_enhancements"); + + private static TagKey tag(String name) { + return TagKey.create(Registries.ENCHANTMENT, new ResourceLocation("c", name)); } } public static class Biomes { + /** + * For biomes that should not spawn monsters over time the normal way. + * In other words, their Spawners and Spawn Cost entries have the monster category empty. + * Example: Mushroom Biomes not having Zombies, Creepers, Skeleton, nor any other normal monsters. + */ + public static final TagKey NO_DEFAULT_MONSTERS = tag("no_default_monsters"); + /** + * Biomes that should not be locatable/selectable by modded biome-locating items or abilities. + */ + public static final TagKey HIDDEN_FROM_LOCATOR_SELECTION = tag("hidden_from_locator_selection"); + + public static final TagKey IS_VOID = tag("is_void"); + public static final TagKey IS_HOT = tag("is_hot"); public static final TagKey IS_HOT_OVERWORLD = tag("is_hot/overworld"); public static final TagKey IS_HOT_NETHER = tag("is_hot/nether"); @@ -495,14 +761,14 @@ public static class Biomes { public static final TagKey IS_COLD_NETHER = tag("is_cold/nether"); public static final TagKey IS_COLD_END = tag("is_cold/end"); - public static final TagKey IS_SPARSE = tag("is_sparse"); - public static final TagKey IS_SPARSE_OVERWORLD = tag("is_sparse/overworld"); - public static final TagKey IS_SPARSE_NETHER = tag("is_sparse/nether"); - public static final TagKey IS_SPARSE_END = tag("is_sparse/end"); - public static final TagKey IS_DENSE = tag("is_dense"); - public static final TagKey IS_DENSE_OVERWORLD = tag("is_dense/overworld"); - public static final TagKey IS_DENSE_NETHER = tag("is_dense/nether"); - public static final TagKey IS_DENSE_END = tag("is_dense/end"); + public static final TagKey IS_SPARSE_VEGETATION = tag("is_sparse_vegetation"); + public static final TagKey IS_SPARSE_VEGETATION_OVERWORLD = tag("is_sparse_vegetation/overworld"); + public static final TagKey IS_SPARSE_VEGETATION_NETHER = tag("is_sparse_vegetation/nether"); + public static final TagKey IS_SPARSE_VEGETATION_END = tag("is_sparse_vegetation/end"); + public static final TagKey IS_DENSE_VEGETATION = tag("is_dense_vegetation"); + public static final TagKey IS_DENSE_VEGETATION_OVERWORLD = tag("is_dense_vegetation/overworld"); + public static final TagKey IS_DENSE_VEGETATION_NETHER = tag("is_dense_vegetation/nether"); + public static final TagKey IS_DENSE_VEGETATION_END = tag("is_dense_vegetation/end"); public static final TagKey IS_WET = tag("is_wet"); public static final TagKey IS_WET_OVERWORLD = tag("is_wet/overworld"); @@ -513,34 +779,197 @@ public static class Biomes { public static final TagKey IS_DRY_NETHER = tag("is_dry/nether"); public static final TagKey IS_DRY_END = tag("is_dry/end"); - public static final TagKey IS_CONIFEROUS = tag("is_coniferous"); + /** + * Biomes that spawn in the Overworld. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_OVERWORLD} + *

+ * NOTE: If you do not add to the vanilla Overworld tag, be sure to add to + * {@link net.minecraft.tags.BiomeTags#HAS_STRONGHOLD} so some Strongholds do not go missing.) + */ + public static final TagKey IS_OVERWORLD = tag("is_overworld"); - public static final TagKey IS_SPOOKY = tag("is_spooky"); - public static final TagKey IS_DEAD = tag("is_dead"); - public static final TagKey IS_LUSH = tag("is_lush"); + public static final TagKey IS_CONIFEROUS_TREE = tag("is_tree/coniferous"); + public static final TagKey IS_SAVANNA_TREE = tag("is_tree/savanna"); + public static final TagKey IS_JUNGLE_TREE = tag("is_tree/jungle"); + public static final TagKey IS_DECIDUOUS_TREE = tag("is_tree/deciduous"); + + /** + * Biomes that spawn as part of giant mountains. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_MOUNTAIN}) + */ + public static final TagKey IS_MOUNTAIN = tag("is_mountain"); + public static final TagKey IS_MOUNTAIN_PEAK = tag("is_mountain/peak"); + public static final TagKey IS_MOUNTAIN_SLOPE = tag("is_mountain/slope"); + + /** + * For temperate or warmer plains-like biomes. + * For snowy plains-like biomes, see {@link #IS_SNOWY_PLAINS}. + */ + public static final TagKey IS_PLAINS = tag("is_plains"); + /** + * For snowy plains-like biomes. + * For warmer plains-like biomes, see {@link #IS_PLAINS}. + */ + public static final TagKey IS_SNOWY_PLAINS = tag("is_snowy_plains"); + /** + * Biomes densely populated with deciduous trees. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_FOREST}) + */ + public static final TagKey IS_FOREST = tag("is_forest"); + public static final TagKey IS_BIRCH_FOREST = tag("is_birch_forest"); + public static final TagKey IS_FLOWER_FOREST = tag("is_flower_forest"); + /** + * Biomes that spawn as a taiga. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_TAIGA}) + */ + public static final TagKey IS_TAIGA = tag("is_taiga"); + public static final TagKey IS_OLD_GROWTH = tag("is_old_growth"); + /** + * Biomes that spawn as a hills biome. (Previously was called Extreme Hills biome in past) + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_HILL}) + */ + public static final TagKey IS_HILL = tag("is_hill"); + public static final TagKey IS_WINDSWEPT = tag("is_windswept"); + /** + * Biomes that spawn as a jungle. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_JUNGLE}) + */ + public static final TagKey IS_JUNGLE = tag("is_jungle"); + /** + * Biomes that spawn as a savanna. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_SAVANNA}) + */ + public static final TagKey IS_SAVANNA = tag("is_savanna"); + public static final TagKey IS_SWAMP = tag("is_swamp"); + public static final TagKey IS_DESERT = tag("is_desert"); + /** + * Biomes that spawn as a badlands. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_BADLANDS}) + */ + public static final TagKey IS_BADLANDS = tag("is_badlands"); + /** + * Biomes that are dedicated to spawning on the shoreline of a body of water. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_BEACH}) + */ + public static final TagKey IS_BEACH = tag("is_beach"); + public static final TagKey IS_STONY_SHORES = tag("is_stony_shores"); public static final TagKey IS_MUSHROOM = tag("is_mushroom"); + + /** + * Biomes that spawn as a river. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_RIVER}) + */ + public static final TagKey IS_RIVER = tag("is_river"); + /** + * Biomes that spawn as part of the world's oceans. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_OCEAN}) + */ + public static final TagKey IS_OCEAN = tag("is_ocean"); + /** + * Biomes that spawn as part of the world's oceans that have low depth. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_DEEP_OCEAN}) + */ + public static final TagKey IS_DEEP_OCEAN = tag("is_deep_ocean"); + public static final TagKey IS_SHALLOW_OCEAN = tag("is_shallow_ocean"); + + public static final TagKey IS_UNDERGROUND = tag("is_underground"); + public static final TagKey IS_CAVE = tag("is_cave"); + + public static final TagKey IS_LUSH = tag("is_lush"); public static final TagKey IS_MAGICAL = tag("is_magical"); public static final TagKey IS_RARE = tag("is_rare"); public static final TagKey IS_PLATEAU = tag("is_plateau"); public static final TagKey IS_MODIFIED = tag("is_modified"); - - public static final TagKey IS_WATER = tag("is_water"); - public static final TagKey IS_DESERT = tag("is_desert"); - public static final TagKey IS_PLAINS = tag("is_plains"); - public static final TagKey IS_SWAMP = tag("is_swamp"); + public static final TagKey IS_SPOOKY = tag("is_spooky"); + /** + * Biomes that lack any natural life or vegetation. + * (Example, land destroyed and sterilized by nuclear weapons) + */ + public static final TagKey IS_WASTELAND = tag("is_wasteland"); + /** + * Biomes whose flora primarily consists of dead or decaying vegetation. + */ + public static final TagKey IS_DEAD = tag("is_dead"); + /** + * Biomes with a large amount of flowers. + */ + public static final TagKey IS_FLORAL = tag("is_floral"); + /** + * Biomes that are able to spawn sand-based blocks on the surface. + */ public static final TagKey IS_SANDY = tag("is_sandy"); + /** + * For biomes that contains lots of naturally spawned snow. + * For biomes where lot of ice is present, see {@link #IS_ICY}. + * Biome with lots of both snow and ice may be in both tags. + */ public static final TagKey IS_SNOWY = tag("is_snowy"); - public static final TagKey IS_WASTELAND = tag("is_wasteland"); - public static final TagKey IS_VOID = tag("is_void"); - public static final TagKey IS_UNDERGROUND = tag("is_underground"); + /** + * For land biomes where ice naturally spawns. + * For biomes where snow alone spawns, see {@link #IS_SNOWY}. + */ + public static final TagKey IS_ICY = tag("is_icy"); + /** + * Biomes consisting primarily of water. + */ + public static final TagKey IS_AQUATIC = tag("is_aquatic"); + /** + * For water biomes where ice naturally spawns. + * For biomes where snow alone spawns, see {@link #IS_SNOWY}. + */ + public static final TagKey IS_AQUATIC_ICY = tag("is_aquatic_icy"); - public static final TagKey IS_CAVE = tag("is_cave"); - public static final TagKey IS_PEAK = tag("is_peak"); - public static final TagKey IS_SLOPE = tag("is_slope"); - public static final TagKey IS_MOUNTAIN = tag("is_mountain"); + /** + * Biomes that spawn in the Nether. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_NETHER}) + */ + public static final TagKey IS_NETHER = tag("is_nether"); + public static final TagKey IS_NETHER_FOREST = tag("is_nether_forest"); + + /** + * Biomes that spawn in the End. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_END}) + */ + public static final TagKey IS_END = tag("is_end"); + /** + * Biomes that spawn as part of the large islands outside the center island in The End dimension. + */ + public static final TagKey IS_OUTER_END_ISLAND = tag("is_outer_end_island"); private static TagKey tag(String name) { - return TagKey.create(Registries.BIOME, new ResourceLocation("forge", name)); + return TagKey.create(Registries.BIOME, new ResourceLocation("c", name)); + } + } + + public static class Structures { + /** + * Structures that should not show up on minimaps or world map views from mods/sites. + * No effect on vanilla map items. + */ + public static final TagKey HIDDEN_FROM_DISPLAYERS = tag("hidden_from_displayers"); + + /** + * Structures that should not be locatable/selectable by modded structure-locating items or abilities. + * No effect on vanilla map items. + */ + public static final TagKey HIDDEN_FROM_LOCATOR_SELECTION = tag("hidden_from_locator_selection"); + + private static TagKey tag(String name) { + return TagKey.create(Registries.STRUCTURE, new ResourceLocation("c", name)); } } @@ -548,46 +977,72 @@ public static class DamageTypes { /** * Damage types representing magic damage. */ - public static final TagKey IS_MAGIC = tag("is_magic"); + public static final TagKey IS_MAGIC = neoforgeTag("is_magic"); /** * Damage types representing poison damage. */ - public static final TagKey IS_POISON = tag("is_poison"); + public static final TagKey IS_POISON = neoforgeTag("is_poison"); /** * Damage types representing damage that can be attributed to withering or the wither. */ - public static final TagKey IS_WITHER = tag("is_wither"); + public static final TagKey IS_WITHER = neoforgeTag("is_wither"); /** * Damage types representing environmental damage, such as fire, lava, magma, cactus, lightning, etc. */ - public static final TagKey IS_ENVIRONMENT = tag("is_environment"); + public static final TagKey IS_ENVIRONMENT = neoforgeTag("is_environment"); /** * Damage types representing physical damage.
* These are types that do not fit other #is_x tags (except #is_fall) * and would meet the general definition of physical damage. */ - public static final TagKey IS_PHYSICAL = tag("is_physical"); + public static final TagKey IS_PHYSICAL = neoforgeTag("is_physical"); /** * Damage types representing damage from commands or other non-gameplay sources.
* Damage from these types should not be reduced, and bypasses invulnerability. */ - public static final TagKey IS_TECHNICAL = tag("is_technical"); + public static final TagKey IS_TECHNICAL = neoforgeTag("is_technical"); /** * Damage types that will not cause the red flashing effect.
* This tag is empty by default. - * + * * @see GameRenderer#bobHurt */ - public static final TagKey NO_FLINCH = tag("no_flinch"); + public static final TagKey NO_FLINCH = neoforgeTag("no_flinch"); - private static TagKey tag(String name) { - return TagKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("forge", name)); + private static TagKey neoforgeTag(String name) { + return TagKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("neoforge", name)); } } + + /** + * Use this to get a TagKey's translation key safely on any side. + * + * @return the translation key for a TagKey. + */ + public static String getTagTranslationKey(TagKey tagKey) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("tag."); + + ResourceLocation registryIdentifier = tagKey.registry().location(); + ResourceLocation tagIdentifier = tagKey.location(); + + if (registryIdentifier.getNamespace().equals("minecraft")) { + stringBuilder.append(registryIdentifier.getNamespace()) + .append("."); + } + + stringBuilder.append(registryIdentifier.getPath().replace("/", ".")) + .append(".") + .append(tagIdentifier.getNamespace()) + .append(".") + .append(tagIdentifier.getPath().replace("/", ".").replace(":", ".")); + + return stringBuilder.toString(); + } } diff --git a/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java b/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java deleted file mode 100644 index 2ce2fead5b..0000000000 --- a/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.graph.ElementOrder; -import com.google.common.graph.GraphBuilder; -import com.google.common.graph.MutableGraph; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import it.unimi.dsi.fastutil.booleans.BooleanConsumer; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.packs.resources.PreparableReloadListener; -import net.minecraft.server.packs.resources.Resource; -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.server.packs.resources.SimplePreparableReloadListener; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.TagKey; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Tier; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; -import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.fml.loading.toposort.TopologicalSort; -import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -import net.neoforged.neoforge.network.configuration.SyncTierSortingRegistry; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.neoforged.neoforge.network.payload.TierSortingRegistryPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistrySyncCompletePayload; -import net.neoforged.neoforge.server.ServerLifecycleHooks; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.Nullable; - -public class TierSortingRegistry { - private static final Logger LOGGER = LogManager.getLogger(); - private static final ResourceLocation ITEM_TIER_ORDERING_JSON = new ResourceLocation("neoforge", "item_tier_ordering.json"); - - /** - * Registers a tier into the tier sorting registry. - * - * @param tier The tier to register - * @param name The name to use internally for dependency resolution - * @param after List of tiers to place this tier after (the tiers in the list will be considered lesser tiers) - * @param before List of tiers to place this tier before (the tiers in the list will be considered better tiers) - */ - public static synchronized Tier registerTier(Tier tier, ResourceLocation name, List after, List before) { - if (tiers.containsKey(name)) - throw new IllegalStateException("Duplicate tier name " + name); - - processTier(tier, name, after, before); - - hasCustomTiers = true; - return tier; - } - - /** - * Returns the list of tiers in the order defined by the dependencies. - * This list will remain valid - * - * @return An unmodifiable list of tiers ordered lesser to greater - */ - public static List getSortedTiers() { - return sortedTiersUnmodifiable; - } - - /** - * Returns the tier associated with a name, if registered into the sorting system. - * - * @param name The name to look up - * @return The tier, or null if not registered - */ - @Nullable - public static Tier byName(ResourceLocation name) { - return tiers.get(name); - } - - /** - * Returns the name associated with a tier, if the tier is registered into the sorting system. - * - * @param tier The tier to look up - * @return The name for the tier, or null if not registered - */ - @Nullable - public static ResourceLocation getName(Tier tier) { - return tiers.inverse().get(tier); - } - - /** - * Queries if a tier should be evaluated using the sorting system, by calling isCorrectTierForDrops - * - * @param tier The tier to query - * @return True if isCorrectTierForDrops should be called for the tier - */ - public static boolean isTierSorted(Tier tier) { - return getName(tier) != null; - } - - /** - * Queries if a tier is high enough to be able to get drops for the given blockstate. - * - * @param tier The tier to look up - * @param state The state to test against - * @return True if the tier is good enough - */ - public static boolean isCorrectTierForDrops(Tier tier, BlockState state) { - if (!isTierSorted(tier)) - return isCorrectTierVanilla(tier, state); - - for (int x = sortedTiers.indexOf(tier) + 1; x < sortedTiers.size(); x++) { - TagKey tag = sortedTiers.get(x).getTag(); - if (tag != null && state.is(tag)) - return false; - } - return true; - } - - /** - * Helper to query all tiers that are lower than the given tier - * - * @param tier The tier - * @return All the lower tiers - */ - public static List getTiersLowerThan(Tier tier) { - if (!isTierSorted(tier)) return List.of(); - return sortedTiers.stream().takeWhile(t -> t != tier).toList(); - } - - // ===================== PRIVATE INTERNAL STUFFS BELOW THIS LINE ===================== - - /** - * Fallback for when a tier isn't in the registry, copy of the logic in {@link DiggerItem#isCorrectToolForDrops} - */ - private static boolean isCorrectTierVanilla(Tier tier, BlockState state) { - int i = tier.getLevel(); - if (i < 3 && state.is(BlockTags.NEEDS_DIAMOND_TOOL)) { - return false; - } else if (i < 2 && state.is(BlockTags.NEEDS_IRON_TOOL)) { - return false; - } else if (i < 1 && state.is(BlockTags.NEEDS_STONE_TOOL)) { - return false; - } - return true; - } - - private static void processTier(Tier tier, ResourceLocation name, List afters, List befores) { - tiers.put(name, tier); - for (Object after : afters) { - ResourceLocation other = getTierName(after); - edges.put(other, name); - } - for (Object before : befores) { - ResourceLocation other = getTierName(before); - edges.put(name, other); - } - } - - private static ResourceLocation getTierName(Object entry) { - if (entry instanceof String s) - return new ResourceLocation(s); - if (entry instanceof ResourceLocation rl) - return rl; - if (entry instanceof Tier t) - return Objects.requireNonNull(getName(t), "Can't have sorting dependencies for tiers not registered in the TierSortingRegistry"); - throw new IllegalStateException("Invalid object type passed into the tier dependencies " + entry.getClass()); - } - - private static boolean hasCustomTiers = false; - private static final BiMap tiers = HashBiMap.create(); - private static final Multimap edges = HashMultimap.create(); - private static final Multimap vanillaEdges = HashMultimap.create(); - - static { - var wood = new ResourceLocation("wood"); - var stone = new ResourceLocation("stone"); - var iron = new ResourceLocation("iron"); - var diamond = new ResourceLocation("diamond"); - var netherite = new ResourceLocation("netherite"); - var gold = new ResourceLocation("gold"); - processTier(Tiers.WOOD, wood, List.of(), List.of()); - processTier(Tiers.GOLD, gold, List.of(wood), List.of(stone)); - processTier(Tiers.STONE, stone, List.of(wood), List.of(iron)); - processTier(Tiers.IRON, iron, List.of(stone), List.of(diamond)); - processTier(Tiers.DIAMOND, diamond, List.of(iron), List.of(netherite)); - processTier(Tiers.NETHERITE, netherite, List.of(diamond), List.of()); - vanillaEdges.putAll(edges); - } - - private static final List sortedTiers = new ArrayList<>(); - private static final List sortedTiersUnmodifiable = Collections.unmodifiableList(sortedTiers); - - static boolean allowVanilla() { - return !hasCustomTiers; - } - - /*package private*/ static void init() { - if (FMLEnvironment.dist.isClient()) ClientEvents.init(); - } - - /*package private*/ static PreparableReloadListener getReloadListener() { - return new SimplePreparableReloadListener() { - final Gson gson = (new GsonBuilder()).create(); - - @Override - protected JsonObject prepare(ResourceManager resourceManager, ProfilerFiller p) { - Optional res = resourceManager.getResource(ITEM_TIER_ORDERING_JSON); - if (res.isEmpty()) - return new JsonObject(); - - try (Reader reader = res.get().openAsReader()) { - return gson.fromJson(reader, JsonObject.class); - } catch (IOException e) { - LOGGER.error("Could not read Tier sorting file " + ITEM_TIER_ORDERING_JSON, e); - return new JsonObject(); - } - } - - @Override - protected void apply(JsonObject data, ResourceManager resourceManager, ProfilerFiller p) { - try { - if (data.size() > 0) { - JsonArray order = GsonHelper.getAsJsonArray(data, "order"); - List customOrder = new ArrayList<>(); - for (JsonElement entry : order) { - ResourceLocation id = new ResourceLocation(entry.getAsString()); - Tier tier = byName(id); - if (tier == null) throw new IllegalStateException("Tier not found with name " + id); - customOrder.add(tier); - } - - List missingTiers = tiers.values().stream().filter(tier -> !customOrder.contains(tier)).toList(); - if (!missingTiers.isEmpty()) - throw new IllegalStateException("Tiers missing from the ordered list: " + missingTiers.stream().map(tier -> Objects.toString(TierSortingRegistry.getName(tier))).collect(Collectors.joining(", "))); - - setTierOrder(customOrder); - return; - } - } catch (Exception e) { - LOGGER.error("Error parsing Tier sorting file " + ITEM_TIER_ORDERING_JSON, e); - } - - recalculateItemTiers(); - } - }; - } - - @SuppressWarnings("UnstableApiUsage") - private static void recalculateItemTiers() { - final MutableGraph graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); - - for (Tier tier : tiers.values()) { - graph.addNode(tier); - } - edges.forEach((key, value) -> { - if (tiers.containsKey(key) && tiers.containsKey(value)) - graph.putEdge(tiers.get(key), tiers.get(value)); - }); - List tierList = TopologicalSort.topologicalSort(graph, null); - - setTierOrder(tierList); - } - - private static void setTierOrder(List tierList) { - runInServerThreadIfPossible(hasServer -> { - sortedTiers.clear(); - sortedTiers.addAll(tierList); - }); - } - - private static void runInServerThreadIfPossible(BooleanConsumer runnable) { - MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); - if (server != null) server.execute(() -> runnable.accept(true)); - else runnable.accept(false); - } - - public static void handleSync(TierSortingRegistryPayload payload, IPayloadContext context) { - setTierOrder(payload.tiers().stream().map(TierSortingRegistry::byName).toList()); - context.replyHandler().send(new TierSortingRegistrySyncCompletePayload()); - } - - public static void sync(ServerConfigurationPacketListener listener, Consumer sender) { - if (!listener.isConnected(TierSortingRegistryPayload.ID)) { - if (allowVanilla()) { - listener.finishCurrentTask(SyncTierSortingRegistry.TYPE); - } else { - listener.disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); - } - return; - } - sender.accept(new TierSortingRegistryPayload(TierSortingRegistry.getSortedTiers().stream().map(TierSortingRegistry::getName).toList())); - } - - private static class ClientEvents { - public static void init() { - NeoForge.EVENT_BUS.addListener(ClientEvents::clientLogInToServer); - } - - private static void clientLogInToServer(ClientPlayerNetworkEvent.LoggingIn event) { - if (!event.getConnection().isMemoryConnection()) - recalculateItemTiers(); - } - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java deleted file mode 100644 index d142561921..0000000000 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.advancements.critereon; - -import com.mojang.serialization.Codec; -import javax.annotation.Nullable; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; -import net.neoforged.neoforge.registries.NeoForgeRegistries; - -/** - * Interface that mods can use to define {@link EntityPredicate}s with custom matching logic. - */ -public interface ICustomEntityPredicate { - /** - * {@return the codec for this predicate} - *

- * The codec must be registered to {@link NeoForgeRegistries#ENTITY_PREDICATE_SERIALIZERS}. - */ - Codec codec(); - - /** - * Convert to a vanilla {@link EntityPredicate}. - */ - default EntityPredicate toVanilla() { - return new EntityPredicate(this); - } - - /** - * Evaluates this predicate on the given arguments. - * - * @param level Level the predicate is being tested in. - * @param position Position in the level the test is being run from. - * @param entity Entity to test. - * - * @return {@code true} if the input arguments matches the predicate, otherwise {@code false} - */ - boolean test(ServerLevel level, @Nullable Vec3 position, Entity entity); -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java deleted file mode 100644 index d66ced2813..0000000000 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.advancements.critereon; - -import com.mojang.serialization.Codec; -import java.util.function.Predicate; -import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.world.item.ItemStack; -import net.neoforged.neoforge.registries.NeoForgeRegistries; - -/** - * Interface that mods can use to define {@link ItemPredicate}s with custom matching logic. - */ -public interface ICustomItemPredicate extends Predicate { - /** - * {@return the codec for this predicate} - *

- * The codec must be registered to {@link NeoForgeRegistries#ITEM_PREDICATE_SERIALIZERS}. - */ - Codec codec(); - - /** - * Convert to a vanilla {@link ItemPredicate}. - */ - default ItemPredicate toVanilla() { - return new ItemPredicate(this); - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java index da0d6a9c17..82b7daa1dc 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java @@ -6,21 +6,18 @@ package net.neoforged.neoforge.common.advancements.critereon; import com.mojang.serialization.Codec; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.world.item.ItemStack; -public class PiglinCurrencyItemPredicate implements ICustomItemPredicate { +public class PiglinCurrencyItemPredicate implements ItemSubPredicate { public static final PiglinCurrencyItemPredicate INSTANCE = new PiglinCurrencyItemPredicate(); public static final Codec CODEC = Codec.unit(INSTANCE); + public static final Type TYPE = new Type<>(PiglinCurrencyItemPredicate.CODEC); private PiglinCurrencyItemPredicate() {} @Override - public Codec codec() { - return CODEC; - } - - @Override - public boolean test(ItemStack stack) { + public boolean matches(ItemStack stack) { return stack.isPiglinCurrency(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java index 63cbec12a9..815643b1a3 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java @@ -5,29 +5,30 @@ package net.neoforged.neoforge.common.advancements.critereon; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import javax.annotation.Nullable; +import net.minecraft.advancements.critereon.EntitySubPredicate; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; -public class PiglinNeutralArmorEntityPredicate implements ICustomEntityPredicate { +public class PiglinNeutralArmorEntityPredicate implements EntitySubPredicate { public static final PiglinNeutralArmorEntityPredicate INSTANCE = new PiglinNeutralArmorEntityPredicate(); - public static final Codec CODEC = Codec.unit(INSTANCE); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE); private PiglinNeutralArmorEntityPredicate() {} @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } @Override - public boolean test(ServerLevel level, @Nullable Vec3 position, Entity entity) { + public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { if (entity instanceof LivingEntity living) { - for (ItemStack armor : entity.getArmorSlots()) { + for (ItemStack armor : living.getArmorSlots()) { if (!armor.isEmpty() && armor.makesPiglinsNeutral(living)) { return true; } diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java index edd58e3dac..879aee9485 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java @@ -6,19 +6,16 @@ package net.neoforged.neoforge.common.advancements.critereon; import com.mojang.serialization.Codec; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.common.ToolAction; -public record ToolActionItemPredicate(ToolAction action) implements ICustomItemPredicate { +public record ToolActionItemPredicate(ToolAction action) implements ItemSubPredicate { public static final Codec CODEC = ToolAction.CODEC.xmap(ToolActionItemPredicate::new, ToolActionItemPredicate::action); + public static final Type TYPE = new Type<>(ToolActionItemPredicate.CODEC); @Override - public Codec codec() { - return CODEC; - } - - @Override - public boolean test(ItemStack stack) { + public boolean matches(ItemStack stack) { return stack.canPerformAction(action); } } diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java b/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java index 583854c17b..277d96f057 100644 --- a/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java +++ b/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java @@ -5,51 +5,24 @@ package net.neoforged.neoforge.common.brewing; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; - -public class BrewingRecipeRegistry { - private static List recipes = new ArrayList(); - - static { - addRecipe(new VanillaBrewingRecipe()); - } - - /** - * Adds a recipe to the registry. Due to the nature of the brewing stand - * inputs that stack (a.k.a max stack size > 1) are not allowed. - * - * @param input - * The Ingredient that goes in same slots as the water bottles - * would. - * @param ingredient - * The Ingredient that goes in the same slot as nether wart would. - * @param output - * The ItemStack that will replace the input once the brewing is - * done. - * @return true if the recipe was added. - */ - public static boolean addRecipe(Ingredient input, Ingredient ingredient, ItemStack output) { - return addRecipe(new BrewingRecipe(input, ingredient, output)); - } - - /** - * Adds a recipe to the registry. Due to the nature of the brewing stand - * inputs that stack (a.k.a max stack size > 1) are not allowed. - */ - public static boolean addRecipe(IBrewingRecipe recipe) { - return recipes.add(recipe); - } - +import net.minecraft.world.item.alchemy.PotionBrewing; +import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent; +import org.jetbrains.annotations.ApiStatus; + +/** + * Starting from 1.20.5 this is used to hold {@link IBrewingRecipe}s inside of {@link PotionBrewing}. + * For queries, use the vanilla {@link PotionBrewing}. + * For registration, use {@link RegisterBrewingRecipesEvent}. + */ +@ApiStatus.Internal +public record BrewingRecipeRegistry(List recipes) { /** * Returns the output ItemStack obtained by brewing the passed input and * ingredient. */ - public static ItemStack getOutput(ItemStack input, ItemStack ingredient) { + public ItemStack getOutput(ItemStack input, ItemStack ingredient) { if (input.isEmpty() || input.getCount() != 1) return ItemStack.EMPTY; if (ingredient.isEmpty()) return ItemStack.EMPTY; @@ -65,45 +38,15 @@ public static ItemStack getOutput(ItemStack input, ItemStack ingredient) { /** * Returns true if the passed input and ingredient have an output */ - public static boolean hasOutput(ItemStack input, ItemStack ingredient) { + public boolean hasOutput(ItemStack input, ItemStack ingredient) { return !getOutput(input, ingredient).isEmpty(); } - /** - * Used by the brewing stand to determine if its contents can be brewed. - * Extra parameters exist to allow modders to create bigger brewing stands - * without much hassle - */ - public static boolean canBrew(NonNullList inputs, ItemStack ingredient, int[] inputIndexes) { - if (ingredient.isEmpty()) return false; - - for (int i : inputIndexes) { - if (hasOutput(inputs.get(i), ingredient)) { - return true; - } - } - - return false; - } - - /** - * Used by the brewing stand to brew its inventory Extra parameters exist to - * allow modders to create bigger brewing stands without much hassle - */ - public static void brewPotions(NonNullList inputs, ItemStack ingredient, int[] inputIndexes) { - for (int i : inputIndexes) { - ItemStack output = getOutput(inputs.get(i), ingredient); - if (!output.isEmpty()) { - inputs.set(i, output); - } - } - } - /** * Returns true if the passed ItemStack is a valid ingredient for any of the * recipes in the registry. */ - public static boolean isValidIngredient(ItemStack stack) { + public boolean isValidIngredient(ItemStack stack) { if (stack.isEmpty()) return false; for (IBrewingRecipe recipe : recipes) { @@ -118,7 +61,7 @@ public static boolean isValidIngredient(ItemStack stack) { * Returns true if the passed ItemStack is a valid input for any of the * recipes in the registry. */ - public static boolean isValidInput(ItemStack stack) { + public boolean isValidInput(ItemStack stack) { for (IBrewingRecipe recipe : recipes) { if (recipe.isInput(stack)) { return true; @@ -126,11 +69,4 @@ public static boolean isValidInput(ItemStack stack) { } return false; } - - /** - * Returns an unmodifiable list containing all the recipes in the registry - */ - public static List getRecipes() { - return Collections.unmodifiableList(recipes); - } } diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java b/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java index 9e9a11c190..c8a113c489 100644 --- a/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java +++ b/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java @@ -5,8 +5,16 @@ package net.neoforged.neoforge.common.brewing; +import static net.minecraft.world.item.alchemy.PotionBrewing.Builder; + import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent; +/** + * Interface for more flexible brewing recipes. + * + *

Register using {@link RegisterBrewingRecipesEvent} and {@link Builder#addRecipe(IBrewingRecipe)}. + */ public interface IBrewingRecipe { /** * Returns true is the passed ItemStack is an input for this recipe. "Input" diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java deleted file mode 100644 index 34e68cf75b..0000000000 --- a/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.brewing; - -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionBrewing; - -/** - * Used in BrewingRecipeRegistry to maintain the vanilla behaviour. - * - * Most of the code was simply adapted from net.minecraft.tileentity.TileEntityBrewingStand - */ -public class VanillaBrewingRecipe implements IBrewingRecipe { - /** - * Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack) - */ - @Override - public boolean isInput(ItemStack stack) { - Item item = stack.getItem(); - return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE; - } - - /** - * Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack) - */ - @Override - public boolean isIngredient(ItemStack stack) { - return PotionBrewing.isIngredient(stack); - } - - /** - * Code copied from TileEntityBrewingStand.brewPotions() - * It brews the potion by doing the bit-shifting magic and then checking if the new PotionEffect list is different to the old one, - * or if the new potion is a splash potion when the old one wasn't. - */ - @Override - public ItemStack getOutput(ItemStack input, ItemStack ingredient) { - if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient)) { - ItemStack result = PotionBrewing.mix(ingredient, input); - if (result != input) { - return result; - } - return ItemStack.EMPTY; - } - - return ItemStack.EMPTY; - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java index 03ee44bbdf..e4cf0f34b6 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java @@ -6,12 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.google.common.base.Joiner; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; public record AndCondition(List children) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( LIST_CODEC.fieldOf("values").forGetter(AndCondition::children)) @@ -27,7 +27,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java index 6f304c4928..186cbb6347 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java @@ -14,9 +14,11 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagManager; +import org.jetbrains.annotations.Nullable; public class ConditionContext implements ICondition.IContext { private final TagManager tagManager; + @Nullable // TODO 1.20.5: Clear loaded tags after reloads complete. The context object may leak, but we still want to invalidate it. private Map, Map>>> loadedTags = null; diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java index ed18b15009..9190408473 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java @@ -23,14 +23,6 @@ * This allows getting the {@link ICondition.IContext} while decoding an entry from within a codec. */ public class ConditionalOps extends RegistryOps { - /** - * @deprecated Use the constructor directly - */ - @Deprecated(forRemoval = true, since = "1.20.4") - public static ConditionalOps create(RegistryOps ops, ICondition.IContext context) { - return new ConditionalOps(ops, context); - } - private final ICondition.IContext context; public ConditionalOps(RegistryOps ops, ICondition.IContext context) { diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java index 594e0b7704..6410e2b8aa 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java @@ -5,13 +5,12 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; public final class FalseCondition implements ICondition { public static final FalseCondition INSTANCE = new FalseCondition(); - public static final Codec CODEC = MapCodec.unit(INSTANCE).stable().codec(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); private FalseCondition() {} @@ -21,7 +20,7 @@ public boolean test(IContext condition) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java index 9a0432a52e..04e0ff5f02 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java @@ -11,6 +11,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; +import com.mojang.serialization.MapCodec; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -18,7 +19,6 @@ import java.util.Optional; import java.util.Set; import java.util.function.Function; -import net.minecraft.Util; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; @@ -39,11 +39,11 @@ static Optional getConditionally(Codec codec, DynamicOps ops, V } static Optional getWithConditionalCodec(Codec> codec, DynamicOps ops, V element) { - return Util.getOrThrow(codec.parse(ops, element), JsonParseException::new); + return codec.parse(ops, element).getOrThrow(JsonParseException::new); } static Optional getWithWithConditionsCodec(Codec>> codec, DynamicOps ops, V elements) { - return Util.getOrThrow(codec.parse(ops, elements).promotePartial((m) -> {}), JsonParseException::new).map(WithConditions::carrier); + return codec.parse(ops, elements).promotePartial((m) -> {}).getOrThrow(JsonParseException::new).map(WithConditions::carrier); } static boolean conditionsMatched(DynamicOps ops, V element) { @@ -78,7 +78,7 @@ static void writeConditions(DynamicOps jsonOps, JsonObject jsonObje boolean test(IContext context); - Codec codec(); + MapCodec codec(); interface IContext { IContext EMPTY = new IContext() { diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java index ee1f35146a..3b56620781 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java @@ -5,13 +5,13 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; public class ItemExistsCondition implements ICondition { - public static Codec CODEC = RecordCodecBuilder.create( + public static MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ResourceLocation.CODEC.fieldOf("item").forGetter(ItemExistsCondition::getItem)) @@ -37,7 +37,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java index bf0913da46..58bbd2460e 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java @@ -6,11 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.neoforged.fml.ModList; public record ModLoadedCondition(String modid) implements ICondition { - public static Codec CODEC = RecordCodecBuilder.create( + public static MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( Codec.STRING.fieldOf("modid").forGetter(ModLoadedCondition::modid)) @@ -22,7 +23,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java index 2ed9ca50e0..cdcd5f4f1c 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java @@ -5,11 +5,11 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; public record NotCondition(ICondition value) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ICondition.CODEC.fieldOf("value").forGetter(NotCondition::value)) @@ -21,7 +21,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java index c256b624eb..767bd24a9d 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java @@ -6,12 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.google.common.base.Joiner; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; public record OrCondition(List values) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( LIST_CODEC.fieldOf("values").forGetter(OrCondition::values)) @@ -28,7 +28,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java index 64cc28efb0..dc9fdcf091 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -13,7 +13,7 @@ import net.minecraft.world.item.Item; public record TagEmptyCondition(TagKey tag) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ResourceLocation.CODEC.xmap(loc -> TagKey.create(Registries.ITEM, loc), TagKey::location).fieldOf("tag").forGetter(TagEmptyCondition::tag)) @@ -37,7 +37,7 @@ public boolean test(ICondition.IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java index b2b39ed19e..2b93aa46fc 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java @@ -5,13 +5,12 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; public final class TrueCondition implements ICondition { public static final TrueCondition INSTANCE = new TrueCondition(); - public static Codec CODEC = MapCodec.unit(INSTANCE).stable().codec(); + public static MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); private TrueCondition() {} @@ -21,7 +20,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java index d0094bc2b0..f23aebcae1 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common.crafting; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -18,9 +19,9 @@ /** Ingredient that matches if any of the child ingredients match */ public class CompoundIngredient extends ChildBasedIngredient { - public static final Codec CODEC = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren).codec(); + public static final MapCodec CODEC = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); public static final Codec DIRECT_CODEC = Ingredient.LIST_CODEC.xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); - public static final Codec CODEC_NONEMPTY = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC_NONEMPTY, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren).codec(); + public static final MapCodec CODEC_NONEMPTY = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC_NONEMPTY, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); public static final Codec DIRECT_CODEC_NONEMPTY = Ingredient.LIST_CODEC_NONEMPTY.xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); protected CompoundIngredient(List children) { diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java b/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java index 1fd381d30f..0dc13003c3 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java @@ -9,55 +9,16 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import java.util.function.Function; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.TagParser; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; import net.neoforged.neoforge.registries.NeoForgeRegistries; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; public class CraftingHelper { - public static final Codec TAG_CODEC = ExtraCodecs.withAlternative(TagParser.AS_CODEC, net.minecraft.nbt.CompoundTag.CODEC); - - @ApiStatus.Internal - public static Codec smeltingResultCodec() { - return ExtraCodecs - .either( - BuiltInRegistries.ITEM.byNameCodec(), - ItemStack.ITEM_WITH_COUNT_CODEC) - .xmap( - either -> either.map(ItemStack::new, Function.identity()), - stack -> { - if (stack.getCount() != 1) { - return Either.right(stack); - } - - var tagForWriting = getTagForWriting(stack); - var attachments = stack.serializeAttachments(); - return tagForWriting == null && attachments == null ? Either.left(stack.getItem()) : Either.right(stack); - }); - } - - @Nullable - public static CompoundTag getTagForWriting(ItemStack stack) { - // Check if not writing the NBT would still give the correct item. - // Just checking for tag != null is not enough: damageable items get a tag set in the stack constructor, - // but we don't want to write it to the recipe file. - if (stack.getTag() == null || stack.getTag().equals(new ItemStack(stack.getItem(), stack.getCount()).getTag())) { - return null; - } else { - return stack.getTag(); - } - } - @ApiStatus.Internal public static Codec makeIngredientCodec(boolean allowEmpty, Codec vanillaCodec) { - var compoundIngredientCodec = ExtraCodecs.lazyInitializedCodec(() -> allowEmpty ? CompoundIngredient.DIRECT_CODEC : CompoundIngredient.DIRECT_CODEC_NONEMPTY); + var compoundIngredientCodec = Codec.lazyInitialized(() -> allowEmpty ? CompoundIngredient.DIRECT_CODEC : CompoundIngredient.DIRECT_CODEC_NONEMPTY); return NeoForgeExtraCodecs.withAlternative( // Compound ingredient handling compoundIngredientCodec.flatComapMap( @@ -73,7 +34,7 @@ private static Codec makeIngredientCodec0(boolean allowEmpty, Codec< Codec dispatchCodec = NeoForgeRegistries.INGREDIENT_TYPES.byNameCodec() .dispatch(Ingredient::getType, ingredientType -> ingredientType.codec(allowEmpty)); // Either codec to combine with the vanilla ingredient codec: - Codec> eitherCodec = ExtraCodecs.either( + Codec> eitherCodec = Codec.either( dispatchCodec, vanillaCodec); return eitherCodec.xmap(either -> either.map(i -> i, i -> i), ingredient -> { diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java new file mode 100644 index 0000000000..a4a727bb8d --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.crafting; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Arrays; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentPredicate; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.HolderSetCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.common.NeoForgeMod; +import org.jetbrains.annotations.Nullable; + +/** + * Ingredient that matches the given items, performing either a {@link DataComponentIngredient#isStrict() strict} or a partial NBT test. + *

+ * Strict NBT ingredients will only match items that have exactly the provided tag, while partial ones will + * match if the item's tags contain all of the elements of the provided one, while allowing for additional elements to exist. + */ +public class DataComponentIngredient extends Ingredient { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + builder -> builder + .group( + HolderSetCodec.create(Registries.ITEM, BuiltInRegistries.ITEM.holderByNameCodec(), false).fieldOf("items").forGetter(DataComponentIngredient::items), + DataComponentPredicate.CODEC.fieldOf("components").forGetter(DataComponentIngredient::components), + Codec.BOOL.optionalFieldOf("strict", false).forGetter(DataComponentIngredient::isStrict)) + .apply(builder, DataComponentIngredient::new)); + public static final MapCodec CODEC_NONEMPTY = RecordCodecBuilder.mapCodec( + builder -> builder + .group( + HolderSetCodec.create(Registries.ITEM, BuiltInRegistries.ITEM.holderByNameCodec(), false).fieldOf("items").forGetter(DataComponentIngredient::items), + DataComponentPredicate.CODEC.fieldOf("components").forGetter(DataComponentIngredient::components), + Codec.BOOL.optionalFieldOf("strict", false).forGetter(DataComponentIngredient::isStrict)) + .apply(builder, DataComponentIngredient::new)); + + private final HolderSet items; + private final DataComponentPredicate components; + private final boolean strict; + + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") + protected DataComponentIngredient(HolderSet items, DataComponentPredicate components, boolean strict) { + super(items.stream().map(item -> { + ItemStack stack = new ItemStack(item, 1, components.asPatch()); + return new Ingredient.ItemValue(stack, ItemStack::matches); + }), NeoForgeMod.NBT_INGREDIENT_TYPE); + this.items = items; + this.components = components; + this.strict = strict; + } + + @Override + public boolean test(@Nullable ItemStack stack) { + if (stack == null) return false; + if (strict) { + for (ItemStack stack2 : getItems()) { + if (ItemStack.matches(stack, stack2)) return true; + } + return false; + } else { + return this.items.contains(stack.getItemHolder()) && this.components.test(stack); + } + } + + @Override + public boolean synchronizeWithContents() { + return false; + } + + @Override + public boolean isSimple() { + return false; + } + + public HolderSet items() { + return items; + } + + public DataComponentPredicate components() { + return components; + } + + public boolean isStrict() { + return strict; + } + + /** + * Creates a new ingredient matching the given item, containing the given components + */ + public static DataComponentIngredient of(boolean strict, ItemStack stack) { + return of(strict, stack.getComponents(), stack.getItem()); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static DataComponentIngredient of(boolean strict, DataComponentType type, T value, ItemLike... items) { + return of(strict, DataComponentPredicate.builder().expect(type, value).build(), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static DataComponentIngredient of(boolean strict, DataComponentMap map, ItemLike... items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + @SafeVarargs + public static DataComponentIngredient of(boolean strict, DataComponentMap map, Holder... items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static DataComponentIngredient of(boolean strict, DataComponentMap map, HolderSet items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + @SafeVarargs + public static DataComponentIngredient of(boolean strict, DataComponentPredicate predicate, Holder... items) { + return of(strict, predicate, HolderSet.direct(items)); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static DataComponentIngredient of(boolean strict, DataComponentPredicate predicate, ItemLike... items) { + return of(strict, predicate, HolderSet.direct(Arrays.stream(items).map(ItemLike::asItem).map(Item::builtInRegistryHolder).toList())); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static DataComponentIngredient of(boolean strict, DataComponentPredicate predicate, HolderSet items) { + return new DataComponentIngredient(items, predicate, strict); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java index 84ed4753c6..1c315ac1c4 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Arrays; import java.util.Collection; @@ -18,14 +18,14 @@ /** Ingredient that matches everything from the first ingredient that is not included in the second ingredient */ public class DifferenceIngredient extends ChildBasedIngredient { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.CODEC.fieldOf("base").forGetter(DifferenceIngredient::getBase), Ingredient.CODEC.fieldOf("subtracted").forGetter(DifferenceIngredient::getSubtracted)) .apply(builder, DifferenceIngredient::new)); - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( + public static final MapCodec CODEC_NONEMPTY = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.CODEC_NONEMPTY.fieldOf("base").forGetter(DifferenceIngredient::getBase), diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java b/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java index e546bf276a..cd2fd333a2 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java @@ -14,7 +14,7 @@ * Note: These methods can't be named 'getHeight' or 'getWidth' due to obfusication issues. */ public interface IShapedRecipe extends Recipe { - int getRecipeWidth(); + int getWidth(); - int getRecipeHeight(); + int getHeight(); } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java b/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java index 243a5f83d7..2d7d8a8696 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.world.item.crafting.Ingredient; /** @@ -14,18 +14,18 @@ * {@code codec} allows ingredients that are known to be empty at deserialization time, * whereas {@code nonEmptyCodec} does not. */ -public record IngredientType(Codec codec, Codec nonEmptyCodec) { +public record IngredientType(MapCodec codec, MapCodec nonEmptyCodec) { /** * Constructor for ingredient types that have the same codec for empty and non-empty serialization. */ - public IngredientType(Codec nonEmptyCodec) { + public IngredientType(MapCodec nonEmptyCodec) { this(nonEmptyCodec, nonEmptyCodec); } /** * Returns the right codec for this ingredient type based on {@code allowEmpty}. */ - public Codec codec(boolean allowEmpty) { + public MapCodec codec(boolean allowEmpty) { return allowEmpty ? codec : nonEmptyCodec; } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java index 95eae2813d..3ae0a22ceb 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.ArrayList; import java.util.Arrays; @@ -19,13 +19,13 @@ /** Ingredient that matches if all child ingredients match */ public class IntersectionIngredient extends ChildBasedIngredient { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.LIST_CODEC.fieldOf("children").forGetter(ChildBasedIngredient::getChildren)) .apply(builder, IntersectionIngredient::new)); - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( + public static final MapCodec CODEC_NONEMPTY = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.LIST_CODEC_NONEMPTY.fieldOf("children").forGetter(ChildBasedIngredient::getChildren)) diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java deleted file mode 100644 index 1d87afa865..0000000000 --- a/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.crafting; - -import com.google.common.base.Preconditions; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtUtils; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.ItemLike; -import net.neoforged.neoforge.attachment.AttachmentHolder; -import net.neoforged.neoforge.common.NeoForgeMod; -import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; -import org.jetbrains.annotations.Nullable; - -/** - * Ingredient that matches the given items, performing either a {@link NBTIngredient#isStrict() strict} or a partial NBT test. - *

- * Strict NBT ingredients will only match items that have exactly the provided tag, while partial ones will - * match if the item's tags contain all of the elements of the provided one, while allowing for additional elements to exist. - */ -public class NBTIngredient extends Ingredient { - public static final Codec CODEC = RecordCodecBuilder.create( - builder -> builder - .group( - NeoForgeExtraCodecs.singularOrPluralCodec(BuiltInRegistries.ITEM.byNameCodec(), "item").forGetter(NBTIngredient::getContainedItems), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, "tag").forGetter(NBTIngredient::getOptionalTag), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, AttachmentHolder.ATTACHMENTS_NBT_KEY).forGetter(NBTIngredient::getAttachmentNbt), - Codec.BOOL.optionalFieldOf("strict", false).forGetter(NBTIngredient::isStrict)) - .apply(builder, NBTIngredient::new)); - - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( - builder -> builder - .group( - NeoForgeExtraCodecs.singularOrPluralCodecNotEmpty(BuiltInRegistries.ITEM.byNameCodec(), "item").forGetter(NBTIngredient::getContainedItems), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, "tag").forGetter(NBTIngredient::getOptionalTag), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, AttachmentHolder.ATTACHMENTS_NBT_KEY).forGetter(NBTIngredient::getAttachmentNbt), - Codec.BOOL.optionalFieldOf("strict", false).forGetter(NBTIngredient::isStrict)) - .apply(builder, NBTIngredient::new)); - - private final boolean strict; - - @Deprecated(forRemoval = true, since = "1.20.4") - protected NBTIngredient(Set items, CompoundTag tag, boolean strict) { - this(items, tag, null, strict); - } - - @SuppressWarnings("OptionalUsedAsFieldOrParameterType") - private NBTIngredient(Set items, Optional tag, Optional attachmentTag, boolean strict) { - this(items, tag.orElse(null), attachmentTag.orElse(null), strict); - } - - protected NBTIngredient(Set items, @Nullable CompoundTag tag, @Nullable CompoundTag attachmentTag, boolean strict) { - super(items.stream().map(item -> { - //Copy the attachment tag in case a modder mutates the tag they get passed when deserializing an attachment - ItemStack stack = new ItemStack(item, 1, attachmentTag == null ? null : attachmentTag.copy()); - // copy NBT to prevent the stack from modifying the original, as attachments or vanilla item durability will modify the tag - if (tag != null) { - stack.setTag(tag.copy()); - } - return new Ingredient.ItemValue(stack, strict ? ItemStack::matches : NBTIngredient::compareStacksWithNBT); - }), NeoForgeMod.NBT_INGREDIENT_TYPE); - Preconditions.checkArgument(!items.isEmpty(), "At least one item needs to be provided for a nbt matching ingredient"); - if (!strict) { - Preconditions.checkArgument(tag != null || attachmentTag != null, "Either nbt or attachment nbt needs to be provided for a non-strict nbt matching ingredient"); - } - this.strict = strict; - } - - @Override - protected boolean areStacksEqual(ItemStack left, ItemStack right) { - return strict ? ItemStack.matches(left, right) : compareStacksWithNBT(left, right); - } - - @Override - public boolean synchronizeWithContents() { - return false; - } - - private static boolean compareStacksWithNBT(ItemStack left, ItemStack right) { - return left.is(right.getItem()) && NbtUtils.compareNbt(left.getTag(), right.getTag(), true) && NbtUtils.compareNbt(left.serializeAttachments(), right.serializeAttachments(), true); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient of(boolean strict, CompoundTag nbt, ItemLike... items) { - return of(strict, nbt, null, items); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient of(boolean strict, @Nullable CompoundTag nbt, @Nullable CompoundTag attachmentNbt, ItemLike... items) { - return new NBTIngredient(Arrays.stream(items).map(ItemLike::asItem).collect(Collectors.toSet()), nbt, attachmentNbt, strict); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient ofAttachment(boolean strict, CompoundTag attachmentNbt, ItemLike... items) { - return of(strict, null, attachmentNbt, items); - } - - /** - * Creates a new ingredient matching the given item, containing the given NBT - */ - public static NBTIngredient of(boolean strict, ItemStack stack) { - //TODO - 1.20.5: return of(strict, stack.getTag(), stack.serializeAttachments(), stack.getItem()); - CompoundTag attachmentNbt = stack.serializeAttachments(); - //Only force create a tag if there is no serializable attachments - CompoundTag nbt = attachmentNbt == null ? stack.getOrCreateTag() : stack.getTag(); - return new NBTIngredient(Set.of(stack.getItem()), nbt, attachmentNbt, strict); - } - - public Set getContainedItems() { - return Arrays.stream(getItems()).map(ItemStack::getItem).collect(Collectors.toSet()); - } - - public CompoundTag getTag() { - return getOptionalTag().orElseGet(CompoundTag::new); - } - - //TODO - 1.20.5: Replace getTag with this method and rename this to getTag - public Optional getOptionalTag() { - return getFirstItem().map(ItemStack::getTag); - } - - public Optional getAttachmentNbt() { - return getFirstItem().map(AttachmentHolder::serializeAttachments); - } - - private Optional getFirstItem() { - final ItemStack[] items = getItems(); - return items.length == 0 ? Optional.empty() : Optional.of(items[0]); - } - - @Override - public boolean isSimple() { - return false; - } - - public boolean isStrict() { - return strict; - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java b/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java index 72051355ff..feb26716cc 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java @@ -76,7 +76,7 @@ public CompletableFuture run(CachedOutput cache) { private CompletableFuture generate(Path out, CachedOutput cache, Builder builder, DynamicOps ops) { return CompletableFuture.supplyAsync(() -> { final Codec>>> withConditionsCodec = ConditionalOps.createConditionalCodecWithConditions(DataMapFile.codec(builder.registryKey, builder.type)); - return withConditionsCodec.encodeStart(ops, Optional.of(builder.build())).getOrThrow(false, msg -> LOGGER.error("Failed to encode {}: {}", out, msg)); + return withConditionsCodec.encodeStart(ops, Optional.of(builder.build())).getOrThrow(msg -> new RuntimeException("Failed to encode %s: %s".formatted(out, msg))); }).thenComposeAsync(encoded -> DataProvider.saveStable(cache, encoded, out)); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java new file mode 100644 index 0000000000..4f0241f4ad --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; +import net.minecraft.world.item.enchantment.Enchantment; +import org.jetbrains.annotations.Nullable; + +public abstract class EnchantmentTagsProvider extends IntrinsicHolderTagsProvider { + @SuppressWarnings("deprecation") + public EnchantmentTagsProvider(PackOutput output, CompletableFuture lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper) { + super(output, Registries.ENCHANTMENT, lookupProvider, enchantment -> BuiltInRegistries.ENCHANTMENT.getResourceKey(enchantment).orElseThrow(), modId, existingFileHelper); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java b/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java index da7f588e48..d2028b73af 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java @@ -13,16 +13,20 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Optional; import java.util.Set; import net.minecraft.client.resources.ClientPackSource; import net.minecraft.client.resources.IndexedAssetSource; import net.minecraft.data.DataProvider; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.FilePackResources; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.VanillaPackResources; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.ServerPacksSource; import net.minecraft.server.packs.resources.MultiPackResourceManager; import net.minecraft.server.packs.resources.Resource; @@ -107,7 +111,7 @@ public ExistingFileHelper(Collection existingPacks, final Set exis File file = existing.toFile(); if (!file.exists()) continue; - PackResources pack = file.isDirectory() ? new PathPackResources(file.getName(), file.toPath(), false) : new FilePackResources(file.getName(), new FilePackResources.SharedZipFileAccess(file), false, ""); + PackResources pack = file.isDirectory() ? new PathPackResources(new PackLocationInfo(file.getName(), Component.empty(), PackSource.BUILT_IN, Optional.empty()), file.toPath()) : new FilePackResources(new PackLocationInfo(file.getName(), Component.empty(), PackSource.BUILT_IN, Optional.empty()), new FilePackResources.SharedZipFileAccess(file), ""); candidateClientResources.add(pack); candidateServerResources.add(pack); } @@ -116,8 +120,8 @@ public ExistingFileHelper(Collection existingPacks, final Set exis if (modFileInfo != null) { // Only opens primary packs - overlays are not currently considered for datagen final String name = "mod:" + existingMod; - candidateClientResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(name)); - candidateServerResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(name)); + candidateClientResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(new PackLocationInfo(name, Component.empty(), PackSource.BUILT_IN, Optional.empty()))); + candidateServerResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(new PackLocationInfo(name, Component.empty(), PackSource.BUILT_IN, Optional.empty()))); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java b/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java index dcb2e243c7..05b68917a7 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java @@ -8,10 +8,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mojang.serialization.JsonOps; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; @@ -21,6 +18,7 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import net.minecraft.core.HolderLookup; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; @@ -38,12 +36,14 @@ public abstract class GlobalLootModifierProvider implements DataProvider { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); private final PackOutput output; + private final CompletableFuture registries; private final String modid; - private final Map toSerialize = new HashMap<>(); + private final Map> toSerialize = new HashMap<>(); private boolean replace = false; - public GlobalLootModifierProvider(PackOutput output, String modid) { + public GlobalLootModifierProvider(PackOutput output, CompletableFuture registries, String modid) { this.output = output; + this.registries = registries; this.modid = modid; } @@ -60,7 +60,11 @@ protected void replacing() { protected abstract void start(); @Override - public CompletableFuture run(CachedOutput cache) { + public final CompletableFuture run(CachedOutput cache) { + return this.registries.thenCompose(registries -> this.run(cache, registries)); + } + + protected CompletableFuture run(CachedOutput cache, HolderLookup.Provider registries) { start(); Path forgePath = this.output.getOutputFolder(PackOutput.Target.DATA_PACK).resolve("neoforge").resolve("loot_modifiers").resolve("global_loot_modifiers.json"); @@ -69,11 +73,13 @@ public CompletableFuture run(CachedOutput cache) { ImmutableList.Builder> futuresBuilder = new ImmutableList.Builder<>(); - toSerialize.forEach(LamdbaExceptionUtils.rethrowBiConsumer((name, json) -> { + for (var entry : toSerialize.entrySet()) { + var name = entry.getKey(); + var lootModifier = entry.getValue(); entries.add(new ResourceLocation(modid, name)); Path modifierPath = modifierFolderPath.resolve(name + ".json"); - futuresBuilder.add(DataProvider.saveStable(cache, json, modifierPath)); - })); + futuresBuilder.add(DataProvider.saveStable(cache, registries, IGlobalLootModifier.CONDITIONAL_CODEC, Optional.of(lootModifier), modifierPath)); + } JsonObject forgeJson = new JsonObject(); forgeJson.addProperty("replace", this.replace); @@ -92,8 +98,7 @@ public CompletableFuture run(CachedOutput cache) { * @param conditions a list of conditions to add to the GLM file */ public void add(String modifier, T instance, List conditions) { - JsonElement json = IGlobalLootModifier.CONDITIONAL_CODEC.encodeStart(JsonOps.INSTANCE, Optional.of(new WithConditions<>(conditions, instance))).getOrThrow(false, s -> {}); - this.toSerialize.put(modifier, json); + this.toSerialize.put(modifier, new WithConditions<>(conditions, instance)); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java b/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java index 5a0bd43c1f..568fd674d9 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java @@ -84,14 +84,14 @@ public CompletableFuture run(final CachedOutput cache) { gather(); return lookupProvider.thenCompose(provider -> { - final DynamicOps dynamicOps = ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, provider), ICondition.IContext.EMPTY); + final DynamicOps dynamicOps = new ConditionalOps<>(RegistryOps.create(JsonOps.INSTANCE, provider), ICondition.IContext.EMPTY); this.conditions.forEach((id, withConditions) -> { final Path path = this.pathProvider.json(id); futuresBuilder.add(CompletableFuture.supplyAsync(() -> { final Codec>> withConditionsCodec = ConditionalOps.createConditionalCodecWithConditions(this.codec); - return withConditionsCodec.encodeStart(dynamicOps, Optional.of(withConditions)).getOrThrow(false, msg -> LOGGER.error("Failed to encode {}: {}", path, msg)); + return withConditionsCodec.encodeStart(dynamicOps, Optional.of(withConditions)).getOrThrow(msg -> new RuntimeException("Failed to encode %s: %s".formatted(path, msg))); }).thenComposeAsync(encoded -> DataProvider.saveStable(cache, encoded, path))); }); diff --git a/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java b/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java index 963065e50d..e77645fca9 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java @@ -14,6 +14,8 @@ import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; @@ -116,6 +118,26 @@ public void add(EntityType key, String name) { add(key.getDescriptionId(), name); } + public void addTag(Supplier> key, String name) { + add(key.get(), name); + } + + public void add(TagKey tagKey, String name) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("tag."); + + ResourceLocation registryIdentifier = tagKey.registry().location(); + ResourceLocation tagResourceLocation = tagKey.location(); + + stringBuilder.append(registryIdentifier.toShortLanguageKey().replace("/", ".")) + .append(".") + .append(tagResourceLocation.getNamespace()) + .append(".") + .append(tagResourceLocation.getPath().replace("/", ".").replace(":", ".")); + + add(stringBuilder.toString(), name); + } + public void add(String key, String value) { if (data.put(key, value) != null) throw new IllegalStateException("Duplicate translation key " + key); diff --git a/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java index 3bfd3369b9..1236e4308e 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.data.tags.DamageTypeTagsProvider; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.damagesource.DamageType; import net.minecraft.world.damagesource.DamageTypes; @@ -78,6 +79,17 @@ protected void addTags(HolderLookup.Provider lookupProvider) { tag(DamageTypes.GENERIC_KILL, Tags.DamageTypes.IS_TECHNICAL); tag(DamageTypes.OUTSIDE_BORDER, Tags.DamageTypes.IS_TECHNICAL); tag(DamageTypes.FELL_OUT_OF_WORLD, Tags.DamageTypes.IS_TECHNICAL); + tag(Tags.DamageTypes.NO_FLINCH); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.DamageTypes.IS_POISON); + tagWithOptionalLegacy(Tags.DamageTypes.IS_WITHER); + tagWithOptionalLegacy(Tags.DamageTypes.IS_MAGIC); + tagWithOptionalLegacy(Tags.DamageTypes.IS_ENVIRONMENT); + tagWithOptionalLegacy(Tags.DamageTypes.IS_PHYSICAL); + tagWithOptionalLegacy(Tags.DamageTypes.IS_TECHNICAL); + tagWithOptionalLegacy(Tags.DamageTypes.NO_FLINCH); } @SafeVarargs @@ -87,6 +99,12 @@ private void tag(ResourceKey type, TagKey... tags) { } } + private TagAppender tagWithOptionalLegacy(TagKey tag) { + TagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; + } + @Override public String getName() { return "NeoForge Damage Type Tags"; diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java index 382080cc07..613c6833f4 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.common.data.internal; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; @@ -13,10 +14,10 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.UnaryOperator; -import net.minecraft.Util; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.Criterion; @@ -33,6 +34,7 @@ import net.minecraft.data.advancements.AdvancementSubProvider; import net.minecraft.data.advancements.packs.VanillaAdvancementProvider; import net.minecraft.data.advancements.packs.VanillaHusbandryAdvancements; +import net.minecraft.resources.RegistryOps; import net.minecraft.world.entity.monster.piglin.PiglinAi; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -57,10 +59,10 @@ public NeoForgeAdvancementProvider(PackOutput output, CompletableFuture getVanillaAdvancementProviders(PackOutput output, CompletableFuture registries) { - List>> criteriaReplacers = new ArrayList<>(); + List, HolderLookup.Provider, Criterion>> criteriaReplacers = new ArrayList<>(); criteriaReplacers.add(replaceMatchToolCriteria(ToolActions.AXE_WAX_OFF, getPrivateValue(VanillaHusbandryAdvancements.class, null, "WAX_SCRAPING_TOOLS"))); - criteriaReplacers.add(replaceInteractCriteria(PiglinCurrencyItemPredicate.INSTANCE.toVanilla(), PiglinAi.BARTERING_ITEM)); - criteriaReplacers.add(replaceWearingPredicate(PiglinNeutralArmorEntityPredicate.INSTANCE.toVanilla(), predicate -> { + criteriaReplacers.add(replaceInteractCriteria(ItemPredicate.Builder.item().withSubPredicate(PiglinCurrencyItemPredicate.TYPE, PiglinCurrencyItemPredicate.INSTANCE).build(), PiglinAi.BARTERING_ITEM)); + criteriaReplacers.add(replaceWearingPredicate(EntityPredicate.Builder.entity().subPredicate(PiglinNeutralArmorEntityPredicate.INSTANCE).build(), predicate -> { if (predicate.head().filter(item -> predicateMatches(item, Items.GOLDEN_HELMET)).isPresent()) { return true; } else if (predicate.chest().filter(item -> predicateMatches(item, Items.GOLDEN_CHESTPLATE)).isPresent()) { @@ -77,14 +79,14 @@ private static List getVanillaAdvancementProviders(PackOut .toList(); } - private static UnaryOperator> replaceMatchToolCriteria(ToolAction toolAction, ItemLike... targetItem) { + private static BiFunction, HolderLookup.Provider, Criterion> replaceMatchToolCriteria(ToolAction toolAction, ItemLike... targetItem) { UnaryOperator replacer = condition -> { if (condition instanceof MatchTool toolMatch && toolMatch.predicate().filter(predicate -> predicateMatches(predicate, targetItem)).isPresent()) { - return new MatchTool(Optional.of(new ToolActionItemPredicate(toolAction).toVanilla())); + return new MatchTool(Optional.of(ItemPredicate.Builder.item().withSubPredicate(ToolActionItemPredicate.TYPE, new ToolActionItemPredicate(toolAction)).build())); } return null; }; - return criterion -> { + return (criterion, registries) -> { if (criterion.trigger() instanceof ItemUsedOnLocationTrigger trigger && criterion.triggerInstance() instanceof ItemUsedOnLocationTrigger.TriggerInstance instance) { ContextAwarePredicate newLocation = replaceConditions(instance.location().orElse(null), replacer, condition -> false); if (newLocation != null) { @@ -95,8 +97,8 @@ private static UnaryOperator> replaceMatchToolCriteria(ToolAction t }; } - private static UnaryOperator> replaceInteractCriteria(ItemPredicate replacement, ItemLike... targetItem) { - return criterion -> { + private static BiFunction, HolderLookup.Provider, Criterion> replaceInteractCriteria(ItemPredicate replacement, ItemLike... targetItem) { + return (criterion, registries) -> { if (criterion.trigger() instanceof PlayerInteractTrigger trigger && criterion.triggerInstance() instanceof PlayerInteractTrigger.TriggerInstance instance) { if (instance.item().filter(predicate -> predicateMatches(predicate, targetItem)).isPresent()) { return new Criterion<>(trigger, new PlayerInteractTrigger.TriggerInstance(instance.player(), Optional.of(replacement), instance.entity())); @@ -120,7 +122,7 @@ private static boolean predicateMatches(ItemPredicate predicate, ItemLike... tar return true; } - private static UnaryOperator> replaceWearingPredicate(EntityPredicate replacement, Predicate shouldReplace) { + private static BiFunction, HolderLookup.Provider, Criterion> replaceWearingPredicate(EntityPredicate replacement, Predicate shouldReplace) { return replacePlayerPredicate(condition -> { if (condition instanceof InvertedLootItemCondition inverted) { if (inverted.term() instanceof LootItemEntityPropertyCondition entityPropertyCondition) { @@ -138,30 +140,31 @@ private static UnaryOperator> replaceWearingPredicate(EntityPredica }, condition -> true);//Skip any additional replacements as we know they would be duplicates } - private static UnaryOperator> replacePlayerPredicate(UnaryOperator replacer, Predicate shouldSkipReplacement) { - return criterion -> { + private static BiFunction, HolderLookup.Provider, Criterion> replacePlayerPredicate(UnaryOperator replacer, Predicate shouldSkipReplacement) { + return (criterion, registries) -> { if (criterion.triggerInstance() instanceof SimpleCriterionTrigger.SimpleInstance simpleInstance) { ContextAwarePredicate newPlayer = replaceConditions(simpleInstance.player().orElse(null), replacer, shouldSkipReplacement); if (newPlayer != null) { - return replacePlayerPredicate((Criterion) criterion, newPlayer); + return replacePlayerPredicate((Criterion) criterion, newPlayer, registries); } } return null; }; } - private static Criterion replacePlayerPredicate(Criterion old, ContextAwarePredicate newPlayer) { + private static Criterion replacePlayerPredicate(Criterion old, ContextAwarePredicate newPlayer, HolderLookup.Provider registries) { Codec codec = old.trigger().codec(); - return Util.getOrThrow(codec.encodeStart(JsonOps.INSTANCE, old.triggerInstance()) + RegistryOps registryops = registries.createSerializationContext(JsonOps.INSTANCE); + return codec.encodeStart(registryops, old.triggerInstance()) .flatMap(element -> { if (element instanceof JsonObject object && object.has("player")) { - object.add("player", Util.getOrThrow(ContextAwarePredicate.CODEC.encodeStart(JsonOps.INSTANCE, newPlayer), error -> new IllegalStateException("Unable to serialize new player predicate"))); - return codec.parse(JsonOps.INSTANCE, object); + object.add("player", ContextAwarePredicate.CODEC.encodeStart(registryops, newPlayer).getOrThrow(error -> new IllegalStateException("Unable to serialize new player predicate"))); + return codec.parse(registryops, object); } return DataResult.error(() -> "Serialized instance does not contain a 'player' element"); }) - .map(old.trigger()::createCriterion), - error -> new IllegalStateException("Unable to convert criterion serialization and replacement")); + .map(old.trigger()::createCriterion) + .getOrThrow(error -> new IllegalStateException("Unable to convert criterion serialization and replacement: " + error)); } @Nullable @@ -199,11 +202,11 @@ private static T getPrivateValue(Class clazz, @Nullable C inst, String return value; } - private record NeoForgeAdvancementGenerator(AdvancementSubProvider vanillaProvider, List>> criteriaReplacers) implements AdvancementGenerator { + private record NeoForgeAdvancementGenerator(AdvancementSubProvider vanillaProvider, List, HolderLookup.Provider, Criterion>> criteriaReplacers) implements AdvancementGenerator { @Override public void generate(HolderLookup.Provider registries, Consumer saver, ExistingFileHelper existingFileHelper) { vanillaProvider.generate(registries, advancementHolder -> { - Advancement.Builder newBuilder = findAndReplaceInHolder(advancementHolder); + Advancement.Builder newBuilder = findAndReplaceInHolder(advancementHolder, registries); if (newBuilder != null) { newBuilder.save(saver, advancementHolder.id(), existingFileHelper); } @@ -211,14 +214,14 @@ public void generate(HolderLookup.Provider registries, Consumer criterion = entry.getValue(); for (var criteriaReplacer : criteriaReplacers) { - Criterion replacedCriterion = criteriaReplacer.apply(criterion); + Criterion replacedCriterion = criteriaReplacer.apply(criterion, registries); if (replacedCriterion != null) { hasReplaced = true; criterion = replacedCriterion; diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java index c7e39d6803..850e036491 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.data.tags.BiomeTagsProvider; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.biome.Biome; @@ -24,71 +25,226 @@ public NeoForgeBiomeTagsProvider(PackOutput output, CompletableFuture biome, TagKey... tags) { tag(key).add(biome); } } + + private TagAppender tagWithOptionalLegacy(TagKey tag) { + return tag(tag).addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + } + + @Override + public String getName() { + return "Neoforge Biome Tags"; + } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java index 9bc63b7d41..aa6350ba9f 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java @@ -11,6 +11,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; @@ -33,15 +34,33 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.BARRELS).addTag(Tags.Blocks.BARRELS_WOODEN); tag(Tags.Blocks.BARRELS_WOODEN).add(Blocks.BARREL); tag(Tags.Blocks.BOOKSHELVES).add(Blocks.BOOKSHELF); + tag(Tags.Blocks.BUDDING_BLOCKS).add(Blocks.BUDDING_AMETHYST); + tag(Tags.Blocks.BUDS).add(Blocks.SMALL_AMETHYST_BUD).add(Blocks.MEDIUM_AMETHYST_BUD).add(Blocks.LARGE_AMETHYST_BUD); + tag(Tags.Blocks.CHAINS).add(Blocks.CHAIN); tag(Tags.Blocks.CHESTS).addTags(Tags.Blocks.CHESTS_ENDER, Tags.Blocks.CHESTS_TRAPPED, Tags.Blocks.CHESTS_WOODEN); tag(Tags.Blocks.CHESTS_ENDER).add(Blocks.ENDER_CHEST); tag(Tags.Blocks.CHESTS_TRAPPED).add(Blocks.TRAPPED_CHEST); tag(Tags.Blocks.CHESTS_WOODEN).add(Blocks.CHEST, Blocks.TRAPPED_CHEST); - tag(Tags.Blocks.COBBLESTONE).addTags(Tags.Blocks.COBBLESTONE_NORMAL, Tags.Blocks.COBBLESTONE_INFESTED, Tags.Blocks.COBBLESTONE_MOSSY, Tags.Blocks.COBBLESTONE_DEEPSLATE); - tag(Tags.Blocks.COBBLESTONE_NORMAL).add(Blocks.COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_INFESTED).add(Blocks.INFESTED_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_MOSSY).add(Blocks.MOSSY_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_DEEPSLATE).add(Blocks.COBBLED_DEEPSLATE); + tag(Tags.Blocks.CLUSTERS).add(Blocks.AMETHYST_CLUSTER); + tag(Tags.Blocks.COBBLESTONES).addTags(Tags.Blocks.COBBLESTONES_NORMAL, Tags.Blocks.COBBLESTONES_INFESTED, Tags.Blocks.COBBLESTONES_MOSSY, Tags.Blocks.COBBLESTONES_DEEPSLATE); + tag(Tags.Blocks.COBBLESTONES_NORMAL).add(Blocks.COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_INFESTED).add(Blocks.INFESTED_COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_MOSSY).add(Blocks.MOSSY_COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_DEEPSLATE).add(Blocks.COBBLED_DEEPSLATE); + addColored(Tags.Blocks.DYED, "{color}_banner"); + addColored(Tags.Blocks.DYED, "{color}_bed"); + addColored(Tags.Blocks.DYED, "{color}_candle"); + addColored(Tags.Blocks.DYED, "{color}_carpet"); + addColored(Tags.Blocks.DYED, "{color}_concrete"); + addColored(Tags.Blocks.DYED, "{color}_concrete_powder"); + addColored(Tags.Blocks.DYED, "{color}_glazed_terracotta"); + addColored(Tags.Blocks.DYED, "{color}_shulker_box"); + addColored(Tags.Blocks.DYED, "{color}_stained_glass"); + addColored(Tags.Blocks.DYED, "{color}_stained_glass_pane"); + addColored(Tags.Blocks.DYED, "{color}_terracotta"); + addColored(Tags.Blocks.DYED, "{color}_wall_banner"); + addColored(Tags.Blocks.DYED, "{color}_wool"); + addColoredTags(tag(Tags.Blocks.DYED)::addTag, Tags.Blocks.DYED); tag(Tags.Blocks.END_STONES).add(Blocks.END_STONE); tag(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST); tag(Tags.Blocks.FENCE_GATES).addTags(Tags.Blocks.FENCE_GATES_WOODEN); @@ -49,24 +68,24 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.FENCES).addTags(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Blocks.FENCES_WOODEN); tag(Tags.Blocks.FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE); tag(Tags.Blocks.FENCES_WOODEN).addTag(BlockTags.WOODEN_FENCES); - tag(Tags.Blocks.GLASS).addTags(Tags.Blocks.GLASS_COLORLESS, Tags.Blocks.STAINED_GLASS, Tags.Blocks.GLASS_TINTED); - tag(Tags.Blocks.GLASS_COLORLESS).add(Blocks.GLASS); - tag(Tags.Blocks.GLASS_SILICA).add(Blocks.GLASS, Blocks.BLACK_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.WHITE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS); - tag(Tags.Blocks.GLASS_TINTED).add(Blocks.TINTED_GLASS); - addColored(tag(Tags.Blocks.STAINED_GLASS)::add, Tags.Blocks.GLASS, "{color}_stained_glass"); - tag(Tags.Blocks.GLASS_PANES).addTags(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Blocks.STAINED_GLASS_PANES); + tag(Tags.Blocks.GLASS_BLOCKS).addTags(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Blocks.GLASS_BLOCKS_TINTED).add(Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS).add(Blocks.GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_CHEAP).add(Blocks.GLASS, Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_TINTED).add(Blocks.TINTED_GLASS); + tag(Tags.Blocks.GLASS_PANES).addTags(Tags.Blocks.GLASS_PANES_COLORLESS).add(Blocks.WHITE_STAINED_GLASS_PANE, Blocks.ORANGE_STAINED_GLASS_PANE, Blocks.MAGENTA_STAINED_GLASS_PANE, Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Blocks.YELLOW_STAINED_GLASS_PANE, Blocks.LIME_STAINED_GLASS_PANE, Blocks.PINK_STAINED_GLASS_PANE, Blocks.GRAY_STAINED_GLASS_PANE, Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Blocks.CYAN_STAINED_GLASS_PANE, Blocks.PURPLE_STAINED_GLASS_PANE, Blocks.BLUE_STAINED_GLASS_PANE, Blocks.BROWN_STAINED_GLASS_PANE, Blocks.GREEN_STAINED_GLASS_PANE, Blocks.RED_STAINED_GLASS_PANE, Blocks.BLACK_STAINED_GLASS_PANE); tag(Tags.Blocks.GLASS_PANES_COLORLESS).add(Blocks.GLASS_PANE); - addColored(tag(Tags.Blocks.STAINED_GLASS_PANES)::add, Tags.Blocks.GLASS_PANES, "{color}_stained_glass_pane"); - tag(Tags.Blocks.GRAVEL).add(Blocks.GRAVEL); - tag(Tags.Blocks.NETHERRACK).add(Blocks.NETHERRACK); - tag(Tags.Blocks.OBSIDIAN).add(Blocks.OBSIDIAN); + tag(Tags.Blocks.GRAVELS).add(Blocks.GRAVEL); + tag(Tags.Blocks.SKULLS).add(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD); + tag(Tags.Blocks.HIDDEN_FROM_RECIPE_VIEWERS); + tag(Tags.Blocks.NETHERRACKS).add(Blocks.NETHERRACK); + tag(Tags.Blocks.OBSIDIANS).add(Blocks.OBSIDIAN); tag(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE).add(Blocks.DEEPSLATE); tag(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK).add(Blocks.NETHERRACK); tag(Tags.Blocks.ORE_BEARING_GROUND_STONE).add(Blocks.STONE); tag(Tags.Blocks.ORE_RATES_DENSE).add(Blocks.COPPER_ORE, Blocks.DEEPSLATE_COPPER_ORE, Blocks.DEEPSLATE_LAPIS_ORE, Blocks.DEEPSLATE_REDSTONE_ORE, Blocks.LAPIS_ORE, Blocks.REDSTONE_ORE); tag(Tags.Blocks.ORE_RATES_SINGULAR).add(Blocks.ANCIENT_DEBRIS, Blocks.COAL_ORE, Blocks.DEEPSLATE_COAL_ORE, Blocks.DEEPSLATE_DIAMOND_ORE, Blocks.DEEPSLATE_EMERALD_ORE, Blocks.DEEPSLATE_GOLD_ORE, Blocks.DEEPSLATE_IRON_ORE, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.GOLD_ORE, Blocks.IRON_ORE, Blocks.NETHER_QUARTZ_ORE); tag(Tags.Blocks.ORE_RATES_SPARSE).add(Blocks.NETHER_GOLD_ORE); - tag(Tags.Blocks.ORES).addTags(Tags.Blocks.ORES_COAL, Tags.Blocks.ORES_COPPER, Tags.Blocks.ORES_DIAMOND, Tags.Blocks.ORES_EMERALD, Tags.Blocks.ORES_GOLD, Tags.Blocks.ORES_IRON, Tags.Blocks.ORES_LAPIS, Tags.Blocks.ORES_REDSTONE, Tags.Blocks.ORES_QUARTZ, Tags.Blocks.ORES_NETHERITE_SCRAP); + tag(Tags.Blocks.ORES).addTags(Tags.Blocks.ORES_COAL, Tags.Blocks.ORES_COPPER, Tags.Blocks.ORES_DIAMOND, Tags.Blocks.ORES_EMERALD, Tags.Blocks.ORES_GOLD, Tags.Blocks.ORES_IRON, Tags.Blocks.ORES_LAPIS, Tags.Blocks.ORES_NETHERITE_SCRAP, Tags.Blocks.ORES_REDSTONE, Tags.Blocks.ORES_QUARTZ); tag(Tags.Blocks.ORES_COAL).addTag(BlockTags.COAL_ORES); tag(Tags.Blocks.ORES_COPPER).addTag(BlockTags.COPPER_ORES); tag(Tags.Blocks.ORES_DIAMOND).addTag(BlockTags.DIAMOND_ORES); @@ -80,38 +99,199 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE).add(Blocks.DEEPSLATE_COAL_ORE, Blocks.DEEPSLATE_COPPER_ORE, Blocks.DEEPSLATE_DIAMOND_ORE, Blocks.DEEPSLATE_EMERALD_ORE, Blocks.DEEPSLATE_GOLD_ORE, Blocks.DEEPSLATE_IRON_ORE, Blocks.DEEPSLATE_LAPIS_ORE, Blocks.DEEPSLATE_REDSTONE_ORE); tag(Tags.Blocks.ORES_IN_GROUND_NETHERRACK).add(Blocks.NETHER_GOLD_ORE, Blocks.NETHER_QUARTZ_ORE); tag(Tags.Blocks.ORES_IN_GROUND_STONE).add(Blocks.COAL_ORE, Blocks.COPPER_ORE, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.GOLD_ORE, Blocks.IRON_ORE, Blocks.LAPIS_ORE, Blocks.REDSTONE_ORE); - tag(Tags.Blocks.SAND).addTags(Tags.Blocks.SAND_COLORLESS, Tags.Blocks.SAND_RED); - tag(Tags.Blocks.SAND_COLORLESS).add(Blocks.SAND); - tag(Tags.Blocks.SAND_RED).add(Blocks.RED_SAND); - tag(Tags.Blocks.SANDSTONE).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); - tag(Tags.Blocks.STONE).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE, Blocks.DEEPSLATE, Blocks.POLISHED_DEEPSLATE, Blocks.INFESTED_DEEPSLATE, Blocks.TUFF); - tag(Tags.Blocks.STORAGE_BLOCKS).addTags(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Blocks.STORAGE_BLOCKS_NETHERITE); - tag(Tags.Blocks.STORAGE_BLOCKS_AMETHYST).add(Blocks.AMETHYST_BLOCK); + tag(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE); + tag(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES).add(Blocks.FURNACE); + tag(Tags.Blocks.SANDS).addTags(Tags.Blocks.SANDS_COLORLESS, Tags.Blocks.SANDS_RED); + tag(Tags.Blocks.RELOCATION_NOT_SUPPORTED); + tag(Tags.Blocks.ROPES); + tag(Tags.Blocks.SANDS_COLORLESS).add(Blocks.SAND); + tag(Tags.Blocks.SANDS_RED).add(Blocks.RED_SAND); + + tag(Tags.Blocks.SANDSTONE_RED_BLOCKS).add(Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE); + tag(Tags.Blocks.SANDSTONE_BLOCKS).addTags(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS); + tag(Tags.Blocks.SANDSTONE_RED_SLABS).add(Blocks.RED_SANDSTONE_SLAB, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS).add(Blocks.SANDSTONE_SLAB, Blocks.CUT_SANDSTONE_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB); + tag(Tags.Blocks.SANDSTONE_SLABS).addTags(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Blocks.SANDSTONE_UNCOLORED_SLABS); + tag(Tags.Blocks.SANDSTONE_RED_STAIRS).add(Blocks.RED_SANDSTONE_STAIRS, Blocks.SMOOTH_RED_SANDSTONE_STAIRS); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS).add(Blocks.SANDSTONE_STAIRS, Blocks.SMOOTH_SANDSTONE_STAIRS); + tag(Tags.Blocks.SANDSTONE_STAIRS).addTags(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS); + + tag(Tags.Blocks.STONES).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.STONE, Blocks.DEEPSLATE, Blocks.TUFF); + tag(Tags.Blocks.STORAGE_BLOCKS).addTags(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Blocks.STORAGE_BLOCKS_COAL, + Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, + Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Blocks.STORAGE_BLOCKS_IRON, + Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, + Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Blocks.STORAGE_BLOCKS_REDSTONE, + Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Blocks.STORAGE_BLOCKS_WHEAT); + tag(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL).add(Blocks.BONE_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_COAL).add(Blocks.COAL_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_COPPER).add(Blocks.COPPER_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_DIAMOND).add(Blocks.DIAMOND_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP).add(Blocks.DRIED_KELP_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_EMERALD).add(Blocks.EMERALD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_GOLD).add(Blocks.GOLD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_IRON).add(Blocks.IRON_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_LAPIS).add(Blocks.LAPIS_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_QUARTZ).add(Blocks.QUARTZ_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER).add(Blocks.RAW_COPPER_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD).add(Blocks.RAW_GOLD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON).add(Blocks.RAW_IRON_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_REDSTONE).add(Blocks.REDSTONE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_SLIME).add(Blocks.SLIME_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_WHEAT).add(Blocks.HAY_BLOCK); + tag(Tags.Blocks.VILLAGER_JOB_SITES).add( + Blocks.BARREL, Blocks.BLAST_FURNACE, Blocks.BREWING_STAND, Blocks.CARTOGRAPHY_TABLE, + Blocks.CAULDRON, Blocks.WATER_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.POWDER_SNOW_CAULDRON, + Blocks.COMPOSTER, Blocks.FLETCHING_TABLE, Blocks.GRINDSTONE, Blocks.LECTERN, + Blocks.LOOM, Blocks.SMITHING_TABLE, Blocks.SMOKER, Blocks.STONECUTTER); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.Blocks.BARRELS); + tagWithOptionalLegacy(Tags.Blocks.BARRELS_WOODEN); + tagWithOptionalLegacy(Tags.Blocks.BOOKSHELVES); + tagWithOptionalLegacy(Tags.Blocks.CHESTS); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_ENDER); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_TRAPPED); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_WOODEN); + tag(Tags.Blocks.COBBLESTONES).addOptionalTag(new ResourceLocation("forge", "cobblestone")); + tag(Tags.Blocks.COBBLESTONES_NORMAL).addOptionalTag(new ResourceLocation("forge", "cobblestone/normal")); + tag(Tags.Blocks.COBBLESTONES_INFESTED).addOptionalTag(new ResourceLocation("forge", "cobblestone/infested")); + tag(Tags.Blocks.COBBLESTONES_MOSSY).addOptionalTag(new ResourceLocation("forge", "cobblestone/mossy")); + tag(Tags.Blocks.COBBLESTONES_DEEPSLATE).addOptionalTag(new ResourceLocation("forge", "cobblestone/deepslate")); + tag(Tags.Blocks.DYED_BLACK) + .addOptionalTag(new ResourceLocation("forge", "glass/black")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/black")); + tag(Tags.Blocks.DYED_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/blue")); + tag(Tags.Blocks.DYED_BROWN) + .addOptionalTag(new ResourceLocation("forge", "glass/brown")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/brown")); + tag(Tags.Blocks.DYED_CYAN) + .addOptionalTag(new ResourceLocation("forge", "glass/cyan")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/cyan")); + tag(Tags.Blocks.DYED_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/gray")); + tag(Tags.Blocks.DYED_GREEN) + .addOptionalTag(new ResourceLocation("forge", "glass/green")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/green")); + tag(Tags.Blocks.DYED_LIGHT_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/light_blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_blue")); + tag(Tags.Blocks.DYED_LIGHT_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/light_gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_gray")); + tag(Tags.Blocks.DYED_LIME) + .addOptionalTag(new ResourceLocation("forge", "glass/lime")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/lime")); + tag(Tags.Blocks.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Blocks.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Blocks.DYED_ORANGE) + .addOptionalTag(new ResourceLocation("forge", "glass/orange")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/orange")); + tag(Tags.Blocks.DYED_PINK) + .addOptionalTag(new ResourceLocation("forge", "glass/pink")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/pink")); + tag(Tags.Blocks.DYED_PURPLE) + .addOptionalTag(new ResourceLocation("forge", "glass/purple")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/purple")); + tag(Tags.Blocks.DYED_RED) + .addOptionalTag(new ResourceLocation("forge", "glass/red")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/red")); + tag(Tags.Blocks.DYED_WHITE) + .addOptionalTag(new ResourceLocation("forge", "glass/white")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/white")); + tag(Tags.Blocks.DYED_YELLOW) + .addOptionalTag(new ResourceLocation("forge", "glass/yellow")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/yellow")); + tagWithOptionalLegacy(Tags.Blocks.END_STONES); + tagWithOptionalLegacy(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST); + tagWithOptionalLegacy(Tags.Blocks.FENCE_GATES); + tagWithOptionalLegacy(Tags.Blocks.FENCE_GATES_WOODEN); + tagWithOptionalLegacy(Tags.Blocks.FENCES); + tagWithOptionalLegacy(Tags.Blocks.FENCES_NETHER_BRICK); + tagWithOptionalLegacy(Tags.Blocks.FENCES_WOODEN); + tag(Tags.Blocks.GRAVELS).addOptionalTag(new ResourceLocation("forge", "gravel")); + tag(Tags.Blocks.GLASS_BLOCKS).addOptionalTag(new ResourceLocation("forge", "glass")); + tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS).addOptionalTag(new ResourceLocation("forge", "glass_colorless")); + tag(Tags.Blocks.GLASS_BLOCKS_CHEAP).addOptionalTag(new ResourceLocation("forge", "glass_silica")); + tag(Tags.Blocks.GLASS_BLOCKS_TINTED).addOptionalTag(new ResourceLocation("forge", "glass_tinted")); + tag(Tags.Blocks.GLASS_PANES_COLORLESS).addOptionalTag(new ResourceLocation("forge", "glass_panes_colorless")); + tag(Tags.Blocks.NETHERRACKS).addOptionalTag(new ResourceLocation("forge", "netherrack")); + tag(Tags.Blocks.OBSIDIANS).addOptionalTag(new ResourceLocation("forge", "obsidian")); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_STONE); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_DENSE); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_SINGULAR); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_SPARSE); + tagWithOptionalLegacy(Tags.Blocks.ORES); + tagWithOptionalLegacy(Tags.Blocks.ORES_COAL); + tagWithOptionalLegacy(Tags.Blocks.ORES_COPPER); + tagWithOptionalLegacy(Tags.Blocks.ORES_DIAMOND); + tagWithOptionalLegacy(Tags.Blocks.ORES_EMERALD); + tagWithOptionalLegacy(Tags.Blocks.ORES_GOLD); + tagWithOptionalLegacy(Tags.Blocks.ORES_IRON); + tagWithOptionalLegacy(Tags.Blocks.ORES_LAPIS); + tagWithOptionalLegacy(Tags.Blocks.ORES_QUARTZ); + tagWithOptionalLegacy(Tags.Blocks.ORES_REDSTONE); + tagWithOptionalLegacy(Tags.Blocks.ORES_NETHERITE_SCRAP); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_NETHERRACK); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_STONE); + tagWithOptionalLegacy(Tags.Blocks.STONES); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_COAL); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_COPPER); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_DIAMOND); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_EMERALD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_GOLD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_IRON); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_LAPIS); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE); + tag(Tags.Blocks.RELOCATION_NOT_SUPPORTED) + .addOptionalTag(new ResourceLocation("forge", "relocation_not_supported")) + .addOptionalTag(new ResourceLocation("forge", "immovable")); + tag(Tags.Blocks.SANDSTONE_BLOCKS).addOptionalTag(new ResourceLocation("forge", "sandstone")); + tag(Tags.Blocks.SANDS).addOptionalTag(new ResourceLocation("forge", "sand")); + tag(Tags.Blocks.SANDS_COLORLESS).addOptionalTag(new ResourceLocation("forge", "sand/colorless")); + tag(Tags.Blocks.SANDS_RED).addOptionalTag(new ResourceLocation("forge", "sand/red")); + } + + private IntrinsicHolderTagsProvider.IntrinsicTagAppender tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; } - private void addColored(Consumer consumer, TagKey group, String pattern) { + private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); TagKey tag = getForgeTag(prefix + color.getName()); Block block = BuiltInRegistries.BLOCK.get(key); if (block == null || block == Blocks.AIR) - throw new IllegalStateException("Unknown vanilla block: " + key.toString()); + throw new IllegalStateException("Unknown vanilla block: " + key); tag(tag).add(block); - consumer.accept(block); + } + } + + private void addColoredTags(Consumer> consumer, TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + for (DyeColor color : DyeColor.values()) { + TagKey tag = getForgeTag(prefix + color.getName()); + consumer.accept(tag); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java index a0f1f41dbd..d662bed173 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java @@ -5,13 +5,13 @@ package net.neoforged.neoforge.common.data.internal; -import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Reference2IntMap; import java.util.Map; import java.util.concurrent.CompletableFuture; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.EntityType; @@ -22,6 +22,7 @@ import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.storage.loot.LootTable; import net.neoforged.fml.util.ObfuscationReflectionHelper; import net.neoforged.neoforge.common.data.DataMapProvider; import net.neoforged.neoforge.registries.datamaps.builtin.Compostable; @@ -48,15 +49,15 @@ protected void gather() { fuels.remove(ItemTags.NON_FLAMMABLE_WOOD); final var vibrationFrequencies = builder(NeoForgeDataMaps.VIBRATION_FREQUENCIES); - ((Object2IntMap) VibrationSystem.VIBRATION_FREQUENCY_FOR_EVENT) - .forEach((event, frequency) -> vibrationFrequencies.add(event.builtInRegistryHolder(), new VibrationFrequency(frequency), false)); + ((Reference2IntMap>) VibrationSystem.VIBRATION_FREQUENCY_FOR_EVENT) + .forEach((event, frequency) -> vibrationFrequencies.add(event, new VibrationFrequency(frequency), false)); final var imitations = builder(NeoForgeDataMaps.PARROT_IMITATIONS); ObfuscationReflectionHelper., SoundEvent>, Parrot>getPrivateValue(Parrot.class, null, "MOB_SOUND_MAP") .forEach((type, sound) -> imitations.add(type.builtInRegistryHolder(), new ParrotImitation(sound), false)); final var raidHeroGifts = builder(NeoForgeDataMaps.RAID_HERO_GIFTS); - ObfuscationReflectionHelper., GiveGiftToHero>getPrivateValue(GiveGiftToHero.class, null, "GIFTS") + ObfuscationReflectionHelper.>, GiveGiftToHero>getPrivateValue(GiveGiftToHero.class, null, "GIFTS") .forEach((type, lootTable) -> raidHeroGifts.add(BuiltInRegistries.VILLAGER_PROFESSION.wrapAsHolder(type), new RaidHeroGift(lootTable), false)); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java new file mode 100644 index 0000000000..97951ec035 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.world.item.enchantment.Enchantments; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.EnchantmentTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; + +public final class NeoForgeEnchantmentTagsProvider extends EnchantmentTagsProvider { + public NeoForgeEnchantmentTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, "neoforge", existingFileHelper); + } + + @Override + public void addTags(HolderLookup.Provider lookupProvider) { + tag(Tags.Enchantments.INCREASE_BLOCK_DROPS) + .add(Enchantments.FORTUNE); + tag(Tags.Enchantments.INCREASE_ENTITY_DROPS) + .add(Enchantments.LOOTING); + tag(Tags.Enchantments.WEAPON_DAMAGE_ENHANCEMENTS) + .add(Enchantments.SHARPNESS) + .add(Enchantments.SMITE) + .add(Enchantments.BANE_OF_ARTHROPODS) + .add(Enchantments.POWER) + .add(Enchantments.IMPALING); + tag(Tags.Enchantments.ENTITY_SPEED_ENHANCEMENTS) + .add(Enchantments.SOUL_SPEED) + .add(Enchantments.SWIFT_SNEAK) + .add(Enchantments.DEPTH_STRIDER); + tag(Tags.Enchantments.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS) + .add(Enchantments.FEATHER_FALLING) + .add(Enchantments.FROST_WALKER); + tag(Tags.Enchantments.ENTITY_DEFENSE_ENHANCEMENTS) + .add(Enchantments.PROTECTION) + .add(Enchantments.BLAST_PROTECTION) + .add(Enchantments.PROJECTILE_PROTECTION) + .add(Enchantments.FIRE_PROTECTION) + .add(Enchantments.RESPIRATION) + .add(Enchantments.FEATHER_FALLING); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java index 34483199bb..9f92c93c40 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java @@ -9,6 +9,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.EntityTypeTagsProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.common.data.ExistingFileHelper; @@ -21,5 +22,15 @@ public NeoForgeEntityTypeTagsProvider(PackOutput output, CompletableFuture tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java index 04e347e34b..c6e9debd07 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java @@ -11,6 +11,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; @@ -34,26 +35,46 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.BARRELS_WOODEN, Tags.Items.BARRELS_WOODEN); tag(Tags.Items.BONES).add(Items.BONE); copy(Tags.Blocks.BOOKSHELVES, Tags.Items.BOOKSHELVES); + tag(Tags.Items.BRICKS).addTags(Tags.Items.BRICKS_NORMAL, Tags.Items.BRICKS_NETHER); + tag(Tags.Items.BRICKS_NORMAL).add(Items.BRICK); + tag(Tags.Items.BRICKS_NETHER).add(Items.NETHER_BRICK); + copy(Tags.Blocks.BUDDING_BLOCKS, Tags.Items.BUDDING_BLOCKS); + copy(Tags.Blocks.BUDS, Tags.Items.BUDS); + copy(Tags.Blocks.CHAINS, Tags.Items.CHAINS); copy(Tags.Blocks.CHESTS, Tags.Items.CHESTS); copy(Tags.Blocks.CHESTS_ENDER, Tags.Items.CHESTS_ENDER); copy(Tags.Blocks.CHESTS_TRAPPED, Tags.Items.CHESTS_TRAPPED); copy(Tags.Blocks.CHESTS_WOODEN, Tags.Items.CHESTS_WOODEN); - copy(Tags.Blocks.COBBLESTONE, Tags.Items.COBBLESTONE); - copy(Tags.Blocks.COBBLESTONE_NORMAL, Tags.Items.COBBLESTONE_NORMAL); - copy(Tags.Blocks.COBBLESTONE_INFESTED, Tags.Items.COBBLESTONE_INFESTED); - copy(Tags.Blocks.COBBLESTONE_MOSSY, Tags.Items.COBBLESTONE_MOSSY); - copy(Tags.Blocks.COBBLESTONE_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE); + copy(Tags.Blocks.CLUSTERS, Tags.Items.CLUSTERS); + copy(Tags.Blocks.COBBLESTONES, Tags.Items.COBBLESTONES); + copy(Tags.Blocks.COBBLESTONES_NORMAL, Tags.Items.COBBLESTONES_NORMAL); + copy(Tags.Blocks.COBBLESTONES_INFESTED, Tags.Items.COBBLESTONES_INFESTED); + copy(Tags.Blocks.COBBLESTONES_MOSSY, Tags.Items.COBBLESTONES_MOSSY); + copy(Tags.Blocks.COBBLESTONES_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); tag(Tags.Items.CROPS).addTags(Tags.Items.CROPS_BEETROOT, Tags.Items.CROPS_CARROT, Tags.Items.CROPS_NETHER_WART, Tags.Items.CROPS_POTATO, Tags.Items.CROPS_WHEAT); tag(Tags.Items.CROPS_BEETROOT).add(Items.BEETROOT); tag(Tags.Items.CROPS_CARROT).add(Items.CARROT); tag(Tags.Items.CROPS_NETHER_WART).add(Items.NETHER_WART); tag(Tags.Items.CROPS_POTATO).add(Items.POTATO); tag(Tags.Items.CROPS_WHEAT).add(Items.WHEAT); - tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_PRISMARINE, Tags.Items.DUSTS_REDSTONE); + addColored(Tags.Items.DYED, "{color}_banner"); + addColored(Tags.Items.DYED, "{color}_bed"); + addColored(Tags.Items.DYED, "{color}_candle"); + addColored(Tags.Items.DYED, "{color}_carpet"); + addColored(Tags.Items.DYED, "{color}_concrete"); + addColored(Tags.Items.DYED, "{color}_concrete_powder"); + addColored(Tags.Items.DYED, "{color}_glazed_terracotta"); + addColored(Tags.Items.DYED, "{color}_shulker_box"); + addColored(Tags.Items.DYED, "{color}_stained_glass"); + addColored(Tags.Items.DYED, "{color}_stained_glass_pane"); + addColored(Tags.Items.DYED, "{color}_terracotta"); + addColored(Tags.Items.DYED, "{color}_wool"); + addColoredTags(tag(Tags.Items.DYED)::addTags, Tags.Items.DYED); + tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_REDSTONE); tag(Tags.Items.DUSTS_GLOWSTONE).add(Items.GLOWSTONE_DUST); - tag(Tags.Items.DUSTS_PRISMARINE).add(Items.PRISMARINE_SHARD); tag(Tags.Items.DUSTS_REDSTONE).add(Items.REDSTONE); - addColored(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES, "{color}_dye"); + addColored(Tags.Items.DYES, "{color}_dye"); + addColoredTags(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES); tag(Tags.Items.EGGS).add(Items.EGG); tag(Tags.Items.ENCHANTING_FUELS).addTag(Tags.Items.GEMS_LAPIS); copy(Tags.Blocks.END_STONES, Tags.Items.END_STONES); @@ -64,6 +85,25 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.FENCES, Tags.Items.FENCES); copy(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Items.FENCES_NETHER_BRICK); copy(Tags.Blocks.FENCES_WOODEN, Tags.Items.FENCES_WOODEN); + tag(Tags.Items.FOODS_FRUITS).add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE); + tag(Tags.Items.FOODS_VEGETABLES).add(Items.CARROT, Items.GOLDEN_CARROT, Items.POTATO, Items.MELON_SLICE, Items.BEETROOT); + tag(Tags.Items.FOODS_BERRIES).add(Items.SWEET_BERRIES, Items.GLOW_BERRIES); + tag(Tags.Items.FOODS_BREADS).add(Items.BREAD); + tag(Tags.Items.FOODS_COOKIES).add(Items.COOKIE); + tag(Tags.Items.FOODS_RAW_MEATS).add(Items.BEEF, Items.CHICKEN, Items.RABBIT, Items.MUTTON); + tag(Tags.Items.FOODS_RAW_FISHES).add(Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH); + tag(Tags.Items.FOODS_COOKED_MEATS).add(Items.COOKED_BEEF, Items.COOKED_CHICKEN, Items.COOKED_RABBIT, Items.COOKED_MUTTON); + tag(Tags.Items.FOODS_COOKED_FISHES).add(Items.COOKED_COD, Items.COOKED_SALMON); + tag(Tags.Items.FOODS_SOUPS).add(Items.BEETROOT_SOUP, Items.MUSHROOM_STEW, Items.RABBIT_STEW, Items.SUSPICIOUS_STEW); + tag(Tags.Items.FOODS_CANDIES); + tag(Tags.Items.FOODS_EDIBLE_WHEN_PLACED).add(Items.CAKE); + tag(Tags.Items.FOODS_FOOD_POISONING).add(Items.POISONOUS_POTATO, Items.PUFFERFISH, Items.SPIDER_EYE, Items.CHICKEN, Items.ROTTEN_FLESH); + tag(Tags.Items.FOODS) + .add(Items.BAKED_POTATO, Items.PUMPKIN_PIE, Items.HONEY_BOTTLE, Items.OMINOUS_BOTTLE, Items.DRIED_KELP) + .addTags(Tags.Items.FOODS_FRUITS, Tags.Items.FOODS_VEGETABLES, Tags.Items.FOODS_BERRIES, Tags.Items.FOODS_BREADS, Tags.Items.FOODS_COOKIES, + Tags.Items.FOODS_RAW_MEATS, Tags.Items.FOODS_RAW_FISHES, Tags.Items.FOODS_COOKED_MEATS, Tags.Items.FOODS_COOKED_FISHES, + Tags.Items.FOODS_SOUPS, Tags.Items.FOODS_CANDIES, + Tags.Items.FOODS_EDIBLE_WHEN_PLACED, Tags.Items.FOODS_FOOD_POISONING); tag(Tags.Items.GEMS).addTags(Tags.Items.GEMS_AMETHYST, Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_EMERALD, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_PRISMARINE, Tags.Items.GEMS_QUARTZ); tag(Tags.Items.GEMS_AMETHYST).add(Items.AMETHYST_SHARD); tag(Tags.Items.GEMS_DIAMOND).add(Items.DIAMOND); @@ -71,30 +111,28 @@ public void addTags(HolderLookup.Provider lookupProvider) { tag(Tags.Items.GEMS_LAPIS).add(Items.LAPIS_LAZULI); tag(Tags.Items.GEMS_PRISMARINE).add(Items.PRISMARINE_CRYSTALS); tag(Tags.Items.GEMS_QUARTZ).add(Items.QUARTZ); - copy(Tags.Blocks.GLASS, Tags.Items.GLASS); - copy(Tags.Blocks.GLASS_TINTED, Tags.Items.GLASS_TINTED); - copy(Tags.Blocks.GLASS_SILICA, Tags.Items.GLASS_SILICA); - copyColored(Tags.Blocks.GLASS, Tags.Items.GLASS); + copy(Tags.Blocks.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS); + copy(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Items.GLASS_BLOCKS_COLORLESS); + copy(Tags.Blocks.GLASS_BLOCKS_TINTED, Tags.Items.GLASS_BLOCKS_TINTED); + copy(Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Items.GLASS_BLOCKS_CHEAP); copy(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES); - copyColored(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES); - copy(Tags.Blocks.GRAVEL, Tags.Items.GRAVEL); - tag(Tags.Items.GUNPOWDER).add(Items.GUNPOWDER); - tag(Tags.Items.HEADS).add(Items.CREEPER_HEAD, Items.DRAGON_HEAD, Items.PLAYER_HEAD, Items.SKELETON_SKULL, Items.WITHER_SKELETON_SKULL, Items.ZOMBIE_HEAD); - tag(Tags.Items.INGOTS).addTags(Tags.Items.INGOTS_BRICK, Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE, Tags.Items.INGOTS_NETHER_BRICK); - tag(Tags.Items.INGOTS_BRICK).add(Items.BRICK); + copy(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS); + copy(Tags.Blocks.GRAVELS, Tags.Items.GRAVELS); + tag(Tags.Items.GUNPOWDERS).add(Items.GUNPOWDER); + tag(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS); + tag(Tags.Items.INGOTS).addTags(Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE); tag(Tags.Items.INGOTS_COPPER).add(Items.COPPER_INGOT); tag(Tags.Items.INGOTS_GOLD).add(Items.GOLD_INGOT); tag(Tags.Items.INGOTS_IRON).add(Items.IRON_INGOT); tag(Tags.Items.INGOTS_NETHERITE).add(Items.NETHERITE_INGOT); - tag(Tags.Items.INGOTS_NETHER_BRICK).add(Items.NETHER_BRICK); - tag(Tags.Items.LEATHER).add(Items.LEATHER); + tag(Tags.Items.LEATHERS).add(Items.LEATHER); tag(Tags.Items.MUSHROOMS).add(Items.BROWN_MUSHROOM, Items.RED_MUSHROOM); tag(Tags.Items.NETHER_STARS).add(Items.NETHER_STAR); - copy(Tags.Blocks.NETHERRACK, Tags.Items.NETHERRACK); - tag(Tags.Items.NUGGETS).addTags(Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_GOLD); + copy(Tags.Blocks.NETHERRACKS, Tags.Items.NETHERRACKS); + tag(Tags.Items.NUGGETS).addTags(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON); tag(Tags.Items.NUGGETS_IRON).add(Items.IRON_NUGGET); tag(Tags.Items.NUGGETS_GOLD).add(Items.GOLD_NUGGET); - copy(Tags.Blocks.OBSIDIAN, Tags.Items.OBSIDIAN); + copy(Tags.Blocks.OBSIDIANS, Tags.Items.OBSIDIANS); copy(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, Tags.Items.ORE_BEARING_GROUND_DEEPSLATE); copy(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, Tags.Items.ORE_BEARING_GROUND_NETHERRACK); copy(Tags.Blocks.ORE_BEARING_GROUND_STONE, Tags.Items.ORE_BEARING_GROUND_STONE); @@ -115,80 +153,220 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, Tags.Items.ORES_IN_GROUND_DEEPSLATE); copy(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, Tags.Items.ORES_IN_GROUND_NETHERRACK); copy(Tags.Blocks.ORES_IN_GROUND_STONE, Tags.Items.ORES_IN_GROUND_STONE); + copy(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES); + copy(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, Tags.Items.PLAYER_WORKSTATIONS_FURNACES); + tag(Tags.Items.RAW_BLOCKS).addTags(Tags.Items.RAW_BLOCKS_COPPER, Tags.Items.RAW_BLOCKS_GOLD, Tags.Items.RAW_BLOCKS_IRON); + tag(Tags.Items.RAW_BLOCKS_COPPER).add(Items.RAW_COPPER_BLOCK); + tag(Tags.Items.RAW_BLOCKS_GOLD).add(Items.RAW_GOLD_BLOCK); + tag(Tags.Items.RAW_BLOCKS_IRON).add(Items.RAW_IRON_BLOCK); tag(Tags.Items.RAW_MATERIALS).addTags(Tags.Items.RAW_MATERIALS_COPPER, Tags.Items.RAW_MATERIALS_GOLD, Tags.Items.RAW_MATERIALS_IRON); tag(Tags.Items.RAW_MATERIALS_COPPER).add(Items.RAW_COPPER); tag(Tags.Items.RAW_MATERIALS_GOLD).add(Items.RAW_GOLD); tag(Tags.Items.RAW_MATERIALS_IRON).add(Items.RAW_IRON); - tag(Tags.Items.RODS).addTags(Tags.Items.RODS_BLAZE, Tags.Items.RODS_WOODEN); + tag(Tags.Items.RODS).addTags(Tags.Items.RODS_WOODEN, Tags.Items.RODS_BLAZE, Tags.Items.RODS_BREEZE); tag(Tags.Items.RODS_BLAZE).add(Items.BLAZE_ROD); + tag(Tags.Items.RODS_BREEZE).add(Items.BREEZE_ROD); tag(Tags.Items.RODS_WOODEN).add(Items.STICK); - copy(Tags.Blocks.SAND, Tags.Items.SAND); - copy(Tags.Blocks.SAND_COLORLESS, Tags.Items.SAND_COLORLESS); - copy(Tags.Blocks.SAND_RED, Tags.Items.SAND_RED); - copy(Tags.Blocks.SANDSTONE, Tags.Items.SANDSTONE); + copy(Tags.Blocks.ROPES, Tags.Items.ROPES); + copy(Tags.Blocks.SANDS, Tags.Items.SANDS); + copy(Tags.Blocks.SANDS_COLORLESS, Tags.Items.SANDS_COLORLESS); + copy(Tags.Blocks.SANDS_RED, Tags.Items.SANDS_RED); + copy(Tags.Blocks.SANDSTONE_BLOCKS, Tags.Items.SANDSTONE_BLOCKS); + copy(Tags.Blocks.SANDSTONE_SLABS, Tags.Items.SANDSTONE_SLABS); + copy(Tags.Blocks.SANDSTONE_STAIRS, Tags.Items.SANDSTONE_STAIRS); + copy(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Items.SANDSTONE_RED_BLOCKS); + copy(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Items.SANDSTONE_RED_SLABS); + copy(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Items.SANDSTONE_RED_STAIRS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, Tags.Items.SANDSTONE_UNCOLORED_BLOCKS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, Tags.Items.SANDSTONE_UNCOLORED_SLABS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, Tags.Items.SANDSTONE_UNCOLORED_STAIRS); tag(Tags.Items.SEEDS).addTags(Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, Tags.Items.SEEDS_WHEAT); tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(Tags.Items.SHEARS).add(Items.SHEARS); tag(Tags.Items.SLIMEBALLS).add(Items.SLIME_BALL); - copy(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS); - copy(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES); - copy(Tags.Blocks.STONE, Tags.Items.STONE); + copy(Tags.Blocks.STONES, Tags.Items.STONES); copy(Tags.Blocks.STORAGE_BLOCKS, Tags.Items.STORAGE_BLOCKS); - copy(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Items.STORAGE_BLOCKS_AMETHYST); + copy(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Items.STORAGE_BLOCKS_BONE_MEAL); copy(Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Items.STORAGE_BLOCKS_COAL); copy(Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Items.STORAGE_BLOCKS_COPPER); copy(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Items.STORAGE_BLOCKS_DIAMOND); + copy(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, Tags.Items.STORAGE_BLOCKS_DRIED_KELP); copy(Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Items.STORAGE_BLOCKS_EMERALD); copy(Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Items.STORAGE_BLOCKS_GOLD); copy(Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Items.STORAGE_BLOCKS_IRON); copy(Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Items.STORAGE_BLOCKS_LAPIS); - copy(Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Items.STORAGE_BLOCKS_QUARTZ); - copy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE); + copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Items.STORAGE_BLOCKS_RAW_COPPER); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Items.STORAGE_BLOCKS_RAW_GOLD); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON); - copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE); - tag(Tags.Items.STRING).add(Items.STRING); + copy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE); + copy(Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Items.STORAGE_BLOCKS_SLIME); + copy(Tags.Blocks.STORAGE_BLOCKS_WHEAT, Tags.Items.STORAGE_BLOCKS_WHEAT); + tag(Tags.Items.STRINGS).add(Items.STRING); + tag(Tags.Items.VILLAGER_JOB_SITES).add( + Items.BARREL, Items.BLAST_FURNACE, Items.BREWING_STAND, Items.CARTOGRAPHY_TABLE, + Items.CAULDRON, Items.COMPOSTER, Items.FLETCHING_TABLE, Items.GRINDSTONE, + Items.LECTERN, Items.LOOM, Items.SMITHING_TABLE, Items.SMOKER, Items.STONECUTTER); + + // Tools and Armors tag(Tags.Items.TOOLS_SHIELDS).add(Items.SHIELD); tag(Tags.Items.TOOLS_BOWS).add(Items.BOW); + tag(Tags.Items.TOOLS_BRUSHES).add(Items.BRUSH); tag(Tags.Items.TOOLS_CROSSBOWS).add(Items.CROSSBOW); tag(Tags.Items.TOOLS_FISHING_RODS).add(Items.FISHING_ROD); - tag(Tags.Items.TOOLS_TRIDENTS).add(Items.TRIDENT); + tag(Tags.Items.TOOLS_SHEARS).add(Items.SHEARS); + tag(Tags.Items.TOOLS_SPEARS).add(Items.TRIDENT); tag(Tags.Items.TOOLS) - .addTags(ItemTags.SWORDS, ItemTags.AXES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.HOES) - .addTags(Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_TRIDENTS); - tag(Tags.Items.ARMORS_HELMETS).add(Items.LEATHER_HELMET, Items.TURTLE_HELMET, Items.CHAINMAIL_HELMET, Items.IRON_HELMET, Items.GOLDEN_HELMET, Items.DIAMOND_HELMET, Items.NETHERITE_HELMET); - tag(Tags.Items.ARMORS_CHESTPLATES).add(Items.LEATHER_CHESTPLATE, Items.CHAINMAIL_CHESTPLATE, Items.IRON_CHESTPLATE, Items.GOLDEN_CHESTPLATE, Items.DIAMOND_CHESTPLATE, Items.NETHERITE_CHESTPLATE); - tag(Tags.Items.ARMORS_LEGGINGS).add(Items.LEATHER_LEGGINGS, Items.CHAINMAIL_LEGGINGS, Items.IRON_LEGGINGS, Items.GOLDEN_LEGGINGS, Items.DIAMOND_LEGGINGS, Items.NETHERITE_LEGGINGS); - tag(Tags.Items.ARMORS_BOOTS).add(Items.LEATHER_BOOTS, Items.CHAINMAIL_BOOTS, Items.IRON_BOOTS, Items.GOLDEN_BOOTS, Items.DIAMOND_BOOTS, Items.NETHERITE_BOOTS); - tag(Tags.Items.ARMORS).addTags(Tags.Items.ARMORS_HELMETS, Tags.Items.ARMORS_CHESTPLATES, Tags.Items.ARMORS_LEGGINGS, Tags.Items.ARMORS_BOOTS); + .addTags(ItemTags.AXES, ItemTags.HOES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.SWORDS) + .addTags(Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_BRUSHES, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_SHEARS, Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_SPEARS); + tag(Tags.Items.ARMORS).addTags(ItemTags.HEAD_ARMOR, ItemTags.CHEST_ARMOR, ItemTags.LEG_ARMOR, ItemTags.FOOT_ARMOR); + tag(Tags.Items.ENCHANTABLES).addTags(ItemTags.ARMOR_ENCHANTABLE, ItemTags.EQUIPPABLE_ENCHANTABLE, ItemTags.WEAPON_ENCHANTABLE, ItemTags.SWORD_ENCHANTABLE, ItemTags.MINING_ENCHANTABLE, ItemTags.MINING_LOOT_ENCHANTABLE, ItemTags.FISHING_ENCHANTABLE, ItemTags.TRIDENT_ENCHANTABLE, ItemTags.BOW_ENCHANTABLE, ItemTags.CROSSBOW_ENCHANTABLE, ItemTags.FIRE_ASPECT_ENCHANTABLE, ItemTags.DURABILITY_ENCHANTABLE).addOptionalTag(ItemTags.MACE_ENCHANTABLE); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.Items.BONES); + tag(Tags.Items.BRICKS_NORMAL).addOptionalTag(new ResourceLocation("forge", "ingots/brick")); + tag(Tags.Items.BRICKS_NETHER).addOptionalTag(new ResourceLocation("forge", "ingots/nether_brick")); + tagWithOptionalLegacy(Tags.Items.CROPS); + tagWithOptionalLegacy(Tags.Items.CROPS_BEETROOT); + tagWithOptionalLegacy(Tags.Items.CROPS_CARROT); + tagWithOptionalLegacy(Tags.Items.CROPS_NETHER_WART); + tagWithOptionalLegacy(Tags.Items.CROPS_POTATO); + tagWithOptionalLegacy(Tags.Items.CROPS_WHEAT); + tagWithOptionalLegacy(Tags.Items.DUSTS); + tagWithOptionalLegacy(Tags.Items.DUSTS_GLOWSTONE); + tagWithOptionalLegacy(Tags.Items.DUSTS_REDSTONE); + tagColoredWithOptionalLegacy(Tags.Items.DYES); + tag(Tags.Items.DYED_BLACK) + .addOptionalTag(new ResourceLocation("forge", "glass/black")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/black")); + tag(Tags.Items.DYED_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/blue")); + tag(Tags.Items.DYED_BROWN) + .addOptionalTag(new ResourceLocation("forge", "glass/brown")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/brown")); + tag(Tags.Items.DYED_CYAN) + .addOptionalTag(new ResourceLocation("forge", "glass/cyan")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/cyan")); + tag(Tags.Items.DYED_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/gray")); + tag(Tags.Items.DYED_GREEN) + .addOptionalTag(new ResourceLocation("forge", "glass/green")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/green")); + tag(Tags.Items.DYED_LIGHT_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/light_blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_blue")); + tag(Tags.Items.DYED_LIGHT_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/light_gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_gray")); + tag(Tags.Items.DYED_LIME) + .addOptionalTag(new ResourceLocation("forge", "glass/lime")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/lime")); + tag(Tags.Items.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Items.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Items.DYED_ORANGE) + .addOptionalTag(new ResourceLocation("forge", "glass/orange")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/orange")); + tag(Tags.Items.DYED_PINK) + .addOptionalTag(new ResourceLocation("forge", "glass/pink")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/pink")); + tag(Tags.Items.DYED_PURPLE) + .addOptionalTag(new ResourceLocation("forge", "glass/purple")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/purple")); + tag(Tags.Items.DYED_RED) + .addOptionalTag(new ResourceLocation("forge", "glass/red")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/red")); + tag(Tags.Items.DYED_WHITE) + .addOptionalTag(new ResourceLocation("forge", "glass/white")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/white")); + tag(Tags.Items.DYED_YELLOW) + .addOptionalTag(new ResourceLocation("forge", "glass/yellow")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/yellow")); + tagWithOptionalLegacy(Tags.Items.ENDER_PEARLS); + tagWithOptionalLegacy(Tags.Items.FEATHERS); + tagWithOptionalLegacy(Tags.Items.GEMS); + tagWithOptionalLegacy(Tags.Items.GEMS_AMETHYST); + tagWithOptionalLegacy(Tags.Items.GEMS_DIAMOND); + tagWithOptionalLegacy(Tags.Items.GEMS_EMERALD); + tagWithOptionalLegacy(Tags.Items.GEMS_LAPIS); + tagWithOptionalLegacy(Tags.Items.GEMS_PRISMARINE); + tagWithOptionalLegacy(Tags.Items.GEMS_QUARTZ); + tagWithOptionalLegacy(Tags.Items.GUNPOWDERS); + tagWithOptionalLegacy(Tags.Items.INGOTS); + tagWithOptionalLegacy(Tags.Items.INGOTS_COPPER); + tagWithOptionalLegacy(Tags.Items.INGOTS_GOLD); + tagWithOptionalLegacy(Tags.Items.INGOTS_IRON); + tagWithOptionalLegacy(Tags.Items.INGOTS_NETHERITE); + tag(Tags.Items.LEATHERS).addOptionalTag(new ResourceLocation("forge", "leather")); + tagWithOptionalLegacy(Tags.Items.MUSHROOMS); + tagWithOptionalLegacy(Tags.Items.NETHER_STARS); + tagWithOptionalLegacy(Tags.Items.NUGGETS); + tagWithOptionalLegacy(Tags.Items.NUGGETS_IRON); + tagWithOptionalLegacy(Tags.Items.NUGGETS_GOLD); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_COPPER); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_GOLD); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_IRON); + tagWithOptionalLegacy(Tags.Items.RODS); + tagWithOptionalLegacy(Tags.Items.RODS_BLAZE); + tagWithOptionalLegacy(Tags.Items.RODS_WOODEN); + tagWithOptionalLegacy(Tags.Items.SEEDS); + tagWithOptionalLegacy(Tags.Items.SEEDS_BEETROOT); + tagWithOptionalLegacy(Tags.Items.SEEDS_MELON); + tagWithOptionalLegacy(Tags.Items.SEEDS_PUMPKIN); + tagWithOptionalLegacy(Tags.Items.SEEDS_WHEAT); + tagWithOptionalLegacy(Tags.Items.SLIMEBALLS); + tagWithOptionalLegacy(Tags.Items.STRINGS); + tagWithOptionalLegacy(Tags.Items.TOOLS_SHIELDS); + tagWithOptionalLegacy(Tags.Items.TOOLS_BOWS); + tagWithOptionalLegacy(Tags.Items.TOOLS_CROSSBOWS); + tagWithOptionalLegacy(Tags.Items.TOOLS_FISHING_RODS); + tag(Tags.Items.TOOLS_SHEARS).addOptionalTag(new ResourceLocation("forge", "shears")); + tag(Tags.Items.TOOLS_SPEARS).addOptionalTag(new ResourceLocation("forge", "tools/tridents")); + tagWithOptionalLegacy(Tags.Items.TOOLS); + tagWithOptionalLegacy(Tags.Items.ARMORS); } - private void addColored(Consumer> consumer, TagKey group, String pattern) { + private IntrinsicHolderTagsProvider.IntrinsicTagAppender tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; + } + + private void tagColoredWithOptionalLegacy(TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + for (DyeColor color : DyeColor.values()) { + TagKey tag = getForgeItemTag(prefix + color.getName()); + tagWithOptionalLegacy(tag); + } + } + + private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); TagKey tag = getForgeItemTag(prefix + color.getName()); Item item = BuiltInRegistries.ITEM.get(key); if (item == null || item == Items.AIR) - throw new IllegalStateException("Unknown vanilla item: " + key.toString()); + throw new IllegalStateException("Unknown vanilla item: " + key); tag(tag).add(item); - consumer.accept(tag); } } - private void copyColored(TagKey blockGroup, TagKey itemGroup) { - String blockPre = blockGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; - String itemPre = itemGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + private void addColoredTags(Consumer> consumer, TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { - TagKey from = getForgeBlockTag(blockPre + color.getName()); - TagKey to = getForgeItemTag(itemPre + color.getName()); - copy(from, to); + TagKey tag = getForgeItemTag(prefix + color.getName()); + consumer.accept(tag); } - copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless")); } @SuppressWarnings("unchecked") @@ -210,4 +388,9 @@ private TagKey getForgeItemTag(String name) { throw new IllegalStateException(Tags.Items.class.getName() + " is missing tag name: " + name); } } + + @Override + public String getName() { + return "Neoforge Item Tags"; + } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java new file mode 100644 index 0000000000..1162409662 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java @@ -0,0 +1,420 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.Locale; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DyeColor; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.LanguageProvider; +import org.apache.commons.lang3.StringUtils; + +public final class NeoForgeLanguageProvider extends LanguageProvider { + public NeoForgeLanguageProvider(PackOutput gen) { + super(gen, "c", "en_us"); + } + + @Override + protected void addTranslations() { + // Blocks + add(Tags.Blocks.BARRELS, "Barrels"); + add(Tags.Blocks.BARRELS_WOODEN, "Wooden Barrels"); + add(Tags.Blocks.BOOKSHELVES, "Bookshelves"); + add(Tags.Blocks.BUDDING_BLOCKS, "Budding Blocks"); + add(Tags.Blocks.BUDS, "Buds"); + add(Tags.Blocks.CHAINS, "Chains"); + add(Tags.Blocks.CHESTS, "Chests"); + add(Tags.Blocks.CHESTS_ENDER, "Ender Chests"); + add(Tags.Blocks.CHESTS_TRAPPED, "Trapped Chests"); + add(Tags.Blocks.CHESTS_WOODEN, "Wooden Chests"); + add(Tags.Blocks.CLUSTERS, "Clusters"); + add(Tags.Blocks.COBBLESTONES, "Cobblestones"); + add(Tags.Blocks.COBBLESTONES_NORMAL, "Normal Cobblestones"); + add(Tags.Blocks.COBBLESTONES_INFESTED, "Infested Cobblestones"); + add(Tags.Blocks.COBBLESTONES_MOSSY, "Mossy Cobblestones"); + add(Tags.Blocks.COBBLESTONES_DEEPSLATE, "Deepslate Cobblestones"); + add(Tags.Blocks.DYED, "Dyed Blocks"); + addColored(Tags.Blocks.DYED, "{color} Dyed Blocks"); + add(Tags.Blocks.END_STONES, "End Stones"); + add(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST, "Enderman Place On Blacklist"); + add(Tags.Blocks.FENCE_GATES, "Fence Gates"); + add(Tags.Blocks.FENCE_GATES_WOODEN, "Wooden Fence Gates"); + add(Tags.Blocks.FENCES, "Fences"); + add(Tags.Blocks.FENCES_NETHER_BRICK, "Fences Nether Brick"); + add(Tags.Blocks.FENCES_WOODEN, "Wooden Fences"); + add(Tags.Blocks.GLASS_BLOCKS, "Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_COLORLESS, "Colorless Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_CHEAP, "Silica Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_TINTED, "Tinted Glass Blocks"); + add(Tags.Blocks.GLASS_PANES, "Glass Panes"); + add(Tags.Blocks.GLASS_PANES_COLORLESS, "Colorless Glass Panes"); + add(Tags.Blocks.GRAVELS, "Gravels"); + add(Tags.Blocks.SKULLS, "Skulls"); + add(Tags.Blocks.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + add(Tags.Blocks.NETHERRACKS, "Netherracks"); + add(Tags.Blocks.NEEDS_WOOD_TOOL, "Needs Wooden Tools"); + add(Tags.Blocks.NEEDS_GOLD_TOOL, "Needs Gold Tools"); + add(Tags.Blocks.NEEDS_NETHERITE_TOOL, "Needs Netherite Tools"); + add(Tags.Blocks.OBSIDIANS, "Obsidians"); + add(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, "Deepslate Ore Bearing Ground"); + add(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, "Netherrack Ore Bearing Ground"); + add(Tags.Blocks.ORE_BEARING_GROUND_STONE, "Stone Ore Bearing Ground"); + add(Tags.Blocks.ORE_RATES_DENSE, "Dense Ore Rates"); + add(Tags.Blocks.ORE_RATES_SINGULAR, "Singular Ore Rates"); + add(Tags.Blocks.ORE_RATES_SPARSE, "Sparse Ore Rates"); + add(Tags.Blocks.ORES, "Ores"); + add(Tags.Blocks.ORES_COAL, "Coal Ores"); + add(Tags.Blocks.ORES_COPPER, "Copper Ores"); + add(Tags.Blocks.ORES_DIAMOND, "Diamond Ores"); + add(Tags.Blocks.ORES_EMERALD, "Emerald Ores"); + add(Tags.Blocks.ORES_GOLD, "Gold Ores"); + add(Tags.Blocks.ORES_IRON, "Iron Ores"); + add(Tags.Blocks.ORES_LAPIS, "Lapis Ores"); + add(Tags.Blocks.ORES_QUARTZ, "Quartz Ores"); + add(Tags.Blocks.ORES_REDSTONE, "Redstone Ores"); + add(Tags.Blocks.ORES_NETHERITE_SCRAP, "Netherite Scrap Ores"); + add(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, "Deepslate Ores In Ground"); + add(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, "Netherrack Ores In Ground"); + add(Tags.Blocks.ORES_IN_GROUND_STONE, "Stone Ores In Ground"); + add(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + add(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + add(Tags.Blocks.RELOCATION_NOT_SUPPORTED, "Relocation Not Supported"); + add(Tags.Blocks.ROPES, "Ropes"); + add(Tags.Blocks.SANDS, "Sands"); + add(Tags.Blocks.SANDS_COLORLESS, "Colorless Sands"); + add(Tags.Blocks.SANDS_RED, "Red Sands"); + add(Tags.Blocks.SANDSTONE_BLOCKS, "Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_SLABS, "Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_STAIRS, "Sandstone Stairs"); + add(Tags.Blocks.SANDSTONE_RED_BLOCKS, "Red Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_RED_SLABS, "Red Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_RED_STAIRS, "Red Sandstone Stairs"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, "Uncolored Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, "Uncolored Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, "Uncolored Sandstone Stairs"); + add(Tags.Blocks.STONES, "Stones"); + add(Tags.Blocks.STORAGE_BLOCKS, "Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + + // Items + add(Tags.Items.BARRELS, "Barrels"); + add(Tags.Items.BARRELS_WOODEN, "Wooden Barrels"); + add(Tags.Items.BONES, "Bones"); + add(Tags.Items.BOOKSHELVES, "Bookshelves"); + add(Tags.Items.BRICKS, "Bricks"); + add(Tags.Items.BRICKS_NORMAL, "Normal Bricks"); + add(Tags.Items.BRICKS_NETHER, "Nether Bricks"); + add(Tags.Items.BUDDING_BLOCKS, "Budding Blocks"); + add(Tags.Items.BUDS, "Buds"); + add(Tags.Items.CHAINS, "Chains"); + add(Tags.Items.CHESTS, "Chests"); + add(Tags.Items.CHESTS_ENDER, "Ender Chests"); + add(Tags.Items.CHESTS_TRAPPED, "Trapped Chests"); + add(Tags.Items.CHESTS_WOODEN, "Wooden Chests"); + add(Tags.Items.CLUSTERS, "Clusters"); + add(Tags.Items.COBBLESTONES, "Cobblestones"); + add(Tags.Items.COBBLESTONES_NORMAL, "Normal Cobblestones"); + add(Tags.Items.COBBLESTONES_INFESTED, "Infested Cobblestones"); + add(Tags.Items.COBBLESTONES_MOSSY, "Mossy Cobblestones"); + add(Tags.Items.COBBLESTONES_DEEPSLATE, "Deepslate Cobblestones"); + add(Tags.Items.CROPS, "Crops"); + add(Tags.Items.CROPS_BEETROOT, "Beetroot Crops"); + add(Tags.Items.CROPS_CARROT, "Carrot Crops"); + add(Tags.Items.CROPS_NETHER_WART, "Nether Wart Crops"); + add(Tags.Items.CROPS_POTATO, "Potato Crops"); + add(Tags.Items.CROPS_WHEAT, "Wheat Crops"); + add(Tags.Items.DUSTS, "Dusts"); + add(Tags.Items.DUSTS_GLOWSTONE, "Glowstone Dusts"); + add(Tags.Items.DUSTS_REDSTONE, "Redstone Dusts"); + add(Tags.Items.DYED, "Dyed Items"); + addColored(Tags.Items.DYED, "{color} Dyed Items"); + add(Tags.Items.EGGS, "Eggs"); + add(Tags.Items.ENCHANTING_FUELS, "Enchanting Fuels"); + add(Tags.Items.END_STONES, "End Stones"); + add(Tags.Items.ENDER_PEARLS, "Ender Pearls"); + add(Tags.Items.FEATHERS, "Feathers"); + add(Tags.Items.FENCE_GATES, "Fence Gates"); + add(Tags.Items.FENCE_GATES_WOODEN, "Wooden Fence Gates"); + add(Tags.Items.FENCES, "Fences"); + add(Tags.Items.FENCES_NETHER_BRICK, "Nether Brick Fences"); + add(Tags.Items.FENCES_WOODEN, "Wooden Fences"); + add(Tags.Items.FOODS, "Foods"); + add(Tags.Items.FOODS_BERRIES, "Berries"); + add(Tags.Items.FOODS_BREADS, "Breads"); + add(Tags.Items.FOODS_CANDIES, "Candies"); + add(Tags.Items.FOODS_COOKED_FISHES, "Cooked Fishes"); + add(Tags.Items.FOODS_COOKED_MEATS, "Cooked Meats"); + add(Tags.Items.FOODS_COOKIES, "Cookies"); + add(Tags.Items.FOODS_EDIBLE_WHEN_PLACED, "Edible When Placed"); + add(Tags.Items.FOODS_FOOD_POISONING, "Food Poisoning Foods"); + add(Tags.Items.FOODS_FRUITS, "Fruits"); + add(Tags.Items.FOODS_RAW_FISHES, "Raw Fishes"); + add(Tags.Items.FOODS_RAW_MEATS, "Raw Meats"); + add(Tags.Items.FOODS_SOUPS, "Soups"); + add(Tags.Items.FOODS_VEGETABLES, "Vegetables"); + add(Tags.Items.GEMS, "Gems"); + add(Tags.Items.GEMS_AMETHYST, "Amethyst Gems"); + add(Tags.Items.GEMS_DIAMOND, "Diamond Gems"); + add(Tags.Items.GEMS_EMERALD, "Emerald Gems"); + add(Tags.Items.GEMS_LAPIS, "Lapis Gems"); + add(Tags.Items.GEMS_PRISMARINE, "Prismarine Gems"); + add(Tags.Items.GEMS_QUARTZ, "Quartz Gems"); + add(Tags.Items.GLASS_BLOCKS, "Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_TINTED, "Tinted Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_CHEAP, "Cheap Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_COLORLESS, "Colorless Glass Blocks"); + add(Tags.Items.GLASS_PANES, "Glass Panes"); + add(Tags.Items.GLASS_PANES_COLORLESS, "Colorless Glass Panes"); + add(Tags.Items.GRAVELS, "Gravels"); + add(Tags.Items.GUNPOWDERS, "Gunpowders"); + add(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + add(Tags.Items.INGOTS, "Ingots"); + add(Tags.Items.INGOTS_COPPER, "Copper Ingots"); + add(Tags.Items.INGOTS_GOLD, "Gold Ingots"); + add(Tags.Items.INGOTS_IRON, "Iron Ingots"); + add(Tags.Items.INGOTS_NETHERITE, "Netherite Ingots"); + add(Tags.Items.LEATHERS, "Leathers"); + add(Tags.Items.MUSHROOMS, "Mushrooms"); + add(Tags.Items.NETHER_STARS, "Nether Stars"); + add(Tags.Items.NETHERRACKS, "Netherracks"); + add(Tags.Items.NUGGETS, "Nuggets"); + add(Tags.Items.NUGGETS_IRON, "Iron Nuggets"); + add(Tags.Items.NUGGETS_GOLD, "Gold Nuggets"); + add(Tags.Items.OBSIDIANS, "Obsidians"); + add(Tags.Items.ORE_BEARING_GROUND_DEEPSLATE, "Deepslate Ore Bearing Ground"); + add(Tags.Items.ORE_BEARING_GROUND_NETHERRACK, "Netherrack Ore Bearing Ground"); + add(Tags.Items.ORE_BEARING_GROUND_STONE, "Stone Ore Bearing Ground"); + add(Tags.Items.ORE_RATES_DENSE, "Dense Ore Rates"); + add(Tags.Items.ORE_RATES_SINGULAR, "Singular Ore Rates"); + add(Tags.Items.ORE_RATES_SPARSE, "Sparse Ore Rates"); + add(Tags.Items.ORES, "Ores"); + add(Tags.Items.ORES_COAL, "Coal Ores"); + add(Tags.Items.ORES_COPPER, "Copper Ores"); + add(Tags.Items.ORES_DIAMOND, "Diamond Ores"); + add(Tags.Items.ORES_EMERALD, "Emerald Ores"); + add(Tags.Items.ORES_GOLD, "Gold Ores"); + add(Tags.Items.ORES_IRON, "Iron Ores"); + add(Tags.Items.ORES_LAPIS, "Lapis Ores"); + add(Tags.Items.ORES_QUARTZ, "Quartz Ores"); + add(Tags.Items.ORES_REDSTONE, "Redstone Ores"); + add(Tags.Items.ORES_NETHERITE_SCRAP, "Netherite Scrap Ores"); + add(Tags.Items.ORES_IN_GROUND_DEEPSLATE, "Deepslate Ores In Ground"); + add(Tags.Items.ORES_IN_GROUND_NETHERRACK, "Netherrack Ores In Ground"); + add(Tags.Items.ORES_IN_GROUND_STONE, "Stone Ores In Ground"); + add(Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + add(Tags.Items.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + add(Tags.Items.RAW_BLOCKS, "Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_COPPER, "Copper Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_GOLD, "Gold Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_IRON, "Iron Raw Blocks"); + add(Tags.Items.RAW_MATERIALS, "Raw Materials"); + add(Tags.Items.RAW_MATERIALS_COPPER, "Copper Raw Materials"); + add(Tags.Items.RAW_MATERIALS_GOLD, "Gold Raw Materials"); + add(Tags.Items.RAW_MATERIALS_IRON, "Iron Raw Materials"); + add(Tags.Items.RODS, "Rods"); + add(Tags.Items.RODS_BLAZE, "Blaze Rods"); + add(Tags.Items.RODS_BREEZE, "Breeze Rods"); + add(Tags.Items.RODS_WOODEN, "Wooden Rods"); + add(Tags.Items.ROPES, "Ropes"); + add(Tags.Items.SANDS, "Sands"); + add(Tags.Items.SANDS_COLORLESS, "Colorless Sands"); + add(Tags.Items.SANDS_RED, "Red Sands"); + add(Tags.Items.SANDSTONE_BLOCKS, "Sandstone Blocks"); + add(Tags.Items.SANDSTONE_SLABS, "Sandstone Slabs"); + add(Tags.Items.SANDSTONE_STAIRS, "Sandstone Stairs"); + add(Tags.Items.SANDSTONE_RED_BLOCKS, "Red Sandstone Blocks"); + add(Tags.Items.SANDSTONE_RED_SLABS, "Red Sandstone Slabs"); + add(Tags.Items.SANDSTONE_RED_STAIRS, "Red Sandstone Stairs"); + add(Tags.Items.SANDSTONE_UNCOLORED_BLOCKS, "Uncolored Sandstone Blocks"); + add(Tags.Items.SANDSTONE_UNCOLORED_SLABS, "Uncolored Sandstone Slabs"); + add(Tags.Items.SANDSTONE_UNCOLORED_STAIRS, "Uncolored Sandstone Stairs"); + add(Tags.Items.SEEDS, "Seeds"); + add(Tags.Items.SEEDS_BEETROOT, "Beetroot Seeds"); + add(Tags.Items.SEEDS_MELON, "Melon Seeds"); + add(Tags.Items.SEEDS_PUMPKIN, "Pumpkin Seeds"); + add(Tags.Items.SEEDS_WHEAT, "Wheat Seeds"); + add(Tags.Items.SLIMEBALLS, "Slimeballs"); + add(Tags.Items.STONES, "Stones"); + add(Tags.Items.STORAGE_BLOCKS, "Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + add(Tags.Items.STRINGS, "Strings"); + add(Tags.Items.TOOLS_SHEARS, "Shears"); + add(Tags.Items.TOOLS_SHIELDS, "Shields"); + add(Tags.Items.TOOLS_BOWS, "Bows"); + add(Tags.Items.TOOLS_CROSSBOWS, "Crossbows"); + add(Tags.Items.TOOLS_FISHING_RODS, "Fishing Rods"); + add(Tags.Items.TOOLS_BRUSHES, "Brushes"); + add(Tags.Items.TOOLS_SPEARS, "Spears"); + add(Tags.Items.TOOLS, "Tools"); + add(Tags.Items.ARMORS, "Armors"); + add(Tags.Items.ENCHANTABLES, "Enchantables"); + + // Fluids + add(Tags.Fluids.WATER, "Water"); + add(Tags.Fluids.LAVA, "Lava"); + add(Tags.Fluids.MILK, "Milk"); + add(Tags.Fluids.GASEOUS, "Gaseous"); + add(Tags.Fluids.HONEY, "Honey"); + add(Tags.Fluids.POTION, "Potion"); + add(Tags.Fluids.SUSPICIOUS_STEW, "Suspicious Stew"); + add(Tags.Fluids.MUSHROOM_STEW, "Mushroom Stew"); + add(Tags.Fluids.RABBIT_STEW, "Rabbit Stew"); + add(Tags.Fluids.BEETROOT_SOUP, "Beetroot Soup"); + add(Tags.Fluids.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + + // Entities + add(Tags.EntityTypes.BOSSES, "Bosses"); + add(Tags.EntityTypes.MINECARTS, "Minecarts"); + add(Tags.EntityTypes.BOATS, "Boats"); + add(Tags.EntityTypes.CAPTURING_NOT_SUPPORTED, "Capturing Not Supported"); + add(Tags.EntityTypes.TELEPORTING_NOT_SUPPORTED, "Teleporting Not Supported"); + + // Enchantments + add(Tags.Enchantments.INCREASE_BLOCK_DROPS, "Increase Block Drops"); + add(Tags.Enchantments.INCREASE_ENTITY_DROPS, "Increase Entity Drops"); + add(Tags.Enchantments.WEAPON_DAMAGE_ENHANCEMENTS, "Weapon Damage Enhancements"); + add(Tags.Enchantments.ENTITY_SPEED_ENHANCEMENTS, "Entity Speed Enhancements"); + add(Tags.Enchantments.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS, "Entity Auxiliary Movement Enhancements"); + add(Tags.Enchantments.ENTITY_DEFENSE_ENHANCEMENTS, "Entity Defense Enhancements"); + + // Biomes + add(Tags.Biomes.NO_DEFAULT_MONSTERS, "No Default Monsters"); + add(Tags.Biomes.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator's Selection"); + add(Tags.Biomes.IS_VOID, "Voids"); + + add(Tags.Biomes.IS_END, "Is End"); + add(Tags.Biomes.IS_NETHER, "Is Nether"); + add(Tags.Biomes.IS_OVERWORLD, "Is Overworld"); + + add(Tags.Biomes.IS_HOT, "Hot"); + add(Tags.Biomes.IS_HOT_OVERWORLD, "Hot Overworld"); + add(Tags.Biomes.IS_HOT_NETHER, "Hot Nether"); + add(Tags.Biomes.IS_HOT_END, "Hot End"); + add(Tags.Biomes.IS_COLD, "Cold"); + add(Tags.Biomes.IS_COLD_OVERWORLD, "Cold Overworld"); + add(Tags.Biomes.IS_COLD_NETHER, "Cold Nether"); + add(Tags.Biomes.IS_COLD_END, "Cold End"); + add(Tags.Biomes.IS_SPARSE_VEGETATION, "Sparse Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_OVERWORLD, "Sparse Overworld Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_NETHER, "Sparse Nether Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_END, "Sparse End Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION, "Dense Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_OVERWORLD, "Dense Overworld Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_NETHER, "Dense Nether Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_END, "Dense End Vegetation"); + add(Tags.Biomes.IS_WET, "Wet"); + add(Tags.Biomes.IS_WET_OVERWORLD, "Wet Overworld"); + add(Tags.Biomes.IS_WET_NETHER, "Wet Nether"); + add(Tags.Biomes.IS_WET_END, "Wet End"); + add(Tags.Biomes.IS_DRY, "Dry"); + add(Tags.Biomes.IS_DRY_OVERWORLD, "Dry Overworld"); + add(Tags.Biomes.IS_DRY_NETHER, "Dry Nether"); + add(Tags.Biomes.IS_DRY_END, "Dry End"); + + add(Tags.Biomes.IS_CONIFEROUS_TREE, "Coniferous Trees"); + add(Tags.Biomes.IS_SAVANNA_TREE, "Savanna Trees"); + add(Tags.Biomes.IS_JUNGLE_TREE, "Jungle Trees"); + add(Tags.Biomes.IS_DECIDUOUS_TREE, "Deciduous Trees"); + + add(Tags.Biomes.IS_MOUNTAIN, "Mountains"); + add(Tags.Biomes.IS_MOUNTAIN_PEAK, "Peaks"); + add(Tags.Biomes.IS_MOUNTAIN_SLOPE, "Slopes"); + + add(Tags.Biomes.IS_PLAINS, "Plains"); + add(Tags.Biomes.IS_SNOWY_PLAINS, "Snowy Plains"); + add(Tags.Biomes.IS_FOREST, "Forest"); + add(Tags.Biomes.IS_BIRCH_FOREST, "Birch Forest"); + add(Tags.Biomes.IS_FLOWER_FOREST, "Flower Forest"); + add(Tags.Biomes.IS_TAIGA, "Taiga"); + add(Tags.Biomes.IS_HILL, "Hills"); + add(Tags.Biomes.IS_WINDSWEPT, "Windswept"); + add(Tags.Biomes.IS_JUNGLE, "Jungle"); + add(Tags.Biomes.IS_FLORAL, "Floral"); + add(Tags.Biomes.IS_BEACH, "Beach"); + add(Tags.Biomes.IS_STONY_SHORES, "Stony Shores"); + add(Tags.Biomes.IS_SHALLOW_OCEAN, "Shallow Ocean"); + add(Tags.Biomes.IS_OCEAN, "Ocean"); + add(Tags.Biomes.IS_DEEP_OCEAN, "Deep Ocean"); + add(Tags.Biomes.IS_RIVER, "River"); + add(Tags.Biomes.IS_BADLANDS, "Badlands"); + add(Tags.Biomes.IS_SNOWY, "Snowy"); + add(Tags.Biomes.IS_ICY, "Icy"); + add(Tags.Biomes.IS_AQUATIC_ICY, "Aquatic Icy"); + add(Tags.Biomes.IS_SPOOKY, "Spooky"); + add(Tags.Biomes.IS_DEAD, "Dead"); + add(Tags.Biomes.IS_LUSH, "Lush"); + add(Tags.Biomes.IS_MUSHROOM, "Mushrooms"); + add(Tags.Biomes.IS_MAGICAL, "Magical"); + add(Tags.Biomes.IS_RARE, "Rare"); + add(Tags.Biomes.IS_PLATEAU, "Plateaus"); + add(Tags.Biomes.IS_MODIFIED, "Modified"); + add(Tags.Biomes.IS_OLD_GROWTH, "Old Growth"); + + add(Tags.Biomes.IS_AQUATIC, "Aquatic"); + add(Tags.Biomes.IS_DESERT, "Deserts"); + add(Tags.Biomes.IS_SAVANNA, "Savanna"); + add(Tags.Biomes.IS_SWAMP, "Swamps"); + add(Tags.Biomes.IS_SANDY, "Sandy"); + add(Tags.Biomes.IS_WASTELAND, "Wastelands"); + + add(Tags.Biomes.IS_UNDERGROUND, "Underground"); + add(Tags.Biomes.IS_CAVE, "Caves"); + + add(Tags.Biomes.IS_NETHER_FOREST, "Nether Forest"); + add(Tags.Biomes.IS_OUTER_END_ISLAND, "Outer End Island"); + + // Structures + add(Tags.Structures.HIDDEN_FROM_DISPLAYERS, "Hidden From Displayers"); + add(Tags.Structures.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator's Selection"); + } + + private void addColored(TagKey baseTagKey, String pattern) { + for (DyeColor color : DyeColor.values()) { + TagKey coloredTag = TagKey.create( + baseTagKey.registry(), + new ResourceLocation(baseTagKey.location().getNamespace(), baseTagKey.location().getPath() + "/" + color.name().toLowerCase(Locale.ROOT))); + + add(coloredTag, pattern.replace("{color}", StringUtils.capitalize(color.getName()))); + } + } + + @Override + public String getName() { + return "Forge Translations"; + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java index 48aaacc260..6c9f4868ca 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java @@ -5,22 +5,27 @@ package net.neoforged.neoforge.common.data.internal; +import com.mojang.datafixers.util.Either; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.WritableRegistry; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.data.loot.LootTableSubProvider; import net.minecraft.data.loot.packs.VanillaLootTableProvider; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.util.ProblemReporter; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.LootPool; @@ -34,7 +39,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; -import net.minecraft.world.level.storage.loot.entries.LootTableReference; +import net.minecraft.world.level.storage.loot.entries.NestedLootTable; import net.minecraft.world.level.storage.loot.entries.SequentialEntry; import net.minecraft.world.level.storage.loot.entries.TagEntry; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; @@ -55,12 +60,12 @@ public final class NeoForgeLootTableProvider extends LootTableProvider { private final List> conditionReplacers = new ArrayList<>(); - public NeoForgeLootTableProvider(PackOutput packOutput) { - super(packOutput, Set.of(), VanillaLootTableProvider.create(packOutput).getTables()); + public NeoForgeLootTableProvider(PackOutput packOutput, CompletableFuture provider) { + super(packOutput, Set.of(), VanillaLootTableProvider.create(packOutput, provider).getTables(), provider); } @Override - protected void validate(Map map, ValidationContext validationcontext) { + protected void validate(WritableRegistry writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) { // Do not validate against all registered loot tables } @@ -79,7 +84,7 @@ public List getTables() { } private LootTableSubProvider replaceAndFilterChangesOnly(LootTableSubProvider subProvider) { - return newConsumer -> subProvider.generate((resourceLocation, builder) -> { + return (lookupProvider, newConsumer) -> subProvider.generate(lookupProvider, (resourceLocation, builder) -> { LootTable.Builder newBuilder = findAndReplaceInLootTableBuilder(builder); if (newBuilder != null) { newConsumer.accept(resourceLocation, newBuilder); @@ -198,9 +203,9 @@ private boolean findAndReplaceInLootEntry(LootPoolEntryContainer entry, Consumer TagKey tag = getPrivateValue(TagEntry.class, tagEntry, "tag"); boolean expand = getPrivateValue(TagEntry.class, tagEntry, "expand"); builder = expand ? TagEntry.expandTag(tag) : TagEntry.tagContents(tag); - } else if (singleton instanceof LootTableReference reference) { - ResourceLocation name = getPrivateValue(LootTableReference.class, reference, "name"); - builder = LootTableReference.lootTableReference(name); + } else if (singleton instanceof NestedLootTable reference) { + Either, LootTable> contents = getPrivateValue(NestedLootTable.class, reference, "contents"); + builder = contents.map(NestedLootTable::lootTableReference, NestedLootTable::inlineLootTable); } else { throw new IllegalStateException("Unknown LootPoolSingletonContainer type: " + singleton.getClass().getName()); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java index 6b067f1563..54133041cd 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java @@ -14,6 +14,7 @@ import java.util.concurrent.CompletableFuture; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.CachedOutput; import net.minecraft.data.PackOutput; @@ -43,8 +44,8 @@ public final class NeoForgeRecipeProvider extends VanillaRecipeProvider { private final Map> replacements = new HashMap<>(); private final Set excludes = new HashSet<>(); - public NeoForgeRecipeProvider(PackOutput packOutput) { - super(packOutput); + public NeoForgeRecipeProvider(PackOutput packOutput, CompletableFuture provider) { + super(packOutput, provider); } private void exclude(ItemLike item) { @@ -72,10 +73,10 @@ protected void buildRecipes(RecipeOutput recipeOutput) { 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); + replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONES_NORMAL); + replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); - replace(Items.STRING, Tags.Items.STRING); + replace(Items.STRING, Tags.Items.STRINGS); exclude(getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); exclude(Blocks.GOLD_BLOCK); @@ -134,7 +135,7 @@ private ShapelessRecipe enhance(ResourceLocation id, ShapelessRecipe vanilla) { } @Override - protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_) { + protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_) { // NOOP - We don't replace any of the advancement things yet... return CompletableFuture.allOf(); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java new file mode 100644 index 0000000000..532a394f91 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.StructureTagsProvider; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.ExistingFileHelper; + +public final class NeoForgeStructureTagsProvider extends StructureTagsProvider { + public NeoForgeStructureTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, "neoforge", existingFileHelper); + } + + @Override + public void addTags(HolderLookup.Provider lookupProvider) { + tag(Tags.Structures.HIDDEN_FROM_DISPLAYERS); + tag(Tags.Structures.HIDDEN_FROM_LOCATOR_SELECTION); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java index a0bee8a6b5..c76d91ab7d 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java @@ -7,6 +7,7 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -15,24 +16,13 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.chunk.LevelChunk; import net.neoforged.neoforge.client.model.data.ModelData; -import net.neoforged.neoforge.common.util.INBTSerializable; import org.jetbrains.annotations.ApiStatus; -public interface IBlockEntityExtension extends INBTSerializable { +public interface IBlockEntityExtension { private BlockEntity self() { return (BlockEntity) this; } - @Override - default void deserializeNBT(CompoundTag nbt) { - self().load(nbt); - } - - @Override - default CompoundTag serializeNBT() { - return self().saveWithFullMetadata(); - } - /** * Called when you receive a TileEntityData packet for the location this * TileEntity is currently in. On the client, the NetworkManager will always @@ -42,22 +32,22 @@ default CompoundTag serializeNBT() { * @param net The NetworkManager the packet originated from * @param pkt The data packet */ - default void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + default void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider lookupProvider) { CompoundTag compoundtag = pkt.getTag(); - if (compoundtag != null) { - self().load(compoundtag); + if (!compoundtag.isEmpty()) { + self().loadWithComponents(compoundtag, lookupProvider); } } /** - * Called when the chunk's TE update tag, gotten from {@link BlockEntity#getUpdateTag()}, is received on the client. + * Called when the chunk's TE update tag, gotten from {@link BlockEntity#getUpdateTag(HolderLookup.Provider)}, is received on the client. *

- * Used to handle this tag in a special way. By default this simply calls {@link BlockEntity#load(CompoundTag)}. + * Used to handle this tag in a special way. By default this simply calls {@link BlockEntity#loadWithComponents(CompoundTag, HolderLookup.Provider)}. * - * @param tag The {@link CompoundTag} sent from {@link BlockEntity#getUpdateTag()} + * @param tag The {@link CompoundTag} sent from {@link BlockEntity#getUpdateTag(HolderLookup.Provider)} */ - default void handleUpdateTag(CompoundTag tag) { - self().load(tag); + default void handleUpdateTag(CompoundTag tag, HolderLookup.Provider lookupProvider) { + self().loadWithComponents(tag, lookupProvider); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java index dbce3e5188..3dfc30b3a1 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java @@ -17,7 +17,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.boss.wither.WitherBoss; import net.minecraft.world.entity.item.ItemEntity; @@ -64,7 +63,7 @@ import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; @@ -277,20 +276,6 @@ default Optional getRespawnPosition(BlockState state, EntityType type, return Optional.empty(); } - /** - * Determines if a specified mob type can spawn on this block, returning false will - * prevent any mob from spawning on the block. - * - * @param state The current state - * @param level The current level - * @param pos Block position in level - * @param type The Mob Category Type - * @return True to allow a mob of the specified category to spawn, false to prevent it. - */ - default boolean isValidSpawn(BlockState state, BlockGetter level, BlockPos pos, SpawnPlacements.Type type, EntityType entityType) { - return state.isValidSpawn(level, pos, entityType); - } - /** * Called when a user either starts or stops sleeping in the bed. * @@ -534,7 +519,7 @@ default boolean getWeakChanges(BlockState state, LevelReader level, BlockPos pos * @return A SoundType to use */ default SoundType getSoundType(BlockState state, LevelReader level, BlockPos pos, @Nullable Entity entity) { - return self().getSoundType(state); + return state.getSoundType(); } /** @@ -577,8 +562,8 @@ default BlockState getStateAtViewpoint(BlockState state, BlockGetter level, Bloc * @return the path type of this block */ @Nullable - default BlockPathTypes getBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob) { - return state.getBlock() == Blocks.LAVA ? BlockPathTypes.LAVA : state.isBurning(level, pos) ? BlockPathTypes.DAMAGE_FIRE : null; + default PathType getBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob) { + return state.getBlock() == Blocks.LAVA ? PathType.LAVA : state.isBurning(level, pos) ? PathType.DAMAGE_FIRE : null; } /** @@ -595,9 +580,9 @@ default BlockPathTypes getBlockPathType(BlockState state, BlockGetter level, Blo * @return the path type of this block */ @Nullable - default BlockPathTypes getAdjacentBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, BlockPathTypes originalType) { - if (state.is(Blocks.SWEET_BERRY_BUSH)) return BlockPathTypes.DANGER_OTHER; - else if (WalkNodeEvaluator.isBurningBlock(state)) return BlockPathTypes.DANGER_FIRE; + default PathType getAdjacentBlockPathType(BlockState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, PathType originalType) { + if (state.is(Blocks.SWEET_BERRY_BUSH)) return PathType.DANGER_OTHER; + else if (WalkNodeEvaluator.isBurningBlock(state)) return PathType.DANGER_FIRE; else return null; } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockStateExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockStateExtension.java index df4688e226..ea41a4f217 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockStateExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockStateExtension.java @@ -16,7 +16,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.SpawnPlacements.Type; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FishingHook; @@ -35,7 +34,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.PushReaction; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.neoforged.neoforge.capabilities.BlockCapabilityCache; @@ -166,19 +165,6 @@ default boolean isBed(BlockGetter level, BlockPos pos, @Nullable LivingEntity sl return self().getBlock().isBed(self(), level, pos, sleeper); } - /** - * Determines if a specified mob type can spawn on this block, returning false will - * prevent any mob from spawning on the block. - * - * @param level The current level - * @param pos Block position in level - * @param type The Mob Category Type - * @return True to allow a mob of the specified category to spawn, false to prevent it. - */ - default boolean isValidSpawn(LevelReader level, BlockPos pos, Type type, EntityType entityType) { - return self().getBlock().isValidSpawn(self(), level, pos, type, entityType); - } - /** * Returns the position that the entity is moved to upon * respawning at this block. @@ -576,7 +562,7 @@ default boolean isBurning(BlockGetter level, BlockPos pos) { * @return the path type of this block */ @Nullable - default BlockPathTypes getBlockPathType(BlockGetter level, BlockPos pos, @Nullable Mob mob) { + default PathType getBlockPathType(BlockGetter level, BlockPos pos, @Nullable Mob mob) { return self().getBlock().getBlockPathType(self(), level, pos, mob); } @@ -593,7 +579,7 @@ default BlockPathTypes getBlockPathType(BlockGetter level, BlockPos pos, @Nullab * @return the path type of this block */ @Nullable - default BlockPathTypes getAdjacentBlockPathType(BlockGetter level, BlockPos pos, @Nullable Mob mob, BlockPathTypes originalType) { + default PathType getAdjacentBlockPathType(BlockGetter level, BlockPos pos, @Nullable Mob mob, PathType originalType) { return self().getBlock().getAdjacentBlockPathType(self(), level, pos, mob, originalType); } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IClientCommonPacketListenerExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IClientCommonPacketListenerExtension.java index 40ea9767d6..0c3d33dc51 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IClientCommonPacketListenerExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IClientCommonPacketListenerExtension.java @@ -83,11 +83,20 @@ default boolean isConnected(final ResourceLocation payloadId) { /** * {@return true if the custom payload is usable by this connection} - * + * + * @param type The payload type to check + */ + default boolean isConnected(final CustomPacketPayload.Type type) { + return isConnected(type.id()); + } + + /** + * {@return true if the custom payload is usable by this connection} + * * @param payload The payload to check */ default boolean isConnected(final CustomPacketPayload payload) { - return isConnected(payload.id()); + return isConnected(payload.type()); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IEnchantmentExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IEnchantmentExtension.java index f0cbfe0024..53096cb9ed 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IEnchantmentExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IEnchantmentExtension.java @@ -6,11 +6,11 @@ package net.neoforged.neoforge.common.extensions; import java.util.Set; -import net.minecraft.world.entity.MobType; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; public interface IEnchantmentExtension { private Enchantment self() { @@ -18,16 +18,16 @@ private Enchantment self() { } /** - * ItemStack aware version of {@link Enchantment#getDamageBonus(int, MobType)} + * ItemStack aware version of {@link Enchantment#getDamageBonus(int, EntityType)} * * @param level the level of the enchantment - * @param mobType the mob type being attacked + * @param entityType the entity type being attacked * @param enchantedItem the item used for the attack * @return the damage bonus */ @SuppressWarnings("deprecation") - default float getDamageBonus(int level, MobType mobType, ItemStack enchantedItem) { - return self().getDamageBonus(level, mobType); + default float getDamageBonus(int level, EntityType entityType, ItemStack enchantedItem) { + return self().getDamageBonus(level, entityType); } /** @@ -37,7 +37,7 @@ default float getDamageBonus(int level, MobType mobType, ItemStack enchantedItem * @param allowedCategories the enchantment categories allowed in the creative tab * @return whether item variants of this enchantment can be added to a given creative tab with the allowed categories */ - default boolean allowedInCreativeTab(Item book, Set allowedCategories) { - return self().isAllowedOnBooks() && allowedCategories.contains(self().category); + default boolean allowedInCreativeTab(Item book, Set> allowedCategories) { + return self().isAllowedOnBooks() && allowedCategories.contains(self().getSupportedItems()); } } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IEntityExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IEntityExtension.java index d66775e663..394586976a 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IEntityExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IEntityExtension.java @@ -9,14 +9,13 @@ import java.util.function.BiPredicate; import java.util.function.Consumer; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -25,7 +24,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.HitResult; -import net.neoforged.neoforge.common.NeoForgeMod; +import net.neoforged.neoforge.attachment.AttachmentInternals; +import net.neoforged.neoforge.attachment.AttachmentType; import net.neoforged.neoforge.common.SoundAction; import net.neoforged.neoforge.common.util.INBTSerializable; import net.neoforged.neoforge.entity.IEntityWithComplexSpawn; @@ -39,11 +39,13 @@ private Entity self() { return (Entity) this; } - default void deserializeNBT(CompoundTag nbt) { + @Override + default void deserializeNBT(HolderLookup.Provider provider, CompoundTag nbt) { self().load(nbt); } - default CompoundTag serializeNBT() { + @Override + default CompoundTag serializeNBT(HolderLookup.Provider provider) { CompoundTag ret = new CompoundTag(); String id = self().getEncodeId(); if (id != null) { @@ -192,23 +194,6 @@ default PartEntity[] getParts() { return null; } - /** - * @return Return the height in blocks the Entity can step up without needing to jump - * This is the sum of vanilla's {@link Entity#maxUpStep()} method and the current value - * of the {@link NeoForgeMod#STEP_HEIGHT} attribute - * (if this Entity is a {@link LivingEntity} and has the attribute), clamped at 0. - */ - default float getStepHeight() { - float vanillaStep = self().maxUpStep(); - if (self() instanceof LivingEntity living) { - AttributeInstance stepHeightAttribute = living.getAttribute(NeoForgeMod.STEP_HEIGHT.value()); - if (stepHeightAttribute != null) { - return (float) Math.max(0, vanillaStep + stepHeightAttribute.getValue()); - } - } - return vanillaStep; - } - /** * Returns the height of the fluid type in relation to the bounding box of * the entity. If the entity is not in the fluid type, then {@code 0} @@ -411,4 +396,15 @@ default void sendPairingData(ServerPlayer serverPlayer, Consumer The type of the entry - * @implNote This is a convenience method for {@link FriendlyByteBuf#writeCollection(Collection, FriendlyByteBuf.Writer)}, where the callback can be a method on the entry type. + * @implNote This is a convenience method for {@link FriendlyByteBuf#writeCollection(Collection, StreamEncoder)}, where the callback can be a method on the entry type. */ default void writeObjectCollection(Collection set, BiConsumer writer) { self().writeCollection(set, (buf, t) -> writer.accept(t, buf)); } - /** - * Reads an {@link ItemStack} from the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte. - * - * @return The read stack - */ - default ItemStack readItemWithLargeCount() { - if (!self().readBoolean()) { - return ItemStack.EMPTY; - } else { - Item item = self().readById(BuiltInRegistries.ITEM); - int i = self().readVarInt(); - return reconstructItemStack(item, i, self().readNbt()); - } - } - - /** - * Writes an {@link ItemStack} to the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte. - * - * @param stack The stack to write - * @return The buffer - */ - default FriendlyByteBuf writeItemWithLargeCount(ItemStack stack) { - if (stack.isEmpty()) { - self().writeBoolean(false); - } else { - self().writeBoolean(true); - Item item = stack.getItem(); - self().writeId(BuiltInRegistries.ITEM, item); - self().writeVarInt(stack.getCount()); - CompoundTag compoundtag = new CompoundTag(); - if (item.isDamageable(stack) || item.shouldOverrideMultiplayerNbt()) { - compoundtag = stack.getTag(); - } - compoundtag = addAttachmentsToTag(compoundtag, stack, false); - - self().writeNbt(compoundtag); - } - - return self(); - } + // TODO 1.20.5: either fix or remove +// /** +// * Reads an {@link ItemStack} from the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte. +// * +// * @return The read stack +// */ +// default ItemStack readItemWithLargeCount() { +// if (!self().readBoolean()) { +// return ItemStack.EMPTY; +// } else { +// Item item = self().readById(BuiltInRegistries.ITEM::byId); +// int i = self().readVarInt(); +// return reconstructItemStack(item, i, self().readNbt()); +// } +// } +// +// /** +// * Writes an {@link ItemStack} to the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte. +// * +// * @param stack The stack to write +// * @return The buffer +// */ +// default FriendlyByteBuf writeItemWithLargeCount(ItemStack stack) { +// if (stack.isEmpty()) { +// self().writeBoolean(false); +// } else { +// self().writeBoolean(true); +// Item item = stack.getItem(); +// self().writeById(BuiltInRegistries.ITEM::getId, item); +// self().writeVarInt(stack.getCount()); +// CompoundTag compoundtag = new CompoundTag(); +// if (item.isDamageable(stack) || item.shouldOverrideMultiplayerNbt()) { +// compoundtag = stack.getTag(); +// } +// compoundtag = addAttachmentsToTag(compoundtag, stack, false); +// +// self().writeNbt(compoundtag); +// } +// +// return self(); +// } /** * Reads an array of objects from the buffer. @@ -113,11 +86,11 @@ default FriendlyByteBuf writeItemWithLargeCount(ItemStack stack) { * @return The array of objects * @param The type of the objects */ - default T[] readArray(IntFunction builder, FriendlyByteBuf.Reader reader) { + default T[] readArray(IntFunction builder, StreamDecoder reader) { int size = self().readVarInt(); T[] array = builder.apply(size); for (int i = 0; i < size; i++) { - array[i] = reader.apply(self()); + array[i] = reader.decode(self()); } return array; } @@ -130,10 +103,10 @@ default T[] readArray(IntFunction builder, FriendlyByteBuf.Reader re * @return The buffer * @param The type of the objects */ - default FriendlyByteBuf writeArray(T[] array, FriendlyByteBuf.Writer writer) { + default FriendlyByteBuf writeArray(T[] array, StreamEncoder writer) { self().writeVarInt(array.length); for (T t : array) { - writer.accept(self(), t); + writer.encode(self(), t); } return self(); } @@ -149,15 +122,15 @@ default FriendlyByteBuf writeByte(byte value) { } /** - * Variant of {@link FriendlyByteBuf#readMap(FriendlyByteBuf.Reader, FriendlyByteBuf.Reader)} that allows reading values + * Variant of {@link FriendlyByteBuf#readMap(StreamDecoder, StreamDecoder)} that allows reading values * that depend on the key. */ - default Map readMap(FriendlyByteBuf.Reader keyReader, BiFunction valueReader) { + default Map readMap(StreamDecoder keyReader, BiFunction valueReader) { final int size = self().readVarInt(); final Map map = Maps.newHashMapWithExpectedSize(size); for (int i = 0; i < size; ++i) { - final K k = keyReader.apply(self()); + final K k = keyReader.decode(self()); map.put(k, valueReader.apply(self(), k)); } @@ -165,13 +138,13 @@ default Map readMap(FriendlyByteBuf.Reader keyReader, BiFunction } /** - * Variant of {@link FriendlyByteBuf#writeMap(Map, FriendlyByteBuf.Writer, FriendlyByteBuf.Writer)} that allows writing values + * Variant of {@link FriendlyByteBuf#writeMap(Map, StreamEncoder, StreamEncoder)} that allows writing values * that depend on the key. */ - default void writeMap(Map map, FriendlyByteBuf.Writer keyWriter, TriConsumer valueWriter) { + default void writeMap(Map map, StreamEncoder keyWriter, TriConsumer valueWriter) { self().writeVarInt(map.size()); map.forEach((key, value) -> { - keyWriter.accept(self(), key); + keyWriter.encode(self(), key); valueWriter.accept(self(), key, value); }); } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IItemExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IItemExtension.java index f85f3c49a4..d7a0ec775b 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IItemExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IItemExtension.java @@ -5,24 +5,24 @@ package net.neoforged.neoforge.common.extensions; -import com.google.common.collect.Multimap; import java.util.HashSet; -import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.function.Consumer; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.animal.horse.Horse; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.EnderMan; @@ -30,20 +30,21 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.AnimalArmorItem; import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorMaterials; import net.minecraft.world.item.AxeItem; -import net.minecraft.world.item.HorseArmorItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.neoforged.neoforge.common.CommonHooks; import net.neoforged.neoforge.common.ToolAction; @@ -62,8 +63,8 @@ private Item self() { * ItemStack sensitive version of getItemAttributeModifiers */ @SuppressWarnings("deprecation") - default Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { - return self().getDefaultAttributeModifiers(slot); + default ItemAttributeModifiers getAttributeModifiers(ItemStack stack) { + return self().getDefaultAttributeModifiers(); } /** @@ -332,14 +333,15 @@ default boolean isBookEnchantable(ItemStack stack, ItemStack book) { * * Returning null from this function will use the default value. * - * @param stack ItemStack for the equipped armor - * @param entity The entity wearing the armor - * @param slot The slot the armor is in - * @param type The subtype, can be null or "overlay" + * @param stack ItemStack for the equipped armor + * @param entity The entity wearing the armor + * @param slot The slot the armor is in + * @param layer The armor layer + * @param innerModel Whether the inner model is used * @return Path of texture to bind, or null to use default */ @Nullable - default String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { + default ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, ArmorMaterial.Layer layer, boolean innerModel) { return null; } @@ -361,7 +363,7 @@ default boolean onEntitySwing(ItemStack stack, LivingEntity entity) { * @return the damage value */ default int getDamage(ItemStack stack) { - return !stack.hasTag() ? 0 : stack.getTag().getInt("Damage"); + return Mth.clamp(stack.getOrDefault(DataComponents.DAMAGE, 0), 0, stack.getMaxDamage()); } /** @@ -371,9 +373,8 @@ default int getDamage(ItemStack stack) { * @param stack The itemstack that is damaged * @return the damage value */ - @SuppressWarnings("deprecation") default int getMaxDamage(ItemStack stack) { - return self().getMaxDamage(); + return stack.getOrDefault(DataComponents.MAX_DAMAGE, 0); } /** @@ -395,7 +396,7 @@ default boolean isDamaged(ItemStack stack) { * @param damage the new damage value */ default void setDamage(ItemStack stack, int damage) { - stack.getOrCreateTag().putInt("Damage", Math.max(0, damage)); + stack.set(DataComponents.DAMAGE, Mth.clamp(damage, 0, stack.getMaxDamage())); } /** @@ -411,26 +412,13 @@ default boolean canPerformAction(ItemStack stack, ToolAction toolAction) { } /** - * ItemStack sensitive version of {@link Item#isCorrectToolForDrops(BlockState)} - * - * @param stack The itemstack used to harvest the block - * @param state The block trying to harvest - * @return true if the stack can harvest the block - */ - default boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { - return self().isCorrectToolForDrops(state); - } - - /** - * Gets the maximum number of items that this stack should be able to hold. This - * is a ItemStack (and thus NBT) sensitive version of {@link Item#getMaxStackSize()}. + * Gets the maximum number of items that this stack should be able to hold. * * @param stack The ItemStack * @return The maximum size this item can be stacked to */ - @SuppressWarnings("deprecation") default int getMaxStackSize(ItemStack stack) { - return self().getMaxStackSize(); + return stack.getOrDefault(DataComponents.MAX_STACK_SIZE, 1); } /** @@ -457,7 +445,7 @@ default int getEnchantmentValue(ItemStack stack) { * @return true if the enchantment can be applied to this item */ default boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return enchantment.category.canEnchant(stack.getItem()); + return stack.getItem().builtInRegistryHolder().is(enchantment.getSupportedItems()); } /** @@ -473,7 +461,8 @@ default boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantme */ @ApiStatus.OverrideOnly default int getEnchantmentLevel(ItemStack stack, Enchantment enchantment) { - return EnchantmentHelper.getTagEnchantmentLevel(enchantment, stack); + ItemEnchantments itemenchantments = stack.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); + return itemenchantments.getLevel(enchantment); } /** @@ -487,8 +476,8 @@ default int getEnchantmentLevel(ItemStack stack, Enchantment enchantment) { * @apiNote Call via {@link IItemStackExtension#getAllEnchantments()}. */ @ApiStatus.OverrideOnly - default Map getAllEnchantments(ItemStack stack) { - return EnchantmentHelper.deserializeEnchantments(stack.getEnchantmentTags()); + default ItemEnchantments getAllEnchantments(ItemStack stack) { + return stack.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); } /** @@ -520,26 +509,24 @@ default boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStac return true; if (!newStack.isDamageableItem() || !oldStack.isDamageableItem()) - return !ItemStack.isSameItemSameTags(newStack, oldStack); + return !ItemStack.isSameItemSameComponents(newStack, oldStack); - CompoundTag newTag = newStack.getTag(); - CompoundTag oldTag = oldStack.getTag(); + DataComponentMap newComponents = newStack.getComponents(); + DataComponentMap oldComponents = oldStack.getComponents(); - if (newTag == null || oldTag == null) - return !(newTag == null && oldTag == null); + if (newComponents.isEmpty() || oldComponents.isEmpty()) + return !(newComponents.isEmpty() && oldComponents.isEmpty()); - Set newKeys = new HashSet<>(newTag.getAllKeys()); - Set oldKeys = new HashSet<>(oldTag.getAllKeys()); + Set> newKeys = new HashSet<>(newComponents.keySet()); + Set> oldKeys = new HashSet<>(oldComponents.keySet()); - newKeys.remove(ItemStack.TAG_DAMAGE); - oldKeys.remove(ItemStack.TAG_DAMAGE); + newKeys.remove(DataComponents.DAMAGE); + oldKeys.remove(DataComponents.DAMAGE); if (!newKeys.equals(oldKeys)) return true; - return !newKeys.stream().allMatch(key -> Objects.equals(newTag.get(key), oldTag.get(key))); - // return !(newStack.is(oldStack.getItem()) && ItemStack.tagMatches(newStack, oldStack) - // && (newStack.isDamageableItem() || newStack.getDamageValue() == oldStack.getDamageValue())); + return !newKeys.stream().allMatch(key -> Objects.equals(newComponents.get(key), oldComponents.get(key))); } /** @@ -605,17 +592,17 @@ default int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) } /** - * Called every tick when this item is equipped {@linkplain AbstractHorse#isArmor(ItemStack) as an armor item} by a horse {@linkplain AbstractHorse#canWearArmor() that can wear armor}. + * Called every tick when this item is equipped {@linkplain Mob#isBodyArmorItem(ItemStack) as an armor item} by a horse {@linkplain Mob#canWearBodyArmor() that can wear armor}. *

- * In vanilla, only {@linkplain Horse horses} can wear armor, and they can only equip items that extend {@link HorseArmorItem}. + * In vanilla, only {@linkplain Horse horses} and {@linkplain Wolf wolves} can wear armor, and they can only equip items that extend {@link AnimalArmorItem}. * * @param stack The armor stack * @param level The level the horse is in * @param horse The horse wearing this item - * @apiNote Call from {@link IItemStackExtension#onHorseArmorTick(Level, Mob)}. + * @apiNote Call from {@link IItemStackExtension#onAnimalArmorTick(Level, Mob)}. */ @ApiStatus.OverrideOnly - default void onHorseArmorTick(ItemStack stack, Level level, Mob horse) {} + default void onAnimalArmorTick(ItemStack stack, Level level, Mob horse) {} /** * Reduce the durability of this item by the amount given. @@ -627,7 +614,7 @@ default void onHorseArmorTick(ItemStack stack, Level level, Mob horse) {} * @param onBroken The on-broken callback from vanilla * @return The amount of damage to pass to the vanilla logic */ - default int damageItem(ItemStack stack, int amount, T entity, Consumer onBroken) { + default int damageItem(ItemStack stack, int amount, @Nullable T entity, Runnable onBroken) { return amount; } @@ -701,7 +688,7 @@ default boolean canWalkOnPowderedSnow(ItemStack stack, LivingEntity wearer) { * @param stack ItemStack in the Chest slot of the entity. */ default boolean isDamageable(ItemStack stack) { - return self().canBeDepleted(); + return stack.has(DataComponents.MAX_DAMAGE); } /** @@ -741,7 +728,7 @@ default int getDefaultTooltipHideFlags(ItemStack stack) { */ @Nullable // read javadoc to find a potential problem default FoodProperties getFoodProperties(ItemStack stack, @Nullable LivingEntity entity) { - return self().getFoodProperties(); + return stack.get(DataComponents.FOOD); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java index 27fd14feac..0d5004c808 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java @@ -5,10 +5,8 @@ package net.neoforged.neoforge.common.extensions; -import java.util.Map; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.Registries; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionResult; @@ -17,22 +15,23 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.animal.horse.Horse; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.HorseArmorItem; +import net.minecraft.world.item.AdventureModePredicate; +import net.minecraft.world.item.AnimalArmorItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.phys.AABB; import net.neoforged.neoforge.capabilities.ItemCapability; @@ -97,8 +96,8 @@ default InteractionResult onItemUseFirst(UseOnContext context) { Player entityplayer = context.getPlayer(); BlockPos blockpos = context.getClickedPos(); BlockInWorld blockworldstate = new BlockInWorld(context.getLevel(), blockpos, false); - Registry registry = entityplayer.level().registryAccess().registryOrThrow(Registries.BLOCK); - if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(registry, blockworldstate)) { + AdventureModePredicate adventureModePredicate = self().get(DataComponents.CAN_PLACE_ON); + if (entityplayer != null && !entityplayer.getAbilities().mayBuild && (adventureModePredicate == null || !adventureModePredicate.test(blockworldstate))) { return InteractionResult.PASS; } else { Item item = self().getItem(); @@ -168,14 +167,14 @@ default boolean canApplyAtEnchantingTable(Enchantment enchantment) { *

* Equivalent to calling {@link EnchantmentHelper#getItemEnchantmentLevel(Enchantment, ItemStack)}. *

- * Use in place of {@link EnchantmentHelper#getTagEnchantmentLevel(Enchantment, ItemStack)} for gameplay logic. + * Use in place of {@link EnchantmentHelper#getItemEnchantmentLevel(Enchantment, ItemStack)} for gameplay logic. *

- * Use {@link EnchantmentHelper#getTagEnchantmentLevel(Enchantment, ItemStack)} instead when modifying the item's enchantments. + * Use {@link DataComponents#ENCHANTMENTS} instead when modifying the item's enchantments. * * @param enchantment The enchantment being checked for. * @return The level of the enchantment, or 0 if not present. * @see #getAllEnchantments() - * @see EnchantmentHelper#getTagEnchantmentLevel(Enchantment, ItemStack) + * @see DataComponents#ENCHANTMENTS */ default int getEnchantmentLevel(Enchantment enchantment) { int level = self().getItem().getEnchantmentLevel(self(), enchantment); @@ -185,17 +184,17 @@ default int getEnchantmentLevel(Enchantment enchantment) { /** * Gets the gameplay level of all enchantments on this stack. *

- * Use in place of {@link EnchantmentHelper#getEnchantments(ItemStack)} for gameplay logic. + * Use in place of {@link DataComponents#ENCHANTMENTS} for gameplay logic. *

- * Use {@link EnchantmentHelper#getEnchantments(ItemStack)} instead when modifying the item's enchantments. + * Use {@link DataComponents#ENCHANTMENTS} instead when modifying the item's enchantments. * - * @return Map of all enchantments on the stack, or an empty empty if no enchantments are present. + * @return Map of all enchantments on the stack, or an empty map if no enchantments are present. * @see #getEnchantmentLevel(Enchantment) - * @see EnchantmentHelper#getEnchantments(ItemStack) + * @see DataComponents#ENCHANTMENTS */ - default Map getAllEnchantments() { - Map map = self().getItem().getAllEnchantments(self()); - return EventHooks.getEnchantmentLevel(map, self()); + default ItemEnchantments getAllEnchantments() { + var enchantments = self().getItem().getAllEnchantments(self()); + return EventHooks.getEnchantmentLevel(enchantments, self()); } /** @@ -295,15 +294,15 @@ default void onArmorTick(Level level, Player player) { } /** - * Called every tick when this item is equipped {@linkplain AbstractHorse#isArmor(ItemStack) as an armor item} by a horse {@linkplain AbstractHorse#canWearArmor() that can wear armor}. + * Called every tick when this item is equipped {@linkplain Mob#isBodyArmorItem(ItemStack) as an armor item} by a horse {@linkplain Mob#canWearBodyArmor()} that can wear armor}. *

- * In vanilla, only {@linkplain Horse horses} can wear armor, and they can only equip items that extend {@link HorseArmorItem}. + * In vanilla, only {@linkplain Horse horses} and {@linkplain Wolf wolves} can wear armor, and they can only equip items that extend {@link AnimalArmorItem}. * * @param level The level the horse is in * @param horse The horse wearing this item */ - default void onHorseArmorTick(Level level, Mob horse) { - self().getItem().onHorseArmorTick(self(), level, horse); + default void onAnimalArmorTick(Level level, Mob horse) { + self().getItem().onAnimalArmorTick(self(), level, horse); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/ILivingEntityExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/ILivingEntityExtension.java index af36431e19..3c071ad62c 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/ILivingEntityExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/ILivingEntityExtension.java @@ -28,7 +28,7 @@ default boolean canSwimInFluidType(FluidType type) { * @param type the type of the fluid */ default void jumpInFluid(FluidType type) { - self().setDeltaMovement(self().getDeltaMovement().add(0.0D, (double) 0.04F * self().getAttributeValue(NeoForgeMod.SWIM_SPEED.value()), 0.0D)); + self().setDeltaMovement(self().getDeltaMovement().add(0.0D, (double) 0.04F * self().getAttributeValue(NeoForgeMod.SWIM_SPEED), 0.0D)); } /** @@ -37,7 +37,7 @@ default void jumpInFluid(FluidType type) { * @param type the type of the fluid */ default void sinkInFluid(FluidType type) { - self().setDeltaMovement(self().getDeltaMovement().add(0.0D, (double) -0.04F * self().getAttributeValue(NeoForgeMod.SWIM_SPEED.value()), 0.0D)); + self().setDeltaMovement(self().getDeltaMovement().add(0.0D, (double) -0.04F * self().getAttributeValue(NeoForgeMod.SWIM_SPEED), 0.0D)); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IMenuTypeExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IMenuTypeExtension.java index 1364f6271c..38404b95cc 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IMenuTypeExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IMenuTypeExtension.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.extensions; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -17,5 +17,5 @@ static MenuType create(IContainerFactory return new MenuType<>(factory, FeatureFlags.DEFAULT_FLAGS); } - T create(int windowId, Inventory playerInv, FriendlyByteBuf extraData); + T create(int windowId, Inventory playerInv, RegistryFriendlyByteBuf extraData); } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IMobEffectExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IMobEffectExtension.java index 2bb6895fdb..fba9c33326 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IMobEffectExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IMobEffectExtension.java @@ -22,7 +22,7 @@ private MobEffect self() { */ default void fillEffectCures(Set cures, MobEffectInstance effectInstance) { cures.addAll(EffectCures.DEFAULT_CURES); - if (self() == MobEffects.POISON) { + if (self() == MobEffects.POISON.value()) { cures.add(EffectCures.HONEY); } } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IPlayerExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IPlayerExtension.java index 08433a2271..cb4a6845b5 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IPlayerExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IPlayerExtension.java @@ -8,14 +8,13 @@ import java.util.OptionalInt; import java.util.function.Consumer; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Abilities; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.neoforge.network.IContainerFactory; @@ -25,65 +24,6 @@ private Player self() { return (Player) this; } - /** - * The entity reach is increased by 2 for creative players, unless it is currently zero, which disables attacks and entity interactions. - * - * @return The entity reach of this player. - */ - default double getEntityReach() { - double range = self().getAttributeValue(NeoForgeMod.ENTITY_REACH.value()); - return range == 0 ? 0 : range + (self().isCreative() ? 2 : 0); - } - - /** - * The reach distance is increased by 0.5 for creative players, unless it is currently zero, which disables interactions. - * - * @return The reach distance of this player. - */ - default double getBlockReach() { - double reach = self().getAttributeValue(NeoForgeMod.BLOCK_REACH.value()); - return reach == 0 ? 0 : reach + (self().isCreative() ? 0.5 : 0); - } - - /** - * Checks if the player can reach an entity by targeting the passed vector.
- * On the server, additional padding is added to account for movement/lag. - * - * @param entityHitVec The vector being range-checked. - * @param padding Extra validation distance. - * @return If the player can attack the entity. - * @apiNote Do not use for block checks, as this method uses {@link #getEntityReach()} - */ - default boolean canReach(Vec3 entityHitVec, double padding) { - return self().getEyePosition().closerThan(entityHitVec, getEntityReach() + padding); - } - - /** - * Checks if the player can reach an entity.
- * On the server, additional padding is added to account for movement/lag. - * - * @param entity The entity being range-checked. - * @param padding Extra validation distance. - * @return If the player can attack the passed entity. - * @apiNote Prefer using {@link #canReach(Vec3, double)} if you have a {@link HitResult} available. - */ - default boolean canReach(Entity entity, double padding) { - return isCloseEnough(entity, getEntityReach() + padding); - } - - /** - * Checks if the player can reach a block.
- * On the server, additional padding is added to account for movement/lag. - * - * @param pos The position being range-checked. - * @param padding Extra validation distance. - * @return If the player can interact with this location. - */ - default boolean canReach(BlockPos pos, double padding) { - double reach = this.getBlockReach() + padding; - return self().getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) < reach * reach; - } - /** * Utility check to see if the player is close enough to a target entity. Uses "eye-to-closest-corner" checks. * @@ -124,7 +64,7 @@ default OptionalInt openMenu(MenuProvider menuProvider, BlockPos pos) { * @param extraDataWriter Consumer to write any additional data the GUI needs * @return The window ID of the opened GUI, or empty if the GUI could not be opened */ - default OptionalInt openMenu(MenuProvider menuProvider, Consumer extraDataWriter) { + default OptionalInt openMenu(MenuProvider menuProvider, Consumer extraDataWriter) { return OptionalInt.empty(); } diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IServerCommonPacketListenerExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IServerCommonPacketListenerExtension.java index c657e38690..7f2af67a48 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IServerCommonPacketListenerExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IServerCommonPacketListenerExtension.java @@ -102,13 +102,22 @@ default boolean isConnected(final ResourceLocation payloadId) { return NetworkRegistry.getInstance().isConnected(self(), payloadId); } + /** + * {@return true if the custom payload type is usable by this connection} + * + * @param type The payload to check + */ + default boolean isConnected(final CustomPacketPayload.Type type) { + return isConnected(type.id()); + } + /** * {@return true if the custom payload is usable by this connection} - * + * * @param payload The payload to check */ default boolean isConnected(final CustomPacketPayload payload) { - return isConnected(payload.id()); + return isConnected(payload.type()); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/loot/AddTableLootModifier.java b/src/main/java/net/neoforged/neoforge/common/loot/AddTableLootModifier.java index 848106ce98..f2ed06bb59 100644 --- a/src/main/java/net/neoforged/neoforge/common/loot/AddTableLootModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/loot/AddTableLootModifier.java @@ -5,10 +5,11 @@ package net.neoforged.neoforge.common.loot; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; @@ -38,34 +39,35 @@ public class AddTableLootModifier extends LootModifier { * @see NeoForgeMod#ADD_TABLE_LOOT_MODIFIER_TYPE */ @ApiStatus.Internal - public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( IGlobalLootModifier.LOOT_CONDITIONS_CODEC.fieldOf("conditions").forGetter(glm -> glm.conditions), - ResourceLocation.CODEC.fieldOf("table").forGetter(AddTableLootModifier::table)).apply(instance, AddTableLootModifier::new)); + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("table").forGetter(AddTableLootModifier::table)).apply(instance, AddTableLootModifier::new)); - private final ResourceLocation table; + private final ResourceKey table; - public AddTableLootModifier(LootItemCondition[] conditionsIn, ResourceLocation table) { + public AddTableLootModifier(LootItemCondition[] conditionsIn, ResourceKey table) { super(conditionsIn); this.table = table; } - public ResourceLocation table() { + public ResourceKey table() { return this.table; } @SuppressWarnings("deprecation") @Override protected ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - LootTable extraTable = context.getResolver().getLootTable(this.table); - // Don't run loot modifiers for subtables; - // the added loot will be modifiable by downstream loot modifiers modifying the target table, - // so if we modify it here then it could get modified twice. - extraTable.getRandomItemsRaw(context, LootTable.createStackSplitter(context.getLevel(), generatedLoot::add)); + context.getResolver().get(Registries.LOOT_TABLE, this.table).ifPresent(extraTable -> { + // Don't run loot modifiers for subtables; + // the added loot will be modifiable by downstream loot modifiers modifying the target table, + // so if we modify it here then it could get modified twice. + extraTable.value().getRandomItemsRaw(context, LootTable.createStackSplitter(context.getLevel(), generatedLoot::add)); + }); return generatedLoot; } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_TABLE_LOOT_MODIFIER_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/loot/CanToolPerformAction.java b/src/main/java/net/neoforged/neoforge/common/loot/CanToolPerformAction.java index 92aa0070be..70e22d3666 100644 --- a/src/main/java/net/neoforged/neoforge/common/loot/CanToolPerformAction.java +++ b/src/main/java/net/neoforged/neoforge/common/loot/CanToolPerformAction.java @@ -6,7 +6,7 @@ package net.neoforged.neoforge.common.loot; import com.google.common.collect.ImmutableSet; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Set; import net.minecraft.world.item.ItemStack; @@ -21,7 +21,7 @@ * This LootItemCondition "neoforge:can_tool_perform_action" can be used to check if a tool can perform a given ToolAction. */ public class CanToolPerformAction implements LootItemCondition { - public static Codec CODEC = RecordCodecBuilder.create( + public static MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ToolAction.CODEC.fieldOf("action").forGetter(action -> action.action)) diff --git a/src/main/java/net/neoforged/neoforge/common/loot/IGlobalLootModifier.java b/src/main/java/net/neoforged/neoforge/common/loot/IGlobalLootModifier.java index b9d78695f4..fcf61e8477 100644 --- a/src/main/java/net/neoforged/neoforge/common/loot/IGlobalLootModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/loot/IGlobalLootModifier.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common.loot; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import java.util.List; import java.util.Optional; @@ -29,7 +30,7 @@ public interface IGlobalLootModifier { .dispatch(IGlobalLootModifier::codec, Function.identity()); Codec>> CONDITIONAL_CODEC = ConditionalOps.createConditionalCodecWithConditions(DIRECT_CODEC); - Codec LOOT_CONDITIONS_CODEC = LootItemConditions.CODEC.listOf().xmap(list -> list.toArray(LootItemCondition[]::new), List::of); + Codec LOOT_CONDITIONS_CODEC = LootItemConditions.DIRECT_CODEC.listOf().xmap(list -> list.toArray(LootItemCondition[]::new), List::of); /** * Applies the modifier to the list of generated loot. This function needs to be responsible for @@ -45,5 +46,5 @@ public interface IGlobalLootModifier { /** * Returns the registered codec for this modifier */ - Codec codec(); + MapCodec codec(); } diff --git a/src/main/java/net/neoforged/neoforge/common/loot/LootModifier.java b/src/main/java/net/neoforged/neoforge/common/loot/LootModifier.java index 72f053e366..072fd58180 100644 --- a/src/main/java/net/neoforged/neoforge/common/loot/LootModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/loot/LootModifier.java @@ -13,8 +13,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.levelgen.feature.trunkplacers.BendingTrunkPlacer; import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.AllOfCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditions; /** * A base implementation of a Global Loot Modifier for modders to extend. @@ -45,7 +45,7 @@ protected static Products.P1, */ protected LootModifier(LootItemCondition[] conditionsIn) { this.conditions = conditionsIn; - this.combinedConditions = LootItemConditions.andConditions(List.of(conditionsIn)); + this.combinedConditions = AllOfCondition.allOf(List.of(conditionsIn)); } @Override diff --git a/src/main/java/net/neoforged/neoforge/common/loot/LootTableIdCondition.java b/src/main/java/net/neoforged/neoforge/common/loot/LootTableIdCondition.java index 1d635a0fd9..7a84c04adc 100644 --- a/src/main/java/net/neoforged/neoforge/common/loot/LootTableIdCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/loot/LootTableIdCondition.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.loot; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.LootContext; @@ -13,7 +13,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; public class LootTableIdCondition implements LootItemCondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ResourceLocation.CODEC.fieldOf("loot_table_id").forGetter(idCondition -> idCondition.targetLootTableId)) diff --git a/src/main/java/net/neoforged/neoforge/common/util/BlockSnapshot.java b/src/main/java/net/neoforged/neoforge/common/util/BlockSnapshot.java index 58d20abe0e..d301a22237 100644 --- a/src/main/java/net/neoforged/neoforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/neoforged/neoforge/common/util/BlockSnapshot.java @@ -8,6 +8,7 @@ import java.lang.ref.WeakReference; import java.util.Objects; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; @@ -58,12 +59,12 @@ public static BlockSnapshot create(ResourceKey dim, LevelAccessor world, } public static BlockSnapshot create(ResourceKey dim, LevelAccessor world, BlockPos pos, int flag) { - return new BlockSnapshot(dim, world, pos, world.getBlockState(pos), getBlockEntityTag(world.getBlockEntity(pos)), flag); + return new BlockSnapshot(dim, world, pos, world.getBlockState(pos), getBlockEntityTag(world.getBlockEntity(pos), world.registryAccess()), flag); } @Nullable - private static CompoundTag getBlockEntityTag(@Nullable BlockEntity te) { - return te == null ? null : te.saveWithFullMetadata(); + private static CompoundTag getBlockEntityTag(@Nullable BlockEntity te, HolderLookup.Provider provider) { + return te == null ? null : te.saveWithFullMetadata(provider); } public BlockState getCurrentBlock() { @@ -86,8 +87,8 @@ public BlockState getReplacedBlock() { } @Nullable - public BlockEntity getBlockEntity() { - return getTag() != null ? BlockEntity.loadStatic(getPos(), getReplacedBlock(), getTag()) : null; + public BlockEntity getBlockEntity(HolderLookup.Provider provider) { + return getTag() != null ? BlockEntity.loadStatic(getPos(), getReplacedBlock(), getTag(), provider) : null; } public boolean restore() { @@ -123,7 +124,7 @@ public boolean restoreToLocation(LevelAccessor world, BlockPos pos, boolean forc if (getTag() != null) { te = world.getBlockEntity(pos); if (te != null) { - te.load(getTag()); + te.loadWithComponents(getTag(), world.registryAccess()); te.setChanged(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/util/DummySavedData.java b/src/main/java/net/neoforged/neoforge/common/util/DummySavedData.java index 47d605d0ff..26ec0d5e65 100644 --- a/src/main/java/net/neoforged/neoforge/common/util/DummySavedData.java +++ b/src/main/java/net/neoforged/neoforge/common/util/DummySavedData.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.common.util; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.saveddata.SavedData; @@ -16,7 +17,7 @@ private DummySavedData() { } @Override - public CompoundTag save(final CompoundTag compound) { + public CompoundTag save(final CompoundTag compound, HolderLookup.Provider provider) { // NOOP return null; } diff --git a/src/main/java/net/neoforged/neoforge/common/util/FakePlayer.java b/src/main/java/net/neoforged/neoforge/common/util/FakePlayer.java index 178c198d5b..fecc07ae84 100644 --- a/src/main/java/net/neoforged/neoforge/common/util/FakePlayer.java +++ b/src/main/java/net/neoforged/neoforge/common/util/FakePlayer.java @@ -21,7 +21,7 @@ import net.minecraft.network.protocol.common.ServerboundKeepAlivePacket; import net.minecraft.network.protocol.common.ServerboundResourcePackPacket; import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; -import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQuery; +import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQueryPacket; import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ServerboundChatAckPacket; import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; @@ -33,7 +33,7 @@ import net.minecraft.network.protocol.game.ServerboundContainerClickPacket; import net.minecraft.network.protocol.game.ServerboundContainerClosePacket; import net.minecraft.network.protocol.game.ServerboundEditBookPacket; -import net.minecraft.network.protocol.game.ServerboundEntityTagQuery; +import net.minecraft.network.protocol.game.ServerboundEntityTagQueryPacket; import net.minecraft.network.protocol.game.ServerboundInteractPacket; import net.minecraft.network.protocol.game.ServerboundJigsawGeneratePacket; import net.minecraft.network.protocol.game.ServerboundLockDifficultyPacket; @@ -121,7 +121,7 @@ private static class FakePlayerNetHandler extends ServerGamePacketListenerImpl { private static final Connection DUMMY_CONNECTION = new FakeConnection(); public FakePlayerNetHandler(MinecraftServer server, ServerPlayer player) { - super(server, DUMMY_CONNECTION, player, CommonListenerCookie.createInitial(player.getGameProfile())); + super(server, DUMMY_CONNECTION, player, CommonListenerCookie.createInitial(player.getGameProfile(), false)); } @Override @@ -185,10 +185,10 @@ public void handleSelectTrade(ServerboundSelectTradePacket packet) {} public void handleEditBook(ServerboundEditBookPacket packet) {} @Override - public void handleEntityTagQuery(ServerboundEntityTagQuery packet) {} + public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) {} @Override - public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {} + public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQueryPacket packet) {} @Override public void handleMovePlayer(ServerboundMovePlayerPacket packet) {} @@ -308,6 +308,6 @@ public FakeConnection() { } @Override - public void setListener(PacketListener listener) {} + public void setListenerForServerboundHandshake(PacketListener listener) {} } } diff --git a/src/main/java/net/neoforged/neoforge/common/util/FriendlyByteBufUtil.java b/src/main/java/net/neoforged/neoforge/common/util/FriendlyByteBufUtil.java index 9fb360cb20..eddc5db4f6 100644 --- a/src/main/java/net/neoforged/neoforge/common/util/FriendlyByteBufUtil.java +++ b/src/main/java/net/neoforged/neoforge/common/util/FriendlyByteBufUtil.java @@ -7,7 +7,9 @@ import io.netty.buffer.Unpooled; import java.util.function.Consumer; +import net.minecraft.core.RegistryAccess; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; /** * Utility class for working with {@link FriendlyByteBuf}s. @@ -18,13 +20,14 @@ private FriendlyByteBufUtil() { } /** - * Writes custom data to a {@link FriendlyByteBuf}, then returns the written data as a byte array. + * Writes custom data to a {@link RegistryFriendlyByteBuf}, then returns the written data as a byte array. * - * @param dataWriter The data writer. + * @param dataWriter The data writer. + * @param registryAccess The registry access used by registry dependent writers on the buffer * @return The written data. */ - public static byte[] writeCustomData(Consumer dataWriter) { - final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); + public static byte[] writeCustomData(Consumer dataWriter, RegistryAccess registryAccess) { + final RegistryFriendlyByteBuf buf = new RegistryFriendlyByteBuf(Unpooled.buffer(), registryAccess); try { dataWriter.accept(buf); return buf.array(); diff --git a/src/main/java/net/neoforged/neoforge/common/util/INBTSerializable.java b/src/main/java/net/neoforged/neoforge/common/util/INBTSerializable.java index c0362a4636..f7a10af101 100644 --- a/src/main/java/net/neoforged/neoforge/common/util/INBTSerializable.java +++ b/src/main/java/net/neoforged/neoforge/common/util/INBTSerializable.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.common.util; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.Tag; import org.jetbrains.annotations.UnknownNullability; @@ -14,7 +15,7 @@ */ public interface INBTSerializable { @UnknownNullability - T serializeNBT(); + T serializeNBT(HolderLookup.Provider provider); - void deserializeNBT(T nbt); + void deserializeNBT(HolderLookup.Provider provider, T nbt); } diff --git a/src/main/java/net/neoforged/neoforge/common/world/BiomeModifier.java b/src/main/java/net/neoforged/neoforge/common/world/BiomeModifier.java index 450a0e2074..6330ff523e 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/BiomeModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/world/BiomeModifier.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common.world; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.function.Function; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -65,7 +66,7 @@ public interface BiomeModifier { /** * @return the codec which serializes and deserializes this biome modifier */ - Codec codec(); + MapCodec codec(); enum Phase { /** diff --git a/src/main/java/net/neoforged/neoforge/common/world/BiomeModifiers.java b/src/main/java/net/neoforged/neoforge/common/world/BiomeModifiers.java index e26e845965..9fd2b53702 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/BiomeModifiers.java +++ b/src/main/java/net/neoforged/neoforge/common/world/BiomeModifiers.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.world; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -55,7 +55,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_FEATURES_BIOME_MODIFIER_TYPE.get(); } } @@ -99,7 +99,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.REMOVE_FEATURES_BIOME_MODIFIER_TYPE.get(); } } @@ -169,7 +169,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_SPAWNS_BIOME_MODIFIER_TYPE.get(); } } @@ -202,7 +202,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.REMOVE_SPAWNS_BIOME_MODIFIER_TYPE.get(); } } @@ -234,7 +234,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_CARVERS_BIOME_MODIFIER_TYPE.get(); } } @@ -278,7 +278,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.REMOVE_CARVERS_BIOME_MODIFIER_TYPE.get(); } } @@ -315,7 +315,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_SPAWN_COSTS_BIOME_MODIFIER_TYPE.get(); } } @@ -347,7 +347,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.REMOVE_SPAWN_COSTS_BIOME_MODIFIER_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/world/LevelChunkAuxiliaryLightManager.java b/src/main/java/net/neoforged/neoforge/common/world/LevelChunkAuxiliaryLightManager.java index 56ce51cfab..d86f5c6be2 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/LevelChunkAuxiliaryLightManager.java +++ b/src/main/java/net/neoforged/neoforge/common/world/LevelChunkAuxiliaryLightManager.java @@ -10,6 +10,7 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.protocol.Packet; @@ -59,7 +60,7 @@ public int getLightAt(BlockPos pos) { @Nullable @Override - public ListTag serializeNBT() { + public ListTag serializeNBT(HolderLookup.Provider provider) { if (lights.isEmpty()) { return null; } @@ -75,7 +76,7 @@ public ListTag serializeNBT() { } @Override - public void deserializeNBT(ListTag list) { + public void deserializeNBT(HolderLookup.Provider provider, ListTag list) { for (int i = 0; i < list.size(); i++) { CompoundTag tag = list.getCompound(i); lights.put(BlockPos.of(tag.getLong("pos")), tag.getByte("level")); diff --git a/src/main/java/net/neoforged/neoforge/common/world/NoneBiomeModifier.java b/src/main/java/net/neoforged/neoforge/common/world/NoneBiomeModifier.java index 0b83e77997..50cea51bf3 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/NoneBiomeModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/world/NoneBiomeModifier.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.world; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.Holder; import net.minecraft.world.level.biome.Biome; import net.neoforged.neoforge.common.NeoForgeMod; @@ -19,7 +19,7 @@ public void modify(Holder biome, Phase phase, ModifiableBiomeInfo.BiomeIn } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.NONE_BIOME_MODIFIER_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/world/NoneStructureModifier.java b/src/main/java/net/neoforged/neoforge/common/world/NoneStructureModifier.java index ef29a69d86..d355e4d6e1 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/NoneStructureModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/world/NoneStructureModifier.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.world; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.Holder; import net.minecraft.world.level.levelgen.structure.Structure; import net.neoforged.neoforge.common.NeoForgeMod; @@ -19,7 +19,7 @@ public void modify(Holder structure, Phase phase, ModifiableStructure } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.NONE_STRUCTURE_MODIFIER_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/world/StructureModifier.java b/src/main/java/net/neoforged/neoforge/common/world/StructureModifier.java index 5be6365d3c..8bbf905719 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/StructureModifier.java +++ b/src/main/java/net/neoforged/neoforge/common/world/StructureModifier.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common.world; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.function.Function; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -66,7 +67,7 @@ public interface StructureModifier { /** * @return the codec which serializes and deserializes this structure modifier */ - Codec codec(); + MapCodec codec(); enum Phase { /** diff --git a/src/main/java/net/neoforged/neoforge/common/world/StructureModifiers.java b/src/main/java/net/neoforged/neoforge/common/world/StructureModifiers.java index ee80d1d707..236aa55a5c 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/StructureModifiers.java +++ b/src/main/java/net/neoforged/neoforge/common/world/StructureModifiers.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.world; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.List; import java.util.Set; import net.minecraft.core.Holder; @@ -91,7 +91,7 @@ public void modify(Holder structure, Phase phase, ModifiableStructure } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.ADD_SPAWNS_STRUCTURE_MODIFIER_TYPE.get(); } } @@ -133,7 +133,7 @@ public void modify(Holder structure, Phase phase, ModifiableStructure } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.REMOVE_SPAWNS_STRUCTURE_MODIFIER_TYPE.get(); } } @@ -169,7 +169,7 @@ public void modify(Holder structure, Phase phase, ModifiableStructure } @Override - public Codec codec() { + public MapCodec codec() { return NeoForgeMod.CLEAR_SPAWNS_STRUCTURE_MODIFIER_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/world/chunk/ForcedChunkManager.java b/src/main/java/net/neoforged/neoforge/common/world/chunk/ForcedChunkManager.java index 63dbff8c7f..dc6b0e8f58 100644 --- a/src/main/java/net/neoforged/neoforge/common/world/chunk/ForcedChunkManager.java +++ b/src/main/java/net/neoforged/neoforge/common/world/chunk/ForcedChunkManager.java @@ -193,7 +193,7 @@ private static > void reinstatePersistentChunks( public static void writeModForcedChunks(CompoundTag nbt, TicketTracker blockForcedChunks, TicketTracker entityForcedChunks) { if (!blockForcedChunks.isEmpty() || !entityForcedChunks.isEmpty()) { Map> forcedEntries = new HashMap<>(); - writeForcedChunkOwners(forcedEntries, blockForcedChunks, "Blocks", Tag.TAG_COMPOUND, (pos, forcedBlocks) -> forcedBlocks.add(NbtUtils.writeBlockPos(pos))); + writeForcedChunkOwners(forcedEntries, blockForcedChunks, "Blocks", Tag.TAG_COMPOUND, (pos, forcedBlocks) -> forcedBlocks.add(writeBlockPos(pos))); writeForcedChunkOwners(forcedEntries, entityForcedChunks, "Entities", Tag.TAG_INT_ARRAY, (uuid, forcedEntities) -> forcedEntities.add(NbtUtils.createUUID(uuid))); ListTag forcedChunks = new ListTag(); for (Map.Entry> entry : forcedEntries.entrySet()) { @@ -270,10 +270,22 @@ public static void readModForcedChunks(CompoundTag nbt, TicketTracker private static void readBlockForcedChunks(ResourceLocation controllerId, long chunkPos, CompoundTag modEntry, String key, Map, LongSet> blockForcedChunks) { ListTag forcedBlocks = modEntry.getList(key, Tag.TAG_COMPOUND); for (int k = 0; k < forcedBlocks.size(); k++) { - blockForcedChunks.computeIfAbsent(new TicketOwner<>(controllerId, NbtUtils.readBlockPos(forcedBlocks.getCompound(k))), owner -> new LongOpenHashSet()).add(chunkPos); + blockForcedChunks.computeIfAbsent(new TicketOwner<>(controllerId, readBlockPos(forcedBlocks.getCompound(k))), owner -> new LongOpenHashSet()).add(chunkPos); } } + private static BlockPos readBlockPos(CompoundTag compoundtag) { + return new BlockPos(compoundtag.getInt("X"), compoundtag.getInt("Y"), compoundtag.getInt("Z")); + } + + public static CompoundTag writeBlockPos(BlockPos blockpos) { + CompoundTag compoundtag = new CompoundTag(); + compoundtag.putInt("X", blockpos.getX()); + compoundtag.putInt("Y", blockpos.getY()); + compoundtag.putInt("Z", blockpos.getZ()); + return compoundtag; + } + /** * Reads the forge entity forced chunks. */ diff --git a/src/main/java/net/neoforged/neoforge/data/event/GatherDataEvent.java b/src/main/java/net/neoforged/neoforge/data/event/GatherDataEvent.java index c4364f6a59..7ae69bf146 100644 --- a/src/main/java/net/neoforged/neoforge/data/event/GatherDataEvent.java +++ b/src/main/java/net/neoforged/neoforge/data/event/GatherDataEvent.java @@ -5,7 +5,8 @@ package net.neoforged.neoforge.data.event; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; @@ -126,12 +127,16 @@ public DataGenerator makeGenerator(final Function pathEnhancer, fina public void runAll() { Map> paths = generators.stream().collect(Collectors.groupingBy(gen -> gen.getPackOutput().getOutputFolder(), LinkedHashMap::new, Collectors.toList())); - paths.values().forEach(LamdbaExceptionUtils.rethrowConsumer(lst -> { + paths.values().forEach(lst -> { DataGenerator parent = lst.get(0); for (int x = 1; x < lst.size(); x++) lst.get(x).getProvidersView().forEach((name, provider) -> parent.addProvider(true, provider)); - parent.run(); - })); + try { + parent.run(); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); } } } diff --git a/src/main/java/net/neoforged/neoforge/energy/EnergyStorage.java b/src/main/java/net/neoforged/neoforge/energy/EnergyStorage.java index b6250cff83..87a590197e 100644 --- a/src/main/java/net/neoforged/neoforge/energy/EnergyStorage.java +++ b/src/main/java/net/neoforged/neoforge/energy/EnergyStorage.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.energy; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.IntTag; import net.minecraft.nbt.Tag; import net.neoforged.neoforge.common.util.INBTSerializable; @@ -83,12 +84,12 @@ public boolean canReceive() { } @Override - public Tag serializeNBT() { + public Tag serializeNBT(HolderLookup.Provider provider) { return IntTag.valueOf(this.getEnergyStored()); } @Override - public void deserializeNBT(Tag nbt) { + public void deserializeNBT(HolderLookup.Provider provider, Tag nbt) { if (!(nbt instanceof IntTag intNbt)) throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation"); this.energy = intNbt.getAsInt(); diff --git a/src/main/java/net/neoforged/neoforge/entity/IEntityWithComplexSpawn.java b/src/main/java/net/neoforged/neoforge/entity/IEntityWithComplexSpawn.java index 323cdc1030..894b0564ee 100644 --- a/src/main/java/net/neoforged/neoforge/entity/IEntityWithComplexSpawn.java +++ b/src/main/java/net/neoforged/neoforge/entity/IEntityWithComplexSpawn.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.entity; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; /** * An interface for Entities that need extra information to be communicated @@ -18,7 +18,7 @@ public interface IEntityWithComplexSpawn { * * @param buffer The packet data stream */ - void writeSpawnData(FriendlyByteBuf buffer); + void writeSpawnData(RegistryFriendlyByteBuf buffer); /** * Called by the client when it receives a Entity spawn packet. @@ -26,5 +26,5 @@ public interface IEntityWithComplexSpawn { * * @param additionalData The packet data stream */ - void readSpawnData(FriendlyByteBuf additionalData); + void readSpawnData(RegistryFriendlyByteBuf additionalData); } diff --git a/src/main/java/net/neoforged/neoforge/event/AddReloadListenerEvent.java b/src/main/java/net/neoforged/neoforge/event/AddReloadListenerEvent.java index 0b56f212ca..ff15701cf4 100644 --- a/src/main/java/net/neoforged/neoforge/event/AddReloadListenerEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/AddReloadListenerEvent.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; import net.minecraft.server.ReloadableServerResources; import net.minecraft.server.packs.resources.PreparableReloadListener; @@ -82,9 +83,9 @@ private WrappedStateAwareListener(final PreparableReloadListener wrapped) { } @Override - public void injectContext(ICondition.IContext context, RegistryAccess regAccess) { + public void injectContext(ICondition.IContext context, HolderLookup.Provider registryLookup) { if (this.wrapped instanceof ContextAwareReloadListener contextAwareListener) { - contextAwareListener.injectContext(context, regAccess); + contextAwareListener.injectContext(context, registryLookup); } } diff --git a/src/main/java/net/neoforged/neoforge/event/AnvilUpdateEvent.java b/src/main/java/net/neoforged/neoforge/event/AnvilUpdateEvent.java index 01d694b84c..a9bcae1025 100644 --- a/src/main/java/net/neoforged/neoforge/event/AnvilUpdateEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/AnvilUpdateEvent.java @@ -25,11 +25,11 @@ public class AnvilUpdateEvent extends Event implements ICancellableEvent { private final ItemStack right; private final String name; private ItemStack output; - private int cost; + private long cost; private int materialCost; private final Player player; - public AnvilUpdateEvent(ItemStack left, ItemStack right, String name, int cost, Player player) { + public AnvilUpdateEvent(ItemStack left, ItemStack right, String name, long cost, Player player) { this.left = left; this.right = right; this.output = ItemStack.EMPTY; @@ -91,7 +91,7 @@ public void setOutput(ItemStack output) { * * @return The level cost of this anvil operation. */ - public int getCost() { + public long getCost() { return cost; } @@ -99,10 +99,12 @@ public int getCost() { * Changes the level cost of this operation.
* The level cost does prevent the output from being available.
* That is, a player without enough experience may not take the output. + * + *

Values will be clamped to the range 0 - MAX_INT. * * @param cost The new level cost. */ - public void setCost(int cost) { + public void setCost(long cost) { this.cost = cost; } diff --git a/src/main/java/net/neoforged/neoforge/event/EventHooks.java b/src/main/java/net/neoforged/neoforge/event/EventHooks.java index 618d88c50d..baf38b932e 100644 --- a/src/main/java/net/neoforged/neoforge/event/EventHooks.java +++ b/src/main/java/net/neoforged/neoforge/event/EventHooks.java @@ -9,9 +9,7 @@ import com.mojang.brigadier.CommandDispatcher; import java.io.File; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.function.BooleanSupplier; import java.util.function.Consumer; @@ -25,7 +23,6 @@ import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -72,6 +69,7 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Explosion; @@ -256,7 +254,7 @@ public static boolean checkSpawnPositionSpawner(Mob mob, ServerLevelAccessor lev * *

      * var zombie = new Zombie(level);
-     * zombie.finalizeSpawn(level, difficulty, spawnType, spawnData, spawnTag);
+     * zombie.finalizeSpawn(level, difficulty, spawnType, spawnData);
      * level.tryAddFreshEntityWithPassengers(zombie);
      * if (zombie.isAddedToWorld()) {
      *     // Do stuff with your new zombie
@@ -269,7 +267,7 @@ public static boolean checkSpawnPositionSpawner(Mob mob, ServerLevelAccessor lev
      * 
      * 
      * var zombie = new Zombie(level);
-     * EventHook.onFinalizeSpawn(zombie, level, difficulty, spawnType, spawnData, spawnTag);
+     * EventHook.onFinalizeSpawn(zombie, level, difficulty, spawnType, spawnData);
      * level.tryAddFreshEntityWithPassengers(zombie);
      * if (zombie.isAddedToWorld()) {
      *     // Do stuff with your new zombie
@@ -281,18 +279,18 @@ public static boolean checkSpawnPositionSpawner(Mob mob, ServerLevelAccessor lev
      * 
      * @return The SpawnGroupData from this event, or null if it was canceled. The return value of this method has no bearing on if the entity will be spawned.
      * @see MobSpawnEvent.FinalizeSpawn
-     * @see Mob#finalizeSpawn(ServerLevelAccessor, DifficultyInstance, MobSpawnType, SpawnGroupData, CompoundTag)
+     * @see Mob#finalizeSpawn(ServerLevelAccessor, DifficultyInstance, MobSpawnType, SpawnGroupData)
      * @apiNote Callers do not need to check if the entity's spawn was cancelled, as the spawn will be blocked by Forge.
      * @implNote Changes to the signature of this method must be reflected in the method redirector coremod.
      */
     @Nullable
     @SuppressWarnings("deprecation") // Call to deprecated Mob#finalizeSpawn is expected.
-    public static SpawnGroupData onFinalizeSpawn(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag spawnTag) {
-        var event = new MobSpawnEvent.FinalizeSpawn(mob, level, mob.getX(), mob.getY(), mob.getZ(), difficulty, spawnType, spawnData, spawnTag, null);
+    public static SpawnGroupData onFinalizeSpawn(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnData) {
+        var event = new MobSpawnEvent.FinalizeSpawn(mob, level, mob.getX(), mob.getY(), mob.getZ(), difficulty, spawnType, spawnData, null);
         boolean cancel = NeoForge.EVENT_BUS.post(event).isCanceled();
 
         if (!cancel) {
-            mob.finalizeSpawn(level, event.getDifficulty(), event.getSpawnType(), event.getSpawnData(), event.getSpawnTag());
+            mob.finalizeSpawn(level, event.getDifficulty(), event.getSpawnType(), event.getSpawnData());
         }
 
         return cancel ? null : event.getSpawnData();
@@ -306,8 +304,8 @@ public static SpawnGroupData onFinalizeSpawn(Mob mob, ServerLevelAccessor level,
      * @see #onFinalizeSpawn
      */
     @Nullable
-    public static MobSpawnEvent.FinalizeSpawn onFinalizeSpawnSpawner(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag spawnTag, BaseSpawner spawner) {
-        var event = new MobSpawnEvent.FinalizeSpawn(mob, level, mob.getX(), mob.getY(), mob.getZ(), difficulty, MobSpawnType.SPAWNER, spawnData, spawnTag, spawner);
+    public static MobSpawnEvent.FinalizeSpawn onFinalizeSpawnSpawner(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, @Nullable SpawnGroupData spawnData, BaseSpawner spawner) {
+        var event = new MobSpawnEvent.FinalizeSpawn(mob, level, mob.getX(), mob.getY(), mob.getZ(), difficulty, MobSpawnType.SPAWNER, spawnData, spawner);
         boolean cancel = NeoForge.EVENT_BUS.post(event).isCanceled();
         return cancel ? null : event;
     }
@@ -415,7 +413,7 @@ public static void firePlayerSavingEvent(Player player, File playerDirectory, St
     }
 
     public static void firePlayerLoadingEvent(Player player, PlayerDataStorage playerFileData, String uuidString) {
-        NeoForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerFileData.getPlayerDataFolder(), uuidString));
+        NeoForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerFileData.getPlayerDir(), uuidString));
     }
 
     @Nullable
@@ -877,7 +875,7 @@ public static void onAdvancementProgressedEvent(Player player, AdvancementHolder
         NeoForge.EVENT_BUS.post(new AdvancementProgressEvent(player, progressed, advancementProgress, criterion, progressType));
     }
 
-    public static boolean onEffectRemoved(LivingEntity entity, MobEffect effect, @Nullable EffectCure cure) {
+    public static boolean onEffectRemoved(LivingEntity entity, Holder effect, @Nullable EffectCure cure) {
         return NeoForge.EVENT_BUS.post(new MobEffectEvent.Remove(entity, effect, cure)).isCanceled();
     }
 
@@ -894,11 +892,11 @@ public static boolean onEffectRemoved(LivingEntity entity, MobEffectInstance eff
      * @return The new level of the enchantment.
      */
     public static int getEnchantmentLevelSpecific(int level, ItemStack stack, Enchantment ench) {
-        Map map = new HashMap<>();
-        map.put(ench, level);
-        var event = new GetEnchantmentLevelEvent(stack, map, ench);
+        var enchantments = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY);
+        enchantments.set(ench, level);
+        var event = new GetEnchantmentLevelEvent(stack, enchantments, ench);
         NeoForge.EVENT_BUS.post(event);
-        return event.getEnchantments().getOrDefault(ench, 0);
+        return enchantments.getLevel(ench);
     }
 
     /**
@@ -908,11 +906,11 @@ public static int getEnchantmentLevelSpecific(int level, ItemStack stack, Enchan
      * @param stack        The stack being queried against.
      * @return The new enchantment map.
      */
-    public static Map getEnchantmentLevel(Map enchantments, ItemStack stack) {
-        enchantments = new HashMap<>(enchantments);
-        var event = new GetEnchantmentLevelEvent(stack, enchantments, null);
+    public static ItemEnchantments getEnchantmentLevel(ItemEnchantments enchantments, ItemStack stack) {
+        var mutableEnchantments = new ItemEnchantments.Mutable(enchantments);
+        var event = new GetEnchantmentLevelEvent(stack, mutableEnchantments, null);
         NeoForge.EVENT_BUS.post(event);
-        return enchantments;
+        return mutableEnchantments.toImmutable();
     }
 
     /**
diff --git a/src/main/java/net/neoforged/neoforge/event/ItemAttributeModifierEvent.java b/src/main/java/net/neoforged/neoforge/event/ItemAttributeModifierEvent.java
index 9540ef4525..c374c2c293 100644
--- a/src/main/java/net/neoforged/neoforge/event/ItemAttributeModifierEvent.java
+++ b/src/main/java/net/neoforged/neoforge/event/ItemAttributeModifierEvent.java
@@ -9,6 +9,7 @@
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
 import java.util.Collection;
+import net.minecraft.core.Holder;
 import net.minecraft.world.entity.EquipmentSlot;
 import net.minecraft.world.entity.ai.attributes.Attribute;
 import net.minecraft.world.entity.ai.attributes.AttributeModifier;
@@ -30,12 +31,12 @@
 public class ItemAttributeModifierEvent extends Event {
     private final ItemStack stack;
     private final EquipmentSlot slotType;
-    private final Multimap originalModifiers;
-    private Multimap unmodifiableModifiers;
+    private final Multimap, AttributeModifier> originalModifiers;
+    private Multimap, AttributeModifier> unmodifiableModifiers;
     @Nullable
-    private Multimap modifiableModifiers;
+    private Multimap, AttributeModifier> modifiableModifiers;
 
-    public ItemAttributeModifierEvent(ItemStack stack, EquipmentSlot slotType, Multimap modifiers) {
+    public ItemAttributeModifierEvent(ItemStack stack, EquipmentSlot slotType, Multimap, AttributeModifier> modifiers) {
         this.stack = stack;
         this.slotType = slotType;
         this.unmodifiableModifiers = this.originalModifiers = modifiers;
@@ -46,21 +47,21 @@ public ItemAttributeModifierEvent(ItemStack stack, EquipmentSlot slotType, Multi
      * Note that adding attributes based on existing attributes may lead to inconsistent results between the tooltip (client)
      * and the actual attributes (server) if the listener order is different. Using {@link #getOriginalModifiers()} instead will give more consistent results.
      */
-    public Multimap getModifiers() {
+    public Multimap, AttributeModifier> getModifiers() {
         return this.unmodifiableModifiers;
     }
 
     /**
      * Returns the attribute map before any changes from other event listeners was made.
      */
-    public Multimap getOriginalModifiers() {
+    public Multimap, AttributeModifier> getOriginalModifiers() {
         return this.originalModifiers;
     }
 
     /**
      * Gets a modifiable map instance, creating it if the current map is currently unmodifiable
      */
-    private Multimap getModifiableMap() {
+    private Multimap, AttributeModifier> getModifiableMap() {
         if (this.modifiableModifiers == null) {
             this.modifiableModifiers = HashMultimap.create(this.originalModifiers);
             this.unmodifiableModifiers = Multimaps.unmodifiableMultimap(this.modifiableModifiers);
@@ -77,7 +78,7 @@ private Multimap getModifiableMap() {
      * @param modifier  Modifier instance.
      * @return True if the attribute was added, false if it was already present
      */
-    public boolean addModifier(Attribute attribute, AttributeModifier modifier) {
+    public boolean addModifier(Holder attribute, AttributeModifier modifier) {
         return getModifiableMap().put(attribute, modifier);
     }
 
@@ -88,7 +89,7 @@ public boolean addModifier(Attribute attribute, AttributeModifier modifier) {
      * @param modifier  Modifier instance
      * @return True if an attribute was removed, false if no change
      */
-    public boolean removeModifier(Attribute attribute, AttributeModifier modifier) {
+    public boolean removeModifier(Holder attribute, AttributeModifier modifier) {
         return getModifiableMap().remove(attribute, modifier);
     }
 
@@ -98,7 +99,7 @@ public boolean removeModifier(Attribute attribute, AttributeModifier modifier) {
      * @param attribute Attribute
      * @return Collection of removed modifiers
      */
-    public Collection removeAttribute(Attribute attribute) {
+    public Collection removeAttribute(Holder attribute) {
         return getModifiableMap().removeAll(attribute);
     }
 
diff --git a/src/main/java/net/neoforged/neoforge/event/VanillaGameEvent.java b/src/main/java/net/neoforged/neoforge/event/VanillaGameEvent.java
index 024e52084c..b36c2513b2 100644
--- a/src/main/java/net/neoforged/neoforge/event/VanillaGameEvent.java
+++ b/src/main/java/net/neoforged/neoforge/event/VanillaGameEvent.java
@@ -5,6 +5,7 @@
 
 package net.neoforged.neoforge.event;
 
+import net.minecraft.core.Holder;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.level.Level;
 import net.minecraft.world.level.gameevent.GameEvent;
@@ -25,11 +26,11 @@
  **/
 public class VanillaGameEvent extends Event implements ICancellableEvent {
     private final Level level;
-    private final GameEvent vanillaEvent;
+    private final Holder vanillaEvent;
     private final Vec3 position;
     private final GameEvent.Context context;
 
-    public VanillaGameEvent(Level level, GameEvent vanillaEvent, Vec3 position, GameEvent.Context context) {
+    public VanillaGameEvent(Level level, Holder vanillaEvent, Vec3 position, GameEvent.Context context) {
         this.level = level;
         this.vanillaEvent = vanillaEvent;
         this.position = position;
@@ -54,7 +55,7 @@ public Entity getCause() {
     /**
      * @return The Vanilla event.
      */
-    public GameEvent getVanillaEvent() {
+    public Holder getVanillaEvent() {
         return vanillaEvent;
     }
 
diff --git a/src/main/java/net/neoforged/neoforge/event/brewing/RegisterBrewingRecipesEvent.java b/src/main/java/net/neoforged/neoforge/event/brewing/RegisterBrewingRecipesEvent.java
new file mode 100644
index 0000000000..53ff0f6af2
--- /dev/null
+++ b/src/main/java/net/neoforged/neoforge/event/brewing/RegisterBrewingRecipesEvent.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) NeoForged and contributors
+ * SPDX-License-Identifier: LGPL-2.1-only
+ */
+
+package net.neoforged.neoforge.event.brewing;
+
+import net.minecraft.world.item.alchemy.PotionBrewing;
+import net.neoforged.bus.api.Event;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Event to register new brewing recipes.
+ *
+ * 

Fired on both client and server side, on the main event bus. + */ +public class RegisterBrewingRecipesEvent extends Event { + private final PotionBrewing.Builder builder; + + @ApiStatus.Internal + public RegisterBrewingRecipesEvent(PotionBrewing.Builder builder) { + this.builder = builder; + } + + public PotionBrewing.Builder getBuilder() { + return builder; + } +} diff --git a/src/main/java/net/neoforged/neoforge/event/enchanting/GetEnchantmentLevelEvent.java b/src/main/java/net/neoforged/neoforge/event/enchanting/GetEnchantmentLevelEvent.java index aa30078b76..fc6ca56d12 100644 --- a/src/main/java/net/neoforged/neoforge/event/enchanting/GetEnchantmentLevelEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/enchanting/GetEnchantmentLevelEvent.java @@ -5,9 +5,9 @@ package net.neoforged.neoforge.event.enchanting; -import java.util.Map; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.neoforged.bus.api.Event; import net.neoforged.neoforge.common.extensions.IItemStackExtension; import org.jetbrains.annotations.Nullable; @@ -20,11 +20,11 @@ */ public class GetEnchantmentLevelEvent extends Event { protected final ItemStack stack; - protected final Map enchantments; + protected final ItemEnchantments.Mutable enchantments; @Nullable protected final Enchantment targetEnchant; - public GetEnchantmentLevelEvent(ItemStack stack, Map enchantments, @Nullable Enchantment targetEnchant) { + public GetEnchantmentLevelEvent(ItemStack stack, ItemEnchantments.Mutable enchantments, @Nullable Enchantment targetEnchant) { this.stack = stack; this.enchantments = enchantments; this.targetEnchant = targetEnchant; @@ -40,7 +40,7 @@ public ItemStack getStack() { /** * Returns the mutable enchantment->level map. */ - public Map getEnchantments() { + public ItemEnchantments.Mutable getEnchantments() { return this.enchantments; } diff --git a/src/main/java/net/neoforged/neoforge/event/entity/EntityAttributeModificationEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/EntityAttributeModificationEvent.java index f634afd99f..4d4e8a614a 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/EntityAttributeModificationEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/EntityAttributeModificationEvent.java @@ -9,6 +9,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -39,17 +40,17 @@ public EntityAttributeModificationEvent(Map, .collect(Collectors.toList())); } - public void add(EntityType entityType, Attribute attribute, double value) { + public void add(EntityType entityType, Holder attribute, double value) { AttributeSupplier.Builder attributes = entityAttributes.computeIfAbsent(entityType, (type) -> new AttributeSupplier.Builder()); attributes.add(attribute, value); } - public void add(EntityType entityType, Attribute attribute) { - add(entityType, attribute, attribute.getDefaultValue()); + public void add(EntityType entityType, Holder attribute) { + add(entityType, attribute, attribute.value().getDefaultValue()); } - public boolean has(EntityType entityType, Attribute attribute) { + public boolean has(EntityType entityType, Holder attribute) { AttributeSupplier globalMap = DefaultAttributes.getSupplier(entityType); return globalMap.hasAttribute(attribute) || (entityAttributes.get(entityType) != null && entityAttributes.get(entityType).hasAttribute(attribute)); } diff --git a/src/main/java/net/neoforged/neoforge/event/entity/EntityEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/EntityEvent.java index 88dfaf0e69..199a4a5ffe 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/EntityEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/EntityEvent.java @@ -166,7 +166,7 @@ public void setNewSize(EntityDimensions size) { public void setNewSize(EntityDimensions size, boolean updateEyeHeight) { this.newSize = size; if (updateEyeHeight) { - this.newEyeHeight = this.getEntity().getEyeHeightAccess(this.getPose(), this.newSize); + this.newEyeHeight = this.getEntity().getEyeHeightAccess(this.getPose()); } } diff --git a/src/main/java/net/neoforged/neoforge/event/entity/EntityJoinLevelEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/EntityJoinLevelEvent.java index 4b8e0589d9..2428e13c14 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/EntityJoinLevelEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/EntityJoinLevelEvent.java @@ -7,8 +7,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.status.ChunkStatus; import net.neoforged.bus.api.ICancellableEvent; import net.neoforged.fml.LogicalSide; import net.neoforged.neoforge.common.NeoForge; diff --git a/src/main/java/net/neoforged/neoforge/event/entity/SpawnPlacementRegisterEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/SpawnPlacementRegisterEvent.java index acf3ed5458..b29537a289 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/SpawnPlacementRegisterEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/SpawnPlacementRegisterEvent.java @@ -12,10 +12,12 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.SpawnPlacementType; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.level.levelgen.Heightmap; import net.neoforged.bus.api.Event; import net.neoforged.bus.api.EventPriority; +import net.neoforged.bus.api.ICancellableEvent; import net.neoforged.fml.event.IModBusEvent; import org.jetbrains.annotations.ApiStatus; @@ -23,7 +25,7 @@ * This event allows each {@link EntityType} to have a {@link SpawnPlacements.SpawnPredicate} registered or modified. * Spawn Predicates are checked whenever an {@link Entity} of the given {@link EntityType} spawns in the world naturally. * - * If registering your own entity's spawn placements, you should use {@link SpawnPlacementRegisterEvent#register(EntityType, SpawnPlacements.Type, Heightmap.Types, SpawnPlacements.SpawnPredicate, Operation)} + * If registering your own entity's spawn placements, you should use {@link SpawnPlacementRegisterEvent#register(EntityType, SpawnPlacementType, Heightmap.Types, SpawnPlacements.SpawnPredicate, Operation)} * So that you ensure that your entity has a heightmap type and placement type registered. * * If modifying vanilla or another mod's spawn placements, you can use three operations: @@ -65,7 +67,7 @@ public void register(EntityType entityType, SpawnPlacement * Use {@code null} for the placement or heightmap to leave them as is (which should be done in almost every case) */ @SuppressWarnings("unchecked") - public void register(EntityType entityType, @Nullable SpawnPlacements.Type placementType, @Nullable Heightmap.Types heightmap, SpawnPlacements.SpawnPredicate predicate, Operation operation) { + public void register(EntityType entityType, @Nullable SpawnPlacementType placementType, @Nullable Heightmap.Types heightmap, SpawnPlacements.SpawnPredicate predicate, Operation operation) { if (!map.containsKey(entityType)) { if (placementType == null) { throw new NullPointerException("Registering a new Spawn Predicate requires a nonnull placement type! Entity Type: " + BuiltInRegistries.ENTITY_TYPE.getKey(entityType)); @@ -103,10 +105,10 @@ public static class MergedSpawnPredicate { private final List> andPredicates; @Nullable private SpawnPlacements.SpawnPredicate replacementPredicate; - private SpawnPlacements.Type spawnType; + private SpawnPlacementType spawnType; private Heightmap.Types heightmapType; - public MergedSpawnPredicate(SpawnPlacements.SpawnPredicate originalPredicate, SpawnPlacements.Type spawnType, Heightmap.Types heightmapType) { + public MergedSpawnPredicate(SpawnPlacements.SpawnPredicate originalPredicate, SpawnPlacementType spawnType, Heightmap.Types heightmapType) { this.originalPredicate = originalPredicate; this.orPredicates = new ArrayList<>(); this.andPredicates = new ArrayList<>(); @@ -115,7 +117,7 @@ public MergedSpawnPredicate(SpawnPlacements.SpawnPredicate originalPredicate, this.heightmapType = heightmapType; } - public SpawnPlacements.Type getSpawnType() { + public SpawnPlacementType getSpawnType() { return spawnType; } @@ -123,7 +125,7 @@ public Heightmap.Types getHeightmapType() { return heightmapType; } - private void merge(Operation operation, SpawnPlacements.SpawnPredicate predicate, @Nullable SpawnPlacements.Type spawnType, @Nullable Heightmap.Types heightmapType) { + private void merge(Operation operation, SpawnPlacements.SpawnPredicate predicate, @Nullable SpawnPlacementType spawnType, @Nullable Heightmap.Types heightmapType) { if (operation == Operation.AND) { andPredicates.add(predicate); } else if (operation == Operation.OR) { diff --git a/src/main/java/net/neoforged/neoforge/event/entity/living/MobEffectEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/living/MobEffectEvent.java index c2734267eb..c9f7b6ef41 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/living/MobEffectEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/living/MobEffectEvent.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.event.entity.living; +import net.minecraft.core.Holder; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -40,12 +41,12 @@ public MobEffectInstance getEffectInstance() { * This Event does not have a result. */ public static class Remove extends MobEffectEvent implements ICancellableEvent { - private final MobEffect effect; + private final Holder effect; @Nullable private final EffectCure cure; @ApiStatus.Internal - public Remove(LivingEntity living, MobEffect effect, @Nullable EffectCure cure) { + public Remove(LivingEntity living, Holder effect, @Nullable EffectCure cure) { super(living, living.getEffect(effect)); this.effect = effect; this.cure = cure; @@ -61,7 +62,7 @@ public Remove(LivingEntity living, MobEffectInstance effectInstance, @Nullable E /** * @return the {@link MobEffect} which is being removed from the entity */ - public MobEffect getEffect() { + public Holder getEffect() { return this.effect; } diff --git a/src/main/java/net/neoforged/neoforge/event/entity/living/MobSpawnEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/living/MobSpawnEvent.java index 1c75616d9e..34a5b3572a 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/living/MobSpawnEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/living/MobSpawnEvent.java @@ -6,7 +6,6 @@ package net.neoforged.neoforge.event.entity.living; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; @@ -264,19 +263,16 @@ public static class FinalizeSpawn extends MobSpawnEvent implements ICancellableE private DifficultyInstance difficulty; @Nullable private SpawnGroupData spawnData; - @Nullable - private CompoundTag spawnTag; /** * @apiNote Do not construct directly. Access via {@link EventHooks#onFinalizeSpawn} / {@link EventHooks#onFinalizeSpawnSpawner}. */ @ApiStatus.Internal - public FinalizeSpawn(Mob entity, ServerLevelAccessor level, double x, double y, double z, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag spawnTag, @Nullable BaseSpawner spawner) { + public FinalizeSpawn(Mob entity, ServerLevelAccessor level, double x, double y, double z, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnData, @Nullable BaseSpawner spawner) { super(entity, level, x, y, z); this.difficulty = difficulty; this.spawnType = spawnType; this.spawnData = spawnData; - this.spawnTag = spawnTag; this.spawner = spawner; } @@ -330,27 +326,6 @@ public void setSpawnData(@Nullable SpawnGroupData data) { this.spawnData = data; } - /** - * This is the NBT data the entity was loaded from, if applicable. It is unknown if the entity has already been loaded from this data, or if it will be loaded later. - * Callers should not modify this data. If you need to change the data, you can create a copy, modify it, and set it via {@link FinalizeSpawn#setSpawnTag} - * - * @return The spawn data this entity was or will be loaded from, if any. - */ - @Nullable - public CompoundTag getSpawnTag() { - return this.spawnTag; - } - - /** - * Sets the spawn data for this event, which will be propagated to {@link Mob#finalizeSpawn} unless cancelled. - * The only vanilla mob known to use this tag for anything in finalize is tropical fish for setting the variant when spawned via bucket. - * - * @param tag The new spawn tag - */ - public void setSpawnTag(@Nullable CompoundTag tag) { - this.spawnTag = tag; - } - /** * Retrieves the underlying {@link BaseSpawner} instance if this mob was created by a Mob Spawner of some form. * This is always null unless {@link #getSpawnType()} is {@link MobSpawnType#SPAWNER}, and may still be null even then. diff --git a/src/main/java/net/neoforged/neoforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/player/PlayerInteractEvent.java index 1f19f74cf2..76f233eb2a 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/player/PlayerInteractEvent.java @@ -39,7 +39,6 @@ public abstract class PlayerInteractEvent extends PlayerEvent { private final BlockPos pos; @Nullable private final Direction face; - private InteractionResult cancellationResult = InteractionResult.PASS; protected PlayerInteractEvent(Player player, InteractionHand hand, BlockPos pos, @Nullable Direction face) { super(Preconditions.checkNotNull(player, "Null player in PlayerInteractEvent!")); @@ -58,6 +57,8 @@ protected PlayerInteractEvent(Player player, InteractionHand hand, BlockPos pos, * If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then try {@link EntityInteract}. */ public static class EntityInteractSpecific extends PlayerInteractEvent implements ICancellableEvent { + private InteractionResult cancellationResult = InteractionResult.PASS; + private final Vec3 localPos; private final Entity target; @@ -81,6 +82,23 @@ public Vec3 getLocalPos() { public Entity getTarget() { return target; } + + /** + * @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause + * the client to keep trying more interactions until something works. + */ + public InteractionResult getCancellationResult() { + return cancellationResult; + } + + /** + * Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. + */ + public void setCancellationResult(InteractionResult result) { + this.cancellationResult = result; + } } /** @@ -97,6 +115,8 @@ public Entity getTarget() { * If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then try {@link RightClickItem}. */ public static class EntityInteract extends PlayerInteractEvent implements ICancellableEvent { + private InteractionResult cancellationResult = InteractionResult.PASS; + private final Entity target; public EntityInteract(Player player, InteractionHand hand, Entity target) { @@ -107,6 +127,23 @@ public EntityInteract(Player player, InteractionHand hand, Entity target) { public Entity getTarget() { return target; } + + /** + * @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause + * the client to keep trying more interactions until something works. + */ + public InteractionResult getCancellationResult() { + return cancellationResult; + } + + /** + * Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. + */ + public void setCancellationResult(InteractionResult result) { + this.cancellationResult = result; + } } /** @@ -123,6 +160,8 @@ public Entity getTarget() { * Note that handling things differently on the client vs server may cause desynchronizations! */ public static class RightClickBlock extends PlayerInteractEvent implements ICancellableEvent { + private InteractionResult cancellationResult = InteractionResult.PASS; + private Result useBlock = Result.DEFAULT; private Result useItem = Result.DEFAULT; private BlockHitResult hitVec; @@ -180,6 +219,23 @@ public void setCanceled(boolean canceled) { useItem = Result.DENY; } } + + /** + * @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause + * the client to keep trying more interactions until something works. + */ + public InteractionResult getCancellationResult() { + return cancellationResult; + } + + /** + * Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. + */ + public void setCancellationResult(InteractionResult result) { + this.cancellationResult = result; + } } /** @@ -190,9 +246,28 @@ public void setCanceled(boolean canceled) { * If we are on the client and result is not {@link InteractionResult#SUCCESS}, the client will then continue to other hands. */ public static class RightClickItem extends PlayerInteractEvent implements ICancellableEvent { + private InteractionResult cancellationResult = InteractionResult.PASS; + public RightClickItem(Player player, InteractionHand hand) { super(player, hand, player.blockPosition(), null); } + + /** + * @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause + * the client to keep trying more interactions until something works. + */ + public InteractionResult getCancellationResult() { + return cancellationResult; + } + + /** + * Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. + */ + public void setCancellationResult(InteractionResult result) { + this.cancellationResult = result; + } } /** @@ -363,22 +438,4 @@ public Level getLevel() { public LogicalSide getSide() { return getLevel().isClientSide ? LogicalSide.CLIENT : LogicalSide.SERVER; } - - /** - * @return The InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant - * method of the event. By default, this is {@link InteractionResult#PASS}, meaning cancelled events will cause - * the client to keep trying more interactions until something works. - */ - public InteractionResult getCancellationResult() { - return cancellationResult; - } - - /** - * Set the InteractionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant - * method of the event. - * Note that this only has an effect on {@link RightClickBlock}, {@link RightClickItem}, {@link EntityInteract}, and {@link EntityInteractSpecific}. - */ - public void setCancellationResult(InteractionResult result) { - this.cancellationResult = result; - } } diff --git a/src/main/java/net/neoforged/neoforge/event/entity/player/UseItemOnBlockEvent.java b/src/main/java/net/neoforged/neoforge/event/entity/player/UseItemOnBlockEvent.java index caa5e023ef..f0234aae46 100644 --- a/src/main/java/net/neoforged/neoforge/event/entity/player/UseItemOnBlockEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/entity/player/UseItemOnBlockEvent.java @@ -5,11 +5,18 @@ package net.neoforged.neoforge.event.entity.player; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; import net.neoforged.bus.api.ICancellableEvent; import net.neoforged.neoforge.common.extensions.IItemExtension; @@ -18,7 +25,7 @@ * *

The event fires in three phases, corresponding with the three interaction behaviors: * {@link IItemExtension#onItemUseFirst}, - * {@link BlockBehaviour#use}, + * {@link BlockBehaviour#useItemOn}, * and {@link Item#useOn}.

* *

The event fires after the interaction logic decides to run the particular interaction behavior, @@ -33,6 +40,7 @@ public class UseItemOnBlockEvent extends PlayerInteractEvent implements ICancellableEvent { private final UseOnContext context; private final UsePhase usePhase; + private ItemInteractionResult cancellationResult = ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; public UseItemOnBlockEvent(UseOnContext context, UsePhase usePhase) { super(context.getPlayer(), context.getHand(), context.getClickedPos(), context.getClickedFace()); @@ -64,19 +72,37 @@ public UsePhase getUsePhase() { * * @param result InteractionResult to return to the interaction logic *

    - *
  • SUCCESS, CONSUME, CONSUME_PARTIAL, and FAIL will prevent further types of interaction attempts + *
  • {@link ItemInteractionResult#SUCCESS}, {@link ItemInteractionResult#CONSUME}, {@link ItemInteractionResult#CONSUME_PARTIAL}, and FAIL will prevent further types of interaction attempts * when provided from the ITEM_BEFORE_BLOCK phase. - *
  • SUCCESS, CONSUME, and CONSUME_PARTIAL will trigger advancements on the server (except in the ITEM_BEFORE_BLOCK phase), + *
  • {@link ItemInteractionResult#SUCCESS}, {@link ItemInteractionResult#CONSUME}, and {@link ItemInteractionResult#CONSUME_PARTIAL} will trigger advancements on the server (except in the ITEM_BEFORE_BLOCK phase), * and will also prevent the ITEM_AFTER_BLOCK item interaction from occurring if provided during the BLOCK phase. - *
  • SUCCESS will trigger the arm-swinging mechanic. - *
  • PASS will always allow proceeding to the next phase. + *
  • {@link ItemInteractionResult#SUCCESS} will trigger the arm-swinging mechanic. + *
  • {@link ItemInteractionResult#PASS_TO_DEFAULT_BLOCK_INTERACTION} will always allow proceeding to the next phase. + *
  • {@link ItemInteractionResult#SKIP_DEFAULT_BLOCK_INTERACTION} will not call the block's {@link net.minecraft.world.level.block.Block#useItemOn(ItemStack, BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult) use method}
  • *
*/ - public void cancelWithResult(InteractionResult result) { + public void cancelWithResult(ItemInteractionResult result) { this.setCancellationResult(result); this.setCanceled(true); } + /** + * @return The {@link ItemInteractionResult} that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. By default, this is {@link ItemInteractionResult#PASS_TO_DEFAULT_BLOCK_INTERACTION}, meaning cancelled events will cause + * the client to keep trying more interactions until something works. + */ + public ItemInteractionResult getCancellationResult() { + return cancellationResult; + } + + /** + * Set the {@link ItemInteractionResult} that will be returned to vanilla if the event is cancelled, instead of calling the relevant + * method of the event. + */ + public void setCancellationResult(ItemInteractionResult result) { + this.cancellationResult = result; + } + public static enum UsePhase { /** * The {@link IItemExtension#onItemUseFirst(ItemStack, UseOnContext)} interaction. @@ -85,7 +111,7 @@ public static enum UsePhase { ITEM_BEFORE_BLOCK, /** - * The {@link BlockBehaviour#use} interaction. + * The {@link BlockBehaviour#useItemOn} interaction. * Skipped if the player is sneaking and holding an item that skips the block while sneaking (most items). */ BLOCK, diff --git a/src/main/java/net/neoforged/neoforge/event/level/BlockEvent.java b/src/main/java/net/neoforged/neoforge/event/level/BlockEvent.java index 39ca0ce6cd..21dc059ef6 100644 --- a/src/main/java/net/neoforged/neoforge/event/level/BlockEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/level/BlockEvent.java @@ -70,7 +70,7 @@ public BreakEvent(Level level, BlockPos pos, BlockState state, Player player) { { this.exp = 0; } else { - int fortuneLevel = player.getMainHandItem().getEnchantmentLevel(Enchantments.BLOCK_FORTUNE); + int fortuneLevel = player.getMainHandItem().getEnchantmentLevel(Enchantments.FORTUNE); int silkTouchLevel = player.getMainHandItem().getEnchantmentLevel(Enchantments.SILK_TOUCH); this.exp = state.getExpDrop(level, level.random, pos, fortuneLevel, silkTouchLevel); } diff --git a/src/main/java/net/neoforged/neoforge/event/level/ChunkDataEvent.java b/src/main/java/net/neoforged/neoforge/event/level/ChunkDataEvent.java index 5615ea96f5..cf8b49e957 100644 --- a/src/main/java/net/neoforged/neoforge/event/level/ChunkDataEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/level/ChunkDataEvent.java @@ -11,7 +11,7 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.status.ChunkType; import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.neoforged.bus.api.Event; import net.neoforged.neoforge.common.NeoForge; @@ -54,14 +54,14 @@ public CompoundTag getData() { * This event is fired on the {@link NeoForge#EVENT_BUS}.
**/ public static class Load extends ChunkDataEvent { - private ChunkStatus.ChunkType status; + private ChunkType status; - public Load(ChunkAccess chunk, CompoundTag data, ChunkStatus.ChunkType status) { + public Load(ChunkAccess chunk, CompoundTag data, ChunkType type) { super(chunk, data); - this.status = status; + this.status = type; } - public ChunkStatus.ChunkType getStatus() { + public ChunkType getType() { return this.status; } } diff --git a/src/main/java/net/neoforged/neoforge/event/level/ChunkEvent.java b/src/main/java/net/neoforged/neoforge/event/level/ChunkEvent.java index 8eb9a8949d..7c38fb93ac 100644 --- a/src/main/java/net/neoforged/neoforge/event/level/ChunkEvent.java +++ b/src/main/java/net/neoforged/neoforge/event/level/ChunkEvent.java @@ -7,8 +7,8 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.status.ChunkStatus; import net.neoforged.bus.api.Event; import net.neoforged.neoforge.common.NeoForge; import org.jetbrains.annotations.ApiStatus; diff --git a/src/main/java/net/neoforged/neoforge/fluids/FluidStack.java b/src/main/java/net/neoforged/neoforge/fluids/FluidStack.java index d8ce58a464..52808c672a 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/FluidStack.java +++ b/src/main/java/net/neoforged/neoforge/fluids/FluidStack.java @@ -1,349 +1,553 @@ /* - * Copyright (c) Forge Development LLC and contributors + * Copyright (c) NeoForged and contributors * SPDX-License-Identifier: LGPL-2.1-only */ package net.neoforged.neoforge.fluids; +import com.mojang.logging.LogUtils; import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import io.netty.handler.codec.DecoderException; +import io.netty.handler.codec.EncoderException; +import java.util.Objects; import java.util.Optional; +import java.util.function.BiFunction; +import java.util.function.Predicate; +import java.util.function.UnaryOperator; import java.util.stream.Stream; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponentHolder; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentPatch; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.PatchedDataComponentMap; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.tags.TagKey; +import net.minecraft.util.ExtraCodecs; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; /** - * ItemStack substitute for Fluids. - * - * NOTE: Equality is based on the Fluid, not the amount. Use - * {@link #isFluidStackIdentical(FluidStack)} to determine if FluidID, Amount and NBT Tag are all - * equal. + * {@link ItemStack} equivalent for fluids. + * The main difference is that a fluid stack is always required to have an amount, while an item stack defaults to 1. + * Another difference is that the component prototype of a fluid stack is currently always empty, while an item stack gets its component prototype from the item. * + *

Most methods in this class are adapted from {@link ItemStack}. */ -public class FluidStack { - private static final Logger LOGGER = LogManager.getLogger(); - - public static final FluidStack EMPTY = new FluidStack(Fluids.EMPTY, 0); - - public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance - .group( - BuiltInRegistries.FLUID.byNameCodec().fieldOf("FluidName").forGetter(FluidStack::getFluid), - Codec.INT.fieldOf("Amount").forGetter(FluidStack::getAmount), - CompoundTag.CODEC.optionalFieldOf("Tag").forGetter(stack -> Optional.ofNullable(stack.getTag()))) - .apply(instance, (fluid, amount, tag) -> { - FluidStack stack = new FluidStack(fluid, amount); - tag.ifPresent(stack::setTag); - return stack; - })); - - private boolean isEmpty; +public final class FluidStack implements DataComponentHolder { + private static final Codec> FLUID_NON_EMPTY_CODEC = BuiltInRegistries.FLUID.holderByNameCodec().validate(holder -> { + return holder.is(Fluids.EMPTY.builtInRegistryHolder()) ? DataResult.error(() -> { + return "Fluid must not be minecraft:empty"; + }) : DataResult.success(holder); + }); + /** + * A standard codec for fluid stacks that does not accept empty stacks. + */ + public static final Codec CODEC = Codec.lazyInitialized( + () -> RecordCodecBuilder.create( + instance -> instance.group( + FLUID_NON_EMPTY_CODEC.fieldOf("id").forGetter(FluidStack::getFluidHolder), + ExtraCodecs.POSITIVE_INT.fieldOf("amount").forGetter(FluidStack::getAmount), // note: no .orElse(1) compared to ItemStack + DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY) + .forGetter(stack -> stack.components.asPatch())) + .apply(instance, FluidStack::new))); + + /** + * A standard codec for fluid stacks that always deserializes with a fixed amount, + * and does not accept empty stacks. + * + *

Fluid equivalent of {@link ItemStack#SINGLE_ITEM_CODEC}. + */ + public static Codec fixedAmountCodec(int amount) { + return Codec.lazyInitialized( + () -> RecordCodecBuilder.create( + instance -> instance.group( + FLUID_NON_EMPTY_CODEC.fieldOf("id").forGetter(FluidStack::getFluidHolder), + DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY) + .forGetter(stack -> stack.components.asPatch())) + .apply(instance, (holder, patch) -> new FluidStack(holder, amount, patch)))); + } + + /** + * A standard codec for fluid stacks that accepts empty stacks, serializing them as {@code {}}. + */ + public static final Codec OPTIONAL_CODEC = ExtraCodecs.optionalEmptyMap(CODEC) + .xmap(optional -> optional.orElse(FluidStack.EMPTY), stack -> stack.isEmpty() ? Optional.empty() : Optional.of(stack)); + /** + * A stream codec for fluid stacks that accepts empty stacks. + */ + public static final StreamCodec OPTIONAL_STREAM_CODEC = new StreamCodec<>() { + private static final StreamCodec> FLUID_STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.FLUID); + + @Override + public FluidStack decode(RegistryFriendlyByteBuf buf) { + int amount = buf.readVarInt(); + if (amount <= 0) { + return FluidStack.EMPTY; + } else { + Holder holder = FLUID_STREAM_CODEC.decode(buf); + DataComponentPatch patch = DataComponentPatch.STREAM_CODEC.decode(buf); + return new FluidStack(holder, amount, patch); + } + } + + @Override + public void encode(RegistryFriendlyByteBuf buf, FluidStack stack) { + if (stack.isEmpty()) { + buf.writeVarInt(0); + } else { + buf.writeVarInt(stack.getAmount()); + FLUID_STREAM_CODEC.encode(buf, stack.getFluidHolder()); + DataComponentPatch.STREAM_CODEC.encode(buf, stack.components.asPatch()); + } + } + }; + /** + * A stream codec for fluid stacks that does not accept empty stacks. + */ + public static final StreamCodec STREAM_CODEC = new StreamCodec<>() { + @Override + public FluidStack decode(RegistryFriendlyByteBuf buf) { + FluidStack stack = FluidStack.OPTIONAL_STREAM_CODEC.decode(buf); + if (stack.isEmpty()) { + throw new DecoderException("Empty FluidStack not allowed"); + } else { + return stack; + } + } + + @Override + public void encode(RegistryFriendlyByteBuf buf, FluidStack stack) { + if (stack.isEmpty()) { + throw new EncoderException("Empty FluidStack not allowed"); + } else { + FluidStack.OPTIONAL_STREAM_CODEC.encode(buf, stack); + } + } + }; + private static final Logger LOGGER = LogUtils.getLogger(); + public static final FluidStack EMPTY = new FluidStack(null); private int amount; - @Nullable - private CompoundTag tag; private final Fluid fluid; + private final PatchedDataComponentMap components; - public FluidStack(Fluid fluid, int amount) { - if (fluid == null) { - LOGGER.fatal("Null fluid supplied to fluidstack. Did you try and create a stack for an unregistered fluid?"); - throw new IllegalArgumentException("Cannot create a fluidstack from a null fluid"); - } else if (!BuiltInRegistries.FLUID.containsValue(fluid)) { - LOGGER.fatal("Failed attempt to create a FluidStack for an unregistered Fluid {} (type {})", fluid, fluid.getClass().getName()); - throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid"); - } - this.amount = amount; - this.fluid = fluid; + @Override + public PatchedDataComponentMap getComponents() { + return components; + } - updateEmpty(); + public DataComponentPatch getComponentsPatch() { + return !this.isEmpty() ? this.components.asPatch() : DataComponentPatch.EMPTY; + } + + public FluidStack(Holder fluid, int amount, DataComponentPatch patch) { + this(fluid.value(), amount, PatchedDataComponentMap.fromPatch(DataComponentMap.EMPTY, patch)); } public FluidStack(Holder fluid, int amount) { this(fluid.value(), amount); } - public FluidStack(Fluid fluid, int amount, @Nullable CompoundTag nbt) { - this(fluid, amount); - - if (nbt != null) { - tag = nbt.copy(); - } + public FluidStack(Fluid fluid, int amount) { + this(fluid, amount, new PatchedDataComponentMap(DataComponentMap.EMPTY)); } - public FluidStack(Holder fluid, int amount, @Nullable CompoundTag nbt) { - this(fluid.value(), amount, nbt); + private FluidStack(Fluid fluid, int amount, PatchedDataComponentMap components) { + this.fluid = fluid; + this.amount = amount; + this.components = components; } - public FluidStack(FluidStack stack, int amount) { - this(stack.getFluid(), amount, stack.tag); + private FluidStack(@Nullable Void unused) { + this.fluid = null; + this.components = new PatchedDataComponentMap(DataComponentMap.EMPTY); } /** - * This provides a safe method for retrieving a FluidStack - if the Fluid is invalid, the stack - * will return as null. + * Tries to parse a fluid stack. Empty stacks cannot be parsed with this method. */ - public static FluidStack loadFluidStackFromNBT(CompoundTag nbt) { - if (nbt == null) { - return EMPTY; - } - if (!nbt.contains("FluidName", Tag.TAG_STRING)) { - return EMPTY; - } + public static Optional parse(HolderLookup.Provider lookupProvider, Tag tag) { + return CODEC.parse(lookupProvider.createSerializationContext(NbtOps.INSTANCE), tag) + .resultOrPartial(error -> LOGGER.error("Tried to load invalid fluid: '{}'", error)); + } - ResourceLocation fluidName = new ResourceLocation(nbt.getString("FluidName")); - Fluid fluid = BuiltInRegistries.FLUID.get(fluidName); - if (fluid == Fluids.EMPTY) { - return EMPTY; - } - FluidStack stack = new FluidStack(fluid, nbt.getInt("Amount")); + /** + * Tries to parse a fluid stack, defaulting to {@link #EMPTY} on parsing failure. + */ + public static FluidStack parseOptional(HolderLookup.Provider lookupProvider, CompoundTag tag) { + return tag.isEmpty() ? EMPTY : parse(lookupProvider, tag).orElse(EMPTY); + } - if (nbt.contains("Tag", Tag.TAG_COMPOUND)) { - stack.tag = nbt.getCompound("Tag"); - } - return stack; + /** + * Checks if this fluid stack is empty. + */ + public boolean isEmpty() { + return this == EMPTY || this.fluid == Fluids.EMPTY || this.amount <= 0; } - public CompoundTag writeToNBT(CompoundTag nbt) { - nbt.putString("FluidName", BuiltInRegistries.FLUID.getKey(getFluid()).toString()); - nbt.putInt("Amount", amount); + /** + * Splits off a stack of the given amount of this stack and reduces this stack by the amount. + */ + public FluidStack split(int amount) { + int i = Math.min(amount, this.amount); + FluidStack fluidStack = this.copyWithAmount(i); + this.shrink(i); + return fluidStack; + } - if (tag != null) { - nbt.put("Tag", tag.copy()); + /** + * Creates a copy of this stack with {@code 0} amount. + */ + public FluidStack copyAndClear() { + if (this.isEmpty()) { + return EMPTY; + } else { + FluidStack fluidStack = this.copy(); + this.setAmount(0); + return fluidStack; } - return nbt; } - public void writeToPacket(FriendlyByteBuf buf) { - buf.writeId(BuiltInRegistries.FLUID, getFluid()); - buf.writeVarInt(getAmount()); - buf.writeNbt(tag); + /** + * Returns the fluid in this stack, or {@link Fluids#EMPTY} if this stack is empty. + */ + public Fluid getFluid() { + return this.isEmpty() ? Fluids.EMPTY : this.fluid; } - public static FluidStack readFromPacket(FriendlyByteBuf buf) { - Fluid fluid = buf.readById(BuiltInRegistries.FLUID); - int amount = buf.readVarInt(); - CompoundTag tag = buf.readNbt(); - if (fluid == Fluids.EMPTY) return EMPTY; - return new FluidStack(fluid, amount, tag); + public Holder getFluidHolder() { + return this.getFluid().builtInRegistryHolder(); } - public final Fluid getFluid() { - return isEmpty ? Fluids.EMPTY : getRawFluid(); + public boolean is(TagKey tag) { + return this.getFluid().builtInRegistryHolder().is(tag); } - public final Fluid getRawFluid() { - return fluid; + public boolean is(Fluid fluid) { + return this.getFluid() == fluid; } - public final FluidType getFluidType() { - return getFluid().getFluidType(); + public boolean is(Predicate> holderPredicate) { + return holderPredicate.test(this.getFluidHolder()); } - public final Holder getFluidHolder() { - return getFluid().builtInRegistryHolder(); + public boolean is(Holder holder) { + return is(holder.value()); } - public final boolean is(TagKey tag) { - return getFluidHolder().is(tag); + public boolean is(HolderSet holderSet) { + return holderSet.contains(this.getFluidHolder()); } - public final boolean is(Fluid fluid) { - return getFluid() == fluid; + public Stream> getTags() { + return this.getFluid().builtInRegistryHolder().tags(); } - public final boolean is(FluidType fluidType) { - return getFluidType() == fluidType; + /** + * Saves this stack to a tag, directly writing the keys into the passed tag. + * + * @throws IllegalStateException if this stack is empty + */ + public Tag save(HolderLookup.Provider lookupProvider, Tag prefix) { + if (this.isEmpty()) { + throw new IllegalStateException("Cannot encode empty FluidStack"); + } else { + return CODEC.encode(this, lookupProvider.createSerializationContext(NbtOps.INSTANCE), prefix).getOrThrow(); + } } - public final boolean is(Holder holder) { - return is(holder.value()); + /** + * Saves this stack to a new tag. + * + * @throws IllegalStateException if this stack is empty + */ + public Tag save(HolderLookup.Provider lookupProvider) { + if (this.isEmpty()) { + throw new IllegalStateException("Cannot encode empty FluidStack"); + } else { + return CODEC.encodeStart(lookupProvider.createSerializationContext(NbtOps.INSTANCE), this).getOrThrow(); + } } - public final boolean is(HolderSet holderSet) { - return holderSet.contains(getFluidHolder()); + /** + * Saves this stack to a new tag. Empty stacks are supported and will be saved as an empty tag. + */ + public Tag saveOptional(HolderLookup.Provider lookupProvider) { + return this.isEmpty() ? new CompoundTag() : this.save(lookupProvider, new CompoundTag()); } - public final Stream> getTags() { - return getFluidHolder().tags(); + /** + * Creates a copy of this fluid stack. + */ + public FluidStack copy() { + if (this.isEmpty()) { + return EMPTY; + } else { + return new FluidStack(this.fluid, this.amount, this.components.copy()); + } } - public boolean isEmpty() { - return isEmpty; + /** + * Creates a copy of this fluid stack with the given amount. + */ + public FluidStack copyWithAmount(int amount) { + if (this.isEmpty()) { + return EMPTY; + } else { + FluidStack fluidStack = this.copy(); + fluidStack.setAmount(amount); + return fluidStack; + } } - protected void updateEmpty() { - isEmpty = fluid == Fluids.EMPTY || amount <= 0; + /** + * Checks if the two fluid stacks are equal. This checks the fluid, amount, and components. + * + * @return {@code true} if the two fluid stacks have equal fluid, amount, and components + */ + public static boolean matches(FluidStack first, FluidStack second) { + if (first == second) { + return true; + } else { + return first.getAmount() != second.getAmount() ? false : isSameFluidSameComponents(first, second); + } } - public int getAmount() { - return isEmpty ? 0 : amount; + /** + * Checks if the two fluid stacks have the same fluid. Ignores amount and components. + * + * @return {@code true} if the two fluid stacks have the same fluid + */ + public static boolean isSameFluid(FluidStack first, FluidStack second) { + return first.is(second.getFluid()); } - public void setAmount(int amount) { - if (fluid == Fluids.EMPTY) throw new IllegalStateException("Can't modify the empty stack."); - this.amount = amount; - updateEmpty(); + /** + * Checks if the two fluid stacks have the same fluid and components. Ignores amount. + * + * @return {@code true} if the two fluid stacks have the same fluid and components + */ + public static boolean isSameFluidSameComponents(FluidStack first, FluidStack second) { + if (!first.is(second.getFluid())) { + return false; + } else { + return first.isEmpty() && second.isEmpty() ? true : Objects.equals(first.components, second.components); + } } - public void grow(int amount) { - setAmount(this.amount + amount); + public static MapCodec lenientOtionalFieldOf(String fieldName) { + return CODEC.lenientOptionalFieldOf(fieldName) + .xmap(optional -> optional.orElse(EMPTY), stack -> stack.isEmpty() ? Optional.empty() : Optional.of(stack)); + } + + /** + * Hashes the fluid and components of this stack, ignoring the amount. + */ + public static int hashFluidAndComponents(@Nullable FluidStack stack) { + if (stack != null) { + int i = 31 + stack.getFluid().hashCode(); + return 31 * i + stack.getComponents().hashCode(); + } else { + return 0; + } } - public void shrink(int amount) { - setAmount(this.amount - amount); + /** + * Returns the {@link FluidType#getDescriptionId(FluidStack) description id} of this stack. + */ + public String getDescriptionId() { + return this.getFluidType().getDescriptionId(this); } - public boolean hasTag() { - return tag != null; + @Override + public String toString() { + return this.getAmount() + " " + this.getFluid(); } + /** + * Sets a data component. + */ @Nullable - public CompoundTag getTag() { - return tag; + public T set(DataComponentType type, @Nullable T component) { + return this.components.set(type, component); } - public void setTag(CompoundTag tag) { - if (fluid == Fluids.EMPTY) throw new IllegalStateException("Can't modify the empty stack."); - this.tag = tag; + /** + * Updates a data component if it exists, using an additional {@code updateContext}. + */ + @Nullable + public T update(DataComponentType type, T component, U updateContext, BiFunction updater) { + return this.set(type, updater.apply(this.getOrDefault(type, component), updateContext)); } - public CompoundTag getOrCreateTag() { - if (tag == null) - setTag(new CompoundTag()); - return tag; + /** + * Updates a data component if it exists. + */ + @Nullable + public T update(DataComponentType type, T component, UnaryOperator updater) { + T t = this.getOrDefault(type, component); + return this.set(type, updater.apply(t)); } - public CompoundTag getChildTag(String childName) { - if (tag == null) - return null; - return tag.getCompound(childName); + /** + * Removes a data component. + */ + @Nullable + public T remove(DataComponentType type) { + return this.components.remove(type); } - public CompoundTag getOrCreateChildTag(String childName) { - getOrCreateTag(); - CompoundTag child = tag.getCompound(childName); - if (!tag.contains(childName, Tag.TAG_COMPOUND)) { - tag.put(childName, child); - } - return child; + /** + * Applies a set of component changes to this stack. + */ + public void applyComponents(DataComponentPatch patch) { + this.components.applyPatch(patch); } - public void removeChildTag(String childName) { - if (tag != null) - tag.remove(childName); + /** + * Applies a set of component changes to this stack. + */ + public void applyComponents(DataComponentMap components) { + this.components.setAll(components); } - public Component getDisplayName() { + /** + * Returns the hover name of this stack. + */ + public Component getHoverName() { return getFluidType().getDescription(this); } - public String getTranslationKey() { - return getFluidType().getDescriptionId(this); + /** + * Returns the amount of this stack. + */ + public int getAmount() { + return this.isEmpty() ? 0 : this.amount; } /** - * @return A copy of this FluidStack + * Sets the amount of this stack. */ - public FluidStack copy() { - //TODO - 1.20.5: Mirror vanilla's ItemStack#copy method and return the empty instance if this is empty - return new FluidStack(getFluid(), amount, tag); + public void setAmount(int amount) { + this.amount = amount; } /** - * @return A copy of this FluidStack + * Limits the amount of this stack is at most the given amount. */ - public FluidStack copyWithAmount(int amount) { - if (isEmpty() || amount <= 0) { - return EMPTY; + public void limitSize(int amount) { + if (!this.isEmpty() && this.getAmount() > amount) { + this.setAmount(amount); } - return new FluidStack(getFluid(), amount, tag); } /** - * Determines if the FluidIDs and NBT Tags are equal. This does not check amounts. - * - * @param other - * The FluidStack for comparison - * @return true if the Fluids (IDs and NBT Tags) are the same + * Adds the given amount to this stack. */ - public boolean isFluidEqual(FluidStack other) { - return is(other.getFluid()) && isFluidStackTagEqual(other); + public void grow(int addedAmount) { + this.setAmount(this.getAmount() + addedAmount); } - private boolean isFluidStackTagEqual(FluidStack other) { - return tag == null ? other.tag == null : other.tag != null && tag.equals(other.tag); + /** + * Removes the given amount from this stack. + */ + public void shrink(int removedAmount) { + this.grow(-removedAmount); } + // Extra methods that are not directly adapted from ItemStack go below + /** - * Determines if the NBT Tags are equal. Useful if the FluidIDs are known to be equal. + * Returns the fluid type of this stack. */ - public static boolean areFluidStackTagsEqual(FluidStack stack1, FluidStack stack2) { - return stack1.isFluidStackTagEqual(stack2); + public FluidType getFluidType() { + return getFluid().getFluidType(); } /** - * Determines if the Fluids are equal and this stack is larger. - * - * @return true if this FluidStack contains the other FluidStack (same fluid and >= amount) + * Check if the fluid type of this stack is equal to the given fluid type. */ - public boolean containsFluid(FluidStack other) { - return isFluidEqual(other) && amount >= other.amount; + public boolean is(FluidType fluidType) { + return getFluidType() == fluidType; } + // Deprecated pre-1.20.5 methods that are kept around for a while to allow for a transition go below + /** - * Determines if the FluidIDs, Amounts, and NBT Tags are all equal. - * - * @param other - * - the FluidStack for comparison - * @return true if the two FluidStacks are exactly the same + * @deprecated Use {@link #getHoverName} instead. */ - public boolean isFluidStackIdentical(FluidStack other) { - return isFluidEqual(other) && amount == other.amount; + @Deprecated(forRemoval = true, since = "1.20.5") + public Component getDisplayName() { + return getHoverName(); } /** - * Determines if the FluidIDs and NBT Tags are equal compared to a registered container - * ItemStack. This does not check amounts. - * - * @param other - * The ItemStack for comparison - * @return true if the Fluids (IDs and NBT Tags) are the same + * @deprecated Prefer {@link #getHoverName()}. */ - public boolean isFluidEqual(ItemStack other) { - return FluidUtil.getFluidContained(other).map(this::isFluidEqual).orElse(false); + @Deprecated(forRemoval = true, since = "1.20.5") + public String getTranslationKey() { + return getFluidType().getDescriptionId(this); } - @Override - public final int hashCode() { - int code = 1; - code = 31 * code + getFluid().hashCode(); - if (tag != null) - code = 31 * code + tag.hashCode(); - return code; + /** + * Determines if the fluid and the components are equal. This does not check amounts. + * + * @deprecated Use {@link #isSameFluidSameComponents} instead. + */ + @Deprecated(forRemoval = true, since = "1.20.5") + public boolean isFluidEqual(FluidStack other) { + return isSameFluidSameComponents(this, other); + } + + /** + * Determines if components are equal. + */ + @Deprecated(forRemoval = true, since = "1.20.5") + public static boolean areFluidStackTagsEqual(FluidStack first, FluidStack second) { + return Objects.equals(first.components, second.components); } /** - * Default equality comparison for a FluidStack. Same functionality as isFluidEqual(). + * Determines if Fluids are equal and this stack is larger. * - * This is included for use in data structures. + * @return true if this FluidStack contains the other FluidStack (same fluid, same components and >= amount) */ - @Override - public final boolean equals(Object o) { - if (!(o instanceof FluidStack)) { - return false; - } - return isFluidEqual((FluidStack) o); + @Deprecated(forRemoval = true, since = "1.20.5") + public boolean containsFluid(FluidStack other) { + return isFluidEqual(other) && amount >= other.amount; + } + + /** + * Determines if Fluids, Amounts, and components are all equal. + * + * @deprecated Use {@link #matches} instead. + */ + @Deprecated(forRemoval = true, since = "1.20.5") + public boolean isFluidStackIdentical(FluidStack other) { + return matches(this, other); + } + + /** + * Determines if the FluidIDs and components are equal compared to a container item stack. This does not check amounts. + */ + @Deprecated(forRemoval = true, since = "1.20.5") + public boolean isFluidEqual(ItemStack other) { + return FluidUtil.getFluidContained(other).map(this::isFluidEqual).orElse(false); } } diff --git a/src/main/java/net/neoforged/neoforge/fluids/FluidType.java b/src/main/java/net/neoforged/neoforge/fluids/FluidType.java index d3b5d97140..db00fa0886 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/FluidType.java +++ b/src/main/java/net/neoforged/neoforge/fluids/FluidType.java @@ -39,7 +39,7 @@ import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; @@ -83,7 +83,7 @@ public class FluidType { private final boolean canConvertToSource; private final boolean supportsBoating; @Nullable - private final BlockPathTypes pathType, adjacentPathType; + private final PathType pathType, adjacentPathType; private final boolean canHydrate; private final int lightLevel; private final int density; @@ -429,7 +429,7 @@ public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos * @return the path type of this fluid */ @Nullable - public BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { + public PathType getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { return this.pathType; } @@ -447,7 +447,7 @@ public BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, Bloc * @return the path type of this fluid */ @Nullable - public BlockPathTypes getAdjacentBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, BlockPathTypes originalType) { + public PathType getAdjacentBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, PathType originalType) { return this.adjacentPathType; } @@ -886,8 +886,8 @@ public static final class Properties { private boolean canConvertToSource = false; private boolean supportsBoating = false; @Nullable - private BlockPathTypes pathType = BlockPathTypes.WATER, - adjacentPathType = BlockPathTypes.WATER_BORDER; + private PathType pathType = PathType.WATER, + adjacentPathType = PathType.WATER_BORDER; private final Map sounds = new HashMap<>(); private boolean canHydrate = false; private int lightLevel = 0, @@ -1015,7 +1015,7 @@ public Properties supportsBoating(boolean supportsBoating) { * @param pathType the path type of this fluid * @return the property holder instance */ - public Properties pathType(@Nullable BlockPathTypes pathType) { + public Properties pathType(@Nullable PathType pathType) { this.pathType = pathType; return this; } @@ -1028,7 +1028,7 @@ public Properties pathType(@Nullable BlockPathTypes pathType) { * @param adjacentPathType the path type of this fluid * @return the property holder instance */ - public Properties adjacentPathType(@Nullable BlockPathTypes adjacentPathType) { + public Properties adjacentPathType(@Nullable PathType adjacentPathType) { this.adjacentPathType = adjacentPathType; return this; } diff --git a/src/main/java/net/neoforged/neoforge/fluids/FluidUtil.java b/src/main/java/net/neoforged/neoforge/fluids/FluidUtil.java index a55efb1c47..ed1cad88ae 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/FluidUtil.java +++ b/src/main/java/net/neoforged/neoforge/fluids/FluidUtil.java @@ -324,7 +324,7 @@ public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluid */ public static FluidStack tryFluidTransfer(IFluidHandler fluidDestination, IFluidHandler fluidSource, FluidStack resource, boolean doTransfer) { FluidStack drainable = fluidSource.drain(resource, IFluidHandler.FluidAction.SIMULATE); - if (!drainable.isEmpty() && resource.isFluidEqual(drainable)) { + if (!drainable.isEmpty() && FluidStack.isSameFluidSameComponents(resource, drainable)) { return tryFluidTransfer_Internal(fluidDestination, fluidSource, drainable, doTransfer); } return FluidStack.EMPTY; @@ -553,7 +553,7 @@ public static void destroyBlockOnFluidPlacement(Level level, BlockPos pos) { * Returns empty itemStack if none of the enabled buckets can hold the fluid. */ public static ItemStack getFilledBucket(FluidStack fluidStack) { - if (!fluidStack.hasTag() || fluidStack.getTag().isEmpty()) { + if (fluidStack.getComponents().isEmpty()) { if (fluidStack.is(Fluids.WATER)) { return new ItemStack(Items.WATER_BUCKET); } else if (fluidStack.is(Fluids.LAVA)) { diff --git a/src/main/java/net/neoforged/neoforge/fluids/SimpleFluidContent.java b/src/main/java/net/neoforged/neoforge/fluids/SimpleFluidContent.java new file mode 100644 index 0000000000..08c6390799 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/fluids/SimpleFluidContent.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.fluids; + +import com.mojang.serialization.Codec; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +/** + * Stock data component class to hold a {@link FluidStack}. + * + *

A corresponding {@link DataComponentType} must be registered to use this class. + */ +public class SimpleFluidContent { + public static final SimpleFluidContent EMPTY = new SimpleFluidContent(FluidStack.EMPTY); + public static final Codec CODEC = FluidStack.OPTIONAL_CODEC + .xmap(SimpleFluidContent::new, content -> content.fluidStack); + public static final StreamCodec STREAM_CODEC = FluidStack.OPTIONAL_STREAM_CODEC + .map(SimpleFluidContent::new, content -> content.fluidStack); + + private final FluidStack fluidStack; + + private SimpleFluidContent(FluidStack fluidStack) { + this.fluidStack = fluidStack; + } + + public static SimpleFluidContent copyOf(FluidStack fluidStack) { + return fluidStack.isEmpty() ? EMPTY : new SimpleFluidContent(fluidStack.copy()); + } + + public FluidStack copy() { + return this.fluidStack.copy(); + } + + public boolean isEmpty() { + return this.fluidStack.isEmpty(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (!(obj instanceof SimpleFluidContent o)) { + return false; + } else { + return FluidStack.matches(this.fluidStack, o.fluidStack); + } + } + + @Override + public int hashCode() { + return this.fluidStack.getAmount() * 31 + FluidStack.hashFluidAndComponents(this.fluidStack); + } +} diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStack.java b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStack.java index 4310e86cc9..b813d675fb 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStack.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStack.java @@ -5,31 +5,33 @@ package net.neoforged.neoforge.fluids.capability.templates; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.component.DataComponentType; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.SimpleFluidContent; import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; /** * FluidHandlerItemStack is a template capability provider for ItemStacks. - * Data is stored directly in the vanilla NBT, in the same way as the old ItemFluidContainer. + * Data is stored in a {@link SimpleFluidContent} component. * - * This class allows an ItemStack to contain any partial level of fluid up to its capacity, unlike {@link FluidHandlerItemStackSimple} + *

This class allows an ItemStack to contain any partial level of fluid up to its capacity, unlike {@link FluidHandlerItemStackSimple} * - * Additional examples are provided to enable consumable fluid containers (see {@link Consumable}), + *

Additional examples are provided to enable consumable fluid containers (see {@link Consumable}), * fluid containers with different empty and full items (see {@link SwapEmpty}, */ public class FluidHandlerItemStack implements IFluidHandlerItem { - public static final String FLUID_NBT_KEY = "Fluid"; - + protected final DataComponentType componentType; protected ItemStack container; protected int capacity; /** - * @param container The container itemStack, data is stored on it directly as NBT. - * @param capacity The maximum capacity of this fluid tank. + * @param componentType The data component type to use for data storage. + * @param container The container itemStack, data is stored on it directly under a component. + * @param capacity The maximum capacity of this fluid tank. */ - public FluidHandlerItemStack(ItemStack container, int capacity) { + public FluidHandlerItemStack(DataComponentType componentType, ItemStack container, int capacity) { + this.componentType = componentType; this.container = container; this.capacity = capacity; } @@ -40,21 +42,11 @@ public ItemStack getContainer() { } public FluidStack getFluid() { - CompoundTag tagCompound = container.getTag(); - if (tagCompound == null || !tagCompound.contains(FLUID_NBT_KEY)) { - return FluidStack.EMPTY; - } - return FluidStack.loadFluidStackFromNBT(tagCompound.getCompound(FLUID_NBT_KEY)); + return container.getOrDefault(componentType, SimpleFluidContent.EMPTY).copy(); } protected void setFluid(FluidStack fluid) { - if (!container.hasTag()) { - container.setTag(new CompoundTag()); - } - - CompoundTag fluidTag = new CompoundTag(); - fluid.writeToNBT(fluidTag); - container.getTag().put(FLUID_NBT_KEY, fluidTag); + container.set(componentType, SimpleFluidContent.copyOf(fluid)); } @Override @@ -93,7 +85,7 @@ public int fill(FluidStack resource, FluidAction doFill) { return fillAmount; } else { - if (contained.isFluidEqual(resource)) { + if (FluidStack.isSameFluidSameComponents(contained, resource)) { int fillAmount = Math.min(capacity - contained.getAmount(), resource.getAmount()); if (doFill.execute() && fillAmount > 0) { @@ -110,7 +102,7 @@ public int fill(FluidStack resource, FluidAction doFill) { @Override public FluidStack drain(FluidStack resource, FluidAction action) { - if (container.getCount() != 1 || resource.isEmpty() || !resource.isFluidEqual(getFluid())) { + if (container.getCount() != 1 || resource.isEmpty() || !FluidStack.isSameFluidSameComponents(resource, getFluid())) { return FluidStack.EMPTY; } return drain(resource.getAmount(), action); @@ -156,15 +148,15 @@ public boolean canDrainFluidType(FluidStack fluid) { * Can be used to swap out or destroy the container. */ protected void setContainerToEmpty() { - container.removeTagKey(FLUID_NBT_KEY); + container.remove(componentType); } /** * Destroys the container item when it's emptied. */ public static class Consumable extends FluidHandlerItemStack { - public Consumable(ItemStack container, int capacity) { - super(container, capacity); + public Consumable(DataComponentType componentType, ItemStack container, int capacity) { + super(componentType, container, capacity); } @Override @@ -180,8 +172,8 @@ protected void setContainerToEmpty() { public static class SwapEmpty extends FluidHandlerItemStack { protected final ItemStack emptyContainer; - public SwapEmpty(ItemStack container, ItemStack emptyContainer, int capacity) { - super(container, capacity); + public SwapEmpty(DataComponentType componentType, ItemStack container, ItemStack emptyContainer, int capacity) { + super(componentType, container, capacity); this.emptyContainer = emptyContainer; } diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStackSimple.java b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStackSimple.java index 11a3d60dbc..cf8dc4aea9 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStackSimple.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidHandlerItemStackSimple.java @@ -5,28 +5,30 @@ package net.neoforged.neoforge.fluids.capability.templates; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.component.DataComponentType; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.SimpleFluidContent; import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; /** * FluidHandlerItemStackSimple is a template capability provider for ItemStacks. - * Data is stored directly in the vanilla NBT, in the same way as the old ItemFluidContainer. + * Data is stored in a {@link SimpleFluidContent} component. * - * This implementation only allows item containers to be fully filled or emptied, similar to vanilla buckets. + *

This implementation only allows item containers to be fully filled or emptied, similar to vanilla buckets. */ public class FluidHandlerItemStackSimple implements IFluidHandlerItem { - public static final String FLUID_NBT_KEY = "Fluid"; - + protected final DataComponentType componentType; protected ItemStack container; protected int capacity; /** - * @param container The container itemStack, data is stored on it directly as NBT. - * @param capacity The maximum capacity of this fluid tank. + * @param componentType The data component type to use for data storage. + * @param container The container itemStack, data is stored on it directly as NBT. + * @param capacity The maximum capacity of this fluid tank. */ - public FluidHandlerItemStackSimple(ItemStack container, int capacity) { + public FluidHandlerItemStackSimple(DataComponentType componentType, ItemStack container, int capacity) { + this.componentType = componentType; this.container = container; this.capacity = capacity; } @@ -37,21 +39,11 @@ public ItemStack getContainer() { } public FluidStack getFluid() { - CompoundTag tagCompound = container.getTag(); - if (tagCompound == null || !tagCompound.contains(FLUID_NBT_KEY)) { - return FluidStack.EMPTY; - } - return FluidStack.loadFluidStackFromNBT(tagCompound.getCompound(FLUID_NBT_KEY)); + return container.getOrDefault(componentType, SimpleFluidContent.EMPTY).copy(); } protected void setFluid(FluidStack fluid) { - if (!container.hasTag()) { - container.setTag(new CompoundTag()); - } - - CompoundTag fluidTag = new CompoundTag(); - fluid.writeToNBT(fluidTag); - container.getTag().put(FLUID_NBT_KEY, fluidTag); + container.set(componentType, SimpleFluidContent.copyOf(fluid)); } @Override @@ -97,7 +89,7 @@ public int fill(FluidStack resource, FluidAction action) { @Override public FluidStack drain(FluidStack resource, FluidAction action) { - if (container.getCount() != 1 || resource.isEmpty() || !resource.isFluidEqual(getFluid())) { + if (container.getCount() != 1 || resource.isEmpty() || !FluidStack.isSameFluidSameComponents(resource, getFluid())) { return FluidStack.EMPTY; } return drain(resource.getAmount(), action); @@ -142,15 +134,15 @@ public boolean canDrainFluidType(FluidStack fluid) { * Can be used to destroy the container with "container.stackSize--" */ protected void setContainerToEmpty() { - container.removeTagKey(FLUID_NBT_KEY); + container.remove(componentType); } /** * Destroys the container item when it's emptied. */ public static class Consumable extends FluidHandlerItemStackSimple { - public Consumable(ItemStack container, int capacity) { - super(container, capacity); + public Consumable(DataComponentType componentType, ItemStack container, int capacity) { + super(componentType, container, capacity); } @Override @@ -166,8 +158,8 @@ protected void setContainerToEmpty() { public static class SwapEmpty extends FluidHandlerItemStackSimple { protected final ItemStack emptyContainer; - public SwapEmpty(ItemStack container, ItemStack emptyContainer, int capacity) { - super(container, capacity); + public SwapEmpty(DataComponentType componentType, ItemStack container, ItemStack emptyContainer, int capacity) { + super(componentType, container, capacity); this.emptyContainer = emptyContainer; } diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidTank.java b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidTank.java index d38a48af71..6503d3bf6f 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidTank.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/templates/FluidTank.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.fluids.capability.templates; import java.util.function.Predicate; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.IFluidTank; @@ -58,14 +59,15 @@ public int getFluidAmount() { return fluid.getAmount(); } - public FluidTank readFromNBT(CompoundTag nbt) { - FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt); - setFluid(fluid); + public FluidTank readFromNBT(HolderLookup.Provider lookupProvider, CompoundTag nbt) { + fluid = FluidStack.parseOptional(lookupProvider, nbt.getCompound("Fluid")); return this; } - public CompoundTag writeToNBT(CompoundTag nbt) { - fluid.writeToNBT(nbt); + public CompoundTag writeToNBT(HolderLookup.Provider lookupProvider, CompoundTag nbt) { + if (!fluid.isEmpty()) { + nbt.put("Fluid", fluid.save(lookupProvider)); + } return nbt; } @@ -99,17 +101,17 @@ public int fill(FluidStack resource, FluidAction action) { if (fluid.isEmpty()) { return Math.min(capacity, resource.getAmount()); } - if (!fluid.isFluidEqual(resource)) { + if (!FluidStack.isSameFluidSameComponents(fluid, resource)) { return 0; } return Math.min(capacity - fluid.getAmount(), resource.getAmount()); } if (fluid.isEmpty()) { - fluid = new FluidStack(resource, Math.min(capacity, resource.getAmount())); + fluid = resource.copyWithAmount(Math.min(capacity, resource.getAmount())); onContentsChanged(); return fluid.getAmount(); } - if (!fluid.isFluidEqual(resource)) { + if (!FluidStack.isSameFluidSameComponents(fluid, resource)) { return 0; } int filled = capacity - fluid.getAmount(); @@ -127,7 +129,7 @@ public int fill(FluidStack resource, FluidAction action) { @Override public FluidStack drain(FluidStack resource, FluidAction action) { - if (resource.isEmpty() || !resource.isFluidEqual(fluid)) { + if (resource.isEmpty() || !FluidStack.isSameFluidSameComponents(resource, fluid)) { return FluidStack.EMPTY; } return drain(resource.getAmount(), action); @@ -139,7 +141,7 @@ public FluidStack drain(int maxDrain, FluidAction action) { if (fluid.getAmount() < drained) { drained = fluid.getAmount(); } - FluidStack stack = new FluidStack(fluid, drained); + FluidStack stack = fluid.copyWithAmount(drained); if (action.execute() && drained > 0) { fluid.shrink(drained); onContentsChanged(); diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java index d010c0b67e..e6caccfeb0 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/BucketPickupHandlerWrapper.java @@ -75,7 +75,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) { ItemStack itemStack = bucketPickupHandler.pickupBlock(player, world, blockPos, world.getBlockState(blockPos)); if (itemStack != ItemStack.EMPTY && itemStack.getItem() instanceof BucketItem bucket) { FluidStack extracted = new FluidStack(bucket.getFluid(), FluidType.BUCKET_VOLUME); - if (!resource.isFluidEqual(extracted)) { + if (!FluidStack.isSameFluidSameComponents(resource, extracted)) { //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 {}.", BuiltInRegistries.FLUID.getKey(fluidState.getType()), blockPos, world.dimension().location(), BuiltInRegistries.FLUID.getKey(bucket.getFluid())); @@ -85,7 +85,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) { } } else { FluidStack extracted = new FluidStack(fluidState.getType(), FluidType.BUCKET_VOLUME); - if (resource.isFluidEqual(extracted)) { + if (FluidStack.isSameFluid(resource, extracted)) { //Validate NBT matches return extracted; } diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/CauldronWrapper.java b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/CauldronWrapper.java index c806c91f3f..5c930a5b88 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/CauldronWrapper.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/CauldronWrapper.java @@ -110,7 +110,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) { } BlockState state = level.getBlockState(pos); - if (resource.is(getContent(state).fluid) && !resource.hasTag()) { + if (resource.is(getContent(state).fluid) && resource.getComponents().isEmpty()) { return drain(state, resource.getAmount(), action); } else { return FluidStack.EMPTY; diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBlockWrapper.java b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBlockWrapper.java index 8c56e87a40..49578fda9e 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBlockWrapper.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBlockWrapper.java @@ -59,7 +59,7 @@ public int fill(FluidStack resource, FluidAction action) { public FluidStack drain(FluidStack resource, FluidAction action) { if (!resource.isEmpty() && fluidBlock.canDrain(world, blockPos) && resource.is(fluidBlock.getFluid())) { FluidStack simulatedDrained = fluidBlock.drain(world, blockPos, FluidAction.SIMULATE); - if (simulatedDrained.getAmount() <= resource.getAmount() && resource.isFluidEqual(simulatedDrained)) { + if (simulatedDrained.getAmount() <= resource.getAmount() && FluidStack.isSameFluidSameComponents(resource, simulatedDrained)) { if (action.execute()) { return fluidBlock.drain(world, blockPos, FluidAction.EXECUTE).copy(); } diff --git a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBucketWrapper.java b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBucketWrapper.java index 8f4a1b82ac..dd2dec1c64 100644 --- a/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBucketWrapper.java +++ b/src/main/java/net/neoforged/neoforge/fluids/capability/wrappers/FluidBucketWrapper.java @@ -98,7 +98,7 @@ public FluidStack drain(FluidStack resource, FluidAction action) { } FluidStack fluidStack = getFluid(); - if (!fluidStack.isEmpty() && fluidStack.isFluidEqual(resource)) { + if (!fluidStack.isEmpty() && FluidStack.isSameFluidSameComponents(fluidStack, resource)) { if (action.execute()) { setFluid(FluidStack.EMPTY); } diff --git a/src/main/java/net/neoforged/neoforge/items/ItemHandlerHelper.java b/src/main/java/net/neoforged/neoforge/items/ItemHandlerHelper.java index fbdb5d138b..b9d2474657 100644 --- a/src/main/java/net/neoforged/neoforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/neoforged/neoforge/items/ItemHandlerHelper.java @@ -30,37 +30,12 @@ public static ItemStack insertItem(IItemHandler dest, ItemStack stack, boolean s return stack; } + @Deprecated(forRemoval = true, since = "1.20.5") public static boolean canItemStacksStack(ItemStack a, ItemStack b) { - if (a.isEmpty() || !ItemStack.isSameItem(a, b) || a.hasTag() != b.hasTag()) - return false; - - return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areAttachmentsCompatible(b); - } - - /** - * A relaxed version of canItemStacksStack that stacks itemstacks with different metadata if they don't have subtypes. - * This usually only applies when players pick up items. - */ - public static boolean canItemStacksStackRelaxed(ItemStack a, ItemStack b) { - if (a.isEmpty() || b.isEmpty() || a.getItem() != b.getItem()) - return false; - - if (!a.isStackable()) - return false; - - // Metadata value only matters when the item has subtypes - // Vanilla stacks non-subtype items with different metadata together - // TODO Item subtypes, is this still necessary? - /* e.g. a stick with metadata 0 and a stick with metadata 1 stack - if (a.getHasSubtypes() && a.getMetadata() != b.getMetadata()) - return false; - */ - if (a.hasTag() != b.hasTag()) - return false; - - return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areAttachmentsCompatible(b); + return ItemStack.isSameItemSameComponents(a, b); } + @Deprecated(forRemoval = true, since = "1.20.5") public static ItemStack copyStackWithSize(ItemStack itemStack, int size) { if (size == 0) return ItemStack.EMPTY; @@ -88,7 +63,7 @@ public static ItemStack insertItemStacked(IItemHandler inventory, ItemStack stac // go through the inventory and try to fill up already existing items for (int i = 0; i < sizeInventory; i++) { ItemStack slot = inventory.getStackInSlot(i); - if (canItemStacksStackRelaxed(slot, stack)) { + if (canItemStacksStack(slot, stack)) { stack = inventory.insertItem(i, stack, simulate); if (stack.isEmpty()) { diff --git a/src/main/java/net/neoforged/neoforge/items/ItemStackHandler.java b/src/main/java/net/neoforged/neoforge/items/ItemStackHandler.java index 1d9150761a..a389f05508 100644 --- a/src/main/java/net/neoforged/neoforge/items/ItemStackHandler.java +++ b/src/main/java/net/neoforged/neoforge/items/ItemStackHandler.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.items; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -134,14 +135,13 @@ public boolean isItemValid(int slot, ItemStack stack) { } @Override - public CompoundTag serializeNBT() { + public CompoundTag serializeNBT(HolderLookup.Provider provider) { ListTag nbtTagList = new ListTag(); for (int i = 0; i < stacks.size(); i++) { if (!stacks.get(i).isEmpty()) { CompoundTag itemTag = new CompoundTag(); itemTag.putInt("Slot", i); - stacks.get(i).save(itemTag); - nbtTagList.add(itemTag); + nbtTagList.add(stacks.get(i).save(provider, itemTag)); } } CompoundTag nbt = new CompoundTag(); @@ -151,7 +151,7 @@ public CompoundTag serializeNBT() { } @Override - public void deserializeNBT(CompoundTag nbt) { + public void deserializeNBT(HolderLookup.Provider provider, CompoundTag nbt) { setSize(nbt.contains("Size", Tag.TAG_INT) ? nbt.getInt("Size") : stacks.size()); ListTag tagList = nbt.getList("Items", Tag.TAG_COMPOUND); for (int i = 0; i < tagList.size(); i++) { @@ -159,7 +159,7 @@ public void deserializeNBT(CompoundTag nbt) { int slot = itemTags.getInt("Slot"); if (slot >= 0 && slot < stacks.size()) { - stacks.set(slot, ItemStack.of(itemTags)); + ItemStack.parse(provider, itemTags).ifPresent(stack -> stacks.set(slot, stack)); } } onLoad(); diff --git a/src/main/java/net/neoforged/neoforge/items/wrapper/ShulkerItemStackInvWrapper.java b/src/main/java/net/neoforged/neoforge/items/wrapper/ShulkerItemStackInvWrapper.java index 855ae904c2..16b5b2a949 100644 --- a/src/main/java/net/neoforged/neoforge/items/wrapper/ShulkerItemStackInvWrapper.java +++ b/src/main/java/net/neoforged/neoforge/items/wrapper/ShulkerItemStackInvWrapper.java @@ -6,11 +6,9 @@ package net.neoforged.neoforge.items.wrapper; import net.minecraft.core.NonNullList; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.ContainerHelper; -import net.minecraft.world.item.BlockItem; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.item.component.ItemContainerContents; import net.neoforged.neoforge.items.IItemHandlerModifiable; import net.neoforged.neoforge.items.ItemHandlerHelper; import org.jetbrains.annotations.ApiStatus; @@ -19,9 +17,6 @@ public class ShulkerItemStackInvWrapper implements IItemHandlerModifiable { private final ItemStack stack; - private CompoundTag cachedTag; - private NonNullList itemStacksCache; - public ShulkerItemStackInvWrapper(ItemStack stack) { this.stack = stack; } @@ -135,25 +130,13 @@ public void setStackInSlot(int slot, ItemStack stack) { } private NonNullList getItemList() { - CompoundTag rootTag = BlockItem.getBlockEntityData(this.stack); - if (cachedTag == null || !cachedTag.equals(rootTag)) - itemStacksCache = refreshItemList(rootTag); - return itemStacksCache; - } - - private NonNullList refreshItemList(CompoundTag rootTag) { - NonNullList itemStacks = NonNullList.withSize(getSlots(), ItemStack.EMPTY); - if (rootTag != null && rootTag.contains("Items", CompoundTag.TAG_LIST)) { - ContainerHelper.loadAllItems(rootTag, itemStacks); - } - cachedTag = rootTag; - return itemStacks; + ItemContainerContents contents = this.stack.getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY); + NonNullList list = NonNullList.create(); + contents.copyInto(list); + return list; } private void setItemList(NonNullList itemStacks) { - CompoundTag existing = BlockItem.getBlockEntityData(this.stack); - CompoundTag rootTag = ContainerHelper.saveAllItems(existing == null ? new CompoundTag() : existing, itemStacks); - BlockItem.setBlockEntityData(this.stack, BlockEntityType.SHULKER_BOX, rootTag); - cachedTag = rootTag; + this.stack.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(itemStacks)); } } diff --git a/src/main/java/net/neoforged/neoforge/network/ConfigSync.java b/src/main/java/net/neoforged/neoforge/network/ConfigSync.java index da395ec660..e729b38ac4 100644 --- a/src/main/java/net/neoforged/neoforge/network/ConfigSync.java +++ b/src/main/java/net/neoforged/neoforge/network/ConfigSync.java @@ -36,7 +36,7 @@ public List syncConfigs() { })); return configData.entrySet().stream() - .map(e -> new ConfigFilePayload(e.getValue(), e.getKey())) + .map(e -> new ConfigFilePayload(e.getKey(), e.getValue())) .toList(); } diff --git a/src/main/java/net/neoforged/neoforge/network/ConfigurationInitialization.java b/src/main/java/net/neoforged/neoforge/network/ConfigurationInitialization.java index c4918a2491..15cfcb65db 100644 --- a/src/main/java/net/neoforged/neoforge/network/ConfigurationInitialization.java +++ b/src/main/java/net/neoforged/neoforge/network/ConfigurationInitialization.java @@ -5,12 +5,15 @@ package net.neoforged.neoforge.network; +import java.util.function.Consumer; +import net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener; +import net.minecraft.server.network.ConfigurationTask; +import net.minecraft.server.network.config.SynchronizeRegistriesTask; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.network.configuration.RegistryDataMapNegotiation; import net.neoforged.neoforge.network.configuration.SyncConfig; import net.neoforged.neoforge.network.configuration.SyncRegistries; -import net.neoforged.neoforge.network.configuration.SyncTierSortingRegistry; import net.neoforged.neoforge.network.event.OnGameConfigurationEvent; import net.neoforged.neoforge.network.payload.ConfigFilePayload; import net.neoforged.neoforge.network.payload.FrozenRegistryPayload; @@ -21,20 +24,25 @@ @Mod.EventBusSubscriber(modid = "neoforge", bus = Mod.EventBusSubscriber.Bus.MOD) @ApiStatus.Internal public class ConfigurationInitialization { - @SubscribeEvent - private static void configureModdedClient(OnGameConfigurationEvent event) { - if (event.getListener().isConnected(FrozenRegistrySyncStartPayload.ID) && - event.getListener().isConnected(FrozenRegistryPayload.ID) && - event.getListener().isConnected(FrozenRegistrySyncCompletedPayload.ID)) { - event.register(new SyncRegistries()); + /** + * Method called to add configuration tasks that should run before all others, + * and most importantly before vanilla's own {@link SynchronizeRegistriesTask}. + */ + public static void configureEarlyTasks(ServerConfigurationPacketListener listener, Consumer tasks) { + if (listener.isConnected(FrozenRegistrySyncStartPayload.TYPE) && + listener.isConnected(FrozenRegistryPayload.TYPE) && + listener.isConnected(FrozenRegistrySyncCompletedPayload.TYPE)) { + tasks.accept(new SyncRegistries()); } + } - if (event.getListener().isConnected(ConfigFilePayload.ID)) { + @SubscribeEvent + private static void configureModdedClient(OnGameConfigurationEvent event) { + if (event.getListener().isConnected(ConfigFilePayload.TYPE)) { event.register(new SyncConfig(event.getListener())); } //These two can always be registered they detect the listener connection type internally and will skip themselves. - event.register(new SyncTierSortingRegistry(event.getListener())); event.register(new RegistryDataMapNegotiation(event.getListener())); } } diff --git a/src/main/java/net/neoforged/neoforge/network/IContainerFactory.java b/src/main/java/net/neoforged/neoforge/network/IContainerFactory.java index b95d6985c7..3df5544eef 100644 --- a/src/main/java/net/neoforged/neoforge/network/IContainerFactory.java +++ b/src/main/java/net/neoforged/neoforge/network/IContainerFactory.java @@ -5,13 +5,13 @@ package net.neoforged.neoforge.network; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; public interface IContainerFactory extends MenuType.MenuSupplier { - T create(int windowId, Inventory inv, FriendlyByteBuf data); + T create(int windowId, Inventory inv, RegistryFriendlyByteBuf data); @Override default T create(int p_create_1_, Inventory p_create_2_) { diff --git a/src/main/java/net/neoforged/neoforge/network/NetworkInitialization.java b/src/main/java/net/neoforged/neoforge/network/NetworkInitialization.java index 78826951fc..1af4ad9f9f 100644 --- a/src/main/java/net/neoforged/neoforge/network/NetworkInitialization.java +++ b/src/main/java/net/neoforged/neoforge/network/NetworkInitialization.java @@ -22,8 +22,6 @@ import net.neoforged.neoforge.network.payload.KnownRegistryDataMapsPayload; import net.neoforged.neoforge.network.payload.KnownRegistryDataMapsReplyPayload; import net.neoforged.neoforge.network.payload.RegistryDataMapSyncPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistryPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistrySyncCompletePayload; import net.neoforged.neoforge.network.registration.IPayloadRegistrar; import net.neoforged.neoforge.registries.ClientRegistryManager; import net.neoforged.neoforge.registries.RegistryManager; @@ -39,56 +37,48 @@ private static void register(final RegisterPayloadHandlerEvent event) { .optional(); registrar .common( - TierSortingRegistryPayload.ID, - TierSortingRegistryPayload::new, - handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) - .common( - ConfigFilePayload.ID, - ConfigFilePayload::new, + ConfigFilePayload.TYPE, + ConfigFilePayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .configuration( - FrozenRegistrySyncStartPayload.ID, - FrozenRegistrySyncStartPayload::new, + FrozenRegistrySyncStartPayload.TYPE, + FrozenRegistrySyncStartPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .configuration( - FrozenRegistryPayload.ID, - FrozenRegistryPayload::new, + FrozenRegistryPayload.TYPE, + FrozenRegistryPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .configuration( - FrozenRegistrySyncCompletedPayload.ID, - FrozenRegistrySyncCompletedPayload::new, + FrozenRegistrySyncCompletedPayload.TYPE, + FrozenRegistrySyncCompletedPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle) .server(ServerPayloadHandler.getInstance()::handle)) .configuration( - TierSortingRegistrySyncCompletePayload.ID, - TierSortingRegistrySyncCompletePayload::new, - handlers -> handlers.server(ServerPayloadHandler.getInstance()::handle)) - .configuration( - KnownRegistryDataMapsPayload.ID, - KnownRegistryDataMapsPayload::new, + KnownRegistryDataMapsPayload.TYPE, + KnownRegistryDataMapsPayload.STREAM_CODEC, handlers -> handlers.client(ClientRegistryManager::handleKnownDataMaps)) .configuration( - KnownRegistryDataMapsReplyPayload.ID, - KnownRegistryDataMapsReplyPayload::new, + KnownRegistryDataMapsReplyPayload.TYPE, + KnownRegistryDataMapsReplyPayload.STREAM_CODEC, handlers -> handlers.server(RegistryManager::handleKnownDataMapsReply)) .play( - AdvancedAddEntityPayload.ID, - AdvancedAddEntityPayload::new, + AdvancedAddEntityPayload.TYPE, + AdvancedAddEntityPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .play( - AdvancedOpenScreenPayload.ID, - AdvancedOpenScreenPayload::new, + AdvancedOpenScreenPayload.TYPE, + AdvancedOpenScreenPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .play( - AuxiliaryLightDataPayload.ID, - AuxiliaryLightDataPayload::new, + AuxiliaryLightDataPayload.TYPE, + AuxiliaryLightDataPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)) .play( - RegistryDataMapSyncPayload.ID, - RegistryDataMapSyncPayload::decode, + RegistryDataMapSyncPayload.TYPE, + RegistryDataMapSyncPayload.STREAM_CODEC, handlers -> handlers.client(ClientRegistryManager::handleDataMapSync)) - .play(AdvancedContainerSetDataPayload.ID, - AdvancedContainerSetDataPayload::new, + .play(AdvancedContainerSetDataPayload.TYPE, + AdvancedContainerSetDataPayload.STREAM_CODEC, handlers -> handlers.client(ClientPayloadHandler.getInstance()::handle)); } } diff --git a/src/main/java/net/neoforged/neoforge/network/codec/NeoForgeStreamCodecs.java b/src/main/java/net/neoforged/neoforge/network/codec/NeoForgeStreamCodecs.java new file mode 100644 index 0000000000..2656bbb220 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/network/codec/NeoForgeStreamCodecs.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.network.codec; + +import com.mojang.datafixers.util.Function7; +import java.util.function.Function; +import java.util.function.Supplier; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.ChunkPos; +import net.neoforged.neoforge.common.util.Lazy; + +public final class NeoForgeStreamCodecs { + public static final StreamCodec UNBOUNDED_BYTE_ARRAY = new StreamCodec<>() { + public byte[] decode(FriendlyByteBuf buf) { + return buf.readByteArray(); + } + + public void encode(FriendlyByteBuf buf, byte[] data) { + buf.writeByteArray(data); + } + }; + + public static final StreamCodec CHUNK_POS = new StreamCodec<>() { + @Override + public ChunkPos decode(FriendlyByteBuf buf) { + return buf.readChunkPos(); + } + + @Override + public void encode(FriendlyByteBuf buf, ChunkPos pos) { + buf.writeChunkPos(pos); + } + }; + + public static StreamCodec lazy(Supplier> streamCodecSupplier) { + return new LazyStreamCodec<>(streamCodecSupplier); + } + + private static class LazyStreamCodec implements StreamCodec { + private final Lazy> delegate; + + public LazyStreamCodec(Supplier> streamCodecSupplier) { + delegate = Lazy.of(streamCodecSupplier); + } + + @Override + public void encode(B buf, V value) { + delegate.get().encode(buf, value); + } + + @Override + public V decode(B buf) { + return delegate.get().decode(buf); + } + } + + public static > StreamCodec enumCodec(Class enumClass) { + return new StreamCodec<>() { + @Override + public V decode(B buf) { + return buf.readEnum(enumClass); + } + + @Override + public void encode(B buf, V value) { + buf.writeEnum(value); + } + }; + } + + /** + * Creates a stream codec to encode and decode a {@link ResourceKey} that identifies a registry. + */ + public static StreamCodec>> registryKey() { + return new StreamCodec<>() { + @Override + public ResourceKey> decode(B buf) { + return ResourceKey.createRegistryKey(buf.readResourceLocation()); + } + + @Override + public void encode(B buf, ResourceKey> value) { + buf.writeResourceLocation(value.location()); + } + }; + } + + public static StreamCodec composite( + final StreamCodec codec1, + final Function getter1, + final StreamCodec codec2, + final Function getter2, + final StreamCodec codec3, + final Function getter3, + final StreamCodec codec4, + final Function getter4, + final StreamCodec codec5, + final Function getter5, + final StreamCodec codec6, + final Function getter6, + final StreamCodec codec7, + final Function getter7, + final Function7 p_331335_) { + return new StreamCodec() { + @Override + public C decode(B p_330310_) { + T1 t1 = codec1.decode(p_330310_); + T2 t2 = codec2.decode(p_330310_); + T3 t3 = codec3.decode(p_330310_); + T4 t4 = codec4.decode(p_330310_); + T5 t5 = codec5.decode(p_330310_); + T6 t6 = codec6.decode(p_330310_); + T7 t7 = codec7.decode(p_330310_); + return p_331335_.apply(t1, t2, t3, t4, t5, t6, t7); + } + + @Override + public void encode(B p_332052_, C p_331912_) { + codec1.encode(p_332052_, getter1.apply(p_331912_)); + codec2.encode(p_332052_, getter2.apply(p_331912_)); + codec3.encode(p_332052_, getter3.apply(p_331912_)); + codec4.encode(p_332052_, getter4.apply(p_331912_)); + codec5.encode(p_332052_, getter5.apply(p_331912_)); + codec6.encode(p_332052_, getter6.apply(p_331912_)); + codec7.encode(p_332052_, getter7.apply(p_331912_)); + } + }; + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java b/src/main/java/net/neoforged/neoforge/network/codec/package-info.java similarity index 86% rename from src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java rename to src/main/java/net/neoforged/neoforge/network/codec/package-info.java index 6c23e12b60..e4b63cd63a 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java +++ b/src/main/java/net/neoforged/neoforge/network/codec/package-info.java @@ -6,7 +6,7 @@ @FieldsAreNonnullByDefault @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -package net.neoforged.neoforge.client.gui.overlay; +package net.neoforged.neoforge.network.codec; import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.FieldsAreNonnullByDefault; diff --git a/src/main/java/net/neoforged/neoforge/network/configuration/RegistryDataMapNegotiation.java b/src/main/java/net/neoforged/neoforge/network/configuration/RegistryDataMapNegotiation.java index f22174feec..289dc936ac 100644 --- a/src/main/java/net/neoforged/neoforge/network/configuration/RegistryDataMapNegotiation.java +++ b/src/main/java/net/neoforged/neoforge/network/configuration/RegistryDataMapNegotiation.java @@ -34,7 +34,7 @@ public Type type() { @Override public void run(Consumer sender) { - if (!listener.isConnected(KnownRegistryDataMapsPayload.ID)) { + if (!listener.isConnected(KnownRegistryDataMapsPayload.TYPE)) { final var mandatory = RegistryManager.getDataMaps().values() .stream() .flatMap(map -> map.values().stream()) @@ -52,7 +52,7 @@ public void run(Consumer sender) { return; } - final Map>, List> dataMaps = new HashMap<>(); + final Map>, List> dataMaps = new HashMap<>(); RegistryManager.getDataMaps().forEach((key, attach) -> { final List list = new ArrayList<>(); attach.forEach((id, val) -> { diff --git a/src/main/java/net/neoforged/neoforge/network/configuration/SyncRegistries.java b/src/main/java/net/neoforged/neoforge/network/configuration/SyncRegistries.java index 4a199ac6d1..42c5ef4a8e 100644 --- a/src/main/java/net/neoforged/neoforge/network/configuration/SyncRegistries.java +++ b/src/main/java/net/neoforged/neoforge/network/configuration/SyncRegistries.java @@ -30,7 +30,7 @@ public record SyncRegistries() implements ICustomConfigurationTask { public void run(Consumer sender) { sender.accept(new FrozenRegistrySyncStartPayload(RegistryManager.getRegistryNamesForSyncToClient())); RegistryManager.generateRegistryPackets(false).forEach(sender); - sender.accept(new FrozenRegistrySyncCompletedPayload()); + sender.accept(FrozenRegistrySyncCompletedPayload.INSTANCE); } @Override diff --git a/src/main/java/net/neoforged/neoforge/network/configuration/SyncTierSortingRegistry.java b/src/main/java/net/neoforged/neoforge/network/configuration/SyncTierSortingRegistry.java deleted file mode 100644 index d3049910ef..0000000000 --- a/src/main/java/net/neoforged/neoforge/network/configuration/SyncTierSortingRegistry.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.network.configuration; - -import java.util.function.Consumer; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.common.TierSortingRegistry; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -import org.jetbrains.annotations.ApiStatus; - -/** - * Syncs the tier sorting registry to the client - * - * @param listener the listener to indicate the check if it is a vanilla connection - */ -@ApiStatus.Internal -public record SyncTierSortingRegistry(ServerConfigurationPacketListener listener) implements ICustomConfigurationTask { - private static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "sync_tier_sorting"); - public static final Type TYPE = new Type(ID); - - @Override - public void run(Consumer sender) { - TierSortingRegistry.sync(listener(), sender); - } - - @Override - public Type type() { - return TYPE; - } -} diff --git a/src/main/java/net/neoforged/neoforge/network/connection/ChannelAwareFriendlyByteBuf.java b/src/main/java/net/neoforged/neoforge/network/connection/ChannelAwareFriendlyByteBuf.java new file mode 100644 index 0000000000..e6e5404016 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/network/connection/ChannelAwareFriendlyByteBuf.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.network.connection; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.FriendlyByteBuf; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +@ApiStatus.Internal +public final class ChannelAwareFriendlyByteBuf extends FriendlyByteBuf { + private final ChannelHandlerContext context; + + public ChannelAwareFriendlyByteBuf(ByteBuf p_130051_, ChannelHandlerContext context) { + super(p_130051_); + this.context = context; + } + + @Nullable + public static ChannelHandlerContext unwrapContext(ByteBuf buf) { + while (buf != null) { + if (buf instanceof ChannelAwareFriendlyByteBuf extraContextByteBuf) { + return extraContextByteBuf.context; + } + + buf = buf.unwrap(); + } + + return null; + } +} diff --git a/src/main/java/net/neoforged/neoforge/network/filters/GenericPacketSplitter.java b/src/main/java/net/neoforged/neoforge/network/filters/GenericPacketSplitter.java index ac573671cc..dfc7443ac4 100644 --- a/src/main/java/net/neoforged/neoforge/network/filters/GenericPacketSplitter.java +++ b/src/main/java/net/neoforged/neoforge/network/filters/GenericPacketSplitter.java @@ -5,23 +5,19 @@ package net.neoforged.neoforge.network.filters; -import static net.minecraft.network.Connection.ATTRIBUTE_CLIENTBOUND_PROTOCOL; -import static net.minecraft.network.Connection.ATTRIBUTE_SERVERBOUND_PROTOCOL; - import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; -import io.netty.util.Attribute; -import io.netty.util.AttributeKey; import java.util.ArrayList; import java.util.List; import net.minecraft.network.CompressionDecoder; import net.minecraft.network.Connection; -import net.minecraft.network.ConnectionProtocol; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.VarInt; +import net.minecraft.network.HandlerNames; +import net.minecraft.network.PacketEncoder; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; @@ -29,8 +25,8 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.connection.ChannelAwareFriendlyByteBuf; import net.neoforged.neoforge.network.connection.ConnectionPhase; -import net.neoforged.neoforge.network.connection.ConnectionType; import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent; import net.neoforged.neoforge.network.handling.IPayloadContext; import net.neoforged.neoforge.network.payload.SplitPacketPayload; @@ -47,28 +43,21 @@ public class GenericPacketSplitter extends MessageToMessageEncoder> implements DynamicChannelHandler { private static final Logger LOGGER = LogManager.getLogger(); - private static final int MAX_PACKET_SIZE = CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH; - private static final int MAX_PART_SIZE = determineMaxPayloadSize( - ConnectionProtocol.CONFIGURATION, - PacketFlow.SERVERBOUND); + private record SizeLimits(int packet, int part) { + public SizeLimits(int packet) { + this(packet, determineMaxPayloadSize(packet)); + } + } + + // Used for in-memory connections + private static final SizeLimits compressedSizeLimits = new SizeLimits(CompressionDecoder.MAXIMUM_COMPRESSED_LENGTH); + // Used for non-in-memory connections + private static final SizeLimits uncompressedSizeLimits = new SizeLimits(CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH); private static final byte STATE_FIRST = 1; private static final byte STATE_LAST = 2; - private final AttributeKey> codecKey; - private final ConnectionType connectionType; - private static final AttributeKey SPLITTER_ATTRIBUTE = AttributeKey.valueOf("neoforge:splitter"); - - public GenericPacketSplitter(Connection connection, ConnectionType connectionType) { - this(getProtocolKey(connection.getDirection().getOpposite()), connectionType); - - connection.channel().attr(SPLITTER_ATTRIBUTE).set(this); - } - - public GenericPacketSplitter(AttributeKey> codecKey, ConnectionType connectionType) { - this.codecKey = codecKey; - this.connectionType = connectionType; - } + public static final String CHANNEL_HANDLER_NAME = "neoforge:splitter"; @SubscribeEvent private static void register(final RegisterPayloadHandlerEvent event) { @@ -76,11 +65,10 @@ private static void register(final RegisterPayloadHandlerEvent event) { .versioned(NeoForgeVersion.getSpec()) .optional() .common( - SplitPacketPayload.ID, - SplitPacketPayload::new, + SplitPacketPayload.TYPE, + SplitPacketPayload.STREAM_CODEC, (payload, context) -> { - final GenericPacketSplitter splitter = context.channelHandlerContext().channel().attr(SPLITTER_ATTRIBUTE).get(); - if (splitter != null) { + if (context.channelHandlerContext().pipeline().get(CHANNEL_HANDLER_NAME) instanceof GenericPacketSplitter splitter) { splitter.receivedPacket(payload, context); } else { LOGGER.error("Received split packet without a splitter"); @@ -103,58 +91,51 @@ protected void encode(ChannelHandlerContext ctx, Packet packet, List return; } - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); - packet.write(buf); - if (buf.readableBytes() <= MAX_PACKET_SIZE) { - buf.release(); + if (!((ctx.pipeline().get(HandlerNames.ENCODER) instanceof PacketEncoder encoder))) { + // No encoder in pipeline, pipeline is probably unbound out.add(packet); - } else { - int parts = (int) Math.ceil(((double) buf.readableBytes()) / MAX_PART_SIZE); - if (parts == 1) { - buf.release(); - out.add(packet); - } else { - - Attribute> attribute = ctx.channel().attr(this.codecKey); - ConnectionProtocol.CodecData codecdata = attribute.get(); + return; + } - final byte[] packetData = buf.array(); - for (int part = 0; part < parts; part++) { - final ByteBuf partPrefix; - if (part == 0) { - partPrefix = Unpooled.buffer(5); - partPrefix.writeByte(STATE_FIRST); + boolean hasCompressor = ctx.pipeline().get(HandlerNames.COMPRESS) != null; + // If there IS a compressor, use the NON-compressed limit since the compressor will compress after us! + var sizeLimits = hasCompressor ? uncompressedSizeLimits : compressedSizeLimits; - VarInt.write(partPrefix, codecdata.packetId(packet)); - } else { - partPrefix = Unpooled.buffer(1); - partPrefix.writeByte(part == parts - 1 ? STATE_LAST : 0); - } + FriendlyByteBuf buf = new ChannelAwareFriendlyByteBuf(Unpooled.buffer(), ctx); + try { + @SuppressWarnings("unchecked") + var codec = (StreamCodec>) encoder.getProtocolInfo().codec(); + codec.encode(buf, packet); + if (buf.readableBytes() <= sizeLimits.packet()) { + out.add(packet); + return; + } - final int partSize = Math.min(MAX_PART_SIZE, packetData.length - (part * MAX_PART_SIZE)); - final int prefixSize = partPrefix.readableBytes(); - final byte[] payloadSlice = new byte[partSize + prefixSize]; + int parts = (int) Math.ceil(((double) buf.readableBytes()) / sizeLimits.part()); + if (parts == 1) { + out.add(packet); + return; + } - partPrefix.readBytes(payloadSlice, 0, prefixSize); - System.arraycopy(packetData, part * MAX_PART_SIZE, payloadSlice, prefixSize, partSize); + final byte[] packetData = buf.array(); + for (int part = 0; part < parts; part++) { + final int partSize = Math.min(sizeLimits.part(), packetData.length - (part * sizeLimits.part())); + final byte[] payloadSlice = new byte[partSize + 1]; - out.add(createPacket(codecdata.flow(), payloadSlice)); + byte prefix = part == 0 ? STATE_FIRST : part == parts - 1 ? STATE_LAST : 0; + payloadSlice[0] = prefix; + System.arraycopy(packetData, part * sizeLimits.part(), payloadSlice, 1, partSize); - partPrefix.release(); - } - // We cloned all the data into arrays, no need to retain the buffer anymore - buf.release(); + out.add(createPacket(encoder.getProtocolInfo().flow(), payloadSlice)); } + } finally { + buf.release(); } } private final List receivedBuffers = new ArrayList<>(); private void receivedPacket(SplitPacketPayload payload, IPayloadContext context) { - final ConnectionProtocol protocol = context.protocol(); - final PacketFlow flow = context.flow(); - final ChannelHandlerContext channelHandlerContext = context.channelHandlerContext(); - byte state = payload.payload()[0]; if (state == STATE_FIRST) { if (!receivedBuffers.isEmpty()) { @@ -170,15 +151,10 @@ private void receivedPacket(SplitPacketPayload payload, IPayloadContext context) if (state == STATE_LAST) { final byte[][] buffers = receivedBuffers.toArray(new byte[0][]); - FriendlyByteBuf full = new FriendlyByteBuf(Unpooled.wrappedBuffer(buffers)); - int packetId = full.readVarInt(); + FriendlyByteBuf full = new ChannelAwareFriendlyByteBuf(Unpooled.wrappedBuffer(buffers), context.channelHandlerContext()); - Packet packet = protocol.codec(flow).createPacket(packetId, full, channelHandlerContext); - if (packet == null) { - LOGGER.error("Received invalid packet ID {} in neoforge:split", packetId); - } else { - receivedBuffers.clear(); - full.release(); + try { + Packet packet = context.protocolInfo().codec().decode(full); context.workHandler() .submitAsync(() -> context.packetHandler().handle(packet)) @@ -186,6 +162,9 @@ private void receivedPacket(SplitPacketPayload payload, IPayloadContext context) LOGGER.error("Error handling packet", throwable); return null; }); + } finally { + receivedBuffers.clear(); + full.release(); } } } @@ -199,7 +178,7 @@ private static Packet createPacket(PacketFlow flow, byte[] payload) { @Override public boolean isNecessary(Connection manager) { - return !manager.isMemoryConnection() && isRemoteCompatible(manager); + return isRemoteCompatible(manager); } public enum RemoteCompatibility { @@ -208,26 +187,23 @@ public enum RemoteCompatibility { } public static RemoteCompatibility getRemoteCompatibility(Connection manager) { - return NetworkRegistry.getInstance().isConnected(manager, ConnectionPhase.ANY, SplitPacketPayload.ID) ? RemoteCompatibility.PRESENT : RemoteCompatibility.ABSENT; + return NetworkRegistry.getInstance().isConnected(manager, ConnectionPhase.ANY, SplitPacketPayload.TYPE.id()) ? RemoteCompatibility.PRESENT : RemoteCompatibility.ABSENT; } public static boolean isRemoteCompatible(Connection manager) { return getRemoteCompatibility(manager) != RemoteCompatibility.ABSENT; } - public static int determineMaxPayloadSize(ConnectionProtocol protocol, PacketFlow flow) { + public static int determineMaxPayloadSize(int maxPacketSize) { final FriendlyByteBuf temporaryBuf = new FriendlyByteBuf(Unpooled.buffer()); - int packetId = switch (flow) { - case SERVERBOUND -> protocol.codec(flow).packetId(new ServerboundCustomPayloadPacket(new SplitPacketPayload(new byte[0]))); - case CLIENTBOUND -> protocol.codec(flow).packetId(new ClientboundCustomPayloadPacket(new SplitPacketPayload(new byte[0]))); - }; - //Simulate writing our split packet with a full byte array + //First write the packet id, as does the vanilla packet encoder. - temporaryBuf.writeVarInt(packetId); + //Write a byte for the packet id. Technically it could be multiple bytes, should the packet id be larger than 127. + temporaryBuf.writeByte(0); //Then write the payload id, as does the custom payload packet, regardless of flow. - temporaryBuf.writeResourceLocation(SplitPacketPayload.ID); + temporaryBuf.writeResourceLocation(SplitPacketPayload.TYPE.id()); //Then write the byte prefix to indicate the state of the packet. temporaryBuf.writeByte(STATE_FIRST); @@ -241,13 +217,6 @@ public static int determineMaxPayloadSize(ConnectionProtocol protocol, PacketFlo //During normal write operations, this is the prefix content that is written before the actual payload. //This is the same for both clientbound and serverbound packets. final int prefixSize = temporaryBuf.readableBytes(); - return CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH - prefixSize; - } - - private static AttributeKey> getProtocolKey(PacketFlow flow) { - return switch (flow) { - case CLIENTBOUND -> ATTRIBUTE_CLIENTBOUND_PROTOCOL; - case SERVERBOUND -> ATTRIBUTE_SERVERBOUND_PROTOCOL; - }; + return maxPacketSize - prefixSize; } } diff --git a/src/main/java/net/neoforged/neoforge/network/filters/NetworkFilters.java b/src/main/java/net/neoforged/neoforge/network/filters/NetworkFilters.java index 5f4a82dbdf..9dc2631029 100644 --- a/src/main/java/net/neoforged/neoforge/network/filters/NetworkFilters.java +++ b/src/main/java/net/neoforged/neoforge/network/filters/NetworkFilters.java @@ -9,9 +9,11 @@ import io.netty.channel.ChannelPipeline; import java.util.List; import java.util.Map; -import java.util.function.BiFunction; +import java.util.function.Function; import net.minecraft.network.Connection; +import net.minecraft.network.HandlerNames; import net.neoforged.neoforge.network.connection.ConnectionType; +import net.neoforged.neoforge.network.registration.NetworkRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.ApiStatus; @@ -20,21 +22,26 @@ public class NetworkFilters { private static final Logger LOGGER = LogManager.getLogger(); - private static final Map> instances = ImmutableMap.of( - "neoforge:vanilla_filter", (manager, connectionType) -> new VanillaConnectionNetworkFilter(connectionType), - "neoforge:splitter", GenericPacketSplitter::new); + private static final Map> instances = ImmutableMap.of( + "neoforge:vanilla_filter", VanillaConnectionNetworkFilter::new, + GenericPacketSplitter.CHANNEL_HANDLER_NAME, connectionType -> new GenericPacketSplitter()); - public static void injectIfNecessary(Connection manager, ConnectionType connectionType) { + public static void injectIfNecessary(Connection manager) { cleanIfNecessary(manager); + // Inject the filters right "after" the encoder (but "before" the unbundler if it exists). + // Because Netty processes the pipeline last-to-first when encoding, + // this means that they will be processed before the encoder. + ChannelPipeline pipeline = manager.channel().pipeline(); - if (pipeline.get("packet_handler") == null) + if (pipeline.get(HandlerNames.ENCODER) == null) return; // Realistically this can only ever be null if the connection was prematurely closed due to an error. We return early here to reduce further log spam. + var connectionType = NetworkRegistry.getConnectionType(manager); instances.forEach((key, filterFactory) -> { - DynamicChannelHandler filter = filterFactory.apply(manager, connectionType); + DynamicChannelHandler filter = filterFactory.apply(connectionType); if (filter.isNecessary(manager)) { - pipeline.addBefore("packet_handler", key, filter); + pipeline.addAfter(HandlerNames.ENCODER, key, filter); LOGGER.debug("Injected {} into {}", filter, manager); } }); @@ -42,8 +49,6 @@ public static void injectIfNecessary(Connection manager, ConnectionType connecti public static void cleanIfNecessary(Connection manager) { ChannelPipeline pipeline = manager.channel().pipeline(); - if (pipeline.get("packet_handler") == null) - return; // Realistically this can only ever be null if the connection was prematurely closed due to an error. We return early here to reduce further log spam. //Grab the pipeline filters to remove in a seperate list to avoid a ConcurrentModificationException final List toRemove = pipeline.names() diff --git a/src/main/java/net/neoforged/neoforge/network/filters/VanillaConnectionNetworkFilter.java b/src/main/java/net/neoforged/neoforge/network/filters/VanillaConnectionNetworkFilter.java index 2885b07ec3..d20f5a7288 100644 --- a/src/main/java/net/neoforged/neoforge/network/filters/VanillaConnectionNetworkFilter.java +++ b/src/main/java/net/neoforged/neoforge/network/filters/VanillaConnectionNetworkFilter.java @@ -70,7 +70,7 @@ private static ClientboundUpdateAttributesPacket filterEntityProperties(Clientbo ClientboundUpdateAttributesPacket newPacket = new ClientboundUpdateAttributesPacket(msg.getEntityId(), Collections.emptyList()); msg.getValues().stream() .filter(snapshot -> { - ResourceLocation key = BuiltInRegistries.ATTRIBUTE.getKey(snapshot.getAttribute()); + ResourceLocation key = snapshot.attribute().unwrapKey().map(ResourceKey::location).orElse(null); return key != null && key.getNamespace().equals("minecraft"); }) .forEach(snapshot -> newPacket.getValues().add(snapshot)); diff --git a/src/main/java/net/neoforged/neoforge/network/handlers/ClientPayloadHandler.java b/src/main/java/net/neoforged/neoforge/network/handlers/ClientPayloadHandler.java index baa251dca3..d2d00f819a 100644 --- a/src/main/java/net/neoforged/neoforge/network/handlers/ClientPayloadHandler.java +++ b/src/main/java/net/neoforged/neoforge/network/handlers/ClientPayloadHandler.java @@ -16,14 +16,14 @@ import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.RegistryAccess; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; -import net.neoforged.neoforge.common.TierSortingRegistry; import net.neoforged.neoforge.common.world.AuxiliaryLightManager; import net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager; import net.neoforged.neoforge.entity.IEntityWithComplexSpawn; @@ -39,7 +39,6 @@ import net.neoforged.neoforge.network.payload.FrozenRegistryPayload; import net.neoforged.neoforge.network.payload.FrozenRegistrySyncCompletedPayload; import net.neoforged.neoforge.network.payload.FrozenRegistrySyncStartPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistryPayload; import net.neoforged.neoforge.registries.RegistryManager; import net.neoforged.neoforge.registries.RegistrySnapshot; import org.jetbrains.annotations.ApiStatus; @@ -87,7 +86,7 @@ public void handle(FrozenRegistrySyncCompletedPayload payload, ConfigurationPayl context.packetHandler().disconnect(Component.translatable("neoforge.network.registries.sync.failed", e.getMessage())); return null; }).thenAccept(v -> { - context.replyHandler().send(new FrozenRegistrySyncCompletedPayload()); + context.replyHandler().send(FrozenRegistrySyncCompletedPayload.INSTANCE); }); } @@ -95,16 +94,12 @@ public void handle(ConfigFilePayload payload, IPayloadContext context) { ConfigSync.INSTANCE.receiveSyncedConfig(payload.contents(), payload.fileName()); } - public void handle(TierSortingRegistryPayload payload, IPayloadContext context) { - TierSortingRegistry.handleSync(payload, context); - } - public void handle(AdvancedAddEntityPayload advancedAddEntityPayload, PlayPayloadContext context) { context.workHandler().submitAsync( () -> { Entity entity = Objects.requireNonNull(Minecraft.getInstance().level).getEntity(advancedAddEntityPayload.entityId()); if (entity instanceof IEntityWithComplexSpawn entityAdditionalSpawnData) { - final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(advancedAddEntityPayload.customPayload())); + final RegistryFriendlyByteBuf buf = new RegistryFriendlyByteBuf(Unpooled.wrappedBuffer(advancedAddEntityPayload.customPayload()), entity.registryAccess()); try { entityAdditionalSpawnData.readSpawnData(buf); } finally { @@ -120,7 +115,9 @@ public void handle(AdvancedAddEntityPayload advancedAddEntityPayload, PlayPayloa public void handle(AdvancedOpenScreenPayload msg, PlayPayloadContext context) { context.workHandler().submitAsync(() -> { - final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(msg.additionalData())); + Minecraft mc = Minecraft.getInstance(); + RegistryAccess registryAccess = mc.player.registryAccess(); + final RegistryFriendlyByteBuf buf = new RegistryFriendlyByteBuf(Unpooled.wrappedBuffer(msg.additionalData()), registryAccess); try { createMenuScreen(msg.name(), msg.menuType(), msg.windowId(), buf); } finally { @@ -132,9 +129,9 @@ public void handle(AdvancedOpenScreenPayload msg, PlayPayloadContext context) { }); } - private static void createMenuScreen(Component name, MenuType menuType, int windowId, FriendlyByteBuf buf) { + private static void createMenuScreen(Component name, MenuType menuType, int windowId, RegistryFriendlyByteBuf buf) { Minecraft mc = Minecraft.getInstance(); - MenuScreens.getScreenFactory(menuType, mc, windowId, name).ifPresent(f -> { + MenuScreens.getScreenFactory(menuType).ifPresent(f -> { Screen s = f.create(menuType.create(windowId, mc.player.getInventory(), buf), mc.player.getInventory(), name); mc.player.containerMenu = ((MenuAccess) s).getMenu(); mc.setScreen(s); diff --git a/src/main/java/net/neoforged/neoforge/network/handlers/ServerPayloadHandler.java b/src/main/java/net/neoforged/neoforge/network/handlers/ServerPayloadHandler.java index ee1d298d24..7b3702f424 100644 --- a/src/main/java/net/neoforged/neoforge/network/handlers/ServerPayloadHandler.java +++ b/src/main/java/net/neoforged/neoforge/network/handlers/ServerPayloadHandler.java @@ -6,10 +6,8 @@ package net.neoforged.neoforge.network.handlers; import net.neoforged.neoforge.network.configuration.SyncRegistries; -import net.neoforged.neoforge.network.configuration.SyncTierSortingRegistry; import net.neoforged.neoforge.network.handling.ConfigurationPayloadContext; import net.neoforged.neoforge.network.payload.FrozenRegistrySyncCompletedPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistrySyncCompletePayload; import org.jetbrains.annotations.ApiStatus; @ApiStatus.Internal @@ -25,8 +23,4 @@ private ServerPayloadHandler() {} public void handle(FrozenRegistrySyncCompletedPayload payload, ConfigurationPayloadContext context) { context.taskCompletedHandler().onTaskCompleted(SyncRegistries.TYPE); } - - public void handle(TierSortingRegistrySyncCompletePayload payload, ConfigurationPayloadContext context) { - context.taskCompletedHandler().onTaskCompleted(SyncTierSortingRegistry.TYPE); - } } diff --git a/src/main/java/net/neoforged/neoforge/network/handling/ConfigurationPayloadContext.java b/src/main/java/net/neoforged/neoforge/network/handling/ConfigurationPayloadContext.java index c10ccf02ae..44c288eaee 100644 --- a/src/main/java/net/neoforged/neoforge/network/handling/ConfigurationPayloadContext.java +++ b/src/main/java/net/neoforged/neoforge/network/handling/ConfigurationPayloadContext.java @@ -7,8 +7,7 @@ import io.netty.channel.ChannelHandlerContext; import java.util.Optional; -import net.minecraft.network.ConnectionProtocol; -import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.ProtocolInfo; import net.minecraft.world.entity.player.Player; /** @@ -18,7 +17,7 @@ * @param packetHandler The packet handler that can be used to immediately process other packets. * @param taskCompletedHandler The task completed handler that can be used to indicate that a configuration task has been completed. * @param workHandler A work handler that can be used to schedule work to be done on the main thread. - * @param flow The flow of the packet. + * @param protocolInfo The current protocol info of the connection. * @param channelHandlerContext The channel handler context. * @param player The player of the payload. * @implNote The {@link #player()} will be filled with the current client side player if the payload was sent by the server, the server will only populate this field if it is not configuring the client. @@ -28,11 +27,6 @@ public record ConfigurationPayloadContext( IPacketHandler packetHandler, ITaskCompletedHandler taskCompletedHandler, ISynchronizedWorkHandler workHandler, - PacketFlow flow, + ProtocolInfo protocolInfo, ChannelHandlerContext channelHandlerContext, - Optional player) implements IPayloadContext { - @Override - public ConnectionProtocol protocol() { - return ConnectionProtocol.CONFIGURATION; - } -} + Optional player) implements IPayloadContext {} diff --git a/src/main/java/net/neoforged/neoforge/network/handling/IPayloadContext.java b/src/main/java/net/neoforged/neoforge/network/handling/IPayloadContext.java index e3124598e6..156830a670 100644 --- a/src/main/java/net/neoforged/neoforge/network/handling/IPayloadContext.java +++ b/src/main/java/net/neoforged/neoforge/network/handling/IPayloadContext.java @@ -8,6 +8,7 @@ import io.netty.channel.ChannelHandlerContext; import java.util.Optional; import net.minecraft.network.ConnectionProtocol; +import net.minecraft.network.ProtocolInfo; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -32,15 +33,24 @@ public interface IPayloadContext { */ ISynchronizedWorkHandler workHandler(); + /** + * {@return the current inbound protocol info of the connection} + */ + ProtocolInfo protocolInfo(); + /** * {@return the flow of the packet} */ - PacketFlow flow(); + default PacketFlow flow() { + return protocolInfo().flow(); + } /** * {@return the protocol of the connection} */ - ConnectionProtocol protocol(); + default ConnectionProtocol protocol() { + return protocolInfo().id(); + } /** * {@return the channel handler context} diff --git a/src/main/java/net/neoforged/neoforge/network/handling/PlayPayloadContext.java b/src/main/java/net/neoforged/neoforge/network/handling/PlayPayloadContext.java index 31c630cb47..f43a9c4e37 100644 --- a/src/main/java/net/neoforged/neoforge/network/handling/PlayPayloadContext.java +++ b/src/main/java/net/neoforged/neoforge/network/handling/PlayPayloadContext.java @@ -7,8 +7,7 @@ import io.netty.channel.ChannelHandlerContext; import java.util.Optional; -import net.minecraft.network.ConnectionProtocol; -import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.ProtocolInfo; import net.minecraft.world.entity.player.Player; /** @@ -17,7 +16,7 @@ * @param replyHandler A reply replyHandler that can be used to send a reply to the player. * @param packetHandler The packet replyHandler that can be used to immediately process other packets. * @param workHandler A work replyHandler that can be used to schedule work to be done on the main thread. - * @param flow The flow of the packet. + * @param protocolInfo The current protocol info of the connection. * @param channelHandlerContext The channel replyHandler context. * @param player The player of the payload. * @implNote The {@link #player()} will be filled with the current client side player if the payload was sent by the server, the server will only populate this field if it is not configuring the client. @@ -26,11 +25,6 @@ public record PlayPayloadContext( IReplyHandler replyHandler, IPacketHandler packetHandler, ISynchronizedWorkHandler workHandler, - PacketFlow flow, + ProtocolInfo protocolInfo, ChannelHandlerContext channelHandlerContext, - Optional player) implements IPayloadContext { - @Override - public ConnectionProtocol protocol() { - return ConnectionProtocol.PLAY; - } -} + Optional player) implements IPayloadContext {} diff --git a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedAddEntityPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedAddEntityPayload.java index 69932165c5..c6ddca30ef 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedAddEntityPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedAddEntityPayload.java @@ -5,13 +5,16 @@ package net.neoforged.neoforge.network.payload; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.neoforged.neoforge.common.util.FriendlyByteBufUtil; import net.neoforged.neoforge.entity.IEntityWithComplexSpawn; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import org.jetbrains.annotations.ApiStatus; /** @@ -21,24 +24,17 @@ * @param customPayload The custom data of the entity to add. */ @ApiStatus.Internal -public record AdvancedAddEntityPayload( - int entityId, - byte[] customPayload) implements CustomPacketPayload { - - /** - * The id of this payload. - */ - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_add_entity"); - public AdvancedAddEntityPayload(FriendlyByteBuf buf) { - this( - buf.readVarInt(), - buf.readByteArray()); - } - +public record AdvancedAddEntityPayload(int entityId, byte[] customPayload) implements CustomPacketPayload { + + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_add_entity")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + AdvancedAddEntityPayload::entityId, + NeoForgeStreamCodecs.UNBOUNDED_BYTE_ARRAY, + AdvancedAddEntityPayload::customPayload, + AdvancedAddEntityPayload::new); public AdvancedAddEntityPayload(Entity e) { - this( - e.getId(), - writeCustomData(e)); + this(e.getId(), writeCustomData(e)); } private static byte[] writeCustomData(final Entity entity) { @@ -46,17 +42,11 @@ private static byte[] writeCustomData(final Entity entity) { return new byte[0]; } - return FriendlyByteBufUtil.writeCustomData(additionalSpawnData::writeSpawnData); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeVarInt(entityId()); - buffer.writeByteArray(customPayload()); + return FriendlyByteBufUtil.writeCustomData(additionalSpawnData::writeSpawnData, entity.registryAccess()); } @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedContainerSetDataPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedContainerSetDataPayload.java index d9d6bdf232..8073573b85 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedContainerSetDataPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedContainerSetDataPayload.java @@ -5,7 +5,9 @@ package net.neoforged.neoforge.network.payload; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.game.ClientboundContainerSetDataPacket; import net.minecraft.resources.ResourceLocation; @@ -20,23 +22,20 @@ * @param value The value of the dataslot. */ @ApiStatus.Internal -public record AdvancedContainerSetDataPayload(int containerId, int dataId, int value) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_container_set_data"); - public AdvancedContainerSetDataPayload(FriendlyByteBuf buffer) { - this(buffer.readByte(), buffer.readShort(), buffer.readVarInt()); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeByte(containerId); - buffer.writeShort(dataId); - buffer.writeVarInt(value); - } +public record AdvancedContainerSetDataPayload(byte containerId, short dataId, int value) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_container_set_data")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.BYTE, + AdvancedContainerSetDataPayload::containerId, + ByteBufCodecs.SHORT, + AdvancedContainerSetDataPayload::dataId, + ByteBufCodecs.VAR_INT, + AdvancedContainerSetDataPayload::value, + AdvancedContainerSetDataPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } public ClientboundContainerSetDataPacket toVanillaPacket() { diff --git a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedOpenScreenPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedOpenScreenPayload.java index d756362b37..18274973b1 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/AdvancedOpenScreenPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/AdvancedOpenScreenPayload.java @@ -5,16 +5,17 @@ package net.neoforged.neoforge.network.payload; -import java.util.Objects; -import java.util.function.Consumer; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentSerialization; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.MenuType; -import net.neoforged.neoforge.common.util.FriendlyByteBufUtil; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import org.jetbrains.annotations.ApiStatus; /** @@ -26,31 +27,21 @@ * @param additionalData The additional data to pass to the screen. */ @ApiStatus.Internal -public record AdvancedOpenScreenPayload( - int windowId, - MenuType menuType, - Component name, - byte[] additionalData) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_open_screen"); - public AdvancedOpenScreenPayload(int windowId, MenuType menuType, Component name, Consumer dataWriter) { - this(windowId, menuType, name, FriendlyByteBufUtil.writeCustomData(dataWriter)); - } - - public AdvancedOpenScreenPayload(FriendlyByteBuf buffer) { - this(buffer.readVarInt(), Objects.requireNonNull(buffer.readById(BuiltInRegistries.MENU)), buffer.readComponentTrusted(), buffer.readByteArray()); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeVarInt(windowId()); - buffer.writeId(BuiltInRegistries.MENU, menuType()); - buffer.writeComponent(name()); - buffer.writeByteArray(additionalData()); - } +public record AdvancedOpenScreenPayload(int windowId, MenuType menuType, Component name, byte[] additionalData) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "advanced_open_screen")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + AdvancedOpenScreenPayload::windowId, + ByteBufCodecs.idMapper(BuiltInRegistries.MENU), + AdvancedOpenScreenPayload::menuType, + ComponentSerialization.STREAM_CODEC, + AdvancedOpenScreenPayload::name, + NeoForgeStreamCodecs.UNBOUNDED_BYTE_ARRAY, + AdvancedOpenScreenPayload::additionalData, + AdvancedOpenScreenPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/AuxiliaryLightDataPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/AuxiliaryLightDataPayload.java index 87b4982675..b6a661a4e7 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/AuxiliaryLightDataPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/AuxiliaryLightDataPayload.java @@ -5,30 +5,29 @@ package net.neoforged.neoforge.network.payload; +import java.util.HashMap; import java.util.Map; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ChunkPos; -import net.neoforged.neoforge.common.extensions.IFriendlyByteBufExtension; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; public record AuxiliaryLightDataPayload(ChunkPos pos, Map entries) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "auxiliary_light_data"); - public AuxiliaryLightDataPayload(FriendlyByteBuf buf) { - this(buf.readChunkPos(), buf.readMap(FriendlyByteBuf::readBlockPos, FriendlyByteBuf::readByte)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeChunkPos(pos); - buf.writeMap(entries, FriendlyByteBuf::writeBlockPos, IFriendlyByteBufExtension::writeByte); - } + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "auxiliary_light_data")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + NeoForgeStreamCodecs.CHUNK_POS, + AuxiliaryLightDataPayload::pos, + ByteBufCodecs.map(HashMap::new, BlockPos.STREAM_CODEC, ByteBufCodecs.BYTE), + AuxiliaryLightDataPayload::entries, + AuxiliaryLightDataPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ConfigFilePayload.java b/src/main/java/net/neoforged/neoforge/network/payload/ConfigFilePayload.java index d54058ea75..97984becfe 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ConfigFilePayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ConfigFilePayload.java @@ -6,9 +6,12 @@ package net.neoforged.neoforge.network.payload; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import org.jetbrains.annotations.ApiStatus; /** @@ -16,26 +19,22 @@ *

* This is used to send config files to the client. *

- * - * @param contents The contents of the config file. + * * @param fileName The name of the config file. + * @param contents The contents of the config file. */ @ApiStatus.Internal -public record ConfigFilePayload(byte[] contents, String fileName) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "config_file"); - public ConfigFilePayload(FriendlyByteBuf buf) { - this(buf.readByteArray(), buf.readUtf()); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeByteArray(contents); - buf.writeUtf(fileName); - } +public record ConfigFilePayload(String fileName, byte[] contents) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "config_file")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, + ConfigFilePayload::fileName, + NeoForgeStreamCodecs.UNBOUNDED_BYTE_ARRAY, + ConfigFilePayload::contents, + ConfigFilePayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/DinnerboneProtocolUtils.java b/src/main/java/net/neoforged/neoforge/network/payload/DinnerboneProtocolUtils.java index 9b2676319d..5cfc727436 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/DinnerboneProtocolUtils.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/DinnerboneProtocolUtils.java @@ -9,19 +9,24 @@ import java.util.HashSet; import java.util.Set; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; import org.slf4j.Logger; /** * Protocol utilities for communicating over Dinnerbone's protocol. */ -public class DinnerboneProtocolUtils { +public final class DinnerboneProtocolUtils { public static final Logger LOGGER = LogUtils.getLogger(); private DinnerboneProtocolUtils() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } + public static final StreamCodec> CHANNELS_CODEC = StreamCodec.of( + DinnerboneProtocolUtils::writeChannels, + DinnerboneProtocolUtils::readChannels); + /** * Reads a set of channels from the buffer. * Each channel is a null-terminated string. @@ -30,7 +35,7 @@ private DinnerboneProtocolUtils() { * @param buf the buffer * @return the channels */ - static Set readChannels(FriendlyByteBuf buf) { + private static Set readChannels(FriendlyByteBuf buf) { final StringBuilder builder = new StringBuilder(); final Set channels = new HashSet<>(); @@ -70,7 +75,7 @@ private static void parseAndAddChannel(StringBuilder builder, Set channels) { + private static void writeChannels(FriendlyByteBuf buf, Set channels) { for (ResourceLocation channel : channels) { for (char c : channel.toString().toCharArray()) { buf.writeByte(c); diff --git a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistryPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistryPayload.java index 54f6ce33a5..1f93373b2d 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistryPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistryPayload.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.network.payload; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -20,20 +21,16 @@ */ @ApiStatus.Internal public record FrozenRegistryPayload(ResourceLocation registryName, RegistrySnapshot snapshot) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry"); - public FrozenRegistryPayload(FriendlyByteBuf buf) { - this(buf.readResourceLocation(), new RegistrySnapshot(buf)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeResourceLocation(registryName()); - snapshot().write(buf); - } + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ResourceLocation.STREAM_CODEC, + FrozenRegistryPayload::registryName, + RegistrySnapshot.STREAM_CODEC, + FrozenRegistryPayload::snapshot, + FrozenRegistryPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncCompletedPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncCompletedPayload.java index 63b29f066b..ce6915cce4 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncCompletedPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncCompletedPayload.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.network.payload; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -15,18 +16,15 @@ * This payload is sent to the client when the server has finished sending all the frozen registries. */ @ApiStatus.Internal -public record FrozenRegistrySyncCompletedPayload() implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry_sync_completed"); +public final class FrozenRegistrySyncCompletedPayload implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry_sync_completed")); + public static final FrozenRegistrySyncCompletedPayload INSTANCE = new FrozenRegistrySyncCompletedPayload(); + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(INSTANCE); - public FrozenRegistrySyncCompletedPayload(FriendlyByteBuf buf) { - this(); - } - - @Override - public void write(FriendlyByteBuf buf) {} + private FrozenRegistrySyncCompletedPayload() {} @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncStartPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncStartPayload.java index cfd605d006..ea0735350c 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncStartPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/FrozenRegistrySyncStartPayload.java @@ -7,6 +7,8 @@ import java.util.List; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -22,19 +24,14 @@ */ @ApiStatus.Internal public record FrozenRegistrySyncStartPayload(List toAccess) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry_sync_start"); - - public FrozenRegistrySyncStartPayload(FriendlyByteBuf buf) { - this(buf.readList(FriendlyByteBuf::readResourceLocation)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeCollection(toAccess, FriendlyByteBuf::writeResourceLocation); - } + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "frozen_registry_sync_start")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ResourceLocation.STREAM_CODEC.apply(ByteBufCodecs.list()), + FrozenRegistrySyncStartPayload::toAccess, + FrozenRegistrySyncStartPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsPayload.java index cc2022ddaf..ed5330c5d9 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsPayload.java @@ -5,35 +5,39 @@ package net.neoforged.neoforge.network.payload; +import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; -public record KnownRegistryDataMapsPayload(Map>, List> dataMaps) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation("neoforge:known_registry_data_maps"); - - public KnownRegistryDataMapsPayload(FriendlyByteBuf buf) { - //noinspection RedundantCast javac complains about this cast - this(buf.readMap(b1 -> (ResourceKey>) (Object) b1.readRegistryKey(), b1 -> b1.readList(b2 -> new KnownDataMap(b2.readResourceLocation(), b2.readBoolean())))); - } +public record KnownRegistryDataMapsPayload(Map>, List> dataMaps) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation("neoforge:known_registry_data_maps")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.map( + Maps::newHashMapWithExpectedSize, + NeoForgeStreamCodecs.registryKey(), + KnownDataMap.STREAM_CODEC.apply(ByteBufCodecs.list())), + KnownRegistryDataMapsPayload::dataMaps, + KnownRegistryDataMapsPayload::new); @Override - public void write(FriendlyByteBuf buf) { - buf.writeMap(dataMaps, FriendlyByteBuf::writeResourceKey, (b1, list) -> b1.writeCollection(list, - (b2, known) -> { - b2.writeResourceLocation(known.id()); - b2.writeBoolean(known.mandatory()); - })); + public Type type() { + return TYPE; } - @Override - public ResourceLocation id() { - return ID; + public record KnownDataMap(ResourceLocation id, boolean mandatory) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ResourceLocation.STREAM_CODEC, + KnownDataMap::id, + ByteBufCodecs.BOOL, + KnownDataMap::mandatory, + KnownDataMap::new); } - - public record KnownDataMap(ResourceLocation id, boolean mandatory) {} } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsReplyPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsReplyPayload.java index 5d56cfa6fe..e9d2c4093e 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsReplyPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/KnownRegistryDataMapsReplyPayload.java @@ -5,30 +5,32 @@ package net.neoforged.neoforge.network.payload; +import com.google.common.collect.Maps; +import java.util.ArrayList; import java.util.Collection; import java.util.Map; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; public record KnownRegistryDataMapsReplyPayload( - Map>, Collection> dataMaps) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation("neoforge:known_registry_data_maps_reply"); - - public KnownRegistryDataMapsReplyPayload(FriendlyByteBuf buf) { - //noinspection RedundantCast javac complains about this cast - this(buf.readMap(b1 -> (ResourceKey>) (Object) b1.readRegistryKey(), b1 -> b1.readList(FriendlyByteBuf::readResourceLocation))); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeMap(dataMaps, FriendlyByteBuf::writeResourceKey, (b1, list) -> b1.writeCollection(list, FriendlyByteBuf::writeResourceLocation)); - } + Map>, Collection> dataMaps) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(new ResourceLocation("neoforge:known_registry_data_maps_reply")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.map( + Maps::newHashMapWithExpectedSize, + NeoForgeStreamCodecs.registryKey(), + ResourceLocation.STREAM_CODEC.apply(ByteBufCodecs.collection(ArrayList::new))), + KnownRegistryDataMapsReplyPayload::dataMaps, + KnownRegistryDataMapsReplyPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/MinecraftRegisterPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/MinecraftRegisterPayload.java index 2905bcd2ba..ca51c4ab09 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/MinecraftRegisterPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/MinecraftRegisterPayload.java @@ -7,24 +7,17 @@ import java.util.Set; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; public record MinecraftRegisterPayload(Set newChannels) implements CustomPacketPayload { public static final ResourceLocation ID = new ResourceLocation("register"); - public static final FriendlyByteBuf.Reader READER = MinecraftRegisterPayload::new; - - public MinecraftRegisterPayload(FriendlyByteBuf buf) { - this(DinnerboneProtocolUtils.readChannels(buf)); - } - - @Override - public void write(FriendlyByteBuf buf) { - DinnerboneProtocolUtils.writeChannels(buf, newChannels); - } + public static final Type TYPE = new Type<>(ID); + public static final StreamCodec STREAM_CODEC = DinnerboneProtocolUtils.CHANNELS_CODEC.map(MinecraftRegisterPayload::new, MinecraftRegisterPayload::newChannels); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/MinecraftUnregisterPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/MinecraftUnregisterPayload.java index 0599e11526..fa2d09822f 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/MinecraftUnregisterPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/MinecraftUnregisterPayload.java @@ -7,24 +7,17 @@ import java.util.Set; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; public record MinecraftUnregisterPayload(Set forgottenChannels) implements CustomPacketPayload { public static final ResourceLocation ID = new ResourceLocation("unregister"); - public static final FriendlyByteBuf.Reader READER = MinecraftUnregisterPayload::new; - - public MinecraftUnregisterPayload(FriendlyByteBuf buf) { - this(DinnerboneProtocolUtils.readChannels(buf)); - } - - @Override - public void write(FriendlyByteBuf buf) { - DinnerboneProtocolUtils.writeChannels(buf, forgottenChannels); - } + public static final Type TYPE = new Type<>(ID); + public static final StreamCodec STREAM_CODEC = DinnerboneProtocolUtils.CHANNELS_CODEC.map(MinecraftUnregisterPayload::new, MinecraftUnregisterPayload::forgottenChannels); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkComponent.java b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkComponent.java index 1f371aea4f..70112c7277 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkComponent.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkComponent.java @@ -7,6 +7,8 @@ import java.util.Optional; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; @@ -19,12 +21,10 @@ */ @ApiStatus.Internal public record ModdedNetworkComponent(ResourceLocation id, Optional version) { - public ModdedNetworkComponent(FriendlyByteBuf buf) { - this(buf.readResourceLocation(), buf.readOptional(FriendlyByteBuf::readUtf)); - } - - public void write(FriendlyByteBuf buf) { - buf.writeResourceLocation(id); - buf.writeOptional(version, FriendlyByteBuf::writeUtf); - } + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ResourceLocation.STREAM_CODEC, + ModdedNetworkComponent::id, + ByteBufCodecs.optional(ByteBufCodecs.STRING_UTF8), + ModdedNetworkComponent::version, + ModdedNetworkComponent::new); } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkPayload.java index c8afc9723f..07b4640ab6 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkPayload.java @@ -8,6 +8,8 @@ import java.util.HashSet; import java.util.Set; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -21,21 +23,17 @@ */ @ApiStatus.Internal public record ModdedNetworkPayload(Set configuration, Set play) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "network"); - public static final FriendlyByteBuf.Reader READER = ModdedNetworkPayload::new; - public ModdedNetworkPayload(FriendlyByteBuf buf) { - this(buf.readCollection(HashSet::new, ModdedNetworkComponent::new), buf.readCollection(HashSet::new, ModdedNetworkComponent::new)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeObjectCollection(configuration(), ModdedNetworkComponent::write); - buf.writeObjectCollection(play(), ModdedNetworkComponent::write); - } + public static final Type TYPE = new Type<>(ID); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.collection(HashSet::new, ModdedNetworkComponent.STREAM_CODEC), + ModdedNetworkPayload::configuration, + ByteBufCodecs.collection(HashSet::new, ModdedNetworkComponent.STREAM_CODEC), + ModdedNetworkPayload::play, + ModdedNetworkPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryComponent.java b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryComponent.java index 3771e93326..3004d43422 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryComponent.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryComponent.java @@ -7,8 +7,11 @@ import java.util.Optional; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import org.jetbrains.annotations.ApiStatus; /** @@ -21,18 +24,14 @@ */ @ApiStatus.Internal public record ModdedNetworkQueryComponent(ResourceLocation id, Optional version, Optional flow, boolean optional) { - public ModdedNetworkQueryComponent(FriendlyByteBuf buf) { - this( - buf.readResourceLocation(), - buf.readOptional(FriendlyByteBuf::readUtf), - buf.readOptional(buffer -> buffer.readEnum(PacketFlow.class)), - buf.readBoolean()); - } - - public void write(FriendlyByteBuf buf) { - buf.writeResourceLocation(id); - buf.writeOptional(version, FriendlyByteBuf::writeUtf); - buf.writeOptional(flow, FriendlyByteBuf::writeEnum); - buf.writeBoolean(optional); - } + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ResourceLocation.STREAM_CODEC, + ModdedNetworkQueryComponent::id, + ByteBufCodecs.optional(ByteBufCodecs.STRING_UTF8), + ModdedNetworkQueryComponent::version, + ByteBufCodecs.optional(NeoForgeStreamCodecs.enumCodec(PacketFlow.class)), + ModdedNetworkQueryComponent::flow, + ByteBufCodecs.BOOL, + ModdedNetworkQueryComponent::optional, + ModdedNetworkQueryComponent::new); } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryPayload.java index 527179a54a..02163271de 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkQueryPayload.java @@ -8,6 +8,8 @@ import java.util.HashSet; import java.util.Set; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -21,25 +23,21 @@ */ @ApiStatus.Internal public record ModdedNetworkQueryPayload(Set configuration, Set play) implements CustomPacketPayload { - - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "register"); - public static final FriendlyByteBuf.Reader READER = ModdedNetworkQueryPayload::new; public ModdedNetworkQueryPayload() { this(Set.of(), Set.of()); } - public ModdedNetworkQueryPayload(FriendlyByteBuf byteBuf) { - this(byteBuf.readCollection(HashSet::new, ModdedNetworkQueryComponent::new), byteBuf.readCollection(HashSet::new, ModdedNetworkQueryComponent::new)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeObjectCollection(configuration(), ModdedNetworkQueryComponent::write); - buf.writeObjectCollection(play(), ModdedNetworkQueryComponent::write); - } + public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "register"); + public static final Type TYPE = new Type<>(ID); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.collection(HashSet::new, ModdedNetworkQueryComponent.STREAM_CODEC), + ModdedNetworkQueryPayload::configuration, + ByteBufCodecs.collection(HashSet::new, ModdedNetworkQueryComponent.STREAM_CODEC), + ModdedNetworkQueryPayload::play, + ModdedNetworkQueryPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkSetupFailedPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkSetupFailedPayload.java index 3670a5195e..80250a65f0 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkSetupFailedPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/ModdedNetworkSetupFailedPayload.java @@ -5,9 +5,13 @@ package net.neoforged.neoforge.network.payload; +import java.util.HashMap; import java.util.Map; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentSerialization; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; @@ -21,19 +25,14 @@ @ApiStatus.Internal public record ModdedNetworkSetupFailedPayload(Map failureReasons) implements CustomPacketPayload { public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "modded_network_setup_failed"); - public static final FriendlyByteBuf.Reader READER = ModdedNetworkSetupFailedPayload::new; - - public ModdedNetworkSetupFailedPayload(FriendlyByteBuf buf) { - this(buf.readMap(FriendlyByteBuf::readResourceLocation, FriendlyByteBuf::readComponent)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeMap(failureReasons, FriendlyByteBuf::writeResourceLocation, FriendlyByteBuf::writeComponent); - } + public static final Type TYPE = new Type<>(ID); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.map(HashMap::new, ResourceLocation.STREAM_CODEC, ComponentSerialization.TRUSTED_CONTEXT_FREE_STREAM_CODEC), + ModdedNetworkSetupFailedPayload::failureReasons, + ModdedNetworkSetupFailedPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/RegistryDataMapSyncPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/RegistryDataMapSyncPayload.java index e2f4196e0a..8cc3fa424e 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/RegistryDataMapSyncPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/RegistryDataMapSyncPayload.java @@ -9,6 +9,7 @@ import java.util.Map; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -18,7 +19,9 @@ @SuppressWarnings({ "unchecked", "rawtypes" }) public record RegistryDataMapSyncPayload(ResourceKey> registryKey, Map, ?>> dataMaps) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation("neoforge:registry_data_map_sync"); + public static final CustomPacketPayload.Type> TYPE = new Type<>(new ResourceLocation("neoforge:registry_data_map_sync")); + public static final StreamCodec> STREAM_CODEC = StreamCodec.ofMember( + RegistryDataMapSyncPayload::write, RegistryDataMapSyncPayload::decode); public static RegistryDataMapSyncPayload decode(FriendlyByteBuf buf) { //noinspection RedundantCast javac complains about this cast @@ -30,7 +33,6 @@ public static RegistryDataMapSyncPayload decode(FriendlyByteBuf buf) { return new RegistryDataMapSyncPayload<>(registryKey, attach); } - @Override public void write(FriendlyByteBuf buf) { buf.writeResourceKey(registryKey); buf.writeMap(dataMaps, FriendlyByteBuf::writeResourceLocation, (b1, key, attach) -> { @@ -40,7 +42,7 @@ public void write(FriendlyByteBuf buf) { } @Override - public ResourceLocation id() { - return ID; + public Type> type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/SplitPacketPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/SplitPacketPayload.java index 1bab592d3b..2819c56d5c 100644 --- a/src/main/java/net/neoforged/neoforge/network/payload/SplitPacketPayload.java +++ b/src/main/java/net/neoforged/neoforge/network/payload/SplitPacketPayload.java @@ -6,9 +6,11 @@ package net.neoforged.neoforge.network.payload; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import org.jetbrains.annotations.ApiStatus; /** @@ -21,19 +23,14 @@ */ @ApiStatus.Internal public record SplitPacketPayload(byte[] payload) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "split"); - - public SplitPacketPayload(FriendlyByteBuf buf) { - this(buf.readByteArray()); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeByteArray(payload); - } + public static final Type TYPE = new Type<>(new ResourceLocation(NeoForgeVersion.MOD_ID, "split")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + NeoForgeStreamCodecs.UNBOUNDED_BYTE_ARRAY, + SplitPacketPayload::payload, + SplitPacketPayload::new); @Override - public ResourceLocation id() { - return ID; + public Type type() { + return TYPE; } } diff --git a/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistryPayload.java b/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistryPayload.java deleted file mode 100644 index f1352812a5..0000000000 --- a/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistryPayload.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.network.payload; - -import java.util.List; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -import org.jetbrains.annotations.ApiStatus; - -/** - * The payload for the tier sorting registry packet. - *

- * This payload is used to send the tier order to the client. - *

- * - * @param tiers The tiers in order. - */ -@ApiStatus.Internal -public record TierSortingRegistryPayload(List tiers) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "tier_sorting"); - - public TierSortingRegistryPayload(FriendlyByteBuf buf) { - this(buf.readList(FriendlyByteBuf::readResourceLocation)); - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeCollection(tiers(), FriendlyByteBuf::writeResourceLocation); - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistrySyncCompletePayload.java b/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistrySyncCompletePayload.java deleted file mode 100644 index e1ec1580f5..0000000000 --- a/src/main/java/net/neoforged/neoforge/network/payload/TierSortingRegistrySyncCompletePayload.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.network.payload; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -import org.jetbrains.annotations.ApiStatus; - -/** - * This payload is sent by the server to the client when the tier sorting registry has been fully synced. - */ -@ApiStatus.Internal -public record TierSortingRegistrySyncCompletePayload() implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation(NeoForgeVersion.MOD_ID, "tier_sorting_registry_sync_complete"); - - public TierSortingRegistrySyncCompletePayload(FriendlyByteBuf buf) { - this(); - } - - @Override - public void write(FriendlyByteBuf buf) {} - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/neoforged/neoforge/network/registration/ConfigurationRegistration.java b/src/main/java/net/neoforged/neoforge/network/registration/ConfigurationRegistration.java index 59b829a04b..5b854995ba 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/ConfigurationRegistration.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/ConfigurationRegistration.java @@ -7,6 +7,7 @@ import java.util.Optional; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.neoforged.neoforge.network.handling.ConfigurationPayloadContext; @@ -16,7 +17,7 @@ /** * A record that holds the information needed to describe a registered configuration payload, its reader and handler. * - * @param reader The reader for the payload + * @param codec The reader for the payload * @param handler The handler for the payload * @param version The version of the payload * @param flow The flow of the payload @@ -25,19 +26,14 @@ */ @ApiStatus.Internal public record ConfigurationRegistration( - FriendlyByteBuf.Reader reader, + StreamCodec codec, IConfigurationPayloadHandler handler, Optional version, Optional flow, - boolean optional) implements IConfigurationPayloadHandler, FriendlyByteBuf.Reader { + boolean optional) implements IConfigurationPayloadHandler { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void handle(CustomPacketPayload payload, ConfigurationPayloadContext context) { ((IConfigurationPayloadHandler) handler).handle(payload, context); } - - @Override - public CustomPacketPayload apply(FriendlyByteBuf buffer) { - return reader.apply(buffer); - } } diff --git a/src/main/java/net/neoforged/neoforge/network/registration/IPayloadRegistrar.java b/src/main/java/net/neoforged/neoforge/network/registration/IPayloadRegistrar.java index 95f0068899..e12aafbc63 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/IPayloadRegistrar.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/IPayloadRegistrar.java @@ -8,8 +8,9 @@ import java.util.function.Consumer; import net.minecraft.network.Connection; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.network.ConfigurationTask; import net.neoforged.neoforge.network.handling.ConfigurationPayloadContext; import net.neoforged.neoforge.network.handling.IConfigurationPayloadHandler; @@ -25,17 +26,16 @@ * A custom payload is a class which extends {@link CustomPacketPayload}, it is recommended to use a record for this. *

*

- * The payload is written to the networks outgoing buffer using the {@link CustomPacketPayload#write(FriendlyByteBuf)} method. - * However, to read the payload from the incoming buffer, your registered {@link FriendlyByteBuf.Reader} is used. + * The payload is written to the networks outgoing buffer and read from the incoming buffer using your registered {@link StreamCodec} *
- * When you implement your {@link CustomPacketPayload#write(FriendlyByteBuf)} method you do not need to write the id of the payload, - * neither do you need to read it in your {@link FriendlyByteBuf.Reader} implementation. However, you do need to make sure that the - * id you pass into {@link #play(ResourceLocation, FriendlyByteBuf.Reader, IPlayPayloadHandler)} and - * {@link #configuration(ResourceLocation, FriendlyByteBuf.Reader, IConfigurationPayloadHandler)} is the same as the id you - * return from your {@link CustomPacketPayload#id()}. We suggest using a public static final ResourceLocation field - * to store it and then reference it in both places. + * When you implement your {@link StreamCodec}, you do not need to read or write the id of the payload. However, you do + * need to make sure that the id you pass into {@link #play(CustomPacketPayload.Type, StreamCodec, IPlayPayloadHandler)} and + * {@link #configuration(CustomPacketPayload.Type, StreamCodec, IConfigurationPayloadHandler)} is the same as the id held by the + * {@link CustomPacketPayload.Type} you return from your {@link CustomPacketPayload#type()}. We suggest using a + * public static final CustomPacketPayload.Type field to store it and then reference it in both places. *
- * Ids can be reused between play and configuration payloads, but it is needed to use different ids for different payloads. + * Types can be reused between play and configuration payloads, but it is needed to use different types with different + * ids for different payloads. *
* Under certain situations you are not able to register a payload: *

    @@ -52,8 +52,8 @@ *
  • Play payloads: These are payloads that are sent from the client to the server, or from the server to the client, during normal gameplay.
  • *
  • Configuration payloads: These are payloads that are sent from the server to the client, or from the client to the server, during the login process, before the player is spawned.
  • *
- * You can register a custom payload for either of these types of payloads using the {@link #play(ResourceLocation, FriendlyByteBuf.Reader, IPlayPayloadHandler)} - * and {@link #configuration(ResourceLocation, FriendlyByteBuf.Reader, IConfigurationPayloadHandler)} methods respectively. + * You can register a custom payload for either of these types of payloads using the {@link #play(CustomPacketPayload.Type, StreamCodec, IPlayPayloadHandler)} + * and {@link #configuration(CustomPacketPayload.Type, StreamCodec, IConfigurationPayloadHandler)} methods respectively. *
* The difference between the play and configuration phases, if you like to call them that, is that the configuration phase generally requires * a confirmation payload to be returned to the server to trigger the next phase. In the {@link ConfigurationPayloadContext context} passed into @@ -65,7 +65,7 @@ * Note: the processing of payloads happens solely on the network thread. You are responsible for ensuring that any data you access * in your handlers is either thread safe, or that you queue up your work to be done on the main thread, of the relevant side. * This is particularly important for the {@link IPlayPayloadHandler} or {@link IConfigurationPayloadHandler} implementations that you pass to - * {@link #play(ResourceLocation, FriendlyByteBuf.Reader, IPlayPayloadHandler)} or {@link #configuration(ResourceLocation, FriendlyByteBuf.Reader, IConfigurationPayloadHandler)} + * {@link #play(CustomPacketPayload.Type, StreamCodec, IPlayPayloadHandler)} or {@link #configuration(CustomPacketPayload.Type, StreamCodec, IConfigurationPayloadHandler)} * respectively, since those are also invoked on the network thread. *
* The {@link PlayPayloadContext} and {@link ConfigurationPayloadContext} given to each of these handlers contains a {@link ISynchronizedWorkHandler} @@ -88,7 +88,7 @@ public interface IPayloadRegistrar { * @return The registrar. * @implNote This method will capture all internal errors and wrap them in a {@link RegistrationFailedException}. */ - IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader reader, IPlayPayloadHandler handler); + IPayloadRegistrar play(CustomPacketPayload.Type id, StreamCodec reader, IPlayPayloadHandler handler); /** * Registers a new payload type for the play phase. @@ -106,7 +106,7 @@ public interface IPayloadRegistrar { * @return The registrar. * @implNote This method will capture all internal errors and wrap them in a {@link RegistrationFailedException}. */ - IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler); + IPayloadRegistrar play(CustomPacketPayload.Type id, StreamCodec reader, Consumer>> handler); /** * Registers a new payload type for the configuration phase. @@ -118,7 +118,7 @@ public interface IPayloadRegistrar { * @return The registrar. * @implNote This method will capture all internal errors and wrap them in a {@link RegistrationFailedException}. */ - IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader reader, IConfigurationPayloadHandler handler); + IPayloadRegistrar configuration(CustomPacketPayload.Type id, StreamCodec reader, IConfigurationPayloadHandler handler); /** * Registers a new payload type for the configuration phase. @@ -136,7 +136,7 @@ public interface IPayloadRegistrar { * @return The registrar. * @implNote This method will capture all internal errors and wrap them in a {@link RegistrationFailedException}. */ - IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler); + IPayloadRegistrar configuration(CustomPacketPayload.Type id, StreamCodec reader, Consumer>> handler); /** * Registers a new payload type for all supported phases. @@ -147,7 +147,7 @@ public interface IPayloadRegistrar { * @param handler The handler for the payload. * @return The registrar. */ - default IPayloadRegistrar common(ResourceLocation id, FriendlyByteBuf.Reader reader, IPayloadHandler handler) { + default IPayloadRegistrar common(CustomPacketPayload.Type id, StreamCodec reader, IPayloadHandler handler) { return play(id, reader, handler::handle).configuration(id, reader, handler::handle); } @@ -166,7 +166,7 @@ default IPayloadRegistrar common(ResourceLocatio * @param handler The handler for the payload. * @return The registrar. */ - IPayloadRegistrar common(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler); + IPayloadRegistrar common(CustomPacketPayload.Type id, StreamCodec reader, Consumer>> handler); /** * Defines that the payloads registered by this registrar have a specific version associated with them. diff --git a/src/main/java/net/neoforged/neoforge/network/registration/ModdedConfigurationPayloadRegistration.java b/src/main/java/net/neoforged/neoforge/network/registration/ModdedConfigurationPayloadRegistration.java index 3f8a263950..59a3450a3c 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/ModdedConfigurationPayloadRegistration.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/ModdedConfigurationPayloadRegistration.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.network.registration; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.network.handling.IConfigurationPayloadHandler; @@ -26,4 +27,4 @@ public record ModdedConfigurationPayloadRegistration type, IConfigurationPayloadHandler handler, - FriendlyByteBuf.Reader reader) {} + StreamCodec reader) {} diff --git a/src/main/java/net/neoforged/neoforge/network/registration/ModdedPacketRegistrar.java b/src/main/java/net/neoforged/neoforge/network/registration/ModdedPacketRegistrar.java index 4d08a34374..ab55d71c09 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/ModdedPacketRegistrar.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/ModdedPacketRegistrar.java @@ -11,6 +11,8 @@ import java.util.Optional; import java.util.function.Consumer; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.network.handling.IConfigurationPayloadHandler; @@ -53,45 +55,37 @@ public Map> getPlayRegistrations() { } @Override - public IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader reader, IPlayPayloadHandler handler) { - play( - id, new PlayRegistration<>( - reader, handler, version, Optional.empty(), optional)); + public IPayloadRegistrar play(CustomPacketPayload.Type type, StreamCodec reader, IPlayPayloadHandler handler) { + play(type.id(), new PlayRegistration<>(reader, handler, version, Optional.empty(), optional)); return this; } @Override - public IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader reader, IConfigurationPayloadHandler handler) { - configuration( - id, new ConfigurationRegistration<>( - reader, handler, version, Optional.empty(), optional)); + public IPayloadRegistrar configuration(CustomPacketPayload.Type type, StreamCodec reader, IConfigurationPayloadHandler handler) { + configuration(type.id(), new ConfigurationRegistration<>(reader, handler, version, Optional.empty(), optional)); return this; } @Override - public IPayloadRegistrar play(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler) { + public IPayloadRegistrar play(CustomPacketPayload.Type type, StreamCodec reader, Consumer>> handler) { final PlayPayloadHandler.Builder builder = new PlayPayloadHandler.Builder<>(); handler.accept(builder); final PlayPayloadHandler innerHandler = builder.create(); - play( - id, new PlayRegistration<>( - reader, innerHandler, version, innerHandler.flow(), optional)); + play(type.id(), new PlayRegistration<>(reader, innerHandler, version, innerHandler.flow(), optional)); return this; } @Override - public IPayloadRegistrar configuration(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler) { + public IPayloadRegistrar configuration(CustomPacketPayload.Type type, StreamCodec reader, Consumer>> handler) { final ConfigurationPayloadHandler.Builder builder = new ConfigurationPayloadHandler.Builder<>(); handler.accept(builder); final ConfigurationPayloadHandler innerHandler = builder.create(); - configuration( - id, new ConfigurationRegistration<>( - reader, innerHandler, version, innerHandler.flow(), optional)); + configuration(type.id(), new ConfigurationRegistration<>(reader, innerHandler, version, innerHandler.flow(), optional)); return this; } @Override - public IPayloadRegistrar common(ResourceLocation id, FriendlyByteBuf.Reader reader, Consumer>> handler) { + public IPayloadRegistrar common(CustomPacketPayload.Type id, StreamCodec reader, Consumer>> handler) { final PayloadHandlerBuilder builder = new PayloadHandlerBuilder<>(); handler.accept(builder); configuration(id, reader, builder::handleConfiguration); diff --git a/src/main/java/net/neoforged/neoforge/network/registration/ModdedPlayPayloadRegistration.java b/src/main/java/net/neoforged/neoforge/network/registration/ModdedPlayPayloadRegistration.java index 4e81d5d6bb..e07593b35e 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/ModdedPlayPayloadRegistration.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/ModdedPlayPayloadRegistration.java @@ -5,7 +5,8 @@ package net.neoforged.neoforge.network.registration; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.network.handling.IPlayPayloadHandler; @@ -26,4 +27,4 @@ public record ModdedPlayPayloadRegistration( ResourceLocation id, Class type, IPlayPayloadHandler handler, - FriendlyByteBuf.Reader reader) {} + StreamCodec reader) {} diff --git a/src/main/java/net/neoforged/neoforge/network/registration/NetworkRegistry.java b/src/main/java/net/neoforged/neoforge/network/registration/NetworkRegistry.java index 9895c0abda..f4e243b29f 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/NetworkRegistry.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/NetworkRegistry.java @@ -17,6 +17,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; @@ -27,6 +28,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.PacketListener; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.common.ClientCommonPacketListener; @@ -46,6 +48,7 @@ import net.neoforged.fml.ModLoader; import net.neoforged.fml.config.ConfigTracker; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import net.neoforged.neoforge.network.connection.ChannelAwareFriendlyByteBuf; import net.neoforged.neoforge.network.connection.ConnectionPhase; import net.neoforged.neoforge.network.connection.ConnectionType; import net.neoforged.neoforge.network.connection.ConnectionUtils; @@ -101,6 +104,10 @@ public static NetworkRegistry getInstance() { private final Map> knownConfigurationRegistrations = new HashMap<>(); private final Map> knownPlayRegistrations = new HashMap<>(); + private final Map> vanillaRegistrations = new HashMap<>(); + + private record ProtocolAndFlow(ConnectionProtocol protocol, PacketFlow flow) {} + private NetworkRegistry() {} /** @@ -136,7 +143,27 @@ public void setup() { } /** - * Invoked by the network subsystem to get a reader for a custom packet payload. + * Captures the list of vanilla custom payloads. + * Must be called exactly once for each relevant protocol/flow pair. + */ + public void storeVanillaCustomPayloads(ConnectionProtocol protocol, PacketFlow flow, Set knownVanillaPackets) { + var key = new ProtocolAndFlow(protocol, flow); + + if (vanillaRegistrations.putIfAbsent(key, knownVanillaPackets) != null) { + throw new IllegalStateException("Duplicate vanilla packet capture for " + key); + } + } + + private Set getVanillaCustomPayloads(ConnectionProtocol protocol, PacketFlow flow) { + var ret = vanillaRegistrations.get(new ProtocolAndFlow(protocol, flow)); + if (ret == null) { + throw new IllegalStateException("Failed to capture vanilla packets for " + protocol + " " + flow); + } + return ret; + } + + /** + * Invoked by the network subsystem to get a codec for a custom packet payload. *

* This method special cases three situations: *

    @@ -148,22 +175,30 @@ public void setup() { *

    *

    * This method will then check if the connection is properly configured to be used for modded packets. - * If not a warning is logged, and null is returned. Which causes the packet to be discarded. + * If not a warning is logged, and null is returned on receipt, which causes the packet to be discarded, or an + * exception is thrown on send. *

    *

    - * If the connection is properly configured, the method will check if the packet is known to the connection, and if it is not, null is returned. - * Then the method will check if the packet is known to the registry, and if it is not, null is returned. - * If the packet is known to the registry, the method will return a reader that will invoke the registered replyHandler. + * If the connection is properly configured, the method will check if the packet is known to the connection, and if it is not, + * null is returned on receipt or an exception is thrown on send. + * Then the method will check if the packet is known to the registry, and if it is not, null is returned on receipt or + * an exception is thrown on send. + * If the packet is known to the registry, the method will return a codec that can encode or decode the payload. *

    * * @param id The id of the payload. - * @param context The context of the channel. + * @param bytebuf The buffer holding the payload. * @param protocol The protocol of the connection. * @param knownTypes The known types of the connection. - * @return A reader for the payload, or null if the payload should be discarded. + * @return A codec for the payload, or null if the payload should be discarded on receipt. */ @Nullable - public FriendlyByteBuf.Reader getReader(ResourceLocation id, ChannelHandlerContext context, ConnectionProtocol protocol, Map> knownTypes) { + public StreamCodec getCodec( + ResourceLocation id, + B bytebuf, + ConnectionProtocol protocol, + Map> knownTypes, + boolean encoding) { //Vanilla custom packet, let it deal with it. if (knownTypes.containsKey(id)) { return knownTypes.get(id); @@ -172,53 +207,65 @@ public FriendlyByteBuf.Reader getReader(ResourceL //These are our own custom modded packets which can be sent before a payload setup is negotiated. //Special case them if (id.equals(MinecraftRegisterPayload.ID)) { - return MinecraftRegisterPayload.READER; + return MinecraftRegisterPayload.STREAM_CODEC; } if (id.equals(MinecraftUnregisterPayload.ID)) { - return MinecraftUnregisterPayload.READER; + return MinecraftUnregisterPayload.STREAM_CODEC; } if (id.equals(ModdedNetworkQueryPayload.ID)) { - return ModdedNetworkQueryPayload.READER; + return ModdedNetworkQueryPayload.STREAM_CODEC; } if (id.equals(ModdedNetworkPayload.ID)) { - return ModdedNetworkPayload.READER; + return ModdedNetworkPayload.STREAM_CODEC; } if (id.equals(ModdedNetworkSetupFailedPayload.ID)) { - return ModdedNetworkSetupFailedPayload.READER; + return ModdedNetworkSetupFailedPayload.STREAM_CODEC; } //Check the network setup. + ChannelHandlerContext context = ChannelAwareFriendlyByteBuf.unwrapContext(bytebuf); + if (context == null) { + throw new IllegalArgumentException("Failed to retrieve extra ChannelHandlerContext from byte buf when processing packet " + id + "."); + } + final NetworkPayloadSetup payloadSetup = context.channel().attr(ATTRIBUTE_PAYLOAD_SETUP).get(); - final PacketFlow flow = context.channel().attr(ATTRIBUTE_FLOW).get(); + PacketFlow flow = context.channel().attr(ATTRIBUTE_FLOW).get(); if (payloadSetup == null || flow == null) { + if (encoding) { + throw new IllegalStateException("Cannot send a modded custom payload packet before networking is negotiated"); + } //Error: Bail. LOGGER.warn("Received a modded custom payload packet {} that has not been negotiated with the server. Not parsing packet.", id); return null; } + if (encoding) { + flow = flow.getOpposite(); + } + //Now ask the protocol what kind of payload is being sent and get the channel for it. if (protocol.isPlay()) { final NetworkChannel channel = payloadSetup.play().get(id); //Validate that everything is okey and then return a reader. - if (channel == null && !isAdhocPlayChannelReadable(id, flow)) { + if (channel == null && !encoding && !isAdhocPlayChannelReadable(id, flow)) { LOGGER.warn("Received a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", id); return null; } final PlayRegistration registration = knownPlayRegistrations.get(id); if (registration == null) { - LOGGER.error("Received a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", channel.id()); - throw new IllegalStateException("A client sent a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); + LOGGER.error("Tried to handle a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", id); + throw new IllegalStateException("Tried to handle a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); } if (registration.flow().isPresent()) { if (registration.flow().get() != flow) { - LOGGER.warn("Received a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client.", channel.id()); + LOGGER.warn("Tried to handle a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client.", id); final Connection connection = ConnectionUtils.getConnection(context); final PacketListener listener = connection.getPacketListener(); if (listener instanceof ServerGamePacketListener serverListener) { @@ -226,49 +273,50 @@ public FriendlyByteBuf.Reader getReader(ResourceL } else if (listener instanceof ClientGamePacketListener clientListener) { clientListener.getConnection().disconnect(Component.translatableWithFallback("neoforge.network.invalid_flow", "Failed to process a payload that was send with an invalid flow: %s", flow)); } else { - LOGGER.error("Received a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client, but the listener is not a game listener. This should not happen.", channel.id()); - throw new IllegalStateException("A client sent a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); + LOGGER.error("Tried to handle a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client, but the listener is not a game listener. This should not happen.", id); + throw new IllegalStateException("Tried to handle a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); } } } - return registration; + //noinspection unchecked + return (StreamCodec) registration.codec(); } else if (protocol.isConfiguration()) { final NetworkChannel channel = payloadSetup.configuration().get(id); //Also validate that everything is key and then return a reader. - if (channel == null && !isAdhocConfigurationChannelReadable(id, flow)) { + if (channel == null && !encoding && !isAdhocConfigurationChannelReadable(id, flow)) { LOGGER.warn("Received a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", id); return null; } final ConfigurationRegistration registration = knownConfigurationRegistrations.get(id); if (registration == null) { - LOGGER.error("Received a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", channel.id()); - throw new IllegalStateException("A client sent a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); + LOGGER.error("Tried to handle a modded custom payload packet {} with an unknown or not accepted channel. Not parsing packet.", id); + throw new IllegalStateException("Tried to handle a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); } if (registration.flow().isPresent()) { if (registration.flow().get() != flow) { - LOGGER.warn("Received a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client.", channel.id()); + LOGGER.warn("Tried to handle a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client.", id); final Connection connection = ConnectionUtils.getConnection(context); final PacketListener listener = connection.getPacketListener(); - if (listener instanceof ServerGamePacketListener serverListener) { + if (listener instanceof ServerConfigurationPacketListener serverListener) { serverListener.disconnect(Component.translatableWithFallback("neoforge.network.invalid_flow", "Failed to process a payload that was send with an invalid flow: %s", flow)); - } else if (listener instanceof ClientGamePacketListener clientListener) { + } else if (listener instanceof ClientConfigurationPacketListener clientListener) { clientListener.getConnection().disconnect(Component.translatableWithFallback("neoforge.network.invalid_flow", "Failed to process a payload that was send with an invalid flow: %s", flow)); } else { - LOGGER.error("Received a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client, but the listener is not a game listener. This should not happen.", channel.id()); - throw new IllegalStateException("A client sent a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); + LOGGER.error("Tried to handle a modded custom payload packet {} that is not supposed to be sent to the server. Disconnecting client, but the listener is not a config listener. This should not happen.", id); + throw new IllegalStateException("Tried to handle a packet with an unknown or not accepted channel, while negotiation succeeded. Somebody changed the channels known to NeoForge!"); } } } - return registration; + return registration.codec(); } else { //Error case, somebody is trying to sent a custom packet during a phase that is not supported. - LOGGER.error("Received a modded custom payload packet from a client that is not in the configuration or play phase. Not parsing packet."); - throw new IllegalStateException("A client sent a packet while not in the configuration or play phase. Somebody changed the phases known to NeoForge!"); + LOGGER.error("Tried to handle a modded custom payload packet while not in the configuration or play phase. Not handling packet."); + throw new IllegalStateException("Tried to handle a packet while not in the configuration or play phase. Somebody changed the phases known to NeoForge!"); } } @@ -295,16 +343,16 @@ public void onModdedPacketAtServer(ServerCommonPacketListener listener, Serverbo if (listener instanceof ServerConfigurationPacketListener configurationPacketListener) { //Get the configuration channel for the packet. - final NetworkChannel channel = payloadSetup.configuration().get(packet.payload().id()); + final NetworkChannel channel = payloadSetup.configuration().get(packet.payload().type().id()); //Check if the channel should even be processed. - if (channel == null && !isAdhocConfigurationChannelReadable(packet.payload().id(), PacketFlow.SERVERBOUND)) { + if (channel == null && !isAdhocConfigurationChannelReadable(packet.payload().type().id(), PacketFlow.SERVERBOUND)) { LOGGER.warn("Received a modded custom payload packet from a client with an unknown or not accepted channel. Disconnecting client."); listener.disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); return; } - final ResourceLocation id = channel != null ? channel.id() : packet.payload().id(); + final ResourceLocation id = channel != null ? channel.id() : packet.payload().type().id(); //We are in the configuration phase, so lookup packet listeners for that final ConfigurationRegistration registration = knownConfigurationRegistrations.get(id); if (registration == null) { @@ -319,21 +367,21 @@ public void onModdedPacketAtServer(ServerCommonPacketListener listener, Serverbo new ServerPacketHandler(configurationPacketListener), configurationPacketListener::finishCurrentTask, new EventLoopSynchronizedWorkHandler<>(configurationPacketListener.getMainThreadEventLoop(), packet.payload()), - PacketFlow.SERVERBOUND, + listener.getConnection().getInboundProtocol(), listener.getConnection().channel().pipeline().lastContext(), Optional.empty())); } else if (listener instanceof ServerGamePacketListener playPacketListener) { //Get the configuration channel for the packet. - final NetworkChannel channel = payloadSetup.play().get(packet.payload().id()); + final NetworkChannel channel = payloadSetup.play().get(packet.payload().type().id()); //Check if the channel should even be processed. - if (channel == null && !isAdhocPlayChannelReadable(packet.payload().id(), PacketFlow.SERVERBOUND)) { + if (channel == null && !isAdhocPlayChannelReadable(packet.payload().type().id(), PacketFlow.SERVERBOUND)) { LOGGER.warn("Received a modded custom payload packet from a client with an unknown or not accepted channel. Disconnecting client."); listener.disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); return; } - final ResourceLocation id = channel != null ? channel.id() : packet.payload().id(); + final ResourceLocation id = channel != null ? channel.id() : packet.payload().type().id(); //We are in the play phase, so lookup packet listeners for that final PlayRegistration registration = knownPlayRegistrations.get(id); if (registration == null) { @@ -347,7 +395,7 @@ public void onModdedPacketAtServer(ServerCommonPacketListener listener, Serverbo new ServerReplyHandler(playPacketListener), new ServerPacketHandler(playPacketListener), new EventLoopSynchronizedWorkHandler<>(playPacketListener.getMainThreadEventLoop(), packet.payload()), - PacketFlow.SERVERBOUND, + listener.getConnection().getInboundProtocol(), listener.getConnection().channel().pipeline().lastContext(), listener instanceof ServerPlayerConnection connection ? Optional.of(connection.getPlayer()) : Optional.empty())); } else { @@ -369,7 +417,7 @@ public void onModdedPacketAtServer(ServerCommonPacketListener listener, Serverbo * @param packet The packet that was received. */ public boolean onModdedPacketAtClient(ClientCommonPacketListener listener, ClientboundCustomPayloadPacket packet) { - if (packet.payload().id().getNamespace().equals("minecraft")) { + if (packet.payload().type().id().getNamespace().equals("minecraft")) { return false; } @@ -383,16 +431,16 @@ public boolean onModdedPacketAtClient(ClientCommonPacketListener listener, Clien if (listener instanceof ClientConfigurationPacketListener configurationPacketListener) { //Get the configuration channel for the packet. - final NetworkChannel channel = payloadSetup.configuration().get(packet.payload().id()); + final NetworkChannel channel = payloadSetup.configuration().get(packet.payload().type().id()); //Check if the channel should even be processed. - if (channel == null && !isAdhocConfigurationChannelReadable(packet.payload().id(), PacketFlow.CLIENTBOUND)) { + if (channel == null && !isAdhocConfigurationChannelReadable(packet.payload().type().id(), PacketFlow.CLIENTBOUND)) { LOGGER.warn("Received a modded custom payload packet from a server with an unknown or not accepted channel. Disconnecting server."); listener.getConnection().disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); return false; } - final ResourceLocation id = channel != null ? channel.id() : packet.payload().id(); + final ResourceLocation id = channel != null ? channel.id() : packet.payload().type().id(); //We are in the configuration phase, so lookup packet listeners for that final ConfigurationRegistration registration = knownConfigurationRegistrations.get(id); if (registration == null) { @@ -407,21 +455,21 @@ public boolean onModdedPacketAtClient(ClientCommonPacketListener listener, Clien new ClientPacketHandler(configurationPacketListener), (task) -> LOGGER.warn("Tried to finish a task on the client. This should not happen. Ignoring. Task: {}", task), new EventLoopSynchronizedWorkHandler<>(configurationPacketListener.getMainThreadEventLoop(), packet.payload()), - PacketFlow.CLIENTBOUND, + listener.getConnection().getInboundProtocol(), listener.getConnection().channel().pipeline().lastContext(), Optional.ofNullable(configurationPacketListener.getMinecraft().player))); } else if (listener instanceof ClientGamePacketListener playPacketListener) { //Get the configuration channel for the packet. - final NetworkChannel channel = payloadSetup.play().get(packet.payload().id()); + final NetworkChannel channel = payloadSetup.play().get(packet.payload().type().id()); //Check if the channel should even be processed. - if (channel == null && !isAdhocPlayChannelReadable(packet.payload().id(), PacketFlow.CLIENTBOUND)) { + if (channel == null && !isAdhocPlayChannelReadable(packet.payload().type().id(), PacketFlow.CLIENTBOUND)) { LOGGER.warn("Received a modded custom payload packet from a server with an unknown or not accepted channel. Disconnecting server."); listener.getConnection().disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); return false; } - final ResourceLocation id = channel != null ? channel.id() : packet.payload().id(); + final ResourceLocation id = channel != null ? channel.id() : packet.payload().type().id(); //We are in the play phase, so lookup packet listeners for that final PlayRegistration registration = knownPlayRegistrations.get(id); if (registration == null) { @@ -435,7 +483,7 @@ public boolean onModdedPacketAtClient(ClientCommonPacketListener listener, Clien new ClientReplyHandler(playPacketListener), new ClientPacketHandler(playPacketListener), new EventLoopSynchronizedWorkHandler<>(playPacketListener.getMainThreadEventLoop(), packet.payload()), - PacketFlow.CLIENTBOUND, + listener.getConnection().getInboundProtocol(), listener.getConnection().channel().pipeline().lastContext(), Optional.ofNullable(playPacketListener.getMinecraft().player))); } else { @@ -511,7 +559,7 @@ public void onModdedConnectionDetectedAtServer(ServerConfigurationPacketListener sender.getConnection().channel().attr(ATTRIBUTE_PAYLOAD_SETUP).set(setup); - NetworkFilters.injectIfNecessary(sender.getConnection(), sender.getConnectionType()); + NetworkFilters.injectIfNecessary(sender.getConnection()); sender.send(new ModdedNetworkPayload( setup.configuration().values().stream().map(channel -> new ModdedNetworkComponent(channel.id(), channel.chosenVersion())).collect(Collectors.toSet()), @@ -560,7 +608,7 @@ public boolean onVanillaOrOtherConnectionDetectedAtServer(ServerConfigurationPac return false; } - NetworkFilters.injectIfNecessary(sender.getConnection(), sender.getConnectionType()); + NetworkFilters.injectIfNecessary(sender.getConnection()); final ImmutableSet.Builder nowListeningOn = ImmutableSet.builder(); nowListeningOn.addAll(getInitialClientListeningChannels()); @@ -591,19 +639,19 @@ public boolean canSendPacket(Packet packet, ServerCommonPacketListener listen return true; } - if (shouldSendPacketRaw(packet)) { + if (shouldSendPacketRaw(packet, ConnectionPhase.fromPacketListener(listener))) { return true; } - if (isConnected(listener, customPayloadPacket.payload().id())) { + if (isConnected(listener, customPayloadPacket.payload().type().id())) { return true; } - LOGGER.warn("Tried to send {} packet to a client that does not support it. Not sending the packet.", customPayloadPacket.payload().id()); + LOGGER.warn("Tried to send {} packet to a client that does not support it. Not sending the packet.", customPayloadPacket.payload().type().id()); return false; } - public boolean shouldSendPacketRaw(Packet packet) { + public boolean shouldSendPacketRaw(Packet packet, ConnectionPhase phase) { if (!(packet instanceof ClientboundCustomPayloadPacket customPayloadPacket)) { return true; } @@ -629,7 +677,11 @@ public boolean shouldSendPacketRaw(Packet packet) { } //Vanilla payloads. - return ClientboundCustomPayloadPacket.KNOWN_TYPES.containsKey(customPayloadPacket.payload().id()); + if (phase.isConfiguration()) { + return getVanillaCustomPayloads(ConnectionProtocol.CONFIGURATION, PacketFlow.CLIENTBOUND).contains(customPayloadPacket.payload().type().id()); + } else { + return getVanillaCustomPayloads(ConnectionProtocol.PLAY, PacketFlow.CLIENTBOUND).contains(customPayloadPacket.payload().type().id()); + } } /** @@ -663,15 +715,21 @@ public boolean canSendPacket(Packet packet, ClientCommonPacketListener listen } //Vanilla payloads. - if (ServerboundCustomPayloadPacket.KNOWN_TYPES.containsKey(customPayloadPacket.payload().id())) { - return true; + if (ConnectionPhase.fromPacketListener(listener).isConfiguration()) { + if (getVanillaCustomPayloads(ConnectionProtocol.CONFIGURATION, PacketFlow.SERVERBOUND).contains(customPayloadPacket.payload().type().id())) { + return true; + } + } else { + if (getVanillaCustomPayloads(ConnectionProtocol.PLAY, PacketFlow.SERVERBOUND).contains(customPayloadPacket.payload().type().id())) { + return true; + } } - if (isConnected(listener, customPayloadPacket.payload().id())) { + if (isConnected(listener, customPayloadPacket.payload().type().id())) { return true; } - LOGGER.warn("Tried to send {} packet to a server that does not support it. Not sending the packet.", customPayloadPacket.payload().id()); + LOGGER.warn("Tried to send {} packet to a server that does not support it. Not sending the packet.", customPayloadPacket.payload().type().id()); return false; } @@ -765,12 +823,13 @@ public void onModdedNetworkConnectionEstablished(ClientConfigurationPacketListen .map(entry -> new NetworkChannel(entry.id(), entry.version())) .collect(Collectors.toSet())); - NetworkFilters.injectIfNecessary(listener.getConnection(), listener.getConnectionType()); - listener.getConnection().channel().attr(ATTRIBUTE_PAYLOAD_SETUP).set(setup); listener.getConnection().channel().attr(ATTRIBUTE_CONNECTION_TYPE).set(listener.getConnectionType()); listener.getConnection().channel().attr(ATTRIBUTE_FLOW).set(PacketFlow.CLIENTBOUND); + // Only inject filters once the payload setup is stored, as the filters might check for available channels. + NetworkFilters.injectIfNecessary(listener.getConnection()); + final ImmutableSet.Builder nowListeningOn = ImmutableSet.builder(); nowListeningOn.addAll(getInitialClientListeningChannels()); nowListeningOn.addAll(setup.configuration().keySet()); @@ -824,7 +883,7 @@ public boolean onVanillaNetworkConnectionEstablished(ClientConfigurationPacketLi //We are on the client, connected to a vanilla server, We have to load the default configs. ConfigTracker.INSTANCE.loadDefaultServerConfigs(); - NetworkFilters.injectIfNecessary(sender.getConnection(), sender.getConnectionType()); + NetworkFilters.injectIfNecessary(sender.getConnection()); final ImmutableSet.Builder nowListeningOn = ImmutableSet.builder(); nowListeningOn.addAll(getInitialClientListeningChannels()); @@ -910,15 +969,15 @@ public List> filterGameBundlePackets(Channe return; } - if (shouldSendPacketRaw(packet)) { + if (shouldSendPacketRaw(packet, ConnectionPhase.PLAY)) { toSend.add(packet); return; } - final NetworkChannel channel = payloadSetup.play().get(customPayloadPacket.payload().id()); + final NetworkChannel channel = payloadSetup.play().get(customPayloadPacket.payload().type().id()); if (channel == null) { - LOGGER.trace("Somebody tried to send: {} to a client which cannot accept it. Not sending packet.", customPayloadPacket.payload().id()); + LOGGER.trace("Somebody tried to send: {} to a client which cannot accept it. Not sending packet.", customPayloadPacket.payload().type().id()); return; } @@ -948,7 +1007,7 @@ public void configureMockConnection(final Connection connection) { connection.channel().attr(ATTRIBUTE_PAYLOAD_SETUP).set(setup); - NetworkFilters.injectIfNecessary(connection, ConnectionType.NEOFORGE); + NetworkFilters.injectIfNecessary(connection); } /** @@ -1093,6 +1152,10 @@ public void onConfigurationFinished(ClientConfigurationPacketListener listener) listener.send(new MinecraftRegisterPayload(nowListeningOn.build())); } + public static ConnectionType getConnectionType(Connection connection) { + return Objects.requireNonNull(connection.channel().attr(ATTRIBUTE_CONNECTION_TYPE).get(), "no connection type on connection!"); + } + /** * An {@link ISynchronizedWorkHandler} that can be used to schedule tasks on the main thread of the server or client. This wrapper record is used to line up the APIs of the {@link ReentrantBlockableEventLoop} with the {@link ISynchronizedWorkHandler}. * diff --git a/src/main/java/net/neoforged/neoforge/network/registration/PlayRegistration.java b/src/main/java/net/neoforged/neoforge/network/registration/PlayRegistration.java index 21c6350ce6..6e76c9466a 100644 --- a/src/main/java/net/neoforged/neoforge/network/registration/PlayRegistration.java +++ b/src/main/java/net/neoforged/neoforge/network/registration/PlayRegistration.java @@ -6,7 +6,8 @@ package net.neoforged.neoforge.network.registration; import java.util.Optional; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.neoforged.neoforge.network.handling.IPlayPayloadHandler; @@ -16,7 +17,7 @@ /** * A record that holds the information needed to describe a registered play payload, its reader and handler. * - * @param reader The reader for the payload + * @param codec The reader for the payload * @param handler The handler for the payload * @param version The version of the payload * @param flow The flow of the payload @@ -25,19 +26,14 @@ */ @ApiStatus.Internal public record PlayRegistration( - FriendlyByteBuf.Reader reader, + StreamCodec codec, IPlayPayloadHandler handler, Optional version, Optional flow, - boolean optional) implements IPlayPayloadHandler, FriendlyByteBuf.Reader { + boolean optional) implements IPlayPayloadHandler { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void handle(CustomPacketPayload payload, PlayPayloadContext context) { ((IPlayPayloadHandler) handler).handle(payload, context); } - - @Override - public CustomPacketPayload apply(FriendlyByteBuf buffer) { - return reader.apply(buffer); - } } diff --git a/src/main/java/net/neoforged/neoforge/registries/ClientRegistryManager.java b/src/main/java/net/neoforged/neoforge/registries/ClientRegistryManager.java index 5461d3b30d..e56e7cdc46 100644 --- a/src/main/java/net/neoforged/neoforge/registries/ClientRegistryManager.java +++ b/src/main/java/net/neoforged/neoforge/registries/ClientRegistryManager.java @@ -48,7 +48,7 @@ public static void handleDataMapSync(final RegistryDataMapSyncPayload pay } public static void handleKnownDataMaps(final KnownRegistryDataMapsPayload payload, final ConfigurationPayloadContext context) { - record MandatoryEntry(ResourceKey> registry, ResourceLocation id) {} + record MandatoryEntry(ResourceKey> registry, ResourceLocation id) {} final Set ourMandatory = new HashSet<>(); RegistryManager.getDataMaps().forEach((reg, values) -> values.values().forEach(attach -> { if (attach.mandatorySync()) { @@ -92,7 +92,7 @@ record MandatoryEntry(ResourceKey> registry, ResourceLocation id) {} return; } - final var known = new HashMap>, Collection>(); + final var known = new HashMap>, Collection>(); RegistryManager.getDataMaps().forEach((key, vals) -> known.put(key, vals.keySet())); context.replyHandler().send(new KnownRegistryDataMapsReplyPayload(known)); } diff --git a/src/main/java/net/neoforged/neoforge/registries/DataMapLoader.java b/src/main/java/net/neoforged/neoforge/registries/DataMapLoader.java index e6eed455e9..8e1bbdaaa8 100644 --- a/src/main/java/net/neoforged/neoforge/registries/DataMapLoader.java +++ b/src/main/java/net/neoforged/neoforge/registries/DataMapLoader.java @@ -126,7 +126,7 @@ private CompletableFuture>, LoadResult> } private static Map>, LoadResult> load(ResourceManager manager, ProfilerFiller profiler, RegistryAccess access, ICondition.IContext context) { - final RegistryOps ops = ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, access), context); + final RegistryOps ops = new ConditionalOps<>(RegistryOps.create(JsonOps.INSTANCE, access), context); final Map>, LoadResult> values = new HashMap<>(); access.registries().forEach(registryEntry -> { @@ -161,8 +161,7 @@ private static List> readData(RegistryOps for (final Resource resource : resources) { try (Reader reader = resource.openAsReader()) { JsonElement jsonelement = JsonParser.parseReader(reader); - entries.add(codec.decode(ops, jsonelement) - .getOrThrow(false, LOGGER::error).getFirst()); + entries.add(codec.decode(ops, jsonelement).getOrThrow().getFirst()); } catch (Exception exception) { LOGGER.error("Could not read data map of type {} for registry {}", attachmentType.id(), registryKey, exception); } diff --git a/src/main/java/net/neoforged/neoforge/registries/DataPackRegistriesHooks.java b/src/main/java/net/neoforged/neoforge/registries/DataPackRegistriesHooks.java index 8c5726bf15..1c534ceeb7 100644 --- a/src/main/java/net/neoforged/neoforge/registries/DataPackRegistriesHooks.java +++ b/src/main/java/net/neoforged/neoforge/registries/DataPackRegistriesHooks.java @@ -5,17 +5,13 @@ package net.neoforged.neoforge.registries; -import com.google.common.collect.ImmutableMap; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.stream.Stream; import net.minecraft.core.Registry; -import net.minecraft.core.RegistrySynchronization; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.resources.ResourceKey; import org.jetbrains.annotations.ApiStatus; @@ -25,20 +21,21 @@ public final class DataPackRegistriesHooks { private DataPackRegistriesHooks() {} // utility class - private static final Map>, RegistrySynchronization.NetworkedRegistryData> NETWORKABLE_REGISTRIES = new LinkedHashMap<>(); + private static final List> NETWORKABLE_REGISTRIES = new ArrayList<>(); private static final List> DATA_PACK_REGISTRIES = new ArrayList<>(RegistryDataLoader.WORLDGEN_REGISTRIES); private static final List> DATA_PACK_REGISTRIES_VIEW = Collections.unmodifiableList(DATA_PACK_REGISTRIES); private static final Set>> SYNCED_CUSTOM_REGISTRIES = new HashSet<>(); private static final Set>> SYNCED_CUSTOM_REGISTRIES_VIEW = Collections.unmodifiableSet(SYNCED_CUSTOM_REGISTRIES); /* Internal forge hook for retaining mutable access to RegistryAccess's codec registry when it bootstraps. */ - public static Map>, RegistrySynchronization.NetworkedRegistryData> grabNetworkableRegistries(ImmutableMap.Builder>, RegistrySynchronization.NetworkedRegistryData> builder) { - if (!StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass().equals(RegistrySynchronization.class)) + public static List> grabNetworkableRegistries(List> list) { + if (!StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass().equals(RegistryDataLoader.class)) throw new IllegalCallerException("Attempted to call DataPackRegistriesHooks#grabNetworkableRegistries!"); - NETWORKABLE_REGISTRIES.forEach(builder::put); + List> builder = new ArrayList<>(list); + builder.addAll(NETWORKABLE_REGISTRIES); NETWORKABLE_REGISTRIES.clear(); - NETWORKABLE_REGISTRIES.putAll(builder.build()); - return Collections.unmodifiableMap(NETWORKABLE_REGISTRIES); + NETWORKABLE_REGISTRIES.addAll(builder); + return Collections.unmodifiableList(NETWORKABLE_REGISTRIES); } /* Internal forge method, registers a datapack registry codec and folder. */ @@ -47,7 +44,7 @@ static void addRegistryCodec(DataPackRegistryEvent.DataPackRegistryData d DATA_PACK_REGISTRIES.add(loaderData); if (data.networkCodec() != null) { SYNCED_CUSTOM_REGISTRIES.add(loaderData.key()); - NETWORKABLE_REGISTRIES.put(loaderData.key(), new RegistrySynchronization.NetworkedRegistryData<>(loaderData.key(), data.networkCodec())); + NETWORKABLE_REGISTRIES.add(new RegistryDataLoader.RegistryData(loaderData.key(), data.networkCodec())); } } @@ -75,7 +72,7 @@ public static Set>> getSyncedCustomRegistries( @Nullable @ApiStatus.Internal @SuppressWarnings("unchecked") - public static RegistrySynchronization.NetworkedRegistryData getSyncedRegistry(final ResourceKey> registry) { - return (RegistrySynchronization.NetworkedRegistryData) NETWORKABLE_REGISTRIES.get(registry); + public static RegistryDataLoader.RegistryData getSyncedRegistry(final ResourceKey> registry) { + return (RegistryDataLoader.RegistryData) NETWORKABLE_REGISTRIES.stream().filter(data -> data.key().equals(registry)).findFirst().orElse(null); } } diff --git a/src/main/java/net/neoforged/neoforge/registries/DeferredHolder.java b/src/main/java/net/neoforged/neoforge/registries/DeferredHolder.java index 036fa7d267..c6257a87ae 100644 --- a/src/main/java/net/neoforged/neoforge/registries/DeferredHolder.java +++ b/src/main/java/net/neoforged/neoforge/registries/DeferredHolder.java @@ -19,6 +19,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.neoforged.neoforge.registries.datamaps.DataMapType; import org.jetbrains.annotations.Nullable; /** @@ -172,7 +173,7 @@ public ResourceKey getKey() { @Override public boolean equals(Object obj) { if (this == obj) return true; - return obj instanceof DeferredHolder dh && dh.key == this.key; + return obj instanceof Holder h && h.kind() == Kind.REFERENCE && h.unwrapKey().orElseThrow() == this.key; } @Override @@ -232,6 +233,25 @@ public boolean is(TagKey tag) { return this.holder != null && this.holder.is(tag); } + /** + * {@return {@code true} if the {@code holder} is the same as this holder} + */ + @Override + @Deprecated + public boolean is(Holder holder) { + bind(false); + return this.holder != null && this.holder.is(holder); + } + + /** + * {@inheritDoc} + */ + @Override + public @Nullable Z getData(DataMapType type) { + bind(false); + return holder == null ? null : holder.getData(type); + } + /** * {@return all tags present on the underlying object} * @@ -275,4 +295,10 @@ public boolean canSerializeIn(HolderOwner owner) { bind(false); return this.holder != null && this.holder.canSerializeIn(owner); } + + @Override + public Holder getDelegate() { + bind(false); + return this.holder != null ? this.holder.getDelegate() : this; + } } diff --git a/src/main/java/net/neoforged/neoforge/registries/GameData.java b/src/main/java/net/neoforged/neoforge/registries/GameData.java index 26c9bbc930..1d6fa85e00 100644 --- a/src/main/java/net/neoforged/neoforge/registries/GameData.java +++ b/src/main/java/net/neoforged/neoforge/registries/GameData.java @@ -119,6 +119,7 @@ static void fireRemapEvent(final Map getRegistrationOrder() { Set ordered = new LinkedHashSet<>(); ordered.add(Registries.ATTRIBUTE.location()); // Vanilla order is incorrect, both Item and MobEffect depend on Attribute at construction time. + ordered.add(Registries.DATA_COMPONENT_TYPE.location()); // Vanilla order is incorrect, Item depends on data components at construction time. ordered.addAll(BuiltInRegistries.getVanillaRegistrationOrder()); ordered.addAll(BuiltInRegistries.REGISTRY.keySet().stream().sorted(ResourceLocation::compareNamespaced).toList()); return ordered; diff --git a/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistries.java b/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistries.java index d07741083d..d7303802b4 100644 --- a/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistries.java +++ b/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistries.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.registries; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; @@ -14,8 +14,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemDisplayContext; import net.neoforged.neoforge.attachment.AttachmentType; -import net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate; -import net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate; import net.neoforged.neoforge.common.conditions.ICondition; import net.neoforged.neoforge.common.crafting.IngredientType; import net.neoforged.neoforge.common.loot.IGlobalLootModifier; @@ -34,9 +32,9 @@ public class NeoForgeRegistries { // Custom NeoForge registries public static final Registry> ENTITY_DATA_SERIALIZERS = new RegistryBuilder<>(Keys.ENTITY_DATA_SERIALIZERS).sync(true).create(); - public static final Registry> GLOBAL_LOOT_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS).create(); - public static final Registry> BIOME_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.BIOME_MODIFIER_SERIALIZERS).create(); - public static final Registry> STRUCTURE_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.STRUCTURE_MODIFIER_SERIALIZERS).create(); + public static final Registry> GLOBAL_LOOT_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS).create(); + public static final Registry> BIOME_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.BIOME_MODIFIER_SERIALIZERS).create(); + public static final Registry> STRUCTURE_MODIFIER_SERIALIZERS = new RegistryBuilder<>(Keys.STRUCTURE_MODIFIER_SERIALIZERS).create(); public static final Registry FLUID_TYPES = new RegistryBuilder<>(Keys.FLUID_TYPES).create(); public static final Registry HOLDER_SET_TYPES = new RegistryBuilder<>(Keys.HOLDER_SET_TYPES).create(); public static final Registry DISPLAY_CONTEXTS = new RegistryBuilder<>(Keys.DISPLAY_CONTEXTS) @@ -45,9 +43,7 @@ public class NeoForgeRegistries { .defaultKey(new ResourceLocation("none")) .create(); public static final Registry> INGREDIENT_TYPES = new RegistryBuilder<>(Keys.INGREDIENT_TYPES).create(); - public static final Registry> CONDITION_SERIALIZERS = new RegistryBuilder<>(Keys.CONDITION_CODECS).create(); - public static final Registry> ENTITY_PREDICATE_SERIALIZERS = new RegistryBuilder<>(Keys.ENTITY_PREDICATE_SERIALIZERS).create(); - public static final Registry> ITEM_PREDICATE_SERIALIZERS = new RegistryBuilder<>(Keys.ITEM_PREDICATE_SERIALIZERS).create(); + public static final Registry> CONDITION_SERIALIZERS = new RegistryBuilder<>(Keys.CONDITION_CODECS).create(); public static final Registry> ATTACHMENT_TYPES = new RegistryBuilder<>(Keys.ATTACHMENT_TYPES).create(); // Reminder: If you add a registry to NeoForge itself, remember to add it to NeoForgeRegistriesSetup#registerRegistries. @@ -55,16 +51,14 @@ public class NeoForgeRegistries { public static final class Keys { // NeoForge public static final ResourceKey>> ENTITY_DATA_SERIALIZERS = key("entity_data_serializers"); - public static final ResourceKey>> GLOBAL_LOOT_MODIFIER_SERIALIZERS = key("global_loot_modifier_serializers"); - public static final ResourceKey>> BIOME_MODIFIER_SERIALIZERS = key("biome_modifier_serializers"); - public static final ResourceKey>> STRUCTURE_MODIFIER_SERIALIZERS = key("structure_modifier_serializers"); + public static final ResourceKey>> GLOBAL_LOOT_MODIFIER_SERIALIZERS = key("global_loot_modifier_serializers"); + public static final ResourceKey>> BIOME_MODIFIER_SERIALIZERS = key("biome_modifier_serializers"); + public static final ResourceKey>> STRUCTURE_MODIFIER_SERIALIZERS = key("structure_modifier_serializers"); public static final ResourceKey> FLUID_TYPES = key("fluid_type"); public static final ResourceKey> HOLDER_SET_TYPES = key("holder_set_type"); public static final ResourceKey> DISPLAY_CONTEXTS = key("display_contexts"); public static final ResourceKey>> INGREDIENT_TYPES = key("ingredient_serializer"); - public static final ResourceKey>> CONDITION_CODECS = key("condition_codecs"); - public static final ResourceKey>> ENTITY_PREDICATE_SERIALIZERS = key("entity_predicates"); - public static final ResourceKey>> ITEM_PREDICATE_SERIALIZERS = key("item_predicates"); + public static final ResourceKey>> CONDITION_CODECS = key("condition_codecs"); public static final ResourceKey>> ATTACHMENT_TYPES = key("attachment_types"); // NeoForge Dynamic diff --git a/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistriesSetup.java b/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistriesSetup.java index 84d42b18b4..b435c6d984 100644 --- a/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistriesSetup.java +++ b/src/main/java/net/neoforged/neoforge/registries/NeoForgeRegistriesSetup.java @@ -46,7 +46,10 @@ public static synchronized void setup(IEventBus modEventBus) { BuiltInRegistries.VILLAGER_TYPE, // Required for EntityDataSerializers BuiltInRegistries.VILLAGER_PROFESSION, // Required for EntityDataSerializers BuiltInRegistries.CAT_VARIANT, // Required for EntityDataSerializers - BuiltInRegistries.FROG_VARIANT // Required for EntityDataSerializers + BuiltInRegistries.FROG_VARIANT, // Required for EntityDataSerializers + BuiltInRegistries.DATA_COMPONENT_TYPE, // Required for itemstack sync + BuiltInRegistries.RECIPE_SERIALIZER, // Required for Recipe sync + BuiltInRegistries.ATTRIBUTE // Required for ClientboundUpdateAttributesPacket ); private static void registerRegistries(NewRegistryEvent event) { @@ -59,8 +62,6 @@ private static void registerRegistries(NewRegistryEvent event) { event.register(NeoForgeRegistries.DISPLAY_CONTEXTS); event.register(NeoForgeRegistries.INGREDIENT_TYPES); event.register(NeoForgeRegistries.CONDITION_SERIALIZERS); - event.register(NeoForgeRegistries.ENTITY_PREDICATE_SERIALIZERS); - event.register(NeoForgeRegistries.ITEM_PREDICATE_SERIALIZERS); event.register(NeoForgeRegistries.ATTACHMENT_TYPES); } diff --git a/src/main/java/net/neoforged/neoforge/registries/NewRegistryEvent.java b/src/main/java/net/neoforged/neoforge/registries/NewRegistryEvent.java index 563a628f9e..e828272806 100644 --- a/src/main/java/net/neoforged/neoforge/registries/NewRegistryEvent.java +++ b/src/main/java/net/neoforged/neoforge/registries/NewRegistryEvent.java @@ -5,9 +5,9 @@ package net.neoforged.neoforge.registries; -import com.mojang.serialization.Lifecycle; import java.util.ArrayList; import java.util.List; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; import net.minecraft.core.WritableRegistry; import net.minecraft.core.registries.BuiltInRegistries; @@ -71,6 +71,6 @@ private void registerToRootRegistry(Registry registry) { if (BuiltInRegistries.REGISTRY.containsKey(registryName)) throw new IllegalStateException("Attempted duplicate registration of registry " + registryName); - ((WritableRegistry) BuiltInRegistries.REGISTRY).register(registry.key(), registry, Lifecycle.stable()); + ((WritableRegistry) BuiltInRegistries.REGISTRY).register(registry.key(), registry, RegistrationInfo.BUILT_IN); } } diff --git a/src/main/java/net/neoforged/neoforge/registries/RegistryManager.java b/src/main/java/net/neoforged/neoforge/registries/RegistryManager.java index 5c72de7bed..608250e0f1 100644 --- a/src/main/java/net/neoforged/neoforge/registries/RegistryManager.java +++ b/src/main/java/net/neoforged/neoforge/registries/RegistryManager.java @@ -19,6 +19,7 @@ import java.util.Set; import java.util.stream.Collectors; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; @@ -36,6 +37,7 @@ import org.slf4j.Marker; import org.slf4j.MarkerFactory; +@ApiStatus.Internal public class RegistryManager { private static final Logger LOGGER = LogUtils.getLogger(); private static final Marker REGISTRIES = MarkerFactory.getMarker("REGISTRIES"); @@ -94,7 +96,6 @@ public static void postNewRegistryEvent() { pendingModdedRegistries = null; } - @ApiStatus.Internal public static void initDataMaps() { final Map>, Map>> dataMapTypes = new HashMap<>(); ModLoader.get().postEvent(new RegisterDataMapTypesEvent(dataMapTypes)); @@ -201,7 +202,7 @@ private static void applySnapshot(MappedRegistry registry, RegistrySnapsh for (var entry : backup.entrySet()) { ResourceKey key = entry.getKey(); T value = entry.getValue(); - registry.registerMapping(backup.getId(key), key, value, backup.lifecycle(value)); + registry.register(backup.getId(key), key, value, backup.registrationInfo(key).orElse(RegistrationInfo.BUILT_IN)); } } @@ -268,11 +269,17 @@ public enum SnapshotType { FULL } - public static final AttributeKey>, Collection>> ATTRIBUTE_KNOWN_DATA_MAPS = AttributeKey.valueOf("neoforge:known_data_maps"); + public static final AttributeKey>, Collection>> ATTRIBUTE_KNOWN_DATA_MAPS = AttributeKey.valueOf("neoforge:known_data_maps"); - @ApiStatus.Internal public static void handleKnownDataMapsReply(final KnownRegistryDataMapsReplyPayload payload, final ConfigurationPayloadContext context) { context.channelHandlerContext().attr(ATTRIBUTE_KNOWN_DATA_MAPS).set(payload.dataMaps()); context.taskCompletedHandler().onTaskCompleted(RegistryDataMapNegotiation.TYPE); } + + public static boolean isNonSyncedBuiltInRegistry(Registry registry) { + if (!BuiltInRegistries.REGISTRY.containsKey((ResourceKey) registry.key())) { + return false; // Dynamic registry + } + return !registry.doesSync(); + } } diff --git a/src/main/java/net/neoforged/neoforge/registries/RegistrySnapshot.java b/src/main/java/net/neoforged/neoforge/registries/RegistrySnapshot.java index 9cbf723af2..420c3b6849 100644 --- a/src/main/java/net/neoforged/neoforge/registries/RegistrySnapshot.java +++ b/src/main/java/net/neoforged/neoforge/registries/RegistrySnapshot.java @@ -15,13 +15,41 @@ import java.util.TreeMap; import javax.annotation.Nullable; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; public class RegistrySnapshot { private static final Comparator SORTER = ResourceLocation::compareNamespaced; + public static final StreamCodec STREAM_CODEC = new StreamCodec<>() { + @Override + public RegistrySnapshot decode(FriendlyByteBuf buf) { + RegistrySnapshot snapshot = new RegistrySnapshot(); + buf.readMap(size -> snapshot.ids, FriendlyByteBuf::readVarInt, FriendlyByteBuf::readResourceLocation); + buf.readMap(size -> snapshot.aliases, FriendlyByteBuf::readResourceLocation, FriendlyByteBuf::readResourceLocation); + return snapshot; + } + + @Override + public synchronized void encode(FriendlyByteBuf buf, RegistrySnapshot snapshot) { + if (snapshot.binary == null) { + FriendlyByteBuf pkt = new FriendlyByteBuf(Unpooled.buffer()); + try { + pkt.writeMap(snapshot.ids, FriendlyByteBuf::writeVarInt, FriendlyByteBuf::writeResourceLocation); + pkt.writeMap(snapshot.aliases, FriendlyByteBuf::writeResourceLocation, FriendlyByteBuf::writeResourceLocation); + snapshot.binary = new byte[pkt.readableBytes()]; + pkt.readBytes(snapshot.binary); + } finally { + pkt.release(); + } + } + buf.writeBytes(snapshot.binary); + } + }; + // Use a sorted map with the ID as the key. // We need the entries to be sorted by increasing order for client-side application of the snapshot to work. private final Int2ObjectSortedMap ids = new Int2ObjectRBTreeMap<>(); @@ -57,7 +85,7 @@ public RegistrySnapshot(Registry registry, boolean full) { for (var entry : registry.entrySet()) { ResourceKey key = entry.getKey(); T value = entry.getValue(); - backup.registerMapping(registry.getId(key), key, value, registry.lifecycle(value)); + backup.register(registry.getId(key), key, value, registry.registrationInfo(key).orElse(RegistrationInfo.BUILT_IN)); } backup.freeze(); this.fullBackup = backup; @@ -66,37 +94,6 @@ public RegistrySnapshot(Registry registry, boolean full) { } } - /** - * Creates a registry snapshot from the received buffer. - * - * @param buf the buffer containing the data of the received snapshot. - */ - public RegistrySnapshot(FriendlyByteBuf buf) { - this(); - buf.readMap(size -> this.ids, FriendlyByteBuf::readVarInt, FriendlyByteBuf::readResourceLocation); - buf.readMap(size -> this.aliases, FriendlyByteBuf::readResourceLocation, FriendlyByteBuf::readResourceLocation); - } - - /** - * Write the registry snapshot to the given buffer and cache the binary data. - * - * @param buf the buffer to write to. - */ - public synchronized void write(FriendlyByteBuf buf) { - if (this.binary == null) { - FriendlyByteBuf pkt = new FriendlyByteBuf(Unpooled.buffer()); - try { - pkt.writeMap(this.ids, FriendlyByteBuf::writeVarInt, FriendlyByteBuf::writeResourceLocation); - pkt.writeMap(this.aliases, FriendlyByteBuf::writeResourceLocation, FriendlyByteBuf::writeResourceLocation); - this.binary = new byte[pkt.readableBytes()]; - pkt.readBytes(this.binary); - } finally { - pkt.release(); - } - } - buf.writeBytes(this.binary); - } - public Int2ObjectSortedMap getIds() { return this.idsView; } diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapEntry.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapEntry.java index 271d50dba6..ab2428cff6 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapEntry.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapEntry.java @@ -12,7 +12,6 @@ import java.util.function.Function; import net.minecraft.resources.ResourceKey; import net.minecraft.tags.TagKey; -import net.minecraft.util.ExtraCodecs; public record DataMapEntry(T value, boolean replace) { private DataMapEntry(T value) { @@ -20,10 +19,10 @@ private DataMapEntry(T value) { } public static Codec> codec(DataMapType type) { - return ExtraCodecs.either( + return Codec.either( RecordCodecBuilder.>create(i -> i.group( type.codec().fieldOf("value").forGetter(DataMapEntry::value), - ExtraCodecs.strictOptionalField(Codec.BOOL, "replace", false).forGetter(DataMapEntry::replace)).apply(i, DataMapEntry::new)), + Codec.BOOL.optionalFieldOf("replace", false).forGetter(DataMapEntry::replace)).apply(i, DataMapEntry::new)), type.codec()).xmap(e -> e.map(Function.identity(), DataMapEntry::new), entry -> entry.replace() ? Either.left(entry) : Either.right(entry.value())); } @@ -38,7 +37,7 @@ public static Codec> codec(Codec, Resource if (attachment instanceof AdvancedDataMapType advanced) { return RecordCodecBuilder.create(in -> in.group( tagOrValue.fieldOf("key").forGetter(Removal::key), - ExtraCodecs.strictOptionalField((Codec>) advanced.remover(), "remover").forGetter(Removal::remover)).apply(in, Removal::new)); + ((Codec>) advanced.remover()).optionalFieldOf("remover").forGetter(Removal::remover)).apply(in, Removal::new)); } return RecordCodecBuilder.create(inst -> inst .group(tagOrValue.fieldOf("key").forGetter(Removal::key)) diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapFile.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapFile.java index 1c96d2a071..5985c43d69 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapFile.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/DataMapFile.java @@ -45,9 +45,9 @@ public static Codec> codec(ResourceKey> reg } return RecordCodecBuilder.create(in -> in.group( - ExtraCodecs.strictOptionalField(Codec.BOOL, "replace", false).forGetter(DataMapFile::replace), + Codec.BOOL.optionalFieldOf("replace", false).forGetter(DataMapFile::replace), ExtraCodecs.strictUnboundedMap(tagOrValue, ConditionalOps.createConditionalCodecWithConditions(DataMapEntry.codec(dataMap))).fieldOf("values").forGetter(DataMapFile::values), - ExtraCodecs.strictOptionalField(removalsCodec, "remove", List.of()).forGetter(DataMapFile::removals)) + removalsCodec.optionalFieldOf("remove", List.of()).forGetter(DataMapFile::removals)) .apply(in, DataMapFile::new)); } } diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/Compostable.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/Compostable.java index cea410bdb9..821ed75463 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/Compostable.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/Compostable.java @@ -7,7 +7,6 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.ExtraCodecs; /** * Data map value for {@linkplain NeoForgeDataMaps#COMPOSTABLES compostables}. @@ -17,7 +16,7 @@ public record Compostable(float chance) { public static final Codec CHANCE_CODEC = Codec.floatRange(0f, 1f) .xmap(Compostable::new, Compostable::chance); - public static final Codec CODEC = ExtraCodecs.withAlternative( + public static final Codec CODEC = Codec.withAlternative( RecordCodecBuilder.create(in -> in.group( Codec.floatRange(0f, 1f).fieldOf("chance").forGetter(Compostable::chance)).apply(in, Compostable::new)), CHANCE_CODEC); diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/FurnaceFuel.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/FurnaceFuel.java index 9af61de232..044d7a0ed6 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/FurnaceFuel.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/FurnaceFuel.java @@ -17,7 +17,7 @@ public record FurnaceFuel(int burnTime) { public static final Codec BURN_TIME_CODEC = ExtraCodecs.POSITIVE_INT .xmap(FurnaceFuel::new, FurnaceFuel::burnTime); - public static final Codec CODEC = ExtraCodecs.withAlternative( + public static final Codec CODEC = Codec.withAlternative( RecordCodecBuilder.create(in -> in.group( ExtraCodecs.POSITIVE_INT.fieldOf("burn_time").forGetter(FurnaceFuel::burnTime)).apply(in, FurnaceFuel::new)), BURN_TIME_CODEC); diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/ParrotImitation.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/ParrotImitation.java index 6f20bc4dab..5f252da71c 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/ParrotImitation.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/ParrotImitation.java @@ -9,7 +9,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.ExtraCodecs; /** * Data map value for {@link NeoForgeDataMaps#PARROT_IMITATIONS parrot imitations}. @@ -19,6 +18,6 @@ public record ParrotImitation(SoundEvent sound) { public static final Codec SOUND_CODEC = BuiltInRegistries.SOUND_EVENT.byNameCodec() .xmap(ParrotImitation::new, ParrotImitation::sound); - public static final Codec CODEC = ExtraCodecs.withAlternative(RecordCodecBuilder.create(in -> in.group( + public static final Codec CODEC = Codec.withAlternative(RecordCodecBuilder.create(in -> in.group( BuiltInRegistries.SOUND_EVENT.byNameCodec().fieldOf("sound").forGetter(ParrotImitation::sound)).apply(in, ParrotImitation::new)), SOUND_CODEC); } diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/RaidHeroGift.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/RaidHeroGift.java index b446107ae1..e328a234f1 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/RaidHeroGift.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/RaidHeroGift.java @@ -7,21 +7,22 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.ExtraCodecs; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.storage.loot.LootTable; /** * Data map value for {@link NeoForgeDataMaps#RAID_HERO_GIFTS raid hero gifts}. * * @param lootTable the loot table that the villager will hand out after a raid */ -public record RaidHeroGift(ResourceLocation lootTable) { - public static final Codec LOOT_TABLE_CODEC = ResourceLocation.CODEC +public record RaidHeroGift(ResourceKey lootTable) { + public static final Codec LOOT_TABLE_CODEC = ResourceKey.codec(Registries.LOOT_TABLE) .xmap(RaidHeroGift::new, RaidHeroGift::lootTable); - public static final Codec CODEC = ExtraCodecs.withAlternative( + public static final Codec CODEC = Codec.withAlternative( RecordCodecBuilder.create(in -> in.group( - ResourceLocation.CODEC.fieldOf("loot_table").forGetter(RaidHeroGift::lootTable)) + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("loot_table").forGetter(RaidHeroGift::lootTable)) .apply(in, RaidHeroGift::new)), LOOT_TABLE_CODEC); } diff --git a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/VibrationFrequency.java b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/VibrationFrequency.java index e68c0dbb3f..474fa76a49 100644 --- a/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/VibrationFrequency.java +++ b/src/main/java/net/neoforged/neoforge/registries/datamaps/builtin/VibrationFrequency.java @@ -7,7 +7,6 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.ExtraCodecs; /** * Data map value for {@linkplain NeoForgeDataMaps#VIBRATION_FREQUENCIES vibration frequencies}. @@ -17,7 +16,7 @@ public record VibrationFrequency(int frequency) { public static final Codec FREQUENCY_CODEC = Codec.intRange(1, 15) .xmap(VibrationFrequency::new, VibrationFrequency::frequency); - public static final Codec CODEC = ExtraCodecs.withAlternative( + public static final Codec CODEC = Codec.withAlternative( RecordCodecBuilder.create(in -> in.group( Codec.intRange(1, 15).fieldOf("frequency").forGetter(VibrationFrequency::frequency)).apply(in, VibrationFrequency::new)), FREQUENCY_CODEC); diff --git a/src/main/java/net/neoforged/neoforge/registries/holdersets/AndHolderSet.java b/src/main/java/net/neoforged/neoforge/registries/holdersets/AndHolderSet.java index 06a199ac19..80c9ee9c0a 100644 --- a/src/main/java/net/neoforged/neoforge/registries/holdersets/AndHolderSet.java +++ b/src/main/java/net/neoforged/neoforge/registries/holdersets/AndHolderSet.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.registries.holdersets; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -30,12 +31,11 @@ * */ public class AndHolderSet extends CompositeHolderSet { - public static Codec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { + public static MapCodec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { return HolderSetCodec.create(registryKey, holderCodec, forceList) .listOf() .xmap(AndHolderSet::new, CompositeHolderSet::homogenize) - .fieldOf("values") - .codec(); + .fieldOf("values"); } public AndHolderSet(List> values) { diff --git a/src/main/java/net/neoforged/neoforge/registries/holdersets/AnyHolderSet.java b/src/main/java/net/neoforged/neoforge/registries/holdersets/AnyHolderSet.java index 461ed5d800..74903abf09 100644 --- a/src/main/java/net/neoforged/neoforge/registries/holdersets/AnyHolderSet.java +++ b/src/main/java/net/neoforged/neoforge/registries/holdersets/AnyHolderSet.java @@ -7,6 +7,7 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -34,10 +35,9 @@ * */ public record AnyHolderSet(HolderLookup.RegistryLookup registryLookup) implements ICustomHolderSet { - public static Codec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { + public static MapCodec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { return RegistryOps.retrieveRegistryLookup(registryKey) - .xmap(AnyHolderSet::new, AnyHolderSet::registryLookup) - .codec(); + .xmap(AnyHolderSet::new, AnyHolderSet::registryLookup); } @Override diff --git a/src/main/java/net/neoforged/neoforge/registries/holdersets/HolderSetType.java b/src/main/java/net/neoforged/neoforge/registries/holdersets/HolderSetType.java index 80c89745fe..51764be8fb 100644 --- a/src/main/java/net/neoforged/neoforge/registries/holdersets/HolderSetType.java +++ b/src/main/java/net/neoforged/neoforge/registries/holdersets/HolderSetType.java @@ -6,11 +6,12 @@ package net.neoforged.neoforge.registries.holdersets; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; @FunctionalInterface public interface HolderSetType { - Codec> makeCodec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList); + MapCodec> makeCodec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList); } diff --git a/src/main/java/net/neoforged/neoforge/registries/holdersets/NotHolderSet.java b/src/main/java/net/neoforged/neoforge/registries/holdersets/NotHolderSet.java index 84bc9b94cc..91d8b596c7 100644 --- a/src/main/java/net/neoforged/neoforge/registries/holdersets/NotHolderSet.java +++ b/src/main/java/net/neoforged/neoforge/registries/holdersets/NotHolderSet.java @@ -7,6 +7,7 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.ArrayList; import java.util.Iterator; @@ -40,8 +41,8 @@ */ // this doesn't extend CompositeHolderSet because it doesn't need to cache a set public class NotHolderSet implements ICustomHolderSet { - public static Codec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { - return RecordCodecBuilder.>create( + public static MapCodec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { + return RecordCodecBuilder.>mapCodec( builder -> builder .group( RegistryOps.retrieveRegistryLookup(registryKey).forGetter(NotHolderSet::registryLookup), diff --git a/src/main/java/net/neoforged/neoforge/registries/holdersets/OrHolderSet.java b/src/main/java/net/neoforged/neoforge/registries/holdersets/OrHolderSet.java index 9d3cfd3bf0..7f03837cf6 100644 --- a/src/main/java/net/neoforged/neoforge/registries/holdersets/OrHolderSet.java +++ b/src/main/java/net/neoforged/neoforge/registries/holdersets/OrHolderSet.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.registries.holdersets; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -30,12 +31,11 @@ * */ public class OrHolderSet extends CompositeHolderSet { - public static Codec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { + public static MapCodec> codec(ResourceKey> registryKey, Codec> holderCodec, boolean forceList) { return HolderSetCodec.create(registryKey, holderCodec, forceList) .listOf() .xmap(OrHolderSet::new, CompositeHolderSet::homogenize) - .fieldOf("values") - .codec(); + .fieldOf("values"); } public OrHolderSet(List> values) { diff --git a/src/main/java/net/neoforged/neoforge/resource/ContextAwareReloadListener.java b/src/main/java/net/neoforged/neoforge/resource/ContextAwareReloadListener.java index dd567fd603..34cf074faf 100644 --- a/src/main/java/net/neoforged/neoforge/resource/ContextAwareReloadListener.java +++ b/src/main/java/net/neoforged/neoforge/resource/ContextAwareReloadListener.java @@ -7,8 +7,8 @@ import com.google.gson.JsonElement; import com.mojang.serialization.JsonOps; +import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.RegistryOps; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.neoforged.neoforge.common.conditions.ConditionalOps; @@ -21,29 +21,17 @@ *

    * The context is guaranteed to be available for the duration of {@link PreparableReloadListener#reload}. *

    - * For children of {@link SimplePreparableReloadListeners}, it will be available during both {@link SimplePreparableReloadListener#prepare prepare()} and {@link SimplePreparableReloadListener#apply apply()}. + * For children of {@link SimplePreparableReloadListener}, it will be available during both {@link SimplePreparableReloadListener#prepare} prepare()} and {@link SimplePreparableReloadListener#apply apply()}. */ public abstract class ContextAwareReloadListener implements PreparableReloadListener { - /** - * TODO 1.20.5: Make private - * - * @deprecated Use {@link #getContext()} - */ - @Deprecated - protected ICondition.IContext conditionContext = ICondition.IContext.EMPTY; + private ICondition.IContext conditionContext = ICondition.IContext.EMPTY; - /** - * TODO 1.20.5: Make private - * - * @deprecated Use {@link #getRegistryAccess()} - */ - @Deprecated - protected RegistryAccess registryAccess = RegistryAccess.EMPTY; + private HolderLookup.Provider registryLookup = RegistryAccess.EMPTY; @ApiStatus.Internal - public void injectContext(ICondition.IContext context, RegistryAccess regAccess) { + public void injectContext(ICondition.IContext context, HolderLookup.Provider registryLookup) { this.conditionContext = context; - this.registryAccess = regAccess; + this.registryLookup = registryLookup; } /** @@ -56,14 +44,14 @@ protected final ICondition.IContext getContext() { /** * Returns the registry access held by this listener, or {@link RegistryAccess#EMPTY} if it is unavailable. */ - protected final RegistryAccess getRegistryAccess() { - return this.registryAccess; + protected final HolderLookup.Provider getRegistryLookup() { + return this.registryLookup; } /** - * Creates a new {@link ConditionalOps} using {@link #getContext()} and {@link #getRegistryAccess()}. + * Creates a new {@link ConditionalOps} using {@link #getContext()} and {@link #getRegistryLookup()} ()}. */ protected final ConditionalOps makeConditionalOps() { - return new ConditionalOps(RegistryOps.create(JsonOps.INSTANCE, getRegistryAccess()), getContext()); + return new ConditionalOps<>(getRegistryLookup().createSerializationContext(JsonOps.INSTANCE), getContext()); } } diff --git a/src/main/java/net/neoforged/neoforge/resource/EmptyPackResources.java b/src/main/java/net/neoforged/neoforge/resource/EmptyPackResources.java index 4e140c0c2e..f349038cb9 100644 --- a/src/main/java/net/neoforged/neoforge/resource/EmptyPackResources.java +++ b/src/main/java/net/neoforged/neoforge/resource/EmptyPackResources.java @@ -10,6 +10,7 @@ import java.util.Set; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.AbstractPackResources; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.MetadataSectionSerializer; @@ -21,8 +22,8 @@ public class EmptyPackResources extends AbstractPackResources { private final PackMetadataSection packMeta; - public EmptyPackResources(String packId, boolean isBuiltin, PackMetadataSection packMeta) { - super(packId, isBuiltin); + public EmptyPackResources(PackLocationInfo packId, PackMetadataSection packMeta) { + super(packId); this.packMeta = packMeta; } @@ -59,20 +60,18 @@ public IoSupplier getResource(PackType type, ResourceLocation locat public static class EmptyResourcesSupplier implements Pack.ResourcesSupplier { private final PackMetadataSection packMeta; - private final boolean isBuiltin; - public EmptyResourcesSupplier(PackMetadataSection packMeta, boolean isBuiltin) { + public EmptyResourcesSupplier(PackMetadataSection packMeta) { this.packMeta = packMeta; - this.isBuiltin = isBuiltin; } @Override - public PackResources openPrimary(String id) { - return new EmptyPackResources(id, isBuiltin, packMeta); + public PackResources openPrimary(PackLocationInfo id) { + return new EmptyPackResources(id, packMeta); } @Override - public PackResources openFull(String id, Pack.Info info) { + public PackResources openFull(PackLocationInfo id, Pack.Metadata info) { return openPrimary(id); } } diff --git a/src/main/java/net/neoforged/neoforge/resource/ResourcePackLoader.java b/src/main/java/net/neoforged/neoforge/resource/ResourcePackLoader.java index 7d8e8ef68f..e4297e2730 100644 --- a/src/main/java/net/neoforged/neoforge/resource/ResourcePackLoader.java +++ b/src/main/java/net/neoforged/neoforge/resource/ResourcePackLoader.java @@ -26,7 +26,9 @@ import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.server.packs.FeatureFlagsMetadataSection; import net.minecraft.server.packs.OverlayMetadataSection; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; +import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.metadata.MetadataSectionType; @@ -36,7 +38,6 @@ import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.RepositorySource; -import net.minecraft.util.ExtraCodecs; import net.minecraft.util.InclusiveRange; import net.minecraft.world.flag.FeatureFlagSet; import net.neoforged.fml.ModList; @@ -55,6 +56,7 @@ public class ResourcePackLoader { public static final String MOD_RESOURCES_ID = "mod_resources"; private static Map modResourcePacks; private static final Logger LOGGER = LogManager.getLogger(); + private static final PackSelectionConfig MOD_PACK_SELECTION_CONFIG = new PackSelectionConfig(false, Pack.Position.BOTTOM, false); public static Optional getPackFor(String modId) { return Optional.ofNullable(ModList.get().getModFileById(modId)).map(IModFileInfo::getFile).map(mf -> modResourcePacks.get(mf)); @@ -98,18 +100,21 @@ private static void packFinder(Map modResource final String packName = mod.getOwningFile().getFile().getFileName(); try { + var locationInfo = new PackLocationInfo( + name, + Component.literal(packName.isEmpty() ? "[unnamed]" : packName), + PackSource.DEFAULT, + Optional.empty()); + final boolean isRequired = (packType == PackType.CLIENT_RESOURCES && mod.getOwningFile().showAsResourcePack()) || (packType == PackType.SERVER_DATA && mod.getOwningFile().showAsDataPack()); final Pack modPack; // Packs displayed separately must be valid if (isRequired) { modPack = Pack.readMetaAndCreate( - name, - Component.literal(packName.isEmpty() ? "[unnamed]" : packName), - false, + locationInfo, e.getValue(), packType, - Pack.Position.BOTTOM, - PackSource.DEFAULT); + MOD_PACK_SELECTION_CONFIG); if (modPack == null) { ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey())); @@ -117,13 +122,10 @@ private static void packFinder(Map modResource } } else { modPack = readWithOptionalMeta( - name, - Component.literal(packName.isEmpty() ? "[unnamed]" : packName), - false, + locationInfo, e.getValue(), packType, - Pack.Position.BOTTOM, - PackSource.DEFAULT); + MOD_PACK_SELECTION_CONFIG); } if (isRequired) { @@ -142,26 +144,23 @@ private static void packFinder(Map modResource public static final MetadataSectionType OPTIONAL_FORMAT = MetadataSectionType.fromCodec("pack", RecordCodecBuilder.create( in -> in.group( - ExtraCodecs.strictOptionalField(ComponentSerialization.CODEC, "description", Component.empty()).forGetter(PackMetadataSection::description), - ExtraCodecs.strictOptionalField(Codec.INT, "pack_format", -1).forGetter(PackMetadataSection::packFormat), - ExtraCodecs.strictOptionalField(InclusiveRange.codec(Codec.INT), "supported_formats").forGetter(PackMetadataSection::supportedFormats)) + ComponentSerialization.CODEC.optionalFieldOf("description", Component.empty()).forGetter(PackMetadataSection::description), + Codec.INT.optionalFieldOf("pack_format", -1).forGetter(PackMetadataSection::packFormat), + InclusiveRange.codec(Codec.INT).optionalFieldOf("supported_formats").forGetter(PackMetadataSection::supportedFormats)) .apply(in, PackMetadataSection::new))); public static Pack readWithOptionalMeta( - String id, - Component title, - boolean required, + PackLocationInfo location, Pack.ResourcesSupplier resources, PackType type, - Pack.Position position, - PackSource source) throws IOException { - final Pack.Info packInfo = readInfo(type, resources, id, title); - return Pack.create(id, title, required, resources, packInfo, position, false, source); + PackSelectionConfig selectionConfig) throws IOException { + final Pack.Metadata packInfo = readMeta(type, location, resources); + return new Pack(location, resources, packInfo, selectionConfig); } - private static Pack.Info readInfo(PackType type, Pack.ResourcesSupplier resources, String id, Component title) throws IOException { + private static Pack.Metadata readMeta(PackType type, PackLocationInfo location, Pack.ResourcesSupplier resources) throws IOException { final int currentVersion = SharedConstants.getCurrentVersion().getPackVersion(type); - try (final PackResources primaryResources = resources.openPrimary(id)) { + try (final PackResources primaryResources = resources.openPrimary(location)) { final PackMetadataSection metadata = primaryResources.getMetadataSection(OPTIONAL_FORMAT); final FeatureFlagSet flags = Optional.ofNullable(primaryResources.getMetadataSection(FeatureFlagsMetadataSection.TYPE)) @@ -173,16 +172,16 @@ private static Pack.Info readInfo(PackType type, Pack.ResourcesSupplier resource .orElse(List.of()); if (metadata == null) { - return new Pack.Info(title, PackCompatibility.COMPATIBLE, flags, overlays, primaryResources.isHidden()); + return new Pack.Metadata(location.title(), PackCompatibility.COMPATIBLE, flags, overlays, primaryResources.isHidden()); } final PackCompatibility compatibility; if (metadata.packFormat() == -1 && metadata.supportedFormats().isEmpty()) { compatibility = PackCompatibility.COMPATIBLE; } else { - compatibility = PackCompatibility.forVersion(Pack.getDeclaredPackVersions(id, metadata), currentVersion); + compatibility = PackCompatibility.forVersion(Pack.getDeclaredPackVersions(location.id(), metadata), currentVersion); } - return new Pack.Info(metadata.description(), compatibility, flags, overlays, primaryResources.isHidden()); + return new Pack.Metadata(metadata.description(), compatibility, flags, overlays, primaryResources.isHidden()); } } @@ -190,14 +189,16 @@ private static Pack makePack(PackType packType, ArrayList hiddenPacks) { final String id = packType == PackType.CLIENT_RESOURCES ? MOD_RESOURCES_ID : MOD_DATA_ID; final String name = packType == PackType.CLIENT_RESOURCES ? "Mod Resources" : "Mod Data"; final String descriptionKey = packType == PackType.CLIENT_RESOURCES ? "fml.resources.modresources" : "fml.resources.moddata"; - return Pack.readMetaAndCreate(id, Component.literal(name), true, + return Pack.readMetaAndCreate( + new PackLocationInfo(id, Component.literal(name), PackSource.DEFAULT, Optional.empty()), new EmptyPackResources.EmptyResourcesSupplier(new PackMetadataSection(Component.translatable(descriptionKey, hiddenPacks.size()), - SharedConstants.getCurrentVersion().getPackVersion(packType)), false), - packType, Pack.Position.BOTTOM, PackSource.DEFAULT).withChildren(hiddenPacks); + SharedConstants.getCurrentVersion().getPackVersion(packType))), + packType, + new PackSelectionConfig(true, Pack.Position.BOTTOM, false)).withChildren(hiddenPacks); } public static Pack.ResourcesSupplier createPackForMod(IModFileInfo mf) { - return new PathPackResources.PathResourcesSupplier(mf.getFile().getSecureJar().getRootPath(), true); + return new PathPackResources.PathResourcesSupplier(mf.getFile().getSecureJar().getRootPath()); } public static List getDataPackNames() { diff --git a/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java b/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java index 2dd297cc4c..17e538ac23 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java +++ b/src/main/java/net/neoforged/neoforge/server/command/TagsCommand.java @@ -152,8 +152,9 @@ private static int queryElementTags(final CommandContext ctx final ResourceLocation elementLocation = ResourceLocationArgument.getId(ctx, "element"); final ResourceKey elementKey = ResourceKey.create(cast(registryKey), elementLocation); - final Holder elementHolder = registry.getHolder(cast(elementKey)) - .orElseThrow(() -> UNKNOWN_ELEMENT.create(elementLocation, registryKey.location())); + @SuppressWarnings({ "unchecked", "rawtypes" }) + final Optional> elementHolderOpt = registry.getHolder(TagsCommand.cast(elementKey)); + final Holder elementHolder = elementHolderOpt.orElseThrow(() -> UNKNOWN_ELEMENT.create(elementLocation, registryKey.location())); final long containingTagsCount = elementHolder.tags().count(); diff --git a/src/main/java/net/neoforged/neoforge/server/command/generation/GenerationTask.java b/src/main/java/net/neoforged/neoforge/server/command/generation/GenerationTask.java index 4b6194de8f..a6990f4330 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/generation/GenerationTask.java +++ b/src/main/java/net/neoforged/neoforge/server/command/generation/GenerationTask.java @@ -5,7 +5,6 @@ package net.neoforged.neoforge.server.command.generation; -import com.mojang.datafixers.util.Either; import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.LongList; import java.util.Comparator; @@ -20,12 +19,13 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ChunkResult; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.TicketType; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.status.ChunkStatus; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -165,10 +165,10 @@ private void enqueueChunks(LongList chunks) { } } - private void acceptChunkResult(long chunk, Either result) { + private void acceptChunkResult(long chunk, ChunkResult result) { this.server.submit(() -> this.releaseChunk(chunk)); - if (result.left().isPresent()) { + if (result.isSuccess()) { this.okCount.getAndIncrement(); } else { this.errorCount.getAndIncrement(); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 751bb84fd7..c44c149243 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -265,7 +265,7 @@ public net.minecraft.server.level.ServerPlayer initMenu(Lnet/minecraft/world/inv public net.minecraft.server.level.ServerPlayer nextContainerCounter()V # nextContainerCounter public net.minecraft.server.network.ServerCommonPacketListenerImpl connection # connection public net.minecraft.server.network.ServerLoginPacketListenerImpl authenticatedProfile # authenticatedProfile -public net.minecraft.server.packs.FilePackResources (Ljava/lang/String;Lnet/minecraft/server/packs/FilePackResources$SharedZipFileAccess;ZLjava/lang/String;)V # constructor +public net.minecraft.server.packs.FilePackResources (Lnet/minecraft/server/packs/PackLocationInfo;Lnet/minecraft/server/packs/FilePackResources$SharedZipFileAccess;Ljava/lang/String;)V # constructor public net.minecraft.server.packs.FilePackResources$SharedZipFileAccess public net.minecraft.server.packs.FilePackResources$SharedZipFileAccess (Ljava/io/File;)V # constructor public net.minecraft.server.packs.OverlayMetadataSection$OverlayEntry CODEC # CODEC @@ -520,11 +520,11 @@ private-f net.minecraft.world.level.levelgen.DebugLevelSource GRID_HEIGHT # GRID public-f net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator iterateNoiseColumn(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 caves(Lnet/minecraft/data/worldgen/BootstapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # caves -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings end(Lnet/minecraft/data/worldgen/BootstapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # end -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings overworld(Lnet/minecraft/data/worldgen/BootstapContext;ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # overworld -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings floatingIslands(Lnet/minecraft/data/worldgen/BootstapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # floatingIslands -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings nether(Lnet/minecraft/data/worldgen/BootstapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # nether +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings caves(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # caves +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings end(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # end +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings overworld(Lnet/minecraft/data/worldgen/BootstrapContext;ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # overworld +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings floatingIslands(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # floatingIslands +public net.minecraft.world.level.levelgen.NoiseGeneratorSettings nether(Lnet/minecraft/data/worldgen/BootstrapContext;)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # nether public net.minecraft.world.level.levelgen.NoiseGeneratorSettings lambda$static$0(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App; # lambda$static$0 #endgroup public net.minecraft.world.level.levelgen.feature.featuresize.FeatureSizeType (Lcom/mojang/serialization/Codec;)V # constructor diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 94% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml index 8323d05a40..062447fd13 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" -loaderVersion="[1,]" +loaderVersion="[3,]" issueTrackerURL="https://github.com/neoforged/NeoForge/issues" logoFile="neoforged_logo.png" license="LGPL v2.1" @@ -14,4 +14,4 @@ license="LGPL v2.1" authors="The NeoForged Team" description=''' NeoForge, a NEW broad compatibility API. - ''' \ No newline at end of file + ''' diff --git a/src/main/resources/assets/neoforge/lang/en_us.json b/src/main/resources/assets/neoforge/lang/en_us.json index 846d137fc3..385b5dbbd6 100644 --- a/src/main/resources/assets/neoforge/lang/en_us.json +++ b/src/main/resources/assets/neoforge/lang/en_us.json @@ -219,10 +219,6 @@ "neoforge.container.enchant.limitedEnchantability": "Limited Enchantability", "neoforge.swim_speed": "Swim Speed", "neoforge.name_tag_distance": "Nametag Render Distance", - "neoforge.entity_gravity": "Gravity", - "neoforge.block_reach": "Block Reach", - "neoforge.entity_reach": "Entity Reach", - "neoforge.step_height": "Step Height", "neoforge.creative_flight": "Creative Flight", "fluid_type.minecraft.milk": "Milk", diff --git a/src/main/resources/coremods/method_redirector.js b/src/main/resources/coremods/method_redirector.js index 90f45f23d6..7d7480d1f4 100644 --- a/src/main/resources/coremods/method_redirector.js +++ b/src/main/resources/coremods/method_redirector.js @@ -8,7 +8,7 @@ function finalizeSpawnNode(node){ Opcodes.INVOKESTATIC, "net/neoforged/neoforge/event/EventHooks", "onFinalizeSpawn", - "(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/world/entity/SpawnGroupData;", + "(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;", false); } @@ -33,7 +33,7 @@ var replacements = [ { 'opcode': Opcodes.INVOKEVIRTUAL, 'name': 'finalizeSpawn', - 'desc': '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/world/entity/SpawnGroupData;', + 'desc': '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;', 'targets': 'coremods/finalize_spawn_targets.json', 'factory': finalizeSpawnNode } @@ -74,4 +74,4 @@ function initializeCoreMod() { } } } -} \ No newline at end of file +} diff --git a/testframework/build.gradle b/testframework/build.gradle index db24da4b51..35a1c1ab7f 100644 --- a/testframework/build.gradle +++ b/testframework/build.gradle @@ -38,7 +38,7 @@ tasks.withType(JavaCompile).configureEach { tasks.withType(ProcessResources).configureEach { inputs.properties version: version - filesMatching(['META-INF/mods.toml']) { + filesMatching(['META-INF/neoforge.mods.toml']) { expand version: version } } diff --git a/testframework/src/main/java/net/neoforged/testframework/client/FrameworkClientImpl.java b/testframework/src/main/java/net/neoforged/testframework/client/FrameworkClientImpl.java index 31a773a716..d0eb0e3946 100644 --- a/testframework/src/main/java/net/neoforged/testframework/client/FrameworkClientImpl.java +++ b/testframework/src/main/java/net/neoforged/testframework/client/FrameworkClientImpl.java @@ -15,7 +15,7 @@ import net.minecraft.network.chat.Component; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; -import net.neoforged.neoforge.client.event.RegisterGuiOverlaysEvent; +import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent; import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; import net.neoforged.testframework.conf.ClientConfiguration; import net.neoforged.testframework.impl.FrameworkClient; @@ -45,7 +45,7 @@ public void init(IEventBus modBus, ModContainer container) { overlayEnabled = () -> true; } - modBus.addListener((final RegisterGuiOverlaysEvent event) -> event.registerAboveAll(impl.id().getPath(), new TestsOverlay(impl, overlayEnabled))); + modBus.addListener((final RegisterGuiLayersEvent event) -> event.registerAboveAll(impl.id(), new TestsOverlay(impl, overlayEnabled))); if (configuration.openManagerKey() != 0) { final KeyMapping openManagerKey = new KeyMapping("key.testframework.openmanager", configuration.openManagerKey(), keyCategory) { diff --git a/testframework/src/main/java/net/neoforged/testframework/client/TestScreen.java b/testframework/src/main/java/net/neoforged/testframework/client/TestScreen.java index ca244b75c6..6beb83faee 100644 --- a/testframework/src/main/java/net/neoforged/testframework/client/TestScreen.java +++ b/testframework/src/main/java/net/neoforged/testframework/client/TestScreen.java @@ -65,7 +65,7 @@ protected void init() { }; groupableList.resetRows(""); - this.addWidget(groupableList); + this.addRenderableWidget(groupableList); this.searchTextField = new EditBox(this.font, this.width / 2 - 110, 22, 220, 20, Component.literal("Search")); this.searchTextField.setResponder(s -> { @@ -103,7 +103,6 @@ public void render(GuiGraphics pPoseStack, int pMouseX, int pMouseY, float pPart filterMode.active = true; } - groupableList.render(pPoseStack, pMouseX, pMouseY, pPartialTick); super.render(pPoseStack, pMouseX, pMouseY, pPartialTick); searchTextField.render(pPoseStack, pMouseX, pMouseY, pPartialTick); diff --git a/testframework/src/main/java/net/neoforged/testframework/client/TestsOverlay.java b/testframework/src/main/java/net/neoforged/testframework/client/TestsOverlay.java index 50aea63624..17ae738490 100644 --- a/testframework/src/main/java/net/neoforged/testframework/client/TestsOverlay.java +++ b/testframework/src/main/java/net/neoforged/testframework/client/TestsOverlay.java @@ -17,19 +17,19 @@ import java.util.function.Function; import java.util.stream.Collectors; import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; -import net.neoforged.neoforge.client.gui.overlay.ExtendedGui; -import net.neoforged.neoforge.client.gui.overlay.IGuiOverlay; import net.neoforged.testframework.Test; import net.neoforged.testframework.impl.MutableTestFramework; -public final class TestsOverlay implements IGuiOverlay { +public final class TestsOverlay implements LayeredDraw.Layer { public static final int MAX_DISPLAYED = 5; public static final ResourceLocation BG_TEXTURE = new ResourceLocation("testframework", "textures/gui/background.png"); @@ -46,15 +46,15 @@ public TestsOverlay(MutableTestFramework impl, BooleanSupplier enabled) { } @Override - public void render(ExtendedGui gui, GuiGraphics poseStack, float partialTick, int screenWidth, int screenHeight) { + public void render(GuiGraphics poseStack, float partialTick) { if (!enabled.getAsBoolean()) return; List enabled = impl.tests().enabled().collect(Collectors.toCollection(ArrayList::new)); if (enabled.isEmpty()) return; - final Font font = gui.getFont(); + final Font font = Minecraft.getInstance().font; final int startX = 10, startY = 10; - final int maxWidth = screenWidth / 3; + final int maxWidth = poseStack.guiWidth() / 3; int x = startX, y = startY; int maxX = x; @@ -104,22 +104,22 @@ public void render(ExtendedGui gui, GuiGraphics poseStack, float partialTick, in RenderSystem.defaultBlendFunc(); }); - final XY xy = renderTest(gui, font, test, poseStack, maxWidth, x, y, ((int) (fade * 255f) << 24) | 0xffffff, renderingQueue.currentProgress()); + final XY xy = renderTest(font, test, poseStack, maxWidth, x, y, ((int) (fade * 255f) << 24) | 0xffffff, renderingQueue.currentProgress()); y = xy.y() + 5; maxX = Math.max(maxX, xy.x()); renderingQueue.add(RenderSystem::disableBlend); fading.put(test, fade); } else { - final XY xy = renderTest(gui, font, test, poseStack, maxWidth, x, y, 0xffffff, renderingQueue.currentProgress()); + final XY xy = renderTest(font, test, poseStack, maxWidth, x, y, 0xffffff, renderingQueue.currentProgress()); y = xy.y() + 5; maxX = Math.max(maxX, xy.x()); } - if (y >= screenHeight) { + if (y >= poseStack.guiHeight()) { int endIndex = actuallyToRender.indexOf(test) + 1; // If the y is greater than the height, don't render this test at all - if (y > screenHeight) { + if (y > poseStack.guiHeight()) { endIndex--; renderingQueue.revert(); y = lastY; @@ -143,14 +143,14 @@ public void render(ExtendedGui gui, GuiGraphics poseStack, float partialTick, in int lastY = y; int lastMaxX = maxX; renderingQueue.push(); - final XY xy = renderTest(gui, font, test, poseStack, maxWidth, x, y, 0xffffff, renderingQueue.currentProgress()); + final XY xy = renderTest(font, test, poseStack, maxWidth, x, y, 0xffffff, renderingQueue.currentProgress()); y = xy.y() + 5; maxX = Math.max(maxX, xy.x()); - if (y >= screenHeight) { + if (y >= poseStack.guiHeight()) { int endIndex = enabled.indexOf(test) + 1; // If the y is greater than the height, don't render this test at all - if (y > screenHeight) { + if (y > poseStack.guiHeight()) { renderingQueue.revert(); y = lastY; maxX = lastMaxX; @@ -187,7 +187,7 @@ Test.Result.PASSED, new ResourceLocation("testframework", "textures/gui/test_pas Test.Result.NOT_PROCESSED, new ResourceLocation("testframework", "textures/gui/test_not_processed.png"))); // TODO - maybe "group" together tests in the same group? - private XY renderTest(ExtendedGui gui, Font font, Test test, GuiGraphics stack, int maxWidth, int x, int y, int colour, List rendering) { + private XY renderTest(Font font, Test test, GuiGraphics stack, int maxWidth, int x, int y, int colour, List rendering) { final Test.Status status = impl.tests().getStatus(test.id()); final FormattedCharSequence bullet = Component.literal("- ").withStyle(ChatFormatting.BLACK).getVisualOrderText(); rendering.add(withXY(x, y, (x$, y$) -> stack.drawString(font, bullet, x$, y$ - 1, colour))); diff --git a/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledIngredient.java b/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledIngredient.java index af77efd8bb..11785142dc 100644 --- a/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledIngredient.java +++ b/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledIngredient.java @@ -6,6 +6,7 @@ package net.neoforged.testframework.condition; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Arrays; import net.minecraft.world.item.ItemStack; @@ -16,14 +17,14 @@ import org.jetbrains.annotations.Nullable; public final class TestEnabledIngredient extends Ingredient { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.CODEC.fieldOf("base").forGetter(i -> i.base), MutableTestFramework.REFERENCE_CODEC.fieldOf("framework").forGetter(i -> i.framework), Codec.STRING.fieldOf("testId").forGetter(i -> i.testId)) .apply(builder, TestEnabledIngredient::new)); - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( + public static final MapCodec CODEC_NONEMPTY = RecordCodecBuilder.mapCodec( builder -> builder .group( Ingredient.CODEC_NONEMPTY.fieldOf("base").forGetter(i -> i.base), diff --git a/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledLootCondition.java b/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledLootCondition.java index 9800cf00f0..eb834e4c75 100644 --- a/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledLootCondition.java +++ b/testframework/src/main/java/net/neoforged/testframework/condition/TestEnabledLootCondition.java @@ -6,6 +6,7 @@ package net.neoforged.testframework.condition; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; @@ -17,7 +18,7 @@ public record TestEnabledLootCondition(TestFramework framework, String testId) implements LootItemCondition { - public static final Codec CODEC = RecordCodecBuilder.create(in -> in.group( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(in -> in.group( MutableTestFramework.REFERENCE_CODEC.fieldOf("framework").forGetter(TestEnabledLootCondition::framework), Codec.STRING.fieldOf("test").forGetter(TestEnabledLootCondition::testId)).apply(in, TestEnabledLootCondition::new)); public TestEnabledLootCondition(DynamicTest test) { diff --git a/testframework/src/main/java/net/neoforged/testframework/gametest/ExtendedGameTestHelper.java b/testframework/src/main/java/net/neoforged/testframework/gametest/ExtendedGameTestHelper.java index 8f77d3b69a..dac980a29b 100644 --- a/testframework/src/main/java/net/neoforged/testframework/gametest/ExtendedGameTestHelper.java +++ b/testframework/src/main/java/net/neoforged/testframework/gametest/ExtendedGameTestHelper.java @@ -18,14 +18,15 @@ import java.util.stream.Stream; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.gametest.framework.GameTestAssertException; import net.minecraft.gametest.framework.GameTestAssertPosException; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.gametest.framework.GameTestInfo; import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; import net.minecraft.network.Connection; -import net.minecraft.network.ConnectionProtocol; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.server.network.CommonListenerCookie; import net.minecraft.world.Difficulty; @@ -86,7 +87,7 @@ public void useBlock(BlockPos pos, Player player, ItemStack item, Direction dire BlockPos blockpos = this.absolutePos(pos); BlockState blockstate = this.getLevel().getBlockState(blockpos); BlockHitResult hit = new BlockHitResult(Vec3.atCenterOf(blockpos), direction, blockpos, true); - InteractionResult interactionresult = blockstate.use(this.getLevel(), player, InteractionHand.MAIN_HAND, hit); + InteractionResult interactionresult = blockstate.useWithoutItem(this.getLevel(), player, hit); if (!interactionresult.consumesAction()) { UseOnContext useoncontext = new UseOnContext(player, InteractionHand.MAIN_HAND, hit); player.getItemInHand(InteractionHand.MAIN_HAND).useOn(useoncontext); @@ -105,7 +106,7 @@ public GameTestPlayer makeTickingMockServerPlayerInCorner(GameType gameType) { } public GameTestPlayer makeTickingMockServerPlayerInLevel(GameType gameType) { - final CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial(new GameProfile(UUID.randomUUID(), "test-mock-player")); + final CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial(new GameProfile(UUID.randomUUID(), "test-mock-player"), false); final GameTestPlayer serverplayer = new GameTestPlayer(this.getLevel().getServer(), this.getLevel(), commonlistenercookie.gameProfile(), commonlistenercookie.clientInformation(), this); final Connection connection = new Connection(PacketFlow.SERVERBOUND) { @Override @@ -120,8 +121,9 @@ public boolean isMemoryConnection() { } }; EmbeddedChannel embeddedchannel = new EmbeddedChannel(connection); - embeddedchannel.attr(Connection.ATTRIBUTE_SERVERBOUND_PROTOCOL).set(ConnectionProtocol.PLAY.codec(PacketFlow.SERVERBOUND)); - embeddedchannel.attr(Connection.ATTRIBUTE_CLIENTBOUND_PROTOCOL).set(ConnectionProtocol.PLAY.codec(PacketFlow.CLIENTBOUND)); + // TODO - check if needs to be ported + // embeddedchannel.attr(Connection.ATTRIBUTE_SERVERBOUND_PROTOCOL).set(ConnectionProtocol.PLAY.codec(PacketFlow.SERVERBOUND)); + // embeddedchannel.attr(Connection.ATTRIBUTE_CLIENTBOUND_PROTOCOL).set(ConnectionProtocol.PLAY.codec(PacketFlow.CLIENTBOUND)); NetworkRegistry.getInstance().configureMockConnection(connection); this.getLevel().getServer().getPlayerList().placeNewPlayer(connection, serverplayer, commonlistenercookie); this.getLevel().getServer().getConnection().getConnections().add(connection); @@ -206,6 +208,10 @@ public ParametrizedGameTestSequence startSequence(Supplier value) { return new ParametrizedGameTestSequence<>(this.testInfo, this.startSequence(), value); } + public Player makeMockPlayer() { + return makeMockPlayer(GameType.CREATIVE); + } + public void killAllEntitiesOfClass(Class... types) { for (Class type : types) { this.killAllEntitiesOfClass(type); @@ -279,14 +285,17 @@ public void addEndListener(Consumer listener) { public void testStructureLoaded(GameTestInfo info) {} @Override - public void testPassed(GameTestInfo info) { + public void testPassed(GameTestInfo info, GameTestRunner runner) { listener.accept(true); } @Override - public void testFailed(GameTestInfo info) { + public void testFailed(GameTestInfo info, GameTestRunner runner) { listener.accept(false); } + + @Override + public void testAddedForRerun(GameTestInfo p_320937_, GameTestInfo p_320294_, GameTestRunner p_320147_) {} }); } @@ -331,11 +340,11 @@ public void addTemporaryListener(Consumer event) { addEndListener(success -> NeoForge.EVENT_BUS.unregister(event)); } - public void assertMobEffectPresent(E entity, MobEffect effect, String testName) { + public void assertMobEffectPresent(E entity, Holder effect, String testName) { assertEntityProperty(entity, e -> e.hasEffect(effect), testName); } - public void assertMobEffectAbsent(E entity, MobEffect effect, String testName) { + public void assertMobEffectAbsent(E entity, Holder effect, String testName) { assertEntityProperty(entity, e -> !e.hasEffect(effect), testName); } diff --git a/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestData.java b/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestData.java index b6f51d9646..4b006df479 100644 --- a/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestData.java +++ b/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestData.java @@ -17,4 +17,4 @@ public record GameTestData( @Nullable String batchName, String structureName, boolean required, int maxAttempts, int requiredSuccesses, Consumer function, int maxTicks, - long setupTicks, Rotation rotation) {} + long setupTicks, Rotation rotation, boolean skyAccess) {} diff --git a/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestPlayer.java b/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestPlayer.java index a09d97bf9c..eafdc7b220 100644 --- a/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestPlayer.java +++ b/testframework/src/main/java/net/neoforged/testframework/gametest/GameTestPlayer.java @@ -14,9 +14,11 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.gametest.framework.GameTestInfo; import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.common.ClientCommonPacketListener; @@ -53,7 +55,8 @@ public GameTestPlayer moveToCorner() { } public GameTestPlayer moveToCentre() { - moveTo(helper.absoluteVec(new BlockPos(helper.testInfo.getStructureSize().getX() / 2, helper.testInfo.getStructureName().endsWith("_floor") ? 2 : 1, helper.testInfo.getStructureSize().getX() / 2).getCenter()).subtract(0, 0.5, 0)); + Vec3i size = helper.testInfo.getStructureBlockEntity().getStructureSize(); + moveTo(helper.absoluteVec(new BlockPos(size.getX() / 2, helper.testInfo.getStructureName().endsWith("_floor") ? 2 : 1, size.getX() / 2).getCenter()).subtract(0, 0.5, 0)); return this; } @@ -68,15 +71,18 @@ public GameTestPlayer preventItemPickup() { public void testStructureLoaded(GameTestInfo i) {} @Override - public void testPassed(GameTestInfo i) { + public void testPassed(GameTestInfo i, GameTestRunner runner) { disconnectGameTest(); } @Override - public void testFailed(GameTestInfo i) { + public void testFailed(GameTestInfo i, GameTestRunner runner) { disconnectGameTest(); } + @Override + public void testAddedForRerun(GameTestInfo i, GameTestInfo i2, GameTestRunner runner) {} + private final List> listeners = new ArrayList<>(); public void subscribe(Consumer listener) { diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/DefaultMarkdownFileSummaryDumper.java b/testframework/src/main/java/net/neoforged/testframework/impl/DefaultMarkdownFileSummaryDumper.java index 9a1ea57421..8f767100e9 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/DefaultMarkdownFileSummaryDumper.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/DefaultMarkdownFileSummaryDumper.java @@ -27,7 +27,7 @@ public Path outputPath(ResourceLocation frameworkId) { } @Override - public void write(TestSummary summary, Logger logger, PrintWriter writer) { + public void write(TestSummary summary, Logger logger, PrintWriter writer) throws Exception { String disabledList = summary.testInfos() .stream() .filter(info -> !info.enabled()) diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/FrameworkCollectors.java b/testframework/src/main/java/net/neoforged/testframework/impl/FrameworkCollectors.java index 3d85c1e7bd..faf9429def 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/FrameworkCollectors.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/FrameworkCollectors.java @@ -9,7 +9,7 @@ import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; import com.mojang.logging.LogUtils; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; +import cpw.mods.modlauncher.api.LambdaExceptionUtils; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.invoke.MethodHandle; @@ -64,7 +64,7 @@ public static List forClassesWithAnnotation(ModContainer container, Class< final Type annType = Type.getType(annotation); return container.getModInfo().getOwningFile().getFile().getScanResult() .getAnnotations().stream().filter(it -> annType.equals(it.annotationType()) && it.targetType() == ElementType.TYPE && SIDE_FILTER.test(it)) - .map(LamdbaExceptionUtils.rethrowFunction(annotationData -> { + .map(LambdaExceptionUtils.rethrowFunction(annotationData -> { final Class clazz = Class.forName(annotationData.clazz().getClassName()); return (Test) clazz.getDeclaredConstructor().newInstance(); })).toList(); @@ -119,7 +119,7 @@ public static SetMultimap> onInitMe final SetMultimap> set = Multimaps.newSetMultimap(new EnumMap<>(OnInit.Stage.class), HashSet::new); findMethodsWithAnnotation(container, d -> true, OnInit.class) .filter(method -> Modifier.isStatic(method.getModifiers()) && method.getParameterTypes().length == 1 && method.getParameterTypes()[0].isAssignableFrom(TestFrameworkImpl.class)) - .forEach(LamdbaExceptionUtils.rethrowConsumer(method -> { + .forEach(LambdaExceptionUtils.rethrowConsumer(method -> { final MethodHandle handle = ReflectionUtils.handle(method); set.put(method.getAnnotation(OnInit.class).value(), framework -> { try { @@ -142,7 +142,7 @@ public static void templatesWithAnnotation(final ModContainer container, BiConsu container.getModInfo().getOwningFile().getFile().getScanResult() .getAnnotations().stream() .filter(it -> it.targetType() == ElementType.FIELD && it.annotationType().equals(regStrTemplate)) - .map(LamdbaExceptionUtils.rethrowFunction(data -> Class.forName(data.clazz().getClassName()).getDeclaredField(data.memberName()))) + .map(LambdaExceptionUtils.rethrowFunction(data -> Class.forName(data.clazz().getClassName()).getDeclaredField(data.memberName()))) .filter(it -> Modifier.isStatic(it.getModifiers()) && (StructureTemplate.class.isAssignableFrom(it.getType()) || Supplier.class.isAssignableFrom(it.getType()))) .forEach(field -> { try { @@ -170,7 +170,7 @@ public static void groupsWithAnnotation(ModContainer container, Consumer asmType.equals(it.annotationType())) - .forEach(LamdbaExceptionUtils.rethrowConsumer(annotationData -> { + .forEach(LambdaExceptionUtils.rethrowConsumer(annotationData -> { final Class clazz = Class.forName(annotationData.clazz().getClassName()); final Field field = clazz.getDeclaredField(annotationData.memberName()); final String groupId = (String) field.get(null); @@ -195,7 +195,7 @@ public static Stream findMethodsWithAnnotation(ModContainer container, P return container.getModInfo().getOwningFile().getFile().getScanResult() .getAnnotations().stream().filter(it -> annType.equals(it.annotationType()) && it.targetType() == ElementType.METHOD && annotationPredicate.test(it)) .filter(it -> !excludedSides.contains(it.clazz().getClassName())) - .map(LamdbaExceptionUtils.rethrowFunction(annotationData -> { + .map(LambdaExceptionUtils.rethrowFunction(annotationData -> { final Class clazz = Class.forName(annotationData.clazz().getClassName()); final String methodName = annotationData.memberName().substring(0, annotationData.memberName().indexOf("(")); return ReflectionUtils.methodMatching(clazz, it -> it.getName().equals(methodName) && it.getAnnotation(annotation) != null); diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/GameTestRegistration.java b/testframework/src/main/java/net/neoforged/testframework/impl/GameTestRegistration.java index 9baea130d3..e3f468b48c 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/GameTestRegistration.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/GameTestRegistration.java @@ -5,7 +5,6 @@ package net.neoforged.testframework.impl; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -14,6 +13,7 @@ import net.minecraft.gametest.framework.GameTestGenerator; import net.minecraft.gametest.framework.GameTestInfo; import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; import net.minecraft.gametest.framework.TestFunction; import net.neoforged.testframework.Test; import net.neoforged.testframework.conf.Feature; @@ -22,7 +22,15 @@ @ApiStatus.Internal public final class GameTestRegistration { - public static final Method REGISTER_METHOD = LamdbaExceptionUtils.uncheck(() -> GameTestRegistration.class.getDeclaredMethod("register")); + public static final Method REGISTER_METHOD; + + static { + try { + REGISTER_METHOD = GameTestRegistration.class.getDeclaredMethod("register"); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } @GameTestGenerator public static List register() { @@ -37,15 +45,21 @@ public static List register() { tests.add(new TestFunction( data.batchName() == null ? batchName : data.batchName(), test.id(), data.structureName(), - data.rotation(), data.maxTicks(), data.setupTicks(), - data.required(), data.requiredSuccesses(), data.maxAttempts(), + data.rotation(), + data.maxTicks(), + data.setupTicks(), + data.required(), + false, // TODO: MATY fix this + data.maxAttempts(), + data.requiredSuccesses(), + data.skyAccess(), rethrow(helper -> { ReflectionUtils.addListener(helper, new GameTestListener() { @Override public void testStructureLoaded(GameTestInfo info) {} @Override - public void testPassed(GameTestInfo info) { + public void testPassed(GameTestInfo info, GameTestRunner runner) { if (framework.tests().getStatus(test.id()).result() == Test.Result.NOT_PROCESSED) { framework.changeStatus(test, Test.Status.passed("GameTest passed"), null); } @@ -53,11 +67,14 @@ public void testPassed(GameTestInfo info) { } @Override - public void testFailed(GameTestInfo info) { + public void testFailed(GameTestInfo info, GameTestRunner runner) { framework.changeStatus(test, Test.Status.failed("GameTest fail: " + info.getError().getMessage()), null); disable(); } + @Override + public void testAddedForRerun(GameTestInfo p_320937_, GameTestInfo p_320294_, GameTestRunner p_320147_) {} + private void disable() { framework.setEnabled(test, false, null); } diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/PlayerTestStore.java b/testframework/src/main/java/net/neoforged/testframework/impl/PlayerTestStore.java index ea201e8c26..3f8131526a 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/PlayerTestStore.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/PlayerTestStore.java @@ -12,19 +12,16 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.world.level.saveddata.SavedData; +import org.jetbrains.annotations.Nullable; -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault public class PlayerTestStore extends SavedData { - public static final Factory FACTORY = new Factory<>(PlayerTestStore::new, compoundTag -> new PlayerTestStore().decode(compoundTag)); + public static final Factory FACTORY = new Factory<>(PlayerTestStore::new, (compoundTag, provider) -> new PlayerTestStore().decode(compoundTag)); private final Map> playerToTests = new HashMap<>(); @@ -47,7 +44,7 @@ public PlayerTestStore decode(CompoundTag tag) { } @Override - public CompoundTag save(CompoundTag tag) { + public CompoundTag save(CompoundTag tag, HolderLookup.Provider provider) { final CompoundTag testsTag = new CompoundTag(); playerToTests.forEach((uuid, tests) -> { final ListTag testsNbt = new ListTag(); @@ -59,8 +56,10 @@ public CompoundTag save(CompoundTag tag) { } @Override - public void save(File pFile) { - pFile.getParentFile().mkdirs(); - super.save(pFile); + public void save(File file, HolderLookup.Provider prov) { + if (!file.exists()) { + file.getParentFile().mkdirs(); + } + super.save(file, prov); } } diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeEnabledPayload.java b/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeEnabledPayload.java index 9c9788dff5..498c4d8282 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeEnabledPayload.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeEnabledPayload.java @@ -17,7 +17,7 @@ public record ChangeEnabledPayload(MutableTestFramework framework, String testId, boolean enabled) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation("neoforge", "tf_change_enabled"); + public static final CustomPacketPayload.Type ID = new Type<>(new ResourceLocation("neoforge", "tf_change_enabled")); public void handle(PlayPayloadContext context) { switch (context.flow().getReceptionSide()) { case CLIENT -> { @@ -37,14 +37,13 @@ public static ChangeEnabledPayload decode(MutableTestFramework framework, Friend return new ChangeEnabledPayload(framework, buf.readUtf(), buf.readBoolean()); } - @Override public void write(FriendlyByteBuf buf) { buf.writeUtf(testId); buf.writeBoolean(enabled); } @Override - public ResourceLocation id() { + public Type type() { return ID; } } diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeStatusPayload.java b/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeStatusPayload.java index 843a817b68..e9e1df8259 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeStatusPayload.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/packet/ChangeStatusPayload.java @@ -17,8 +17,7 @@ public record ChangeStatusPayload(MutableTestFramework framework, String testId, Test.Status status) implements CustomPacketPayload { - public static final ResourceLocation ID = new ResourceLocation("neoforge", "tf_change_status"); - @Override + public static final CustomPacketPayload.Type ID = new Type<>(new ResourceLocation("neoforge", "tf_change_status")); public void write(FriendlyByteBuf buf) { buf.writeUtf(testId); buf.writeEnum(status.result()); @@ -26,7 +25,7 @@ public void write(FriendlyByteBuf buf) { } @Override - public ResourceLocation id() { + public Type type() { return ID; } diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/packet/TestFrameworkPayloadInitialization.java b/testframework/src/main/java/net/neoforged/testframework/impl/packet/TestFrameworkPayloadInitialization.java index 1f67d638d2..54611a8695 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/packet/TestFrameworkPayloadInitialization.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/packet/TestFrameworkPayloadInitialization.java @@ -5,6 +5,8 @@ package net.neoforged.testframework.impl.packet; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent; @@ -18,7 +20,7 @@ public record TestFrameworkPayloadInitialization(MutableTestFramework framework) public void onNetworkSetup(final RegisterPayloadHandlerEvent event) { final IPayloadRegistrar registrar = event.registrar(NeoForgeVersion.MOD_ID); - registrar.play(ChangeStatusPayload.ID, buf -> ChangeStatusPayload.decode(framework, buf), (payload, context) -> context.workHandler().submitAsync(() -> payload.handle(context))); - registrar.play(ChangeEnabledPayload.ID, buf -> ChangeEnabledPayload.decode(framework, buf), (payload, context) -> context.workHandler().submitAsync(() -> payload.handle(context))); + registrar.play(ChangeStatusPayload.ID, StreamCodec.of((RegistryFriendlyByteBuf buf, ChangeStatusPayload packet) -> packet.write(buf), buf -> ChangeStatusPayload.decode(framework, buf)), (payload, context) -> context.workHandler().submitAsync(() -> payload.handle(context))); + registrar.play(ChangeEnabledPayload.ID, StreamCodec.of((buf, packet) -> packet.write(buf), buf -> ChangeEnabledPayload.decode(framework, buf)), (payload, context) -> context.workHandler().submitAsync(() -> payload.handle(context))); } } diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/reg/RegistrationHelperImpl.java b/testframework/src/main/java/net/neoforged/testframework/impl/reg/RegistrationHelperImpl.java index 61a7397fa4..e2cd1c70b8 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/reg/RegistrationHelperImpl.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/reg/RegistrationHelperImpl.java @@ -11,12 +11,14 @@ import java.util.IdentityHashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.data.CachedOutput; @@ -26,6 +28,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackLocationInfo; +import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.repository.Pack; @@ -64,7 +68,7 @@ public RegistrationHelperImpl(String modId) { } private interface DataGenProvider { - T create(PackOutput output, DataGenerator generator, ExistingFileHelper existingFileHelper, String modId, List> consumers); + T create(PackOutput output, CompletableFuture registries, DataGenerator generator, ExistingFileHelper existingFileHelper, String modId, List> consumers); } private static final Map, DataGenProvider> PROVIDERS; @@ -77,26 +81,26 @@ void register(Class type, DataGenProvider provide } final var reg = new ProviderRegistrar(); - reg.register(LanguageProvider.class, (output, generator, existingFileHelper, modId, consumers) -> new LanguageProvider(output, modId, "en_us") { + reg.register(LanguageProvider.class, (output, registries, generator, existingFileHelper, modId, consumers) -> new LanguageProvider(output, modId, "en_us") { @Override protected void addTranslations() { consumers.forEach(c -> c.accept(this)); } }); - reg.register(BlockStateProvider.class, (output, generator, existingFileHelper, modId, consumers) -> new BlockStateProvider(output, modId, existingFileHelper) { + reg.register(BlockStateProvider.class, (output, registries, generator, existingFileHelper, modId, consumers) -> new BlockStateProvider(output, modId, existingFileHelper) { @Override protected void registerStatesAndModels() { existingFileHelper.trackGenerated(new ResourceLocation("testframework:block/white"), ModelProvider.TEXTURE); consumers.forEach(c -> c.accept(this)); } }); - reg.register(ItemModelProvider.class, (output, generator, existingFileHelper, modId, consumers) -> new ItemModelProvider(output, modId, existingFileHelper) { + reg.register(ItemModelProvider.class, (output, registries, generator, existingFileHelper, modId, consumers) -> new ItemModelProvider(output, modId, existingFileHelper) { @Override protected void registerModels() { consumers.forEach(c -> c.accept(this)); } }); - reg.register(GlobalLootModifierProvider.class, (output, generator, existingFileHelper, modId, consumers) -> new GlobalLootModifierProvider(output, modId) { + reg.register(GlobalLootModifierProvider.class, (output, registries, generator, existingFileHelper, modId, consumers) -> new GlobalLootModifierProvider(output, registries, modId) { @Override protected void start() { consumers.forEach(c -> c.accept(this)); @@ -174,23 +178,18 @@ public String registerSubpack(String name) { eventListeners().accept((final AddPackFindersEvent event) -> { if (event.getPackType() == PackType.SERVER_DATA) { event.addRepositorySource(acceptor -> acceptor.accept( - Pack.create( - newName, - Component.literal(newName), - true, + new Pack( + new PackLocationInfo(newName, Component.literal(newName), PackSource.BUILT_IN, Optional.empty()), new PathPackResources.PathResourcesSupplier( owner.getModInfo().getOwningFile() - .getFile().findResource(newName), - true), - new Pack.Info( + .getFile().findResource(newName)), + new Pack.Metadata( Component.empty(), PackCompatibility.COMPATIBLE, FeatureFlags.DEFAULT_FLAGS, List.of(), true), - Pack.Position.BOTTOM, - true, - PackSource.SERVER))); + new PackSelectionConfig(true, Pack.Position.BOTTOM, true)))); } }); return newName; @@ -225,7 +224,7 @@ public Consumer> eventListeners() { private void gather(final GatherDataEvent event) { providers.asMap().forEach((cls, cons) -> event.getGenerator().addProvider(true, PROVIDERS.get(cls).create( - event.getGenerator().getPackOutput(), event.getGenerator(), event.getExistingFileHelper(), modId, (List) cons))); + event.getGenerator().getPackOutput(), event.getLookupProvider(), event.getGenerator(), event.getExistingFileHelper(), modId, (List) cons))); directProviders.forEach(func -> event.getGenerator().addProvider(true, new DataProvider() { final DataProvider p = func.apply(event); diff --git a/testframework/src/main/java/net/neoforged/testframework/impl/test/AbstractTest.java b/testframework/src/main/java/net/neoforged/testframework/impl/test/AbstractTest.java index c9ad41491d..db1898afcd 100644 --- a/testframework/src/main/java/net/neoforged/testframework/impl/test/AbstractTest.java +++ b/testframework/src/main/java/net/neoforged/testframework/impl/test/AbstractTest.java @@ -23,6 +23,7 @@ import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.gametest.framework.GameTestInfo; import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; import net.minecraft.gametest.framework.StructureUtils; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -114,7 +115,8 @@ protected final void configureGameTest(@Nullable GameTest gameTest, @Nullable Em gameTest.templateNamespace().isBlank() ? (templateFromPattern == null ? gameTestTemplate(gameTest) : templateFromPattern.toString()) : new ResourceLocation(gameTest.templateNamespace(), gameTest.template()).toString(), gameTest.required(), gameTest.attempts(), gameTest.requiredSuccesses(), this::onGameTest, gameTest.timeoutTicks(), gameTest.setupTicks(), - StructureUtils.getRotationForRotationSteps(gameTest.rotationSteps())); + StructureUtils.getRotationForRotationSteps(gameTest.rotationSteps()), + gameTest.skyAccess()); } protected String gameTestTemplate(GameTest gameTest) { @@ -309,14 +311,17 @@ protected void onGameTest(GameTestHelper helper) { public void testStructureLoaded(GameTestInfo pTestInfo) {} @Override - public void testPassed(GameTestInfo pTestInfo) { + public void testPassed(GameTestInfo pTestInfo, GameTestRunner runner) { isDuringGameTest = false; } @Override - public void testFailed(GameTestInfo pTestInfo) { + public void testFailed(GameTestInfo pTestInfo, GameTestRunner runner) { isDuringGameTest = false; } + + @Override + public void testAddedForRerun(GameTestInfo p_320937_, GameTestInfo p_320294_, GameTestRunner p_320147_) {} }); final var actualHelper = new ExtendedGameTestHelper(helper.testInfo); this.onGameTest.forEach(test -> test.accept(actualHelper)); diff --git a/testframework/src/main/java/net/neoforged/testframework/summary/FileSummaryDumper.java b/testframework/src/main/java/net/neoforged/testframework/summary/FileSummaryDumper.java index f0df8b9816..8d5613a546 100644 --- a/testframework/src/main/java/net/neoforged/testframework/summary/FileSummaryDumper.java +++ b/testframework/src/main/java/net/neoforged/testframework/summary/FileSummaryDumper.java @@ -5,7 +5,6 @@ package net.neoforged.testframework.summary; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import java.io.PrintWriter; import java.nio.file.Files; import java.nio.file.Path; @@ -20,12 +19,14 @@ public interface FileSummaryDumper extends SummaryDumper { default void dump(TestSummary summary, Logger logger) { logger.info("Test summary processing..."); Path outputPath = outputPath(summary.frameworkId()); - LamdbaExceptionUtils.uncheck(() -> { + try { Files.createDirectories(outputPath.getParent()); try (PrintWriter writer = new PrintWriter(Files.newBufferedWriter(outputPath))) { this.write(summary, logger, writer); } - }); + } catch (Exception e) { + throw new RuntimeException(e); + } logger.info("Wrote test summary to {}", outputPath); } } diff --git a/testframework/src/main/resources/META-INF/mods.toml b/testframework/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from testframework/src/main/resources/META-INF/mods.toml rename to testframework/src/main/resources/META-INF/neoforge.mods.toml diff --git a/tests/src/generated/resources/assets/neotests_extending_connected_block/blockstates/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_extending_connected_block/blockstates/destroy_on_piston_move.json new file mode 100644 index 0000000000..b176c9a225 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_connected_block/blockstates/destroy_on_piston_move.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_extending_connected_block:block/destroy_on_piston_move" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_connected_block/lang/en_us.json b/tests/src/generated/resources/assets/neotests_extending_connected_block/lang/en_us.json new file mode 100644 index 0000000000..bceeb3f7e2 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_connected_block/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "block.neotests_extending_connected_block.destroy_on_piston_move": "Destroy on piston move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/tag_based_tool_types/models/block/test_stone.json b/tests/src/generated/resources/assets/neotests_extending_connected_block/models/block/destroy_on_piston_move.json similarity index 61% rename from tests/src/generated/resources/assets/tag_based_tool_types/models/block/test_stone.json rename to tests/src/generated/resources/assets/neotests_extending_connected_block/models/block/destroy_on_piston_move.json index 1b45c04047..ce4a458c61 100644 --- a/tests/src/generated/resources/assets/tag_based_tool_types/models/block/test_stone.json +++ b/tests/src/generated/resources/assets/neotests_extending_connected_block/models/block/destroy_on_piston_move.json @@ -1,6 +1,6 @@ { "parent": "minecraft:block/cube_all", "textures": { - "all": "minecraft:block/debug" + "all": "testframework:block/white" } } \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_connected_block/models/item/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_extending_connected_block/models/item/destroy_on_piston_move.json new file mode 100644 index 0000000000..2560c49b0a --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_connected_block/models/item/destroy_on_piston_move.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_extending_connected_block:block/destroy_on_piston_move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_piston_head/blockstates/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_extending_piston_head/blockstates/destroy_on_piston_move.json new file mode 100644 index 0000000000..fa2c4ac9dc --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_piston_head/blockstates/destroy_on_piston_move.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_extending_piston_head:block/destroy_on_piston_move" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_piston_head/lang/en_us.json b/tests/src/generated/resources/assets/neotests_extending_piston_head/lang/en_us.json new file mode 100644 index 0000000000..761a46cb9b --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_piston_head/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "block.neotests_extending_piston_head.destroy_on_piston_move": "Destroy on piston move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_piston_head/models/block/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_extending_piston_head/models/block/destroy_on_piston_move.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_piston_head/models/block/destroy_on_piston_move.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_extending_piston_head/models/item/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_extending_piston_head/models/item/destroy_on_piston_move.json new file mode 100644 index 0000000000..077a2512c0 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_extending_piston_head/models/item/destroy_on_piston_move.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_extending_piston_head:block/destroy_on_piston_move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_player_destroy/blockstates/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_player_destroy/blockstates/destroy_on_piston_move.json new file mode 100644 index 0000000000..4f19207560 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_player_destroy/blockstates/destroy_on_piston_move.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_player_destroy:block/destroy_on_piston_move" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_player_destroy/lang/en_us.json b/tests/src/generated/resources/assets/neotests_player_destroy/lang/en_us.json new file mode 100644 index 0000000000..25bfa6ad90 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_player_destroy/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "block.neotests_player_destroy.destroy_on_piston_move": "Destroy on piston move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_player_destroy/models/block/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_player_destroy/models/block/destroy_on_piston_move.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_player_destroy/models/block/destroy_on_piston_move.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_player_destroy/models/item/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_player_destroy/models/item/destroy_on_piston_move.json new file mode 100644 index 0000000000..cf6a9391e9 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_player_destroy/models/item/destroy_on_piston_move.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_player_destroy:block/destroy_on_piston_move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_push_only_reaction/blockstates/push_on_piston_move.json b/tests/src/generated/resources/assets/neotests_push_only_reaction/blockstates/push_on_piston_move.json new file mode 100644 index 0000000000..a673a8405c --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_push_only_reaction/blockstates/push_on_piston_move.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_push_only_reaction:block/push_on_piston_move" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_push_only_reaction/lang/en_us.json b/tests/src/generated/resources/assets/neotests_push_only_reaction/lang/en_us.json new file mode 100644 index 0000000000..fb6275b614 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_push_only_reaction/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "block.neotests_push_only_reaction.push_on_piston_move": "Push on piston move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_push_only_reaction/models/block/push_on_piston_move.json b/tests/src/generated/resources/assets/neotests_push_only_reaction/models/block/push_on_piston_move.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_push_only_reaction/models/block/push_on_piston_move.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_push_only_reaction/models/item/push_on_piston_move.json b/tests/src/generated/resources/assets/neotests_push_only_reaction/models/item/push_on_piston_move.json new file mode 100644 index 0000000000..45d98339d4 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_push_only_reaction/models/item/push_on_piston_move.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_push_only_reaction:block/push_on_piston_move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_retracting_connected_block/blockstates/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_retracting_connected_block/blockstates/destroy_on_piston_move.json new file mode 100644 index 0000000000..513195d8df --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_retracting_connected_block/blockstates/destroy_on_piston_move.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_retracting_connected_block:block/destroy_on_piston_move" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_retracting_connected_block/lang/en_us.json b/tests/src/generated/resources/assets/neotests_retracting_connected_block/lang/en_us.json new file mode 100644 index 0000000000..b382d3cee1 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_retracting_connected_block/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "block.neotests_retracting_connected_block.destroy_on_piston_move": "Destroy on piston move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/block/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/block/destroy_on_piston_move.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/block/destroy_on_piston_move.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/item/destroy_on_piston_move.json b/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/item/destroy_on_piston_move.json new file mode 100644 index 0000000000..2b23b41880 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_retracting_connected_block/models/item/destroy_on_piston_move.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_retracting_connected_block:block/destroy_on_piston_move" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/tag_based_tool_types/blockstates/test_stone.json b/tests/src/generated/resources/assets/tag_based_tool_types/blockstates/test_stone.json deleted file mode 100644 index 4331b202d8..0000000000 --- a/tests/src/generated/resources/assets/tag_based_tool_types/blockstates/test_stone.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "tag_based_tool_types:block/test_stone" - } - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_stone.json b/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_stone.json deleted file mode 100644 index e74daa5bae..0000000000 --- a/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_stone.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "tag_based_tool_types:block/test_stone" -} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_tool.json b/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_tool.json deleted file mode 100644 index fbf16c745d..0000000000 --- a/tests/src/generated/resources/assets/tag_based_tool_types/models/item/test_tool.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "minecraft:item/wooden_pickaxe" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/obtain_dirt.json b/tests/src/generated/resources/data/data_gen_test/advancements/obtain_dirt.json index d0a816f4f9..7766eaa29c 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/obtain_dirt.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/obtain_dirt.json @@ -4,9 +4,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:dirt" - ] + "items": "minecraft:dirt" } ] }, @@ -19,7 +17,8 @@ "translate": "dirt_description" }, "icon": { - "item": "minecraft:dirt" + "count": 1, + "id": "minecraft:dirt" }, "title": { "translate": "block.minecraft.dirt" diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json index a8e4738553..d8c30f05a1 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:crimson_planks" - ] + "items": "minecraft:crimson_planks" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json index 928158cb57..cbc21eb8d6 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:crimson_planks" - ] + "items": "minecraft:crimson_planks" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional.json index 6cd1887416..bd1dc49321 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional.json @@ -26,9 +26,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:dirt" - ] + "items": "minecraft:dirt" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional2.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional2.json index ff5111bbba..46393dcedd 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional2.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional2.json @@ -29,9 +29,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:dirt" - ] + "items": "minecraft:dirt" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional3.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional3.json index 3725e2ee20..ece0b05709 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional3.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional3.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:diamond_block" - ] + "items": "minecraft:diamond_block" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional4.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional4.json index aabdc105e9..335436d76f 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional4.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/conditional4.json @@ -14,9 +14,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:diamond_block" - ] + "items": "minecraft:diamond_block" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json index 0b16dc6e7c..37dc7a798c 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:crimson_planks" - ] + "items": "minecraft:crimson_planks" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json index 3c795c1515..ee4745a24d 100644 --- a/tests/src/generated/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json +++ b/tests/src/generated/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:crimson_fence" - ] + "items": "minecraft:crimson_fence" } ] }, diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json index 22c3a37d23..0fbe392450 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json @@ -10,10 +10,47 @@ "tag": "minecraft:logs" }, { - "type": "neoforge:nbt", - "item": "minecraft:stone_pickaxe", - "strict": true, - "tag": "{Damage:3}" + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [ + { + "type": "minecraft:generic.attack_damage", + "amount": 2.0, + "name": "Tool modifier", + "operation": "add_value", + "slot": "mainhand", + "uuid": [ + -885041709, + 1683771192, + -1533567981, + -1556236849 + ] + }, + { + "type": "minecraft:generic.attack_speed", + "amount": -2.799999952316284, + "name": "Tool modifier", + "operation": "add_value", + "slot": "mainhand", + "uuid": [ + -98353636, + 1098926181, + -1340359474, + -1752847197 + ] + } + ] + }, + "minecraft:damage": 3, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:repair_cost": 0 + }, + "items": "minecraft:stone_pickaxe", + "strict": true } ] }, @@ -22,6 +59,7 @@ "#" ], "result": { - "item": "minecraft:gold_block" + "count": 1, + "id": "minecraft:gold_block" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json index 8c082a4cb0..fab1468874 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_only_vanilla.json @@ -19,6 +19,7 @@ " # " ], "result": { - "item": "minecraft:dirt" + "count": 1, + "id": "minecraft:dirt" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/conditional.json b/tests/src/generated/resources/data/data_gen_test/recipes/conditional.json index 79856ad3cf..f62698f172 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/conditional.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/conditional.json @@ -34,6 +34,6 @@ ], "result": { "count": 64, - "item": "minecraft:diamond_block" + "id": "minecraft:diamond_block" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/conditional2.json b/tests/src/generated/resources/data/data_gen_test/recipes/conditional2.json index 5ad34968aa..421214f8c1 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/conditional2.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/conditional2.json @@ -37,6 +37,6 @@ ], "result": { "count": 64, - "item": "minecraft:diamond_block" + "id": "minecraft:diamond_block" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/conditional3.json b/tests/src/generated/resources/data/data_gen_test/recipes/conditional3.json index 2a9ac6d1ef..2ff1d2fdf1 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/conditional3.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/conditional3.json @@ -17,6 +17,7 @@ "XX" ], "result": { - "item": "minecraft:netherite_block" + "count": 1, + "id": "minecraft:netherite_block" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/conditional4.json b/tests/src/generated/resources/data/data_gen_test/recipes/conditional4.json index 07a441f967..1bbd681945 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/conditional4.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/conditional4.json @@ -21,6 +21,6 @@ ], "result": { "count": 9, - "item": "minecraft:netherite_block" + "id": "minecraft:netherite_block" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/difference_ingredient.json b/tests/src/generated/resources/data/data_gen_test/recipes/difference_ingredient.json index 7d05228ba7..c4e562b06b 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/difference_ingredient.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/difference_ingredient.json @@ -18,6 +18,7 @@ " # " ], "result": { - "item": "minecraft:flint_and_steel" + "count": 1, + "id": "minecraft:flint_and_steel" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/intersection_ingredient.json b/tests/src/generated/resources/data/data_gen_test/recipes/intersection_ingredient.json index 81c6afd96a..de34e17c5f 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/intersection_ingredient.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/intersection_ingredient.json @@ -20,6 +20,7 @@ " # " ], "result": { - "item": "minecraft:netherrack" + "count": 1, + "id": "minecraft:netherrack" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/tags/blocks/test.json b/tests/src/generated/resources/data/data_gen_test/tags/blocks/test.json index c84f0e73b8..8491e30e9d 100644 --- a/tests/src/generated/resources/data/data_gen_test/tags/blocks/test.json +++ b/tests/src/generated/resources/data/data_gen_test/tags/blocks/test.json @@ -2,7 +2,7 @@ "values": [ "minecraft:diamond_block", "#minecraft:stone_bricks", - "#forge:cobblestone", + "#c:cobblestones", { "id": "chisel:marble/raw", "required": false diff --git a/tests/src/generated/resources/data/minecraft/advancements/good_parent.json b/tests/src/generated/resources/data/minecraft/advancements/good_parent.json index 0b8144eec5..cc94d9d20b 100644 --- a/tests/src/generated/resources/data/minecraft/advancements/good_parent.json +++ b/tests/src/generated/resources/data/minecraft/advancements/good_parent.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:cobblestone" - ] + "items": "minecraft:cobblestone" } ] }, @@ -19,7 +17,8 @@ "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", "description": "You got cobblestone", "icon": { - "item": "minecraft:cobblestone" + "count": 1, + "id": "minecraft:cobblestone" }, "show_toast": false, "title": { diff --git a/tests/src/generated/resources/data/minecraft/advancements/obtain_diamond_block.json b/tests/src/generated/resources/data/minecraft/advancements/obtain_diamond_block.json index 13e33fe395..df2a7d3f43 100644 --- a/tests/src/generated/resources/data/minecraft/advancements/obtain_diamond_block.json +++ b/tests/src/generated/resources/data/minecraft/advancements/obtain_diamond_block.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:diamond_block" - ] + "items": "minecraft:diamond_block" } ] }, @@ -19,7 +17,8 @@ "description": "You obtained a DiamondBlock", "frame": "challenge", "icon": { - "item": "minecraft:diamond_block" + "count": 1, + "id": "minecraft:diamond_block" }, "title": { "translate": "block.minecraft.diamond_block" diff --git a/tests/src/generated/resources/data/minecraft/advancements/story/root.json b/tests/src/generated/resources/data/minecraft/advancements/story/root.json index 48939804ac..f668f1a736 100644 --- a/tests/src/generated/resources/data/minecraft/advancements/story/root.json +++ b/tests/src/generated/resources/data/minecraft/advancements/story/root.json @@ -4,9 +4,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:crafting_table" - ] + "items": "minecraft:crafting_table" } ] }, @@ -18,7 +16,8 @@ "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", "description": "Changed Description", "icon": { - "item": "minecraft:grass_block" + "count": 1, + "id": "minecraft:grass_block" }, "show_toast": false, "title": { diff --git a/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json b/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json index 8bc5c65537..678814251b 100644 --- a/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json +++ b/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json @@ -17,7 +17,8 @@ "display": { "description": "Get a named item", "icon": { - "item": "minecraft:anvil" + "count": 1, + "id": "minecraft:anvil" }, "title": "Named!" }, diff --git a/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/wheat_harvest.json b/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/wheat_harvest.json index a70ddc8e00..cba79b142f 100644 --- a/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/wheat_harvest.json +++ b/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/wheat_harvest.json @@ -4,9 +4,7 @@ { "condition": "minecraft:match_tool", "predicate": { - "items": [ - "minecraft:shears" - ] + "items": "minecraft:shears" } }, { diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/advancements/recipes/misc/test_smithing.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/advancements/recipes/misc/test_smithing.json deleted file mode 100644 index a391a8efcb..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/advancements/recipes/misc/test_smithing.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_shovel": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:stone_shovel" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_item_attachment_recipe_copying:test_smithing" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_shovel" - ] - ], - "rewards": { - "recipes": [ - "neotests_item_attachment_recipe_copying:test_smithing" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/recipes/test_smithing.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/recipes/test_smithing.json deleted file mode 100644 index 1a4fdeea57..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_copying/recipes/test_smithing.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:gold_ingot" - }, - "base": { - "item": "minecraft:stone_shovel" - }, - "result": { - "item": "minecraft:golden_shovel" - }, - "template": { - "item": "minecraft:netherite_upgrade_smithing_template" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_blasting.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_blasting.json deleted file mode 100644 index 6b2cab6e0d..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_blasting.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_shovel": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:golden_shovel" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_item_attachment_recipe_output:test_blasting" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_shovel" - ] - ], - "rewards": { - "recipes": [ - "neotests_item_attachment_recipe_output:test_blasting" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shaped.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shaped.json deleted file mode 100644 index 5bdd90ce51..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shaped.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_shovel": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:golden_shovel" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_item_attachment_recipe_output:test_shaped" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_shovel" - ] - ], - "rewards": { - "recipes": [ - "neotests_item_attachment_recipe_output:test_shaped" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shapeless.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shapeless.json deleted file mode 100644 index c0a56d13b9..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/advancements/recipes/misc/test_shapeless.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_shovel": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:golden_shovel" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_item_attachment_recipe_output:test_shapeless" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_shovel" - ] - ], - "rewards": { - "recipes": [ - "neotests_item_attachment_recipe_output:test_shapeless" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_blasting.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_blasting.json deleted file mode 100644 index cadd8c8572..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_blasting.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "type": "minecraft:blasting", - "category": "misc", - "cookingtime": 100, - "experience": 1.0, - "ingredient": { - "type": "testframework:test_enabled", - "base": { - "item": "minecraft:golden_shovel" - }, - "framework": "neotests:tests", - "testId": "itemAttachmentRecipeOutput" - }, - "result": { - "item": "minecraft:golden_shovel", - "neoforge:attachments": "{\"neotests_item_attachment_recipe_output:test_int\":1}" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shaped.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shaped.json deleted file mode 100644 index 00364080ac..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shaped.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "x": { - "type": "testframework:test_enabled", - "base": { - "item": "minecraft:golden_shovel" - }, - "framework": "neotests:tests", - "testId": "itemAttachmentRecipeOutput" - } - }, - "pattern": [ - "xx", - "xx" - ], - "result": { - "item": "minecraft:golden_shovel", - "neoforge:attachments": "{\"neotests_item_attachment_recipe_output:test_int\":1}" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shapeless.json b/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shapeless.json deleted file mode 100644 index a204def013..0000000000 --- a/tests/src/generated/resources/data/neotests_item_attachment_recipe_output/recipes/test_shapeless.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "type": "testframework:test_enabled", - "base": { - "item": "minecraft:golden_shovel" - }, - "framework": "neotests:tests", - "testId": "itemAttachmentRecipeOutput" - } - ], - "result": { - "item": "minecraft:golden_shovel", - "neoforge:attachments": "{\"neotests_item_attachment_recipe_output:test_int\":1}" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_mod_datapack/advancements/recipes/misc/test_advancement.json b/tests/src/generated/resources/data/neotests_mod_datapack/advancements/recipes/misc/test_advancement.json index 94a45a77f5..c98426e11f 100644 --- a/tests/src/generated/resources/data/neotests_mod_datapack/advancements/recipes/misc/test_advancement.json +++ b/tests/src/generated/resources/data/neotests_mod_datapack/advancements/recipes/misc/test_advancement.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:scute" - ] + "items": "minecraft:turtle_scute" } ] }, diff --git a/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/advancements/recipes/misc/partial_attachments.json b/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/advancements/recipes/misc/partial_attachments.json deleted file mode 100644 index 3462fb2ed0..0000000000 --- a/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/advancements/recipes/misc/partial_attachments.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_pick": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:iron_pickaxe" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_partial_attachment_ingredient:partial_attachments" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_pick" - ] - ], - "rewards": { - "recipes": [ - "neotests_partial_attachment_ingredient:partial_attachments" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/recipes/partial_attachments.json b/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/recipes/partial_attachments.json deleted file mode 100644 index 8474e380a5..0000000000 --- a/tests/src/generated/resources/data/neotests_partial_attachment_ingredient/recipes/partial_attachments.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "item": "minecraft:diamond" - }, - "E": { - "item": "minecraft:emerald" - }, - "I": { - "type": "testframework:test_enabled", - "base": { - "type": "neoforge:nbt", - "item": "minecraft:iron_pickaxe", - "neoforge:attachments": "{\"neotests_partial_attachment_ingredient:test_int\":1}", - "tag": "{Damage:0}" - }, - "framework": "neotests:tests", - "testId": "partialAttachmentIngredient" - } - }, - "pattern": [ - "IDE" - ], - "result": { - "item": "minecraft:poppy" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/advancements/recipes/misc/partial_nbt_and_attachments.json b/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/advancements/recipes/misc/partial_nbt_and_attachments.json deleted file mode 100644 index 7ac521b941..0000000000 --- a/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/advancements/recipes/misc/partial_nbt_and_attachments.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_pick": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:netherite_pickaxe" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_partial_nbt_attachment_ingredient:partial_nbt_and_attachments" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_pick" - ] - ], - "rewards": { - "recipes": [ - "neotests_partial_nbt_attachment_ingredient:partial_nbt_and_attachments" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/recipes/partial_nbt_and_attachments.json b/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/recipes/partial_nbt_and_attachments.json deleted file mode 100644 index 85d88c11de..0000000000 --- a/tests/src/generated/resources/data/neotests_partial_nbt_attachment_ingredient/recipes/partial_nbt_and_attachments.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "item": "minecraft:diamond" - }, - "E": { - "item": "minecraft:emerald" - }, - "I": { - "type": "testframework:test_enabled", - "base": { - "type": "neoforge:nbt", - "item": "minecraft:netherite_pickaxe", - "neoforge:attachments": "{\"neotests_partial_nbt_attachment_ingredient:test_int\":1}", - "tag": "{Damage:2}" - }, - "framework": "neotests:tests", - "testId": "partialNbtAttachmentIngredient" - } - }, - "pattern": [ - "IDE" - ], - "result": { - "item": "minecraft:azalea" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_partial_nbtingredient/advancements/recipes/misc/partial_nbt.json b/tests/src/generated/resources/data/neotests_partial_nbtingredient/advancements/recipes/misc/partial_nbt.json index fb2f6c9d0e..8ba11815a4 100644 --- a/tests/src/generated/resources/data/neotests_partial_nbtingredient/advancements/recipes/misc/partial_nbt.json +++ b/tests/src/generated/resources/data/neotests_partial_nbtingredient/advancements/recipes/misc/partial_nbt.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:iron_axe" - ] + "items": "minecraft:iron_axe" } ] }, diff --git a/tests/src/generated/resources/data/neotests_partial_nbtingredient/recipes/partial_nbt.json b/tests/src/generated/resources/data/neotests_partial_nbtingredient/recipes/partial_nbt.json index 4981618dd5..d510dfaa4c 100644 --- a/tests/src/generated/resources/data/neotests_partial_nbtingredient/recipes/partial_nbt.json +++ b/tests/src/generated/resources/data/neotests_partial_nbtingredient/recipes/partial_nbt.json @@ -11,9 +11,11 @@ "I": { "type": "testframework:test_enabled", "base": { - "type": "neoforge:nbt", - "item": "minecraft:iron_axe", - "tag": "{Damage:2}" + "type": "neoforge:components", + "components": { + "minecraft:damage": 2 + }, + "items": "minecraft:iron_axe" }, "framework": "neotests:tests", "testId": "partialNBTIngredient" @@ -23,6 +25,7 @@ "IDE" ], "result": { - "item": "minecraft:allium" + "count": 1, + "id": "minecraft:allium" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/advancements/recipes/misc/strict_attachments.json b/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/advancements/recipes/misc/strict_attachments.json deleted file mode 100644 index 26b3532cbe..0000000000 --- a/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/advancements/recipes/misc/strict_attachments.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_apple": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:apple" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_strict_attachment_ingredient:strict_attachments" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_apple" - ] - ], - "rewards": { - "recipes": [ - "neotests_strict_attachment_ingredient:strict_attachments" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/recipes/strict_attachments.json b/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/recipes/strict_attachments.json deleted file mode 100644 index 1593462e65..0000000000 --- a/tests/src/generated/resources/data/neotests_strict_attachment_ingredient/recipes/strict_attachments.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "type": "testframework:test_enabled", - "base": { - "type": "neoforge:nbt", - "item": "minecraft:apple", - "neoforge:attachments": "{\"neotests_strict_attachment_ingredient:test_int\":4}", - "strict": true - }, - "framework": "neotests:tests", - "testId": "strictAttachmentIngredient" - }, - { - "item": "minecraft:acacia_planks" - } - ], - "result": { - "item": "minecraft:acacia_chest_boat" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/advancements/recipes/misc/strict_attachments.json b/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/advancements/recipes/misc/strict_attachments.json deleted file mode 100644 index 40f84802b0..0000000000 --- a/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/advancements/recipes/misc/strict_attachments.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_axe": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:diamond_axe" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "has_the_recipe": { - "conditions": { - "recipe": "neotests_strict_nbt_attachment_ingredient:strict_attachments" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe", - "has_axe" - ] - ], - "rewards": { - "recipes": [ - "neotests_strict_nbt_attachment_ingredient:strict_attachments" - ] - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/recipes/strict_attachments.json b/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/recipes/strict_attachments.json deleted file mode 100644 index 51f1dc4d39..0000000000 --- a/tests/src/generated/resources/data/neotests_strict_nbt_attachment_ingredient/recipes/strict_attachments.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "type": "testframework:test_enabled", - "base": { - "type": "neoforge:nbt", - "item": "minecraft:diamond_axe", - "neoforge:attachments": "{\"neotests_strict_nbt_attachment_ingredient:test_int\":4}", - "strict": true, - "tag": "{Damage:4}" - }, - "framework": "neotests:tests", - "testId": "strictNbtAttachmentIngredient" - }, - { - "item": "minecraft:acacia_planks" - } - ], - "result": { - "item": "minecraft:acacia_fence" - } -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/neotests_strict_nbtingredient/advancements/recipes/misc/strict_nbt.json b/tests/src/generated/resources/data/neotests_strict_nbtingredient/advancements/recipes/misc/strict_nbt.json index cf8d98b121..e8bb3b6ad8 100644 --- a/tests/src/generated/resources/data/neotests_strict_nbtingredient/advancements/recipes/misc/strict_nbt.json +++ b/tests/src/generated/resources/data/neotests_strict_nbtingredient/advancements/recipes/misc/strict_nbt.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:diamond_pickaxe" - ] + "items": "minecraft:diamond_pickaxe" } ] }, diff --git a/tests/src/generated/resources/data/neotests_strict_nbtingredient/recipes/strict_nbt.json b/tests/src/generated/resources/data/neotests_strict_nbtingredient/recipes/strict_nbt.json index a5faa70970..76ce12890c 100644 --- a/tests/src/generated/resources/data/neotests_strict_nbtingredient/recipes/strict_nbt.json +++ b/tests/src/generated/resources/data/neotests_strict_nbtingredient/recipes/strict_nbt.json @@ -5,10 +5,12 @@ { "type": "testframework:test_enabled", "base": { - "type": "neoforge:nbt", - "item": "minecraft:diamond_pickaxe", - "strict": true, - "tag": "{Damage:4}" + "type": "neoforge:components", + "components": { + "minecraft:damage": 4 + }, + "items": "minecraft:diamond_pickaxe", + "strict": true }, "framework": "neotests:tests", "testId": "strictNBTIngredient" @@ -18,6 +20,7 @@ } ], "result": { - "item": "minecraft:acacia_boat" + "count": 1, + "id": "minecraft:acacia_boat" } } \ No newline at end of file diff --git a/tests/src/generated/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json b/tests/src/generated/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json deleted file mode 100644 index 8918dd1442..0000000000 --- a/tests/src/generated/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "tag_based_tool_types:test_stone" - } - ], - "rolls": 1.0 - } - ], - "random_sequence": "tag_based_tool_types:blocks/test_stone" -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json b/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json deleted file mode 100644 index df82695e04..0000000000 --- a/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/minable/my_tool.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "tag_based_tool_types:test_stone" - ] -} \ No newline at end of file diff --git a/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json b/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json deleted file mode 100644 index df82695e04..0000000000 --- a/tests/src/generated/resources/data/tag_based_tool_types/tags/blocks/needs_my_tier_tool.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "tag_based_tool_types:test_stone" - ] -} \ No newline at end of file diff --git a/tests/src/generated/resources/pack.mcmeta b/tests/src/generated/resources/pack.mcmeta index 01f1b239ee..6a4e7b5809 100644 --- a/tests/src/generated/resources/pack.mcmeta +++ b/tests/src/generated/resources/pack.mcmeta @@ -38,7 +38,7 @@ }, "pack": { "description": "NeoForge tests resource pack", - "pack_format": 22, + "pack_format": 31, "supported_formats": [ 0, 2147483647 diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/attachment/AttachmentTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/attachment/AttachmentTests.java index 118a67e35e..7be2240558 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/attachment/AttachmentTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/attachment/AttachmentTests.java @@ -7,104 +7,71 @@ import static net.minecraft.commands.Commands.literal; -import com.google.common.base.Suppliers; import com.mojang.brigadier.Command; -import com.mojang.serialization.Codec; -import io.netty.buffer.Unpooled; -import java.util.List; -import java.util.Optional; -import net.minecraft.Util; import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; -import net.minecraft.core.FrontAndTop; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.RecipeOutput; -import net.minecraft.data.recipes.RecipeProvider; -import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.data.recipes.ShapelessRecipeBuilder; -import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; -import net.minecraft.data.recipes.SmithingTransformRecipeBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.gametest.framework.GameTest; import net.minecraft.nbt.IntTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.StringTag; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.Container; -import net.minecraft.world.SimpleContainer; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.CrafterBlock; -import net.minecraft.world.level.block.entity.ChestBlockEntity; -import net.minecraft.world.level.block.entity.CrafterBlockEntity; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.chunk.LevelChunk; import net.neoforged.neoforge.attachment.AttachmentType; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.util.INBTSerializable; import net.neoforged.neoforge.event.RegisterCommandsEvent; -import net.neoforged.neoforge.items.IItemHandler; -import net.neoforged.neoforge.items.ItemStackHandler; import net.neoforged.neoforge.registries.NeoForgeRegistries; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; import net.neoforged.testframework.annotation.TestHolder; -import net.neoforged.testframework.condition.TestEnabledIngredient; import net.neoforged.testframework.gametest.EmptyTemplate; import net.neoforged.testframework.registration.RegistrationHelper; @ForEachTest(groups = "attachment") -public class AttachmentTests { - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that ItemStack attachments are written to and read from packets as we expect") - static void itemAttachmentSyncTest(final DynamicTest test, final RegistrationHelper reg) { - final var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("handler", () -> AttachmentType.serializable(() -> new ItemStackHandler(1)).build()); - - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - IItemHandler handler = stack.getData(attachmentType); - helper.assertTrue(handler != null, "ItemStack handler is null"); - assert handler != null; - - handler.insertItem(0, Items.DIAMOND.getDefaultInstance(), false); - helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), handler.getStackInSlot(0)), "ItemStack handler did not accept the item"); - - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); - - // Try without stack nbt - buf.writeItem(stack); - ItemStack readStack = buf.readItem(); - - helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly without NBT"); - helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); - - // Try with empty nbt - stack.getOrCreateTag(); - buf.writeItem(stack); - readStack = buf.readItem(); - - helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly with NBT"); - helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); - - // Try with non-empty nbt - stack.getOrCreateTag().putString("test", "test"); - buf.writeItem(stack); - readStack = buf.readItem(); - - helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly with NBT"); - helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); - - helper.succeed(); - }); - } - +public class AttachmentTests { // Porting 1.20.5 nuke? +/* @GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that ItemStack attachments are written to and read from packets as we expect") +static void itemAttachmentSyncTest(final DynamicTest test, final RegistrationHelper reg) { +final var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("handler", () -> AttachmentType.serializable(() -> new ItemStackHandler(1)).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +IItemHandler handler = stack.getData(attachmentType); +helper.assertTrue(handler != null, "ItemStack handler is null"); +assert handler != null; + +handler.insertItem(0, Items.DIAMOND.getDefaultInstance(), false); +helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), handler.getStackInSlot(0)), "ItemStack handler did not accept the item"); + +FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); + +// Try without stack nbt +buf.writeItemWithLargeCount(stack); +ItemStack readStack = buf.readItemWithLargeCount(); + +helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly without NBT"); +helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); + +// Try with empty nbt +stack.getOrCreateTag(); +buf.writeItemWithLargeCount(stack); +readStack = buf.readItemWithLargeCount(); + +helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly with NBT"); +helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); + +// Try with non-empty nbt +stack.getOrCreateTag().putString("test", "test"); +buf.writeItemWithLargeCount(stack); +readStack = buf.readItemWithLargeCount(); + +helper.assertTrue(ItemStack.matches(stack, readStack), "ItemStack did not sync correctly with NBT"); +helper.assertTrue(ItemStack.matches(Items.DIAMOND.getDefaultInstance(), readStack.getData(attachmentType).getStackInSlot(0)), "ItemStack handler did not sync the contained item"); + +helper.succeed(); +}); +}*/ @GameTest @EmptyTemplate @TestHolder(description = "Ensures that chunk attachments can capture a reference to the containing LevelChunk.") @@ -128,12 +95,12 @@ public void setValue(int value) { } @Override - public IntTag serializeNBT() { + public IntTag serializeNBT(HolderLookup.Provider provider) { return IntTag.valueOf(value); } @Override - public void deserializeNBT(IntTag nbt) { + public void deserializeNBT(HolderLookup.Provider provider, IntTag nbt) { this.value = nbt.getAsInt(); } } @@ -160,6 +127,8 @@ public void deserializeNBT(IntTag nbt) { var pos = helper.absolutePos(BlockPos.ZERO); player.setPos(pos.getCenter()); + helper.getLevel().getChunk(pos).removeData(attachmentType); // remove data to ensure that the test can run multiple times + helper.getLevel().getServer().getCommands().performPrefixedCommand(player.createCommandSourceStack(), test.id() + " print_and_increment"); helper.assertTrue(((LevelChunk) helper.getLevel().getChunk(pos)).getData(attachmentType).getValue() == 1, "Chunk attachment value should have been 1"); @@ -172,275 +141,275 @@ public void deserializeNBT(IntTag nbt) { }); } - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that ItemStack attachments can be specified in recipe outputs") - static void itemAttachmentRecipeOutput(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - - var ingredient = new TestEnabledIngredient( - Ingredient.of(Items.GOLDEN_SHOVEL), - test.framework(), - test.id()); - var outputStack = Suppliers.memoize(() -> { - var stack = new ItemStack(Items.GOLDEN_SHOVEL); - stack.setData(attachmentType, 1); - return stack; - }); - - var shapelessId = new ResourceLocation(reg.modId(), "test_shapeless"); - var shapedId = new ResourceLocation(reg.modId(), "test_shaped"); - var blastingId = new ResourceLocation(reg.modId(), "test_blasting"); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput recipeOutput) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, outputStack.get()) - .requires(ingredient) - .unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) - .save(recipeOutput, shapelessId); - - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, outputStack.get()) - .pattern("xx") - .pattern("xx") - .define('x', ingredient) - .unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) - .save(recipeOutput, shapedId); - - SimpleCookingRecipeBuilder.blasting(ingredient, RecipeCategory.MISC, outputStack.get(), 1.0f, 100) - .unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) - .save(recipeOutput, blastingId); - } - }); - - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(0, Items.GOLDEN_SHOVEL.getDefaultInstance())) - .thenIdle(3) - - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> { - var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); - var stack = chest.getItem(0); - - helper.assertTrue(stack.getItem() == Items.GOLDEN_SHOVEL, "Expected golden shovel"); - helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); - helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); - }) - - .thenExecute(() -> { - // Just look at the output via the RecipeManager - var recipeManager = helper.getLevel().getRecipeManager(); - - for (var id : List.of(shapelessId, shapedId, blastingId)) { - var recipe = recipeManager.byKey(id).map(RecipeHolder::value).orElse(null); - if (recipe == null) { - helper.fail("No recipe " + id); - } - - helper.assertTrue(ItemStack.matches(outputStack.get(), recipe.getResultItem(helper.getLevel().registryAccess())), "Recipe output should match stack."); - } - }) - - .thenSucceed()); - } - - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that ItemStack attachments can be cloned in certain recipes") - static void itemAttachmentRecipeCopying(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - - var smithingId = new ResourceLocation(reg.modId(), "test_smithing"); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput recipeOutput) { - SmithingTransformRecipeBuilder.smithing(Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(Items.STONE_SHOVEL), Ingredient.of(Items.GOLD_INGOT), RecipeCategory.MISC, Items.GOLDEN_SHOVEL) - .unlocks("has_shovel", has(Items.STONE_SHOVEL)) - .save(recipeOutput, smithingId); - } - }); - - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> { - ItemStack shulkerBox = Items.SHULKER_BOX.getDefaultInstance(); - shulkerBox.setData(attachmentType, 1); - crafter.setItem(0, shulkerBox); - }) - .thenExecute(crafter -> crafter.setItem(1, Items.BLACK_DYE.getDefaultInstance())) - .thenIdle(3) - - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> { - var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); - var stack = chest.getItem(0); - - helper.assertTrue(stack.getItem() == Items.BLACK_SHULKER_BOX, "Expected black shulker box"); - helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); - helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); - }) - - .thenIdle(5) // Crafter cooldown - .thenExecute(crafter -> { - ItemStack writtenBook = Items.WRITTEN_BOOK.getDefaultInstance(); - writtenBook.setData(attachmentType, 1); - writtenBook.addTagElement("author", StringTag.valueOf("NeoForge")); - writtenBook.addTagElement("title", StringTag.valueOf("How to copy attachments")); - crafter.setItem(0, writtenBook); - }) - .thenExecute(crafter -> crafter.setItem(1, Items.WRITABLE_BOOK.getDefaultInstance())) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> { - var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); - var stack = chest.getItem(1); - - helper.assertTrue(stack.getItem() == Items.WRITTEN_BOOK, "Expected written book"); - helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); - helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); - }) - - .thenExecute(() -> { - // Just look at the output via the RecipeManager - var recipeManager = helper.getLevel().getRecipeManager(); - Recipe smithingRecipe = (Recipe) recipeManager.byKey(smithingId).map(RecipeHolder::value).orElse(null); - if (smithingRecipe == null) { - helper.fail("No recipe " + smithingId); - } - ItemStack smithingInput = new ItemStack(Items.STONE_SHOVEL); - smithingInput.setData(attachmentType, 1); - Container smithingContainer = new SimpleContainer( - new ItemStack(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), - smithingInput, - new ItemStack(Items.GOLD_INGOT)); - var outputStack = new ItemStack(Items.GOLDEN_SHOVEL); - outputStack.setData(attachmentType, 1); - helper.assertTrue(ItemStack.matches(outputStack, smithingRecipe.assemble(smithingContainer, helper.getLevel().registryAccess())), "Recipe output should match stack."); - }) - - .thenSucceed()); - } - - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that ItemStack.CODEC can handle attachments") - static void itemAttachmentCodec(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - stack.setData(attachmentType, 1); - - var encodedNbt = Util.getOrThrow(ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack), IllegalStateException::new); - var decodedStack = Util.getOrThrow(ItemStack.CODEC.parse(NbtOps.INSTANCE, encodedNbt), IllegalStateException::new); - - helper.assertTrue(decodedStack.hasData(attachmentType), "Decoded stack should have the data"); - helper.assertTrue(ItemStack.matches(stack, decodedStack), "Stacks should match"); +/* @GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that ItemStack attachments can be specified in recipe outputs") +static void itemAttachmentRecipeOutput(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); + +var ingredient = new TestEnabledIngredient( +Ingredient.of(Items.GOLDEN_SHOVEL), +test.framework(), +test.id()); +var outputStack = Suppliers.memoize(() -> { +var stack = new ItemStack(Items.GOLDEN_SHOVEL); +stack.setData(attachmentType, 1); +return stack; +}); + +var shapelessId = new ResourceLocation(reg.modId(), "test_shapeless"); +var shapedId = new ResourceLocation(reg.modId(), "test_shaped"); +var blastingId = new ResourceLocation(reg.modId(), "test_blasting"); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput(), event.getLookupProvider()) { +@Override +protected void buildRecipes(RecipeOutput recipeOutput) { +ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, outputStack.get()) +.requires(ingredient) +.unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) +.save(recipeOutput, shapelessId); + +ShapedRecipeBuilder.shaped(RecipeCategory.MISC, outputStack.get()) +.pattern("xx") +.pattern("xx") +.define('x', ingredient) +.unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) +.save(recipeOutput, shapedId); + +SimpleCookingRecipeBuilder.blasting(ingredient, RecipeCategory.MISC, outputStack.get(), 1.0f, 100) +.unlockedBy("has_shovel", has(Items.GOLDEN_SHOVEL)) +.save(recipeOutput, blastingId); +} +}); + +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) + +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> crafter.setItem(0, Items.GOLDEN_SHOVEL.getDefaultInstance())) +.thenIdle(3) + +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> { +var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); +var stack = chest.getItem(0); + +helper.assertTrue(stack.getItem() == Items.GOLDEN_SHOVEL, "Expected golden shovel"); +helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); +helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); +}) + +.thenExecute(() -> { +// Just look at the output via the RecipeManager +var recipeManager = helper.getLevel().getRecipeManager(); + +for (var id : List.of(shapelessId, shapedId, blastingId)) { +var recipe = recipeManager.byKey(id).map(RecipeHolder::value).orElse(null); +if (recipe == null) { +helper.fail("No recipe " + id); +} - helper.succeed(); - }); - } +helper.assertTrue(ItemStack.matches(outputStack.get(), recipe.getResultItem(helper.getLevel().registryAccess())), "Recipe output should match stack."); +} +}) - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that attachments can opt-out of serializing default values") - static void itemAttachmentSkipSerialization(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT, i -> i != 0).build()); +.thenSucceed()); +} - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - stack.setData(attachmentType, 1); - helper.assertTrue(stack.serializeAttachments() != null, "Stack should have serialized attachments"); - stack.setData(attachmentType, 0); - helper.assertTrue(stack.serializeAttachments() == null, "None of the stack's attachments should be serialized"); - helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that ItemStack attachments can be cloned in certain recipes") +static void itemAttachmentRecipeCopying(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); + +var smithingId = new ResourceLocation(reg.modId(), "test_smithing"); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput(), event.getLookupProvider()) { +@Override +protected void buildRecipes(RecipeOutput recipeOutput) { +SmithingTransformRecipeBuilder.smithing(Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(Items.STONE_SHOVEL), Ingredient.of(Items.GOLD_INGOT), RecipeCategory.MISC, Items.GOLDEN_SHOVEL) +.unlocks("has_shovel", has(Items.STONE_SHOVEL)) +.save(recipeOutput, smithingId); +} +}); + +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) + +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> { +ItemStack shulkerBox = Items.SHULKER_BOX.getDefaultInstance(); +shulkerBox.setData(attachmentType, 1); +crafter.setItem(0, shulkerBox); +}) +.thenExecute(crafter -> crafter.setItem(1, Items.BLACK_DYE.getDefaultInstance())) +.thenIdle(3) + +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> { +var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); +var stack = chest.getItem(0); + +helper.assertTrue(stack.getItem() == Items.BLACK_SHULKER_BOX, "Expected black shulker box"); +helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); +helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); +}) + +.thenIdle(5) // Crafter cooldown +.thenExecute(crafter -> { +ItemStack writtenBook = Items.WRITTEN_BOOK.getDefaultInstance(); +writtenBook.setData(attachmentType, 1); +writtenBook.addTagElement("author", StringTag.valueOf("NeoForge")); +writtenBook.addTagElement("title", StringTag.valueOf("How to copy attachments")); +crafter.setItem(0, writtenBook); +}) +.thenExecute(crafter -> crafter.setItem(1, Items.WRITABLE_BOOK.getDefaultInstance())) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> { +var chest = helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class); +var stack = chest.getItem(1); + +helper.assertTrue(stack.getItem() == Items.WRITTEN_BOOK, "Expected written book"); +helper.assertTrue(stack.hasData(attachmentType), "Expected attachment"); +helper.assertTrue(stack.getData(attachmentType) == 1, "Expected attachment value of 1"); +}) + +.thenExecute(() -> { +// Just look at the output via the RecipeManager +var recipeManager = helper.getLevel().getRecipeManager(); +Recipe smithingRecipe = (Recipe) recipeManager.byKey(smithingId).map(RecipeHolder::value).orElse(null); +if (smithingRecipe == null) { +helper.fail("No recipe " + smithingId); +} +ItemStack smithingInput = new ItemStack(Items.STONE_SHOVEL); +smithingInput.setData(attachmentType, 1); +Container smithingContainer = new SimpleContainer( +new ItemStack(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), +smithingInput, +new ItemStack(Items.GOLD_INGOT)); +var outputStack = new ItemStack(Items.GOLDEN_SHOVEL); +outputStack.setData(attachmentType, 1); +helper.assertTrue(ItemStack.matches(outputStack, smithingRecipe.assemble(smithingContainer, helper.getLevel().registryAccess())), "Recipe output should match stack."); +}) + +.thenSucceed()); +} - helper.succeed(); - }); - } +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that ItemStack.CODEC can handle attachments") +static void itemAttachmentCodec(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that removing attachments works") - static void itemAttachmentRemoval(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +stack.setData(attachmentType, 1); - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - stack.setData(attachmentType, 1); - helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); - stack.removeData(attachmentType); - helper.assertFalse(stack.hasData(attachmentType), "Stack should not have attached data"); +var encodedNbt = Util.getOrThrow(ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack), IllegalStateException::new); +var decodedStack = Util.getOrThrow(ItemStack.CODEC.parse(NbtOps.INSTANCE, encodedNbt), IllegalStateException::new); - helper.succeed(); - }); - } +helper.assertTrue(decodedStack.hasData(attachmentType), "Decoded stack should have the data"); +helper.assertTrue(ItemStack.matches(stack, decodedStack), "Stacks should match"); - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that the presence of non-serializable attachments can be checked") - static void itemAttachmentPresence(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).build()); - - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - stack.setData(attachmentType, 1); - helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); - //Also check we can detect the presence if we don't know what types are attached - helper.assertTrue(stack.hasAttachments(), "Stack should have attached data"); +helper.succeed(); +}); +} - helper.succeed(); - }); - } +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that attachments can opt-out of serializing default values") +static void itemAttachmentSkipSerialization(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT, i -> i != 0).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +stack.setData(attachmentType, 1); +helper.assertTrue(stack.serializeAttachments() != null, "Stack should have serialized attachments"); +stack.setData(attachmentType, 0); +helper.assertTrue(stack.serializeAttachments() == null, "None of the stack's attachments should be serialized"); +helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); + +helper.succeed(); +}); +} - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that custom cloning behaviour works") - static void itemAttachmentCloning(final DynamicTest test, final RegistrationHelper reg) { - //Note: Modification of the data to create a copy is not intended and only used to verify that the data is cloned properly - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).copyHandler((holder, i) -> 2 * i).build()); +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that removing attachments works") +static void itemAttachmentRemoval(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +stack.setData(attachmentType, 1); +helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); +stack.removeData(attachmentType); +helper.assertFalse(stack.hasData(attachmentType), "Stack should not have attached data"); + +helper.succeed(); +}); +} - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - stack.setData(attachmentType, 1); - helper.assertTrue(stack.getData(attachmentType) == 1, "Stack should have attached data"); - stack = stack.copy(); - helper.assertTrue(stack.getData(attachmentType) == 2, "Stack cloner should have cloned and modified the data"); - helper.succeed(); - }); - } +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that the presence of non-serializable attachments can be checked") +static void itemAttachmentPresence(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +stack.setData(attachmentType, 1); +helper.assertTrue(stack.hasData(attachmentType), "Stack should have attached data"); +//Also check we can detect the presence if we don't know what types are attached +helper.assertTrue(stack.hasAttachments(), "Stack should have attached data"); + +helper.succeed(); +}); +} - @GameTest - @EmptyTemplate - @TestHolder(description = "Ensures that optional data can be queried") - static void itemAttachmentOptional(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).build()); +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that custom cloning behaviour works") +static void itemAttachmentCloning(final DynamicTest test, final RegistrationHelper reg) { +//Note: Modification of the data to create a copy is not intended and only used to verify that the data is cloned properly +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).copyHandler((holder, i) -> 2 * i).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +stack.setData(attachmentType, 1); +helper.assertTrue(stack.getData(attachmentType) == 1, "Stack should have attached data"); +stack = stack.copy(); +helper.assertTrue(stack.getData(attachmentType) == 2, "Stack cloner should have cloned and modified the data"); +helper.succeed(); +}); +} - test.onGameTest(helper -> { - ItemStack stack = Items.APPLE.getDefaultInstance(); - Optional optional = stack.getExistingData(attachmentType); - helper.assertTrue(optional.isEmpty(), "Optional should be empty"); - stack.setData(attachmentType, 1); - optional = stack.getExistingData(attachmentType); - helper.assertTrue(optional.isPresent(), "Optional should have attached data"); - helper.succeed(); - }); - } +@GameTest +@EmptyTemplate +@TestHolder(description = "Ensures that optional data can be queried") +static void itemAttachmentOptional(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).build()); + +test.onGameTest(helper -> { +ItemStack stack = Items.APPLE.getDefaultInstance(); +Optional optional = stack.getExistingData(attachmentType); +helper.assertTrue(optional.isEmpty(), "Optional should be empty"); +stack.setData(attachmentType, 1); +optional = stack.getExistingData(attachmentType); +helper.assertTrue(optional.isPresent(), "Optional should have attached data"); +helper.succeed(); +}); +}*/ } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockPropertyTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockPropertyTests.java index 248c769496..dde2aee965 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockPropertyTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockPropertyTests.java @@ -7,6 +7,7 @@ import java.util.function.Supplier; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.gametest.framework.GameTest; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; @@ -14,12 +15,12 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.server.level.ThreadedLevelLightEngine; -import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Items; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -57,7 +58,7 @@ static void levelSensitiveLight(final DynamicTest test, final RegistrationHelper test.onGameTest(helper -> helper.startSequence() .thenExecute(() -> helper.setBlock(lightPos, lightBlock.get())) - .thenExecute(() -> helper.useBlock(lightPos, helper.makeMockPlayer(), Items.ACACIA_BUTTON.getDefaultInstance())) + .thenExecute(() -> helper.useBlock(lightPos, helper.makeMockPlayer(GameType.CREATIVE), Items.ACACIA_BUTTON.getDefaultInstance())) .thenMap(() -> helper.getLevel().getChunkAt(helper.absolutePos(testPos))) .thenMap(chunk -> ((ThreadedLevelLightEngine) helper.getLevel().getLightEngine()).waitForPendingTasks(chunk.getPos().x, chunk.getPos().z)) .thenWaitUntil(future -> helper.assertTrue(future.isDone(), "Light engine did not update to lit")) @@ -111,8 +112,7 @@ public LightBlock(Properties properties, Supplier getUpdatePacket() { } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider holderLookup) { CompoundTag tag = pkt.getTag(); - if (tag != null) { + if (!tag.isEmpty()) { setLit(tag.getBoolean("lit")); } } @Override - public CompoundTag getUpdateTag() { - CompoundTag tag = super.getUpdateTag(); + public CompoundTag getUpdateTag(HolderLookup.Provider holderLookup) { + CompoundTag tag = super.getUpdateTag(holderLookup); tag.putBoolean("lit", lit); return tag; } @Override - public void handleUpdateTag(CompoundTag tag) { - super.handleUpdateTag(tag); + public void loadAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.loadAdditional(tag, holderLookup); lit = tag.getBoolean("lit"); } @Override - public void load(CompoundTag tag) { - super.load(tag); - lit = tag.getBoolean("lit"); - } - - @Override - protected void saveAdditional(CompoundTag tag) { - super.saveAdditional(tag); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.saveAdditional(tag, holderLookup); tag.putBoolean("lit", lit); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockTests.java index 40de055e23..a088831618 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/block/BlockTests.java @@ -14,7 +14,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -70,16 +70,16 @@ static void woodlessFenceGate(final DynamicTest test, final RegistrationHelper r } @GameTest - @EmptyTemplate(floor = true) + @EmptyTemplate(floor = true, value = "5x5x5") // barrier blocks may prevent respawn @TestHolder(description = "Tests if the Neo-added getRespawnPosition method correctly changes the position") static void customRespawnTest(final DynamicTest test, final RegistrationHelper reg) { final var respawn = reg.blocks().register("respawn", () -> new Block(BlockBehaviour.Properties.of()) { @Override - public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult blockHitResult) { + protected ItemInteractionResult useItemOn(ItemStack p_316304_, BlockState state, Level world, BlockPos pos, Player player, InteractionHand p_316595_, BlockHitResult p_316140_) { if (!world.isClientSide && player instanceof ServerPlayer serverPlayer) { serverPlayer.setRespawnPosition(world.dimension(), pos, 0, false, true); } - return InteractionResult.sidedSuccess(world.isClientSide); + return ItemInteractionResult.sidedSuccess(world.isClientSide); } @Override diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/FluidTemplatesTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/FluidTemplatesTests.java new file mode 100644 index 0000000000..b0d6f31f40 --- /dev/null +++ b/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/FluidTemplatesTests.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.debug.capabilities; + +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.Registries; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.material.Fluids; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.SimpleFluidContent; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.templates.FluidHandlerItemStack; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.testframework.TestFramework; +import net.neoforged.testframework.annotation.ForEachTest; +import net.neoforged.testframework.annotation.OnInit; +import net.neoforged.testframework.annotation.TestHolder; +import net.neoforged.testframework.gametest.EmptyTemplate; +import net.neoforged.testframework.gametest.ExtendedGameTestHelper; +import net.neoforged.testframework.registration.RegistrationHelper; + +@ForEachTest(groups = "capabilities.fluidtemplates") +public class FluidTemplatesTests { + private static final RegistrationHelper REG_HELPER = RegistrationHelper.create("neotests_capabilities_fluidtemplates"); + public static final DeferredHolder, DataComponentType> SIMPLE_FLUID_CONTENT = REG_HELPER + .registrar(Registries.DATA_COMPONENT_TYPE) + .register("simple_fluid_content", () -> DataComponentType.builder() + .persistent(SimpleFluidContent.CODEC) + .networkSynchronized(SimpleFluidContent.STREAM_CODEC).build()); + + @OnInit + static void register(final TestFramework framework) { + REG_HELPER.register(framework.modEventBus()); + } + + @GameTest + @EmptyTemplate + @TestHolder(description = "Tests that FluidHandlerItemStack works") + public static void testFluidHandlerItemStack(ExtendedGameTestHelper helper) { + ItemStack stack = Items.APPLE.getDefaultInstance(); + int capacity = 2 * FluidType.BUCKET_VOLUME; + var fluidHandler = new FluidHandlerItemStack(SIMPLE_FLUID_CONTENT.get(), stack, capacity); + + if (fluidHandler.getTanks() != 1) { + helper.fail("Expected a single tank"); + } + if (fluidHandler.getTankCapacity(0) != capacity) { + helper.fail("Expected tank capacity of " + capacity); + } + if (fluidHandler.getFluidInTank(0).getAmount() != 0) { + helper.fail("Expected empty tank"); + } + if (stack.has(SIMPLE_FLUID_CONTENT.get())) { + helper.fail("Expected no fluid stack component"); + } + + var waterStack = new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME); + if (fluidHandler.fill(waterStack, IFluidHandler.FluidAction.EXECUTE) != FluidType.BUCKET_VOLUME) { + helper.fail("Expected to be able to fill a bucket of water"); + } + if (!stack.has(SIMPLE_FLUID_CONTENT.get())) { + helper.fail("Expected fluid stack component"); + } + if (fluidHandler.getFluidInTank(0).getAmount() != FluidType.BUCKET_VOLUME) { + helper.fail("Expected a bucket of water"); + } + + var drained = fluidHandler.drain(FluidType.BUCKET_VOLUME, IFluidHandler.FluidAction.EXECUTE); + if (!FluidStack.matches(drained, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME))) { + helper.fail("Expected to drain a bucket of water"); + } + if (fluidHandler.getFluidInTank(0).getAmount() != 0) { + helper.fail("Expected empty tank"); + } + if (stack.has(SIMPLE_FLUID_CONTENT.get())) { + helper.fail("Expected no fluid stack component"); + } + + helper.succeed(); + } +} diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/VanillaHandlersTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/VanillaHandlersTests.java index 9d3aeb124b..7ffb86549f 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/VanillaHandlersTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/capabilities/VanillaHandlersTests.java @@ -115,25 +115,25 @@ public static void testCauldronCapability(ExtendedGameTestHelper helper) { helper.assertTrue(fillResult == 1000, "Filled " + fillResult); helper.assertBlockState(cauldronPos, state -> state.is(Blocks.WATER_CAULDRON) && state.getValue(LayeredCauldronBlock.LEVEL) == 3, () -> "Expected level 3 cauldron"); - helper.assertTrue(wrapper.getFluidInTank(0).equals(new FluidStack(Fluids.WATER, 1000)), "Expected 1000 water"); + helper.assertTrue(FluidStack.matches(wrapper.getFluidInTank(0), new FluidStack(Fluids.WATER, 1000)), "Expected 1000 water"); // Try to empty as well helper.assertTrue(wrapper.drain(new FluidStack(Fluids.LAVA, 1000), EXECUTE).isEmpty(), "Cannot drain lava"); helper.assertTrue(wrapper.drain(new FluidStack(Fluids.WATER, 999), EXECUTE).isEmpty(), "Cannot drain less than 1000 water"); - helper.assertTrue(wrapper.drain(new FluidStack(Fluids.WATER, 1000), EXECUTE).equals(new FluidStack(Fluids.WATER, 1000)), "Expected drain of 1000 water"); + helper.assertTrue(FluidStack.matches(wrapper.drain(new FluidStack(Fluids.WATER, 1000), EXECUTE), new FluidStack(Fluids.WATER, 1000)), "Expected drain of 1000 water"); helper.assertBlockPresent(Blocks.CAULDRON, cauldronPos); helper.assertTrue(wrapper.getFluidInTank(0).isEmpty(), "Expected empty handler"); // Try lava cauldron helper.setBlock(cauldronPos, Blocks.LAVA_CAULDRON); - helper.assertTrue(wrapper.getFluidInTank(0).equals(new FluidStack(Fluids.LAVA, 1000)), "Expected 1000 lava"); - helper.assertTrue(wrapper.drain(1000, EXECUTE).equals(new FluidStack(Fluids.LAVA, 1000)), "Expected drain of 1000 lava"); + helper.assertTrue(FluidStack.matches(wrapper.getFluidInTank(0), new FluidStack(Fluids.LAVA, 1000)), "Expected 1000 lava"); + helper.assertTrue(FluidStack.matches(wrapper.drain(1000, EXECUTE), new FluidStack(Fluids.LAVA, 1000)), "Expected drain of 1000 lava"); helper.assertBlockPresent(Blocks.CAULDRON, cauldronPos); // Try partial water filling helper.setBlock(cauldronPos, Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 2)); - helper.assertTrue(wrapper.getFluidInTank(0).equals(new FluidStack(Fluids.WATER, 666)), "Expected 666 water"); + helper.assertTrue(FluidStack.matches(wrapper.getFluidInTank(0), new FluidStack(Fluids.WATER, 666)), "Expected 666 water"); helper.assertTrue(wrapper.drain(1000, EXECUTE).isEmpty(), "Expected no water drain from partial cauldron"); helper.assertTrue(wrapper.fill(new FluidStack(Fluids.WATER, 1000), EXECUTE) == 0, "Expected no water fill to partial cauldron"); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/chat/CommandTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/chat/CommandTests.java index 8696527c07..ef24386902 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/chat/CommandTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/chat/CommandTests.java @@ -13,6 +13,7 @@ import net.minecraft.commands.CommandSource; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.core.Holder; import net.minecraft.gametest.framework.GameTest; import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; @@ -69,18 +70,18 @@ static void enumArgument(final DynamicTest test) { enum TestArgument { BLD { @Override - public MobEffect getEffect() { + public Holder getEffect() { return MobEffects.BLINDNESS; } }, NV { @Override - public MobEffect getEffect() { + public Holder getEffect() { return MobEffects.NIGHT_VISION; } }; - public abstract MobEffect getEffect(); + public abstract Holder getEffect(); } NeoForge.EVENT_BUS.addListener((final RegisterCommandsEvent event) -> { diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/client/GuiTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/client/GuiTests.java index e38ead199b..9eb8a90d52 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/client/GuiTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/client/GuiTests.java @@ -10,14 +10,19 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffects; import net.neoforged.api.distmarker.Dist; +import net.neoforged.neoforge.client.event.ClientChatEvent; +import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent; import net.neoforged.neoforge.client.event.ScreenEvent; +import net.neoforged.neoforge.client.gui.VanillaGuiLayers; import net.neoforged.neoforge.client.gui.widget.ExtendedButton; import net.neoforged.neoforge.client.gui.widget.ExtendedSlider; import net.neoforged.testframework.DynamicTest; @@ -106,4 +111,60 @@ private void pushLayerButton(Button button) { this.minecraft.pushGuiLayer(new TestLayer(Component.literal("LayerScreen"))); } } + + @TestHolder(description = "Checks that GUI layers can move hearts, air bubbles, etc") + static void testGuiLayerLeftRightHeight(DynamicTest test) { + test.framework().modEventBus().addListener((RegisterGuiLayersEvent event) -> { + event.registerBelow(VanillaGuiLayers.PLAYER_HEALTH, new ResourceLocation(test.createModId(), "left1"), makeLeftOverlay(test, 3, 0x80FF0000)); + event.registerBelow(VanillaGuiLayers.ARMOR_LEVEL, new ResourceLocation(test.createModId(), "left2"), makeLeftOverlay(test, 3, 0x80CC0000)); + event.registerAbove(VanillaGuiLayers.ARMOR_LEVEL, new ResourceLocation(test.createModId(), "left3"), makeLeftOverlay(test, 3, 0x80990000)); + + event.registerBelow(VanillaGuiLayers.FOOD_LEVEL, new ResourceLocation(test.createModId(), "right1"), makeRightOverlay(test, 2, 0x8000FF00)); + event.registerBelow(VanillaGuiLayers.VEHICLE_HEALTH, new ResourceLocation(test.createModId(), "right2"), makeRightOverlay(test, 2, 0x8000DD00)); + event.registerBelow(VanillaGuiLayers.AIR_LEVEL, new ResourceLocation(test.createModId(), "right3"), makeRightOverlay(test, 2, 0x8000BB00)); + event.registerAbove(VanillaGuiLayers.AIR_LEVEL, new ResourceLocation(test.createModId(), "right4"), makeRightOverlay(test, 2, 0x80009900)); + }); + + test.eventListeners().forge().addListener((ClientChatEvent chatEvent) -> { + if (chatEvent.getMessage().equalsIgnoreCase("gui layer test")) { + test.requestConfirmation(Minecraft.getInstance().player, Component.literal( + """ + Do you see green rectangles on the right and red rectangles on the left? + Do the vanilla hearts, armor, food, vehicle health and air overlays move accordingly? + """)); + } + }); + } + + private static LayeredDraw.Layer makeRightOverlay(DynamicTest test, int height, int color) { + return (guiGraphics, partialTick) -> { + if (!test.framework().tests().isEnabled(test.id())) { + return; + } + var gui = Minecraft.getInstance().gui; + guiGraphics.fill( + guiGraphics.guiWidth() / 2 + 91 - 80, + guiGraphics.guiHeight() - gui.rightHeight + 9 - height, + guiGraphics.guiWidth() / 2 + 91, + guiGraphics.guiHeight() - gui.rightHeight + 9, + color); + gui.rightHeight += height + 1; + }; + } + + private static LayeredDraw.Layer makeLeftOverlay(DynamicTest test, int height, int color) { + return (guiGraphics, partialTick) -> { + if (!test.framework().tests().isEnabled(test.id())) { + return; + } + var gui = Minecraft.getInstance().gui; + guiGraphics.fill( + guiGraphics.guiWidth() / 2 - 91, + guiGraphics.guiHeight() - gui.leftHeight + 9 - height, + guiGraphics.guiWidth() / 2 - 91 + 80, + guiGraphics.guiHeight() - gui.leftHeight + 9, + color); + gui.leftHeight += height + 1; + }; + } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/crafting/IngredientTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/crafting/IngredientTests.java index 0d8e19062c..6e1bf3dfdc 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/crafting/IngredientTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/crafting/IngredientTests.java @@ -5,26 +5,23 @@ package net.neoforged.neoforge.debug.crafting; -import com.mojang.serialization.Codec; -import java.util.Optional; import net.minecraft.core.FrontAndTop; +import net.minecraft.core.component.DataComponents; import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.gametest.framework.GameTest; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CrafterBlock; import net.minecraft.world.level.block.entity.CrafterBlockEntity; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.neoforged.neoforge.attachment.AttachmentType; -import net.neoforged.neoforge.common.crafting.NBTIngredient; -import net.neoforged.neoforge.registries.NeoForgeRegistries; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; import net.neoforged.testframework.annotation.TestHolder; @@ -38,13 +35,13 @@ public class IngredientTests { @EmptyTemplate @TestHolder(description = "Tests if partial NBT ingredients match the correct stacks") static void partialNBTIngredient(final DynamicTest test, final RegistrationHelper reg) { - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { + reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput(), event.getLookupProvider()) { @Override protected void buildRecipes(RecipeOutput output) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.ALLIUM) .pattern("IDE") .define('I', new TestEnabledIngredient( - NBTIngredient.of(false, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 2), Items.IRON_AXE), + DataComponentIngredient.of(false, DataComponents.DAMAGE, 2, Items.IRON_AXE), test.framework(), test.id())) .define('D', Items.DIAMOND) .define('E', Items.EMERALD) @@ -71,8 +68,8 @@ protected void buildRecipes(RecipeOutput output) { .thenIdle(5) // Crafter cooldown // Axe is now damaged, we expect the recipe to work, even if we also add other random values to the compound - .thenExecute(crafter -> crafter.getItem(0).hurt(2, helper.getLevel().random, null)) - .thenExecute(crafter -> crafter.getItem(0).getTag().putFloat("abcd", helper.getLevel().random.nextFloat())) + .thenExecute(crafter -> crafter.getItem(0).hurtAndBreak(2, helper.getLevel().random, null, () -> {})) + .thenExecute(crafter -> CustomData.update(DataComponents.CUSTOM_DATA, crafter.getItem(0), tag -> tag.putFloat("abcd", helper.getLevel().random.nextFloat()))) .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ALLIUM)) @@ -84,12 +81,12 @@ protected void buildRecipes(RecipeOutput output) { @EmptyTemplate @TestHolder(description = "Tests if strict NBT ingredients match the correct stacks") static void strictNBTIngredient(final DynamicTest test, final RegistrationHelper reg) { - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { + reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput(), event.getLookupProvider()) { @Override protected void buildRecipes(RecipeOutput output) { ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ACACIA_BOAT) .requires(new TestEnabledIngredient( - NBTIngredient.of(true, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 4), Items.DIAMOND_PICKAXE), + DataComponentIngredient.of(true, DataComponents.DAMAGE, 4, Items.DIAMOND_PICKAXE), test.framework(), test.id())) .requires(Items.ACACIA_PLANKS) .unlockedBy("has_pick", has(Items.DIAMOND_PICKAXE)) @@ -103,7 +100,7 @@ protected void buildRecipes(RecipeOutput output) { .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.DIAMOND_PICKAXE, 1, Optional.of(putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 1))))) + .thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.DIAMOND_PICKAXE.builtInRegistryHolder(), 1, net.minecraft.core.component.DataComponentPatch.builder().set(net.minecraft.core.component.DataComponents.DAMAGE, 1).build()))) .thenExecute(crafter -> crafter.setItem(0, Items.ACACIA_PLANKS.getDefaultInstance())) .thenIdle(3) @@ -114,8 +111,8 @@ protected void buildRecipes(RecipeOutput output) { .thenIdle(5) // Crafter cooldown // Pickaxe now has a damage value of 4, but superfluous nbt tags, so the recipe should still not work - .thenExecute(crafter -> crafter.getItem(1).hurt(3, helper.getLevel().random, null)) - .thenExecute(crafter -> crafter.getItem(1).getOrCreateTag().putFloat("abcd", 12f)) + .thenExecute(crafter -> crafter.getItem(1).hurtAndBreak(3, helper.getLevel().random, null, () -> {})) + .thenExecute(crafter -> CustomData.update(DataComponents.CUSTOM_DATA, crafter.getItem(1), tag -> tag.putFloat("abcd", 12f))) .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) @@ -123,250 +120,250 @@ protected void buildRecipes(RecipeOutput output) { .thenIdle(5) // Crafter cooldown // The superfluous element is gone, so the recipe should now work - .thenExecute(crafter -> crafter.getItem(1).removeTagKey("abcd")) + .thenExecute(crafter -> CustomData.update(DataComponents.CUSTOM_DATA, crafter.getItem(1), tag -> tag.remove("abcd"))) .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ACACIA_BOAT)) .thenSucceed()); } +/* +@GameTest +@EmptyTemplate +@TestHolder(description = "Tests if partial NBT ingredients match the correct stacks using partial attachments") +static void partialAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); +var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { +@Override +protected void buildRecipes(RecipeOutput output) { +ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.POPPY) +.pattern("IDE") +.define('I', new TestEnabledIngredient( +DataComponentIngredient.ofAttachment(false, putInt(new CompoundTag(), attachmentType.getId().toString(), 1), Items.IRON_PICKAXE), +test.framework(), test.id())) +.define('D', Items.DIAMOND) +.define('E', Items.EMERALD) +.unlockedBy("has_pick", has(Items.IRON_PICKAXE)) +.save(output, new ResourceLocation(reg.modId(), "partial_attachments")); +} +}); - @GameTest - @EmptyTemplate - @TestHolder(description = "Tests if partial NBT ingredients match the correct stacks using partial attachments") - static void partialAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput output) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.POPPY) - .pattern("IDE") - .define('I', new TestEnabledIngredient( - NBTIngredient.ofAttachment(false, putInt(new CompoundTag(), attachmentType.getId().toString(), 1), Items.IRON_PICKAXE), - test.framework(), test.id())) - .define('D', Items.DIAMOND) - .define('E', Items.EMERALD) - .unlockedBy("has_pick", has(Items.IRON_PICKAXE)) - .save(output, new ResourceLocation(reg.modId(), "partial_attachments")); - } - }); - - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(0, Items.IRON_PICKAXE.getDefaultInstance())) - .thenExecute(crafter -> crafter.setItem(1, Items.DIAMOND.getDefaultInstance())) - .thenExecute(crafter -> crafter.setItem(2, Items.EMERALD.getDefaultInstance())) - .thenIdle(3) +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> crafter.setItem(0, Items.IRON_PICKAXE.getDefaultInstance())) +.thenExecute(crafter -> crafter.setItem(1, Items.DIAMOND.getDefaultInstance())) +.thenExecute(crafter -> crafter.setItem(2, Items.EMERALD.getDefaultInstance())) +.thenIdle(3) - // Pick has no attachments, the recipe shouldn't work - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +// Pick has no attachments, the recipe shouldn't work +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Pick now has the attachment, we expect the recipe to work, even if we also add other random attachments and nbt - .thenExecute(crafter -> crafter.getItem(0).setData(attachmentType, 1)) - .thenExecute(crafter -> crafter.getItem(0).setData(altAttachmentType, true)) - .thenExecute(crafter -> crafter.getItem(0).getTag().putFloat("abcd", helper.getLevel().random.nextFloat())) +// Pick now has the attachment, we expect the recipe to work, even if we also add other random attachments and nbt +.thenExecute(crafter -> crafter.getItem(0).setData(attachmentType, 1)) +.thenExecute(crafter -> crafter.getItem(0).setData(altAttachmentType, true)) +.thenExecute(crafter -> crafter.getItem(0).getTag().putFloat("abcd", helper.getLevel().random.nextFloat())) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.POPPY)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.POPPY)) - .thenSucceed()); - } +.thenSucceed()); +} - @GameTest - @EmptyTemplate - @TestHolder(description = "Tests if strict NBT ingredients match the correct stacks using attachments") - static void strictAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput output) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ACACIA_CHEST_BOAT) - .requires(new TestEnabledIngredient( - NBTIngredient.ofAttachment(true, putInt(new CompoundTag(), attachmentType.getId().toString(), 4), Items.APPLE), - test.framework(), test.id())) - .requires(Items.ACACIA_PLANKS) - .unlockedBy("has_apple", has(Items.APPLE)) - .save(output, new ResourceLocation(reg.modId(), "strict_attachments")); - } - }); +@GameTest +@EmptyTemplate +@TestHolder(description = "Tests if strict NBT ingredients match the correct stacks using attachments") +static void strictAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); +var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { +@Override +protected void buildRecipes(RecipeOutput output) { +ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ACACIA_CHEST_BOAT) +.requires(new TestEnabledIngredient( +DataComponentIngredient.ofAttachment(true, putInt(new CompoundTag(), attachmentType.getId().toString(), 4), Items.APPLE), +test.framework(), test.id())) +.requires(Items.ACACIA_PLANKS) +.unlockedBy("has_apple", has(Items.APPLE)) +.save(output, new ResourceLocation(reg.modId(), "strict_attachments")); +} +}); - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.APPLE, 1, putInt(new CompoundTag(), attachmentType.getId().toString(), 3)))) - .thenExecute(crafter -> crafter.setItem(0, Items.ACACIA_PLANKS.getDefaultInstance())) - .thenIdle(3) +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.APPLE, 1, putInt(new CompoundTag(), attachmentType.getId().toString(), 3)))) +.thenExecute(crafter -> crafter.setItem(0, Items.ACACIA_PLANKS.getDefaultInstance())) +.thenIdle(3) - // Axe has the attachment but at the wrong value, so, the recipe shouldn't work - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +// Axe has the attachment but at the wrong value, so, the recipe shouldn't work +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Axe now has the attachment at the correct value of 4, but has other superfluous attachments, so the recipe should still not work - .thenExecute(crafter -> crafter.getItem(1).setData(attachmentType, 4)) - .thenExecute(crafter -> crafter.getItem(1).setData(altAttachmentType, true)) +// Axe now has the attachment at the correct value of 4, but has other superfluous attachments, so the recipe should still not work +.thenExecute(crafter -> crafter.getItem(1).setData(attachmentType, 4)) +.thenExecute(crafter -> crafter.getItem(1).setData(altAttachmentType, true)) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Axe now has the attachment at the correct value of 4, without superfluous attachments, but has nbt, so the recipe should still not work - .thenExecute(crafter -> crafter.getItem(1).removeData(altAttachmentType)) - .thenExecute(crafter -> crafter.getItem(1).getOrCreateTag().putFloat("abcd", 12f)) +// Axe now has the attachment at the correct value of 4, without superfluous attachments, but has nbt, so the recipe should still not work +.thenExecute(crafter -> crafter.getItem(1).removeData(altAttachmentType)) +.thenExecute(crafter -> crafter.getItem(1).getOrCreateTag().putFloat("abcd", 12f)) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // The superfluous element is gone, so the recipe should now work - .thenExecute(crafter -> crafter.getItem(1).removeTagKey("abcd")) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ACACIA_CHEST_BOAT)) +// The superfluous element is gone, so the recipe should now work +.thenExecute(crafter -> crafter.getItem(1).removeTagKey("abcd")) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ACACIA_CHEST_BOAT)) - .thenSucceed()); - } +.thenSucceed()); +} - @GameTest - @EmptyTemplate - @TestHolder(description = "Tests if partial NBT ingredients match the correct stacks using partial attachments and nbt") - static void partialNbtAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput output) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.AZALEA) - .pattern("IDE") - .define('I', new TestEnabledIngredient( - NBTIngredient.of(false, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 2), putInt(new CompoundTag(), attachmentType.getId().toString(), 1), Items.NETHERITE_PICKAXE), - test.framework(), test.id())) - .define('D', Items.DIAMOND) - .define('E', Items.EMERALD) - .unlockedBy("has_pick", has(Items.NETHERITE_PICKAXE)) - .save(output, new ResourceLocation(reg.modId(), "partial_nbt_and_attachments")); - } - }); +@GameTest +@EmptyTemplate +@TestHolder(description = "Tests if partial NBT ingredients match the correct stacks using partial attachments and nbt") +static void partialNbtAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); +var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { +@Override +protected void buildRecipes(RecipeOutput output) { +ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.AZALEA) +.pattern("IDE") +.define('I', new TestEnabledIngredient( +DataComponentIngredient.of(false, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 2), putInt(new CompoundTag(), attachmentType.getId().toString(), 1), Items.NETHERITE_PICKAXE), +test.framework(), test.id())) +.define('D', Items.DIAMOND) +.define('E', Items.EMERALD) +.unlockedBy("has_pick", has(Items.NETHERITE_PICKAXE)) +.save(output, new ResourceLocation(reg.modId(), "partial_nbt_and_attachments")); +} +}); - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(0, Items.NETHERITE_PICKAXE.getDefaultInstance())) - .thenExecute(crafter -> crafter.setItem(1, Items.DIAMOND.getDefaultInstance())) - .thenExecute(crafter -> crafter.setItem(2, Items.EMERALD.getDefaultInstance())) - .thenIdle(3) +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> crafter.setItem(0, Items.NETHERITE_PICKAXE.getDefaultInstance())) +.thenExecute(crafter -> crafter.setItem(1, Items.DIAMOND.getDefaultInstance())) +.thenExecute(crafter -> crafter.setItem(2, Items.EMERALD.getDefaultInstance())) +.thenIdle(3) - // Pick has no attachments, the recipe shouldn't work - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +// Pick has no attachments, the recipe shouldn't work +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Pick now has the correct damage and attachment, we expect the recipe to work, even if we also add other random attachments and nbt - .thenExecute(crafter -> crafter.getItem(0).hurt(2, helper.getLevel().random, null)) - .thenExecute(crafter -> crafter.getItem(0).setData(attachmentType, 1)) - .thenExecute(crafter -> crafter.getItem(0).setData(altAttachmentType, true)) - .thenExecute(crafter -> crafter.getItem(0).getTag().putFloat("abcd", helper.getLevel().random.nextFloat())) +// Pick now has the correct damage and attachment, we expect the recipe to work, even if we also add other random attachments and nbt +.thenExecute(crafter -> crafter.getItem(0).hurt(2, helper.getLevel().random, null)) +.thenExecute(crafter -> crafter.getItem(0).setData(attachmentType, 1)) +.thenExecute(crafter -> crafter.getItem(0).setData(altAttachmentType, true)) +.thenExecute(crafter -> crafter.getItem(0).getTag().putFloat("abcd", helper.getLevel().random.nextFloat())) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.AZALEA)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.AZALEA)) - .thenSucceed()); - } +.thenSucceed()); +} - @GameTest - @EmptyTemplate - @TestHolder(description = "Tests if strict NBT ingredients match the correct stacks using attachments and nbt") - static void strictNbtAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { - var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); - var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) - .register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); - - reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { - @Override - protected void buildRecipes(RecipeOutput output) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ACACIA_FENCE) - .requires(new TestEnabledIngredient( - NBTIngredient.of(true, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 4), putInt(new CompoundTag(), attachmentType.getId().toString(), 4), Items.DIAMOND_AXE), - test.framework(), test.id())) - .requires(Items.ACACIA_PLANKS) - .unlockedBy("has_axe", has(Items.DIAMOND_AXE)) - .save(output, new ResourceLocation(reg.modId(), "strict_attachments")); - } - }); +@GameTest +@EmptyTemplate +@TestHolder(description = "Tests if strict NBT ingredients match the correct stacks using attachments and nbt") +static void strictNbtAttachmentIngredient(final DynamicTest test, final RegistrationHelper reg) { +var attachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_int", () -> AttachmentType.builder(() -> 0).serialize(Codec.INT).build()); +var altAttachmentType = reg.registrar(NeoForgeRegistries.Keys.ATTACHMENT_TYPES) +.register("test_bool", () -> AttachmentType.builder(() -> false).serialize(Codec.BOOL).build()); + +reg.addProvider(event -> new RecipeProvider(event.getGenerator().getPackOutput()) { +@Override +protected void buildRecipes(RecipeOutput output) { +ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ACACIA_FENCE) +.requires(new TestEnabledIngredient( +DataComponentIngredient.of(true, putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 4), putInt(new CompoundTag(), attachmentType.getId().toString(), 4), Items.DIAMOND_AXE), +test.framework(), test.id())) +.requires(Items.ACACIA_PLANKS) +.unlockedBy("has_axe", has(Items.DIAMOND_AXE)) +.save(output, new ResourceLocation(reg.modId(), "strict_attachments")); +} +}); - test.onGameTest(helper -> helper - .startSequence() - .thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) - .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) +test.onGameTest(helper -> helper +.startSequence() +.thenExecute(() -> helper.setBlock(1, 1, 1, Blocks.CRAFTER.defaultBlockState().setValue(BlockStateProperties.ORIENTATION, FrontAndTop.UP_NORTH).setValue(CrafterBlock.CRAFTING, true))) +.thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST)) - .thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) - .thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.DIAMOND_AXE, 1, putInt(new CompoundTag(), attachmentType.getId().toString(), 3)))) - .thenExecute(crafter -> crafter.getItem(1).setTag(putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 1))) - .thenExecute(crafter -> crafter.setItem(0, Items.ACACIA_PLANKS.getDefaultInstance())) - .thenIdle(3) +.thenMap(() -> helper.requireBlockEntity(1, 1, 1, CrafterBlockEntity.class)) +.thenExecute(crafter -> crafter.setItem(1, new ItemStack(Items.DIAMOND_AXE, 1, putInt(new CompoundTag(), attachmentType.getId().toString(), 3)))) +.thenExecute(crafter -> crafter.getItem(1).setTag(putInt(new CompoundTag(), ItemStack.TAG_DAMAGE, 1))) +.thenExecute(crafter -> crafter.setItem(0, Items.ACACIA_PLANKS.getDefaultInstance())) +.thenIdle(3) - // Axe is damaged and has the attachment but at the wrong value, so, the recipe shouldn't work - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +// Axe is damaged and has the attachment but at the wrong value, so, the recipe shouldn't work +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Axe now has the attachment and damage at the correct value of 4, but has other superfluous attachments, so the recipe should still not work - .thenExecute(crafter -> crafter.getItem(1).hurt(3, helper.getLevel().random, null)) - .thenExecute(crafter -> crafter.getItem(1).setData(attachmentType, 4)) - .thenExecute(crafter -> crafter.getItem(1).setData(altAttachmentType, true)) +// Axe now has the attachment and damage at the correct value of 4, but has other superfluous attachments, so the recipe should still not work +.thenExecute(crafter -> crafter.getItem(1).hurt(3, helper.getLevel().random, null)) +.thenExecute(crafter -> crafter.getItem(1).setData(attachmentType, 4)) +.thenExecute(crafter -> crafter.getItem(1).setData(altAttachmentType, true)) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // Axe now has the attachment at the correct value of 4, without superfluous attachments, but has superfluous nbt, so the recipe should still not work - .thenExecute(crafter -> crafter.getItem(1).removeData(altAttachmentType)) - .thenExecute(crafter -> crafter.getItem(1).getOrCreateTag().putFloat("abcd", 12f)) +// Axe now has the attachment at the correct value of 4, without superfluous attachments, but has superfluous nbt, so the recipe should still not work +.thenExecute(crafter -> crafter.getItem(1).removeData(altAttachmentType)) +.thenExecute(crafter -> crafter.getItem(1).getOrCreateTag().putFloat("abcd", 12f)) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerEmpty(1, 2, 1)) - .thenIdle(5) // Crafter cooldown +.thenIdle(5) // Crafter cooldown - // The superfluous element is gone, so the recipe should now work - .thenExecute(crafter -> crafter.getItem(1).removeTagKey("abcd")) - .thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) - .thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ACACIA_FENCE)) +// The superfluous element is gone, so the recipe should now work +.thenExecute(crafter -> crafter.getItem(1).removeTagKey("abcd")) +.thenExecute(() -> helper.pulseRedstone(1, 1, 2, 2)) +.thenExecuteAfter(7, () -> helper.assertContainerContains(1, 2, 1, Items.ACACIA_FENCE)) - .thenSucceed()); - } +.thenSucceed()); +} - private static CompoundTag putInt(CompoundTag tag, String key, int value) { - tag.putInt(key, value); - return tag; - } +private static CompoundTag putInt(CompoundTag tag, String key, int value) { +tag.putInt(key, value); +return tag; +}*/ } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/damagesource/DamageTypeTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/damagesource/DamageTypeTests.java index 97e9e2a46a..35a0e9d86d 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/damagesource/DamageTypeTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/damagesource/DamageTypeTests.java @@ -29,6 +29,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameType; import net.minecraft.world.phys.Vec3; import net.neoforged.neoforge.common.damagesource.IDeathMessageProvider; import net.neoforged.neoforge.common.damagesource.IScalingFunction; @@ -91,7 +92,7 @@ public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) test.onGameTest(helper -> { Skeleton target = helper.spawnWithNoFreeWill(EntityType.SKELETON, 1, 1, 1); - Player attacker = helper.makeMockSurvivalPlayer(); + Player attacker = helper.makeMockPlayer(GameType.SURVIVAL); attacker.moveTo(helper.absoluteVec(new Vec3(2, 1, 1))); attacker.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(customSword)); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/effect/MobEffectTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/effect/MobEffectTests.java index fa8d94eea9..79fd33c612 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/effect/MobEffectTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/effect/MobEffectTests.java @@ -66,23 +66,23 @@ public void fillEffectCures(Set cures, MobEffectInstance effectInsta pig.removeEffectsCuredBy(testCure); helper.assertMobEffectAbsent(pig, MobEffects.NIGHT_VISION, "'nightvision removed by test cure'"); - pig.addEffect(new MobEffectInstance(testEffect.get())); - helper.assertMobEffectPresent(pig, testEffect.get(), "'test effect was applied'"); + pig.addEffect(new MobEffectInstance(testEffect)); + helper.assertMobEffectPresent(pig, testEffect, "'test effect was applied'"); pig.removeEffectsCuredBy(EffectCures.MILK); - helper.assertMobEffectPresent(pig, testEffect.get(), "'test effect not removed by milk'"); + helper.assertMobEffectPresent(pig, testEffect, "'test effect not removed by milk'"); pig.removeEffectsCuredBy(testCureTwo); - helper.assertMobEffectAbsent(pig, testEffect.get(), "'test effect removed by test cure'"); + helper.assertMobEffectAbsent(pig, testEffect, "'test effect removed by test cure'"); MobEffectInstance srcInst = new MobEffectInstance(MobEffects.CONFUSION); - MobEffectInstance destInst = MobEffectInstance.load(srcInst.save(new CompoundTag())); + MobEffectInstance destInst = MobEffectInstance.load((CompoundTag) srcInst.save()); helper.assertTrue(srcInst.getCures().equals(destInst.getCures()), "'MobEffectInstance serialization roundtrip (standard cures)'"); srcInst.getCures().add(testCure); - destInst = MobEffectInstance.load(srcInst.save(new CompoundTag())); + destInst = MobEffectInstance.load((CompoundTag) srcInst.save()); helper.assertTrue(srcInst.getCures().equals(destInst.getCures()), "'MobEffectInstance serialization roundtrip (custom additional cure)'"); srcInst.getCures().clear(); - destInst = MobEffectInstance.load(srcInst.save(new CompoundTag())); + destInst = MobEffectInstance.load((CompoundTag) srcInst.save()); helper.assertTrue(srcInst.getCures().equals(destInst.getCures()), "'MobEffectInstance serialization roundtrip (no cures)'"); helper.succeed(); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/enchantment/EnchantmentLevelTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/enchantment/EnchantmentLevelTests.java index 2b13fc213d..7d02bc59ef 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/enchantment/EnchantmentLevelTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/enchantment/EnchantmentLevelTests.java @@ -5,12 +5,14 @@ package net.neoforged.neoforge.debug.enchantment; -import java.util.Map; +import net.minecraft.core.component.DataComponents; import net.minecraft.gametest.framework.GameTest; +import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.neoforged.neoforge.event.enchanting.GetEnchantmentLevelEvent; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; @@ -27,17 +29,17 @@ public class EnchantmentLevelTests { @TestHolder(description = "Tests whether the GetEnchantmentLevelEvent can properly modify enchantment levels.") static void getEnchLevelEvent(final DynamicTest test, final RegistrationHelper reg) { test.eventListeners().forge().addListener((GetEnchantmentLevelEvent e) -> { - Map enchants = e.getEnchantments(); + ItemEnchantments.Mutable enchants = e.getEnchantments(); // Increase the level of sharpness by 1 in all cases. if (e.isTargetting(Enchantments.SHARPNESS)) { - enchants.put(Enchantments.SHARPNESS, enchants.getOrDefault(Enchantments.SHARPNESS, 0) + 1); + enchants.set(Enchantments.SHARPNESS, enchants.getLevel(Enchantments.SHARPNESS) + 1); } // Increase the level of fire aspect by 1 if the stack contains specific NBT. if (e.isTargetting(Enchantments.FIRE_ASPECT)) { - if (e.getStack().getTagElement("boost_fire_aspect") != null) { - enchants.put(Enchantments.FIRE_ASPECT, enchants.getOrDefault(Enchantments.FIRE_ASPECT, 0) + 1); + if (e.getStack().getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).contains("boost_fire_aspect")) { + enchants.set(Enchantments.FIRE_ASPECT, enchants.getLevel(Enchantments.FIRE_ASPECT) + 1); } } }); @@ -49,7 +51,7 @@ static void getEnchLevelEvent(final DynamicTest test, final RegistrationHelper r helper.assertTrue(stack.getEnchantmentLevel(Enchantments.FIRE_ASPECT) == 0, "Fire Aspect level was not zero"); helper.assertTrue(stack.getEnchantmentLevel(Enchantments.SHARPNESS) == 1, "Sharpness level was not one"); - stack.getOrCreateTagElement("boost_fire_aspect"); // Creates the sub-compound "boost_fire_aspect" which will trigger the event listener above. + CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("boost_fire_aspect", new CompoundTag())); // Creates the sub-compound "boost_fire_aspect" which will trigger the event listener above. stack.enchant(Enchantments.SHARPNESS, 5); helper.assertTrue(stack.getEnchantmentLevel(Enchantments.FIRE_ASPECT) == 1, "Fire Aspect level was not one"); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityDataSerializerTest.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityDataSerializerTest.java index 43a2b63efc..9ae494f84d 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityDataSerializerTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityDataSerializerTest.java @@ -11,6 +11,8 @@ import net.minecraft.gametest.framework.GameTest; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializer; @@ -38,7 +40,7 @@ public class EntityDataSerializerTest { private static final RegistrationHelper REG_HELPER = RegistrationHelper.create("neotests_custom_entity_data_serializer"); private static final DeferredHolder, EntityDataSerializer> TEST_SERIALIZER = REG_HELPER .registrar(NeoForgeRegistries.Keys.ENTITY_DATA_SERIALIZERS) - .register("test_serializer", () -> EntityDataSerializer.simple((buf, b) -> buf.writeByte(b), FriendlyByteBuf::readByte)); + .register("test_serializer", () -> EntityDataSerializer.forValueType(ByteBufCodecs.BYTE)); @OnInit static void register(final TestFramework framework) { @@ -61,7 +63,7 @@ static void customEntityDataSerializer(final DynamicTest test, final Registratio } var pkt = new ClientboundSetEntityDataPacket(entity.getId(), items); FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); - pkt.write(buf); + ClientboundSetEntityDataPacket.STREAM_CODEC.encode(new RegistryFriendlyByteBuf(buf, helper.getLevel().registryAccess()), pkt); helper.assertTrue(buf.readVarInt() == entity.getId(), "Entity ID didn't match"); // Drop entity ID buf.readByte(); // Drop item ID int expectedId = NeoForgeRegistries.ENTITY_DATA_SERIALIZERS.getId(TEST_SERIALIZER.get()) + CommonHooks.VANILLA_SERIALIZER_LIMIT; @@ -83,8 +85,8 @@ public TestEntity(EntityType entityType, Level level) { } @Override - protected void defineSynchedData() { - entityData.define(DATA_TEST_VALUE, (byte) 0); + protected void defineSynchedData(SynchedEntityData.Builder p_326003_) { + p_326003_.define(DATA_TEST_VALUE, (byte) 0); } @Override diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityEventTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityEventTests.java index c8db662eb8..d967be09ad 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityEventTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityEventTests.java @@ -61,12 +61,12 @@ static void entityTeleportEvent(final DynamicTest test) { static void entityAttributeModificationEvent(final DynamicTest test, final RegistrationHelper reg) { final var testAttr = reg.registrar(Registries.ATTRIBUTE).register("test_attribute", () -> new RangedAttribute(reg.modId() + ".test_attr", 1.5D, 0.0D, 1024.0D).setSyncable(true)); test.framework().modEventBus().addListener((final EntityAttributeModificationEvent event) -> { - event.add(EntityType.DONKEY, testAttr.get()); + event.add(EntityType.DONKEY, testAttr); }); test.onGameTest(helper -> helper.startSequence(() -> helper.spawnWithNoFreeWill(EntityType.DONKEY, 1, 2, 1)) .thenExecute(donkey -> helper.assertEntityProperty( - donkey, d -> d.getAttribute(testAttr.get()).getValue(), "test attribute", 1.5D)) + donkey, d -> d.getAttribute(testAttr).getValue(), "test attribute", 1.5D)) .thenSucceed()); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityTests.java index a3e34cefd4..33077fddfc 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/EntityTests.java @@ -11,7 +11,10 @@ import net.minecraft.gametest.framework.GameTest; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; @@ -44,7 +47,7 @@ static void customSpawnLogic(final DynamicTest test, final RegistrationHelper re .sized(1, 1)).withLang("Simple spawn egg").withRenderer(() -> NoopRenderer::new); reg.eventListeners().accept((Consumer) event -> event.registrar("test") - .play(CustomSyncPayload.ID, CustomSyncPayload::new, (payload, context) -> {})); + .play(EntityTests.CustomSyncPayload.TYPE, CustomSyncPayload.STREAM_CODEC, (payload, context) -> {})); test.onGameTest(helper -> { helper.startSequence(() -> helper.makeTickingMockServerPlayerInCorner(GameType.SURVIVAL)) @@ -87,7 +90,7 @@ public CustomComplexSpawnEntity(EntityType type, Level level) { } @Override - protected void defineSynchedData() {} + protected void defineSynchedData(SynchedEntityData.Builder builder) {} @Override protected void readAdditionalSaveData(CompoundTag tag) {} @@ -96,10 +99,10 @@ protected void readAdditionalSaveData(CompoundTag tag) {} protected void addAdditionalSaveData(CompoundTag tag) {} @Override - public void writeSpawnData(FriendlyByteBuf buffer) {} + public void writeSpawnData(RegistryFriendlyByteBuf buffer) {} @Override - public void readSpawnData(FriendlyByteBuf additionalData) {} + public void readSpawnData(RegistryFriendlyByteBuf additionalData) {} } public static final class AdaptedSpawnEntity extends Entity { @@ -108,7 +111,7 @@ public AdaptedSpawnEntity(EntityType type, Level level) { } @Override - protected void defineSynchedData() {} + protected void defineSynchedData(SynchedEntityData.Builder builder) {} @Override protected void readAdditionalSaveData(CompoundTag tag) {} @@ -128,7 +131,7 @@ public SimpleEntity(EntityType type, Level level) { } @Override - protected void defineSynchedData() {} + protected void defineSynchedData(SynchedEntityData.Builder builder) {} @Override protected void readAdditionalSaveData(CompoundTag tag) {} @@ -138,18 +141,12 @@ protected void addAdditionalSaveData(CompoundTag tag) {} } public record CustomSyncPayload() implements CustomPacketPayload { - private static final ResourceLocation ID = new ResourceLocation("test", "custom_sync_payload"); - - public CustomSyncPayload(FriendlyByteBuf buf) { - this(); - } - - @Override - public void write(FriendlyByteBuf buf) {} + private static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>(new ResourceLocation("test", "custom_sync_payload")); + private static final StreamCodec STREAM_CODEC = StreamCodec.unit(new EntityTests.CustomSyncPayload()); @Override - public ResourceLocation id() { - return ID; + public CustomPacketPayload.Type type() { + return TYPE; } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/living/LivingEntityEventTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/living/LivingEntityEventTests.java index 6bcf9a1bec..afa040f22a 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/living/LivingEntityEventTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/living/LivingEntityEventTests.java @@ -11,6 +11,7 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestAssertException; import net.minecraft.nbt.CompoundTag; @@ -33,7 +34,7 @@ import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.GameType; import net.neoforged.fml.util.ObfuscationReflectionHelper; @@ -130,7 +131,7 @@ static void getProjectileEvent(final DynamicTest test, final RegistrationHelper test.eventListeners().forge().addListener((final LivingGetProjectileEvent event) -> { if (event.getEntity().getData(shootsFireRes)) { event.setProjectileItemStack(new ItemStack(Items.TIPPED_ARROW)); - PotionUtils.setPotion(event.getProjectileItemStack(), Potions.FIRE_RESISTANCE); + event.getProjectileItemStack().set(DataComponents.POTION_CONTENTS, new PotionContents(Potions.FIRE_RESISTANCE)); } }); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/AdvancementTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/AdvancementTests.java index 837d465b80..df7a863393 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/AdvancementTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/AdvancementTests.java @@ -9,11 +9,13 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Objects; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementType; import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.advancements.critereon.ItemSubPredicate; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; import net.minecraft.gametest.framework.GameTest; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -21,10 +23,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.GameType; -import net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate; import net.neoforged.neoforge.common.data.AdvancementProvider; import net.neoforged.neoforge.event.entity.player.AdvancementEvent; -import net.neoforged.neoforge.registries.NeoForgeRegistries; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; import net.neoforged.testframework.annotation.TestHolder; @@ -84,12 +84,13 @@ static void playerAdvancementProgress(final DynamicTest test) { @EmptyTemplate @TestHolder(description = "Tests if custom advancement predicates work") static void customPredicateTest(final DynamicTest test, final RegistrationHelper reg) { - final AtomicReference>> serializer = new AtomicReference<>(); - serializer.set(reg.registrar(NeoForgeRegistries.Keys.ITEM_PREDICATE_SERIALIZERS) - .register("custom_name", () -> RecordCodecBuilder.create(g -> g.group( - Codec.INT.fieldOf("data1").forGetter(CustomNamePredicate::data1), - Codec.INT.fieldOf("data2").forGetter(CustomNamePredicate::data2)) - .apply(g, (d1, d2) -> new CustomNamePredicate(d1, d2, serializer.get()))))); + ItemSubPredicate.Type type = new ItemSubPredicate.Type<>(RecordCodecBuilder.create(g -> g.group( + Codec.INT.fieldOf("data1").forGetter(CustomNamePredicate::data1), + Codec.INT.fieldOf("data2").forGetter(CustomNamePredicate::data2)) + .apply(g, CustomNamePredicate::new))); + + reg.registrar(Registries.ITEM_SUB_PREDICATE_TYPE) + .register("custom_name", () -> type); reg.addProvider(event -> new AdvancementProvider( event.getGenerator().getPackOutput(), @@ -99,14 +100,18 @@ static void customPredicateTest(final DynamicTest test, final RegistrationHelper Advancement.Builder.advancement() .parent(new ResourceLocation("story/root")) .display(Items.ANVIL, Component.literal("Named!"), Component.literal("Get a named item"), null, AdvancementType.TASK, true, true, false) - .addCriterion("has_named_item", InventoryChangeTrigger.TriggerInstance.hasItems(new CustomNamePredicate(1, 2, serializer.get()).toVanilla())) + .addCriterion("has_named_item", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().withSubPredicate(type, new CustomNamePredicate(1, 2)))) .save(saver, new ResourceLocation(reg.modId(), "named_item"), existingFileHelper); }))); test.onGameTest(helper -> { final ServerPlayer player = helper.makeTickingMockServerPlayerInCorner(GameType.SURVIVAL); helper.startSequence() - .thenExecute(() -> player.getInventory().add(Items.IRON_HELMET.getDefaultInstance().setHoverName(Component.literal("abcd")))) + .thenExecute(() -> { + ItemStack stack = Items.IRON_HELMET.getDefaultInstance(); + stack.set(DataComponents.CUSTOM_NAME, Component.literal("abcd")); + player.getInventory().add(stack); + }) .thenExecuteAfter(5, () -> helper.assertTrue( player.getAdvancements().getOrStartProgress(player.server.getAdvancements().get(new ResourceLocation(reg.modId(), "named_item"))).isDone(), "Player did not complete advancement")) @@ -114,15 +119,10 @@ static void customPredicateTest(final DynamicTest test, final RegistrationHelper }); } - public record CustomNamePredicate(int data1, int data2, Supplier> pred) implements ICustomItemPredicate { - @Override - public Codec codec() { - return pred.get(); - } - + public record CustomNamePredicate(int data1, int data2) implements ItemSubPredicate { @Override - public boolean test(ItemStack itemStack) { - return itemStack.hasCustomHoverName(); + public boolean matches(ItemStack itemStack) { + return itemStack.has(DataComponents.CUSTOM_NAME); } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/PlayerEventTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/PlayerEventTests.java index 0bea55136c..600acfe2cb 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/PlayerEventTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/entity/player/PlayerEventTests.java @@ -16,7 +16,7 @@ import net.minecraft.stats.ServerStatsCounter; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.item.BlockItem; @@ -81,7 +81,7 @@ static void useItemOnBlockEvent(final DynamicTest test) { context.getPlayer().displayClientMessage(Component.literal("Can't place dirt on dispenser"), false); } test.pass(); - event.cancelWithResult(InteractionResult.SUCCESS); + event.cancelWithResult(ItemInteractionResult.sidedSuccess(level.isClientSide)); } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemComponentTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemComponentTests.java new file mode 100644 index 0000000000..3a34c87cf5 --- /dev/null +++ b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemComponentTests.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.debug.item; + +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.registries.DeferredBlock; +import net.neoforged.testframework.DynamicTest; +import net.neoforged.testframework.annotation.ForEachTest; +import net.neoforged.testframework.annotation.TestHolder; +import net.neoforged.testframework.gametest.EmptyTemplate; +import net.neoforged.testframework.registration.RegistrationHelper; + +@ForEachTest(groups = ItemTests.GROUP + ".component") +public class ItemComponentTests { + @GameTest + @EmptyTemplate + @TestHolder(description = "Tests that holders and deferred holders can be used as data components") + public static void testHolderComponent(DynamicTest test, RegistrationHelper reg) { + var blockHolderComponent = reg.registrar(Registries.DATA_COMPONENT_TYPE) + .register("test_holder", () -> DataComponentType.>builder() + .persistent(BuiltInRegistries.BLOCK.holderByNameCodec()) + .networkSynchronized(ByteBufCodecs.holderRegistry(Registries.BLOCK)) + .build()); + + test.onGameTest(helper -> { + ItemStack stack = Items.DIAMOND.getDefaultInstance(); + + ItemStack stack1 = stack.copy(); + stack1.set(blockHolderComponent.get(), Blocks.DIAMOND_BLOCK.builtInRegistryHolder()); + + ItemStack stack2 = stack.copy(); + var diamondDh = DeferredBlock.createBlock(BuiltInRegistries.BLOCK.getKey(Blocks.DIAMOND_BLOCK)); + stack2.set(blockHolderComponent.get(), diamondDh); + + if (!ItemStack.matches(stack1, stack2)) { + helper.fail("Expected the same item stacks"); + } + + if (!ItemStack.matches(stack2, stack1)) { + helper.fail("Expected the same item stacks (reversed order)"); + } + + if (ItemStack.hashItemAndComponents(stack1) != ItemStack.hashItemAndComponents(stack2)) { + helper.fail("Expected the same hash"); + } + + helper.succeed(); + }); + } +} diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemEventTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemEventTests.java index 4b5c956655..e4385cec88 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemEventTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemEventTests.java @@ -26,7 +26,7 @@ public class ItemEventTests { static void itemAttributeModifier(final DynamicTest test) { test.eventListeners().forge().addListener((final ItemAttributeModifierEvent event) -> { if (event.getSlotType() == EquipmentSlot.MAINHAND && event.getItemStack().getItem() == Items.APPLE) { - event.addModifier(Attributes.ARMOR, new AttributeModifier(test.createModId(), 10f, AttributeModifier.Operation.ADDITION)); + event.addModifier(Attributes.ARMOR, new AttributeModifier(test.createModId(), 10f, AttributeModifier.Operation.ADD_VALUE)); } else if (event.getSlotType() == EquipmentSlot.CHEST && event.getItemStack().is(Items.GOLDEN_CHESTPLATE)) { event.clearModifiers(); } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemTests.java index d53d8c8394..9abafb2ddd 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/item/ItemTests.java @@ -5,7 +5,6 @@ package net.neoforged.neoforge.debug.item; -import java.util.Map; import java.util.function.Supplier; import net.minecraft.ChatFormatting; import net.minecraft.client.renderer.entity.PigRenderer; @@ -14,7 +13,6 @@ import net.minecraft.core.dispenser.BlockSource; import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.gametest.framework.GameTest; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; @@ -24,9 +22,6 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.entity.player.Player; @@ -46,17 +41,14 @@ import net.minecraft.world.level.block.entity.DispenserBlockEntity; import net.minecraft.world.level.material.Fluids; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.fml.util.ObfuscationReflectionHelper; import net.neoforged.neoforge.client.model.generators.ModelFile; import net.neoforged.neoforge.common.DeferredSpawnEggItem; -import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; import net.neoforged.testframework.annotation.TestHolder; import net.neoforged.testframework.gametest.EmptyTemplate; import net.neoforged.testframework.gametest.StructureTemplateBuilder; import net.neoforged.testframework.registration.RegistrationHelper; -import org.jetbrains.annotations.Nullable; @ForEachTest(groups = ItemTests.GROUP) public class ItemTests { @@ -114,15 +106,10 @@ public ItemStack execute(BlockSource p_302435_, ItemStack p_123562_) { }) static void forgeSpawnEggTest(final DynamicTest test, final RegistrationHelper reg) { final var testEntity = reg.entityTypes().registerType("test_entity", () -> EntityType.Builder.of(Pig::new, MobCategory.CREATURE) - .sized(1, 1)).withAttributes(() -> { - AttributeSupplier.Builder attributes = Pig.createAttributes(); - //Remove step height attribute to validate that things are handled properly when an entity doesn't have it - Map builder = ObfuscationReflectionHelper.getPrivateValue(AttributeSupplier.Builder.class, attributes, "builder"); - if (builder != null) { - builder.remove(NeoForgeMod.STEP_HEIGHT.value()); - } - return attributes; - }).withRenderer(() -> PigRenderer::new).withLang("Test Pig spawn egg"); + .sized(1, 1)) + .withAttributes(Pig::createAttributes) + .withRenderer(() -> PigRenderer::new) + .withLang("Test Pig spawn egg"); final var egg = reg.items().register("test_spawn_egg", () -> new DeferredSpawnEggItem(testEntity, 0x0000FF, 0xFF0000, new Item.Properties()) { @Override @@ -143,10 +130,11 @@ public InteractionResultHolder use(Level level, Player player, Intera return sup; } - @Override - public boolean spawnsEntity(@Nullable CompoundTag p_43231_, EntityType p_43232_) { - return super.spawnsEntity(p_43231_, p_43232_); - } + // Porting 1.20.5 replacement? +// @Override +// public boolean spawnsEntity(@Nullable CompoundTag p_43231_, EntityType p_43232_) { +// return super.spawnsEntity(p_43231_, p_43232_); +// } }) .tab(CreativeModeTabs.SPAWN_EGGS).withModel(builder -> builder.parent(new ModelFile.UncheckedModelFile(new ResourceLocation("minecraft:item/template_spawn_egg")))); @@ -162,7 +150,7 @@ public boolean spawnsEntity(@Nullable CompoundTag p_43231_, EntityType p_4323 @EmptyTemplate @TestHolder(description = "Tests if custom rarities (with custom styles) work on items") static void itemCustomRarity(final DynamicTest test, final RegistrationHelper reg) { - final Rarity rarity = Rarity.create(reg.modId() + "_CUSTOM", style -> style.withItalic(true).withColor(ChatFormatting.DARK_AQUA)); + final Rarity rarity = Rarity.create(reg.modId() + "_CUSTOM", new ResourceLocation(reg.modId(), "custom"), style -> style.withItalic(true).withColor(ChatFormatting.DARK_AQUA)); final Supplier item = reg.items().registerSimpleItem("test", new Item.Properties().rarity(rarity)) .withLang("Custom rarity test"); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/level/LevelEventTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/level/LevelEventTests.java index 2774dd4c54..d138da33f7 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/level/LevelEventTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/level/LevelEventTests.java @@ -92,7 +92,7 @@ static void alterGroundEvent(final DynamicTest test) { @TestHolder(description = "Tests the vanilla game event by hurting entities that are sheared in the overworld") static void vanillaGameEvent(final DynamicTest test) { test.eventListeners().forge().addListener((final VanillaGameEvent event) -> { - if (event.getVanillaEvent() == GameEvent.SHEAR && event.getLevel().dimension() == Level.OVERWORLD) { + if (event.getVanillaEvent().is(GameEvent.SHEAR) && event.getLevel().dimension() == Level.OVERWORLD) { final var entities = event.getLevel().getEntitiesOfClass(Entity.class, new AABB(BlockPos.containing(event.getEventPosition())), e -> e instanceof Shearable); entities.get(0).hurt(event.getLevel().damageSources().generic(), event.getCause() == null ? 1 : 3); test.pass(); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/loot/GlobalLootModifiersTest.java b/tests/src/main/java/net/neoforged/neoforge/debug/loot/GlobalLootModifiersTest.java index 2e23d213ac..ffe8bd5056 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/loot/GlobalLootModifiersTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/loot/GlobalLootModifiersTest.java @@ -7,20 +7,26 @@ import com.google.common.base.Suppliers; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.List; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.IntStream; import net.minecraft.advancements.critereon.EnchantmentPredicate; +import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.advancements.critereon.ItemSubPredicates; import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.gametest.framework.GameTest; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.InteractionHand; import net.minecraft.world.SimpleContainer; @@ -30,8 +36,6 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.Enchantment.Rarity; -import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.GameType; @@ -68,31 +72,26 @@ public class GlobalLootModifiersTest { public static final RegistrationHelper HELPER = RegistrationHelper.create("neotests_glm_test"); - private static final DeferredRegister> GLM = HELPER.registrar(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS); + private static final DeferredRegister> GLM = HELPER.registrar(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS); private static final DeferredRegister ENCHANTS = HELPER.registrar(Registries.ENCHANTMENT); - private static final DeferredHolder, Codec> DUNGEON_LOOT = GLM.register("dungeon_loot", DungeonLootEnhancerModifier.CODEC); - private static final DeferredHolder, Codec> SMELTING = GLM.register("smelting", SmeltingEnchantmentModifier.CODEC); - private static final DeferredHolder, Codec> WHEATSEEDS = GLM.register("wheat_harvest", WheatSeedsConverterModifier.CODEC); - private static final DeferredHolder, Codec> SILKTOUCH = GLM.register("silk_touch_bamboo", SilkTouchTestModifier.CODEC); - private static final DeferredHolder SMELT = ENCHANTS.register("smelt", () -> new SmelterEnchantment(Rarity.UNCOMMON, EnchantmentCategory.DIGGER, EquipmentSlot.MAINHAND)); + private static final DeferredHolder, MapCodec> DUNGEON_LOOT = GLM.register("dungeon_loot", DungeonLootEnhancerModifier.CODEC); + private static final DeferredHolder, MapCodec> SMELTING = GLM.register("smelting", SmeltingEnchantmentModifier.CODEC); + private static final DeferredHolder, MapCodec> WHEATSEEDS = GLM.register("wheat_harvest", WheatSeedsConverterModifier.CODEC); + private static final DeferredHolder, MapCodec> SILKTOUCH = GLM.register("silk_touch_bamboo", SilkTouchTestModifier.CODEC); + private static final DeferredHolder SMELT = ENCHANTS.register("smelt", () -> new Enchantment( + Enchantment.definition(ItemTags.MINING_ENCHANTABLE, 10, 1, Enchantment.dynamicCost(1, 10), Enchantment.dynamicCost(5, 10), 1, EquipmentSlot.MAINHAND))); @OnInit static void init(final TestFramework framework) { HELPER.register(framework.modEventBus()); } - private static class SmelterEnchantment extends Enchantment { - protected SmelterEnchantment(Rarity rarityIn, EnchantmentCategory typeIn, EquipmentSlot... slots) { - super(rarityIn, typeIn, slots); - } - } - /** * The smelting enchantment causes this modifier to be invoked, via the smelting loot_modifier json */ private static class SmeltingEnchantmentModifier extends LootModifier { - public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, SmeltingEnchantmentModifier::new))); + public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.mapCodec(inst -> codecStart(inst).apply(inst, SmeltingEnchantmentModifier::new))); public SmeltingEnchantmentModifier(LootItemCondition[] conditionsIn) { super(conditionsIn); @@ -114,7 +113,7 @@ private static ItemStack smelt(ItemStack stack, LootContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC.get(); } } @@ -123,7 +122,7 @@ public Codec codec() { * When harvesting blocks with bamboo, this modifier is invoked, via the silk_touch_bamboo loot_modifier json */ private static class SilkTouchTestModifier extends LootModifier { - public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, SilkTouchTestModifier::new))); + public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.mapCodec(inst -> codecStart(inst).apply(inst, SilkTouchTestModifier::new))); public SilkTouchTestModifier(LootItemCondition[] conditionsIn) { super(conditionsIn); @@ -139,12 +138,12 @@ public ObjectArrayList doApply(ObjectArrayList generatedLo fakeTool.enchant(Enchantments.SILK_TOUCH, 1); LootParams.Builder builder = new LootParams.Builder(context.getLevel()); builder.withParameter(LootContextParams.TOOL, fakeTool); - LootTable loottable = context.getLevel().getServer().getLootData().getLootTable(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable()); + LootTable loottable = context.getLevel().getServer().reloadableRegistries().getLootTable(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable()); return loottable.getRandomItems(builder.create(LootContextParamSets.EMPTY)); // TODO - porting: we need an AT } @Override - public Codec codec() { + public MapCodec codec() { return CODEC.get(); } } @@ -154,7 +153,7 @@ public Codec codec() { * This modifier checks how many seeds were harvested and turns X seeds into Y wheat (3:1) */ private static class WheatSeedsConverterModifier extends LootModifier { - public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create(inst -> codecStart(inst).and( + public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.mapCodec(inst -> codecStart(inst).and( inst.group( Codec.INT.fieldOf("numSeeds").forGetter(m -> m.numSeedsToConvert), BuiltInRegistries.ITEM.byNameCodec().fieldOf("seedItem").forGetter(m -> m.itemToCheck), @@ -194,13 +193,13 @@ public ObjectArrayList doApply(ObjectArrayList generatedLo } @Override - public Codec codec() { + public MapCodec codec() { return CODEC.get(); } } private static class DungeonLootEnhancerModifier extends LootModifier { - public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create(inst -> codecStart(inst) + public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.mapCodec(inst -> codecStart(inst) .and(ExtraCodecs.POSITIVE_INT.optionalFieldOf("multiplication_factor", 2).forGetter(m -> m.multiplicationFactor)) .apply(inst, DungeonLootEnhancerModifier::new))); @@ -224,7 +223,7 @@ protected ObjectArrayList doApply(ObjectArrayList generate } @Override - public Codec codec() { + public MapCodec codec() { return CODEC.get(); } } @@ -235,9 +234,10 @@ public Codec codec() { static void smeltingModifierTest(final DynamicTest test) { HELPER.provider(GlobalLootModifierProvider.class, prov -> prov.add("smelting", new SmeltingEnchantmentModifier( new LootItemCondition[] { - MatchTool.toolMatches( - ItemPredicate.Builder.item().hasEnchantment( - new EnchantmentPredicate(SMELT.get(), MinMaxBounds.Ints.atLeast(1)))) + MatchTool.toolMatches(ItemPredicate.Builder.item().withSubPredicate( + ItemSubPredicates.ENCHANTMENTS, + ItemEnchantmentsPredicate.enchantments( + List.of(new EnchantmentPredicate(SMELT.get(), MinMaxBounds.Ints.atLeast(1)))))) .build(), new TestEnabledLootCondition(test) }))); @@ -307,7 +307,7 @@ static void dungeonLootTest(final DynamicTest test) { test.onGameTest(helper -> helper.startSequence() .thenExecute(() -> helper.setBlock(1, 2, 1, Blocks.CHEST.defaultBlockState())) .thenMap(() -> helper.requireBlockEntity(1, 2, 1, ChestBlockEntity.class)) - .thenExecute(chest -> chest.setLootTable(new ResourceLocation("chests/simple_dungeon"), 124424)) + .thenExecute(chest -> chest.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation("chests/simple_dungeon")), 124424)) .thenExecute(chest -> chest.unpackLootTable(helper.makeTickingMockServerPlayerInCorner(GameType.SURVIVAL))) @@ -317,7 +317,7 @@ static void dungeonLootTest(final DynamicTest test) { .collect(Collectors.toMap(ItemStack::getItem, ItemStack::getCount, Integer::sum))) .thenMapToSequence(stacks -> helper - .startSequence(() -> helper.getLevel().getServer().getLootData().getLootTable(new ResourceLocation("chests/simple_dungeon")) + .startSequence(() -> helper.getLevel().getServer().reloadableRegistries().getLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation("chests/simple_dungeon"))) .getRandomItems(new LootParams.Builder(helper.getLevel()) .withParameter(LootContextParams.ORIGIN, helper.absoluteVec(new Vec3(1, 3, 1))) .create(LootContextParamSets.CHEST), 124424)) diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/loot/LootPoolTest.java b/tests/src/main/java/net/neoforged/neoforge/debug/loot/LootPoolTest.java index 32fd7dfd51..b06f9e80fc 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/loot/LootPoolTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/loot/LootPoolTest.java @@ -7,8 +7,10 @@ import java.util.List; import java.util.Set; +import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.gametest.framework.GameTest; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.LootPool; @@ -23,7 +25,7 @@ @ForEachTest(groups = "loot") public class LootPoolTest { - private static final ResourceLocation TEST_LOOT_TABLE = new ResourceLocation("neoforge", "test_loot_table"); + private static final ResourceKey TEST_LOOT_TABLE = ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation("neoforge", "test_loot_table")); @GameTest @EmptyTemplate @@ -33,8 +35,8 @@ public static void testPoolLoading(DynamicTest test, RegistrationHelper reg) { event.getGenerator().getPackOutput(), Set.of(), List.of( - new LootTableProvider.SubProviderEntry(() -> p_249643_ -> { - p_249643_.accept( + new LootTableProvider.SubProviderEntry(() -> (provider, consumer) -> { + consumer.accept( TEST_LOOT_TABLE, LootTable.lootTable() .withPool(LootPool.lootPool() @@ -42,10 +44,11 @@ public static void testPoolLoading(DynamicTest test, RegistrationHelper reg) { .name("custom_name")) .withPool(LootPool.lootPool() .add(LootItem.lootTableItem(Items.GOLD_NUGGET)))); - }, LootContextParamSets.ALL_PARAMS)))); + }, LootContextParamSets.ALL_PARAMS)), + event.getLookupProvider())); test.onGameTest(helper -> { - var testTable = helper.getLevel().getServer().getLootData().getLootTable(TEST_LOOT_TABLE); + var testTable = helper.getLevel().getServer().reloadableRegistries().getLootTable(TEST_LOOT_TABLE); helper.assertTrue(testTable.getPool("custom_name") != null, "Expected custom_name pool"); helper.assertTrue(testTable.getPool("pool1") != null, "Expected unnamed pool pool1"); diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/resources/ModDatapackTest.java b/tests/src/main/java/net/neoforged/neoforge/debug/resources/ModDatapackTest.java index 697855f7b6..c03259011f 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/resources/ModDatapackTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/resources/ModDatapackTest.java @@ -35,7 +35,7 @@ static void modDatapack(final DynamicTest test) { .addCriterion("has_scute", CriteriaTriggers.INVENTORY_CHANGED.createCriterion( new InventoryChangeTrigger.TriggerInstance( Optional.empty(), InventoryChangeTrigger.TriggerInstance.Slots.ANY, List.of( - ItemPredicate.Builder.item().of(Items.SCUTE).build())))) + ItemPredicate.Builder.item().of(Items.TURTLE_SCUTE).build())))) .rewards(AdvancementRewards.Builder.recipe(new ResourceLocation("minecraft:turtle_helmet"))) .save(saver, testAdvancement, existingFileHelper)); return new AdvancementProvider(event.getGenerator().getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper(), generators); diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/AddPackFinderEventTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/AddPackFinderEventTest.java index 9ab2d02705..98b6520dac 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/AddPackFinderEventTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/AddPackFinderEventTest.java @@ -5,7 +5,10 @@ package net.neoforged.neoforge.oldtest; +import java.util.Optional; import net.minecraft.network.chat.Component; +import net.minecraft.server.packs.PackLocationInfo; +import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.repository.BuiltInPackSource; @@ -33,8 +36,7 @@ public AddPackFinderEventTest(IEventBus modEventBus) { public void addPackFinders(AddPackFindersEvent event) { if (event.getPackType() == PackType.CLIENT_RESOURCES) { var resourcePath = ModList.get().getModFileById(MODID).getFile().findResource("test_nested_resource_pack"); - var pack = Pack.readMetaAndCreate("builtin/add_pack_finders_test", Component.literal("display name"), true, - BuiltInPackSource.fromName((path) -> new PathPackResources(path, resourcePath, true)), PackType.CLIENT_RESOURCES, Pack.Position.BOTTOM, PackSource.BUILT_IN); + var pack = Pack.readMetaAndCreate(new PackLocationInfo("builtin/add_pack_finders_test", Component.literal("display name"), PackSource.BUILT_IN, Optional.empty()), BuiltInPackSource.fromName((path) -> new PathPackResources(path, resourcePath)), PackType.CLIENT_RESOURCES, new PackSelectionConfig(true, Pack.Position.BOTTOM, false)); event.addRepositorySource((packConsumer) -> packConsumer.accept(pack)); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/CodecsTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/CodecsTest.java deleted file mode 100644 index 5c0d1ff949..0000000000 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/CodecsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.oldtest; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.world.level.material.Fluids; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.fluids.FluidStack; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * Created to host any custom codecs forge may be adding. - */ -@Mod("forge_codecs_test") -public class CodecsTest { - public static final boolean ENABLE = true; - private static final Logger LOGGER = LogManager.getLogger(); - - public CodecsTest() { - if (ENABLE) { - testFluidStackCodec(); - } - } - - /** - * Makes sure FluidStack.CODEC produces the same data as FluidStack.write - */ - private void testFluidStackCodec() { - FluidStack noTag = new FluidStack(Fluids.WATER, 10); - FluidStack withTag = new FluidStack(Fluids.LAVA, 10); - withTag.getOrCreateChildTag("test").putString("value", "This is a test"); - - CompoundTag noTag_write = noTag.writeToNBT(new CompoundTag()); - CompoundTag withTag_write = withTag.writeToNBT(new CompoundTag()); - - CompoundTag noTag_encode = (CompoundTag) FluidStack.CODEC.encodeStart(NbtOps.INSTANCE, noTag).getOrThrow(false, error -> { - LOGGER.error("Error encoding noTag: {}", error); - }); - CompoundTag withTag_encode = (CompoundTag) FluidStack.CODEC.encodeStart(NbtOps.INSTANCE, withTag).getOrThrow(false, error -> { - LOGGER.error("Error encoding withTag: {}", error); - }); - - if (!noTag_write.equals(noTag_encode)) - throw new IllegalStateException("Encoded noTag does not match"); - if (!withTag_write.equals(withTag_encode)) - throw new IllegalStateException("Encoded withTag does not match"); - - FluidStack noTag_decode = FluidStack.CODEC.decode(NbtOps.INSTANCE, noTag_encode).getOrThrow(false, error -> { - LOGGER.error("Error decoding noTag: {}", error); - }).getFirst(); - FluidStack withTag_decode = FluidStack.CODEC.decode(NbtOps.INSTANCE, withTag_encode).getOrThrow(false, error -> { - LOGGER.error("Error decoding withTag: {}", error); - }).getFirst(); - - if (!noTag.isFluidStackIdentical(noTag_decode)) - throw new IllegalStateException("Decoded noTag does not match"); - if (!withTag.isFluidStackIdentical(withTag_decode)) - throw new IllegalStateException("Decoded withTag does not match"); - } -} diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/DataGeneratorTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/DataGeneratorTest.java index 008323b3c3..0348f7f2c1 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/DataGeneratorTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/DataGeneratorTest.java @@ -62,7 +62,7 @@ import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -120,7 +120,6 @@ import net.neoforged.neoforge.common.crafting.CompoundIngredient; import net.neoforged.neoforge.common.crafting.DifferenceIngredient; import net.neoforged.neoforge.common.crafting.IntersectionIngredient; -import net.neoforged.neoforge.common.crafting.NBTIngredient; import net.neoforged.neoforge.common.data.AdvancementProvider; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; @@ -179,13 +178,13 @@ public static void gatherData(GatherDataEvent event) { gen.addProvider(event.includeClient(), new SoundDefinitions(packOutput, event.getExistingFileHelper())); gen.addProvider(event.includeClient(), new ParticleDescriptions(packOutput, event.getExistingFileHelper())); - gen.addProvider(event.includeServer(), new Recipes(packOutput)); + gen.addProvider(event.includeServer(), new Recipes(packOutput, lookupProvider)); gen.addProvider(event.includeServer(), new Tags(packOutput, lookupProvider, event.getExistingFileHelper())); gen.addProvider(event.includeServer(), new AdvancementProvider(packOutput, lookupProvider, event.getExistingFileHelper(), List.of(new Advancements()))); gen.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(packOutput, lookupProvider, BUILDER, Set.of(MODID))); } - public static void levelStem(BootstapContext context) { + public static void levelStem(BootstrapContext context) { HolderGetter dimensionTypes = context.lookup(Registries.DIMENSION_TYPE); HolderGetter noiseGeneratorSettings = context.lookup(Registries.NOISE_SETTINGS); HolderGetter biomes = context.lookup(Registries.BIOME); @@ -196,8 +195,8 @@ public static void levelStem(BootstapContext context) { } public static class Recipes extends RecipeProvider implements IConditionBuilder { - public Recipes(PackOutput gen) { - super(gen); + public Recipes(PackOutput gen, CompletableFuture lookupProvider) { + super(gen, lookupProvider); } @Override @@ -286,7 +285,7 @@ protected void buildRecipes(RecipeOutput consumer) { ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Blocks.GOLD_BLOCK) .pattern("#") .pattern("#") - .define('#', CompoundIngredient.of(Ingredient.of(ItemTags.PLANKS), Ingredient.of(ItemTags.LOGS), NBTIngredient.of(true, Util.make(() -> { + .define('#', CompoundIngredient.of(Ingredient.of(ItemTags.PLANKS), Ingredient.of(ItemTags.LOGS), net.neoforged.neoforge.common.crafting.DataComponentIngredient.of(true, Util.make(() -> { ItemStack stack = new ItemStack(Items.STONE_PICKAXE); stack.setDamageValue(3); return stack; @@ -499,7 +498,7 @@ protected void addTags(HolderLookup.Provider provider) { tag(BlockTags.create(new ResourceLocation(MODID, "test"))) .add(Blocks.DIAMOND_BLOCK) .addTag(BlockTags.STONE_BRICKS) - .addTag(net.neoforged.neoforge.common.Tags.Blocks.COBBLESTONE) + .addTag(net.neoforged.neoforge.common.Tags.Blocks.COBBLESTONES) .addOptional(new ResourceLocation("chisel", "marble/raw")) .addOptionalTag(new ResourceLocation("neoforge", "storage_blocks/ruby")); @@ -528,7 +527,7 @@ protected void addTranslations() { add(Blocks.STONE, "Stone"); add(Items.DIAMOND, "Diamond"); //add(Biomes.BEACH, "Beach"); - add(MobEffects.POISON, "Poison"); + add(MobEffects.POISON.value(), "Poison"); add(Enchantments.SHARPNESS, "Sharpness"); add(EntityType.CAT, "Cat"); add(MODID + ".test.unicode", "\u0287s\u01DD\u2534 \u01DDpo\u0254\u1D09u\u2229"); diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/ManyMobEffectsTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/ManyMobEffectsTest.java index 12bca3e25a..f6d609cb1c 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/ManyMobEffectsTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/ManyMobEffectsTest.java @@ -6,6 +6,8 @@ package net.neoforged.neoforge.oldtest; import java.util.List; +import java.util.Optional; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; @@ -18,9 +20,8 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.SuspiciousStewItem; -import net.minecraft.world.item.alchemy.PotionUtils; -import net.minecraft.world.level.block.SuspiciousEffectHolder; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.component.SuspiciousStewEffects; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.fml.util.ObfuscationReflectionHelper; @@ -59,10 +60,11 @@ public class ManyMobEffectsTest { final var index = i; effect = MOB_EFFECTS.register("effect_" + i, () -> new MobEffect(MobEffectCategory.NEUTRAL, 0xFF0000) { @Override - public void applyEffectTick(LivingEntity entity, int amplifier) { + public boolean applyEffectTick(LivingEntity entity, int amplifier) { if (entity.level().isClientSide) { LOGGER.info("Effect Tick for {} on the client", index); } + return super.applyEffectTick(entity, amplifier); } @Override @@ -82,11 +84,11 @@ public ManyMobEffectsTest(IEventBus modBus) { .icon(() -> new ItemStack(Items.POTION)) .displayItems((params, output) -> { var stack = new ItemStack(Items.POTION); - PotionUtils.setCustomEffects(stack, List.of(new MobEffectInstance(LAST_EFFECT.get(), 1000))); + stack.set(DataComponents.POTION_CONTENTS, new PotionContents(Optional.empty(), Optional.empty(), List.of(new MobEffectInstance(LAST_EFFECT, 1000)))); output.accept(stack); stack = new ItemStack(Items.SUSPICIOUS_STEW); - SuspiciousStewItem.saveMobEffects(stack, List.of(new SuspiciousEffectHolder.EffectEntry(LAST_EFFECT.get(), 1000))); + stack.set(DataComponents.SUSPICIOUS_STEW_EFFECTS, new SuspiciousStewEffects(List.of(new SuspiciousStewEffects.Entry(LAST_EFFECT, 1000)))); output.accept(stack); }) .build()))); @@ -96,10 +98,11 @@ private static void mobInteract(PlayerInteractEvent.EntityInteract event) { if (!event.getTarget().level().isClientSide() && event.getTarget() instanceof MushroomCow cow) { var heldItem = event.getEntity().getItemInHand(event.getHand()); if (heldItem.is(Items.POTION)) { - var effects = PotionUtils.getMobEffects(heldItem); - if (!effects.isEmpty()) { - ObfuscationReflectionHelper.setPrivateValue(MushroomCow.class, cow, effects.get(0).getEffect(), "effect"); - ObfuscationReflectionHelper.setPrivateValue(MushroomCow.class, cow, effects.get(0).getDuration(), "effectDuration"); + var effects = heldItem.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects().iterator(); + if (effects.hasNext()) { + MobEffectInstance effect = effects.next(); + ObfuscationReflectionHelper.setPrivateValue(MushroomCow.class, cow, effect.getEffect(), "effect"); + ObfuscationReflectionHelper.setPrivateValue(MushroomCow.class, cow, effect.getDuration(), "effectDuration"); } } else if (heldItem.isEmpty()) { var effect = ((MobEffect) ObfuscationReflectionHelper.getPrivateValue(MushroomCow.class, cow, "effect")); diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/PotionEventTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/PotionEventTest.java index a38b3ac7d7..58da5a67ba 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/PotionEventTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/PotionEventTest.java @@ -9,11 +9,9 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.bus.api.Event.Result; -import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry; +import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent; import net.neoforged.neoforge.event.entity.living.MobEffectEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -21,14 +19,11 @@ @Mod("potion_event_test") @Mod.EventBusSubscriber public class PotionEventTest { - private static Logger LOGGER = LogManager.getLogger(PotionEventTest.class); + private static final Logger LOGGER = LogManager.getLogger(PotionEventTest.class); - public PotionEventTest(IEventBus modEventBus) { - modEventBus.addListener(this::onSetup); - } - - private void onSetup(FMLCommonSetupEvent event) { - BrewingRecipeRegistry.addRecipe(Ingredient.of(Items.ICE), Ingredient.of(Items.LAVA_BUCKET), new ItemStack(Items.OBSIDIAN)); + @SubscribeEvent + public static void onBrewingSetup(RegisterBrewingRecipesEvent event) { + event.getBuilder().addRecipe(Ingredient.of(Items.ICE), Ingredient.of(Items.LAVA_BUCKET), new ItemStack(Items.OBSIDIAN)); } @SubscribeEvent diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/block/FullPotsAccessorDemo.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/block/FullPotsAccessorDemo.java index 1af0f9fffe..eb5f8d53d1 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/block/FullPotsAccessorDemo.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/block/FullPotsAccessorDemo.java @@ -23,6 +23,7 @@ import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; @@ -31,7 +32,7 @@ import net.minecraft.stats.Stats; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTabs; @@ -107,10 +108,8 @@ public DioriteFlowerPotBlock() { } @Override - @SuppressWarnings("deprecation") - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { 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(BuiltInRegistries.ITEM.getKey(item)); boolean hasFlower = be.plant != Blocks.AIR; @@ -136,12 +135,12 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player } level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); - return InteractionResult.sidedSuccess(level.isClientSide()); + return ItemInteractionResult.sidedSuccess(level.isClientSide()); } else { - return InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } } - return super.use(state, level, pos, player, hand, hit); + return super.useItemOn(stack, state, level, pos, player, hand, hit); } @Override @@ -184,13 +183,13 @@ public ModelData getModelData() { } @Override - public CompoundTag getUpdateTag() { - return saveWithFullMetadata(); + public CompoundTag getUpdateTag(HolderLookup.Provider holderLookup) { + return saveWithFullMetadata(holderLookup); } @Override - public void handleUpdateTag(CompoundTag tag) { - super.handleUpdateTag(tag); + public void handleUpdateTag(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.handleUpdateTag(tag, holderLookup); modelData = modelData.derive().with(PLANT_PROPERTY, plant).build(); requestModelDataUpdate(); } @@ -201,23 +200,23 @@ public ClientboundBlockEntityDataPacket getUpdatePacket() { } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { - handleUpdateTag(pkt.getTag()); + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider holderLookup) { + handleUpdateTag(pkt.getTag(), holderLookup); //noinspection ConstantConditions level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), Block.UPDATE_ALL); } @Override - public void load(CompoundTag tag) { - super.load(tag); + public void loadAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.loadAdditional(tag, holderLookup); plant = BuiltInRegistries.BLOCK.get(new ResourceLocation(tag.getString("plant"))); } @Override - protected void saveAdditional(CompoundTag tag) { + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { //noinspection ConstantConditions tag.putString("plant", BuiltInRegistries.BLOCK.getKey(plant).toString()); - super.saveAdditional(tag); + super.saveAdditional(tag, holderLookup); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomArmorModelTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomArmorModelTest.java index db269995d7..8529ec1ae2 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomArmorModelTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomArmorModelTest.java @@ -14,6 +14,7 @@ import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -58,7 +59,7 @@ private void addCreative(BuildCreativeModeTabContentsEvent event) { } private static class TintedArmorItem extends ArmorItem { - public TintedArmorItem(ArmorMaterial material, ArmorItem.Type slot, Properties props) { + public TintedArmorItem(Holder material, ArmorItem.Type slot, Properties props) { super(material, slot, props); } @@ -75,14 +76,16 @@ public Model getGenericArmorModel(LivingEntity entityLiving, ItemStack itemStack } private static class EndermanArmorItem extends ArmorItem { - public EndermanArmorItem(ArmorMaterial material, ArmorItem.Type slot, Properties props) { + private static final ResourceLocation ARMOR_TEXTURE = new ResourceLocation("textures/entity/enderman/enderman.png"); + + public EndermanArmorItem(Holder material, ArmorItem.Type slot, Properties props) { super(material, slot, props); } @Nullable @Override - public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { - return "textures/entity/enderman/enderman.png"; + public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, ArmorMaterial.Layer layer, boolean innerModel) { + return ARMOR_TEXTURE; } @Override diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomPresetEditorTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomPresetEditorTest.java index 18297c8aac..aa1cdd2b85 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomPresetEditorTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomPresetEditorTest.java @@ -20,7 +20,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; -import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -68,7 +68,7 @@ public String getName() { }); } - private static WorldPreset makeWorldPreset(BootstapContext context) { + private static WorldPreset makeWorldPreset(BootstrapContext context) { Holder overworldNoise = context.lookup(Registries.NOISE_SETTINGS) .getOrThrow(NoiseGeneratorSettings.OVERWORLD); Holder plains = context.lookup(Registries.BIOME) diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomSpriteSourceTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomSpriteSourceTest.java index f89e5bd0ce..04ddaa2558 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomSpriteSourceTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomSpriteSourceTest.java @@ -7,7 +7,7 @@ import com.mojang.blaze3d.platform.NativeImage; import com.mojang.logging.LogUtils; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Optional; import net.minecraft.client.renderer.texture.SpriteContents; @@ -55,7 +55,7 @@ private void registerTextureAtlasSpriteLoaders(RegisterSpriteSourceTypesEvent ev private record CustomSpriteSource(ResourceLocation id) implements SpriteSource { private static final Logger LOGGER = LogUtils.getLogger(); - private static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group( + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> inst.group( ResourceLocation.CODEC.fieldOf("id").forGetter(CustomSpriteSource::id)).apply(inst, CustomSpriteSource::new)); @Override diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomTooltipTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomTooltipTest.java index f9247abaa0..588a5a1993 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomTooltipTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/CustomTooltipTest.java @@ -38,7 +38,6 @@ import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredRegister; -import org.jetbrains.annotations.Nullable; @Mod(CustomTooltipTest.ID) public class CustomTooltipTest { @@ -89,8 +88,8 @@ public CustomItemWithTooltip(Properties properties) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List components, TooltipFlag flag) { - super.appendHoverText(stack, level, components, flag); + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List components, TooltipFlag flag) { + super.appendHoverText(stack, context, components, flag); 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)); } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java index 2b62b18dbe..23a71ad62b 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/CustomItemDisplayContextTest.java @@ -14,6 +14,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; @@ -84,7 +85,7 @@ public static void registerRenderers(EntityRenderersEvent.RegisterRenderers even @SubscribeEvent public static void registerContext(final RegisterEvent event) { - event.register(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, helper -> helper.register("hanging", HANGING)); + event.register(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, helper -> helper.register(new ResourceLocation(MODID, "hanging"), HANGING)); } private static class ItemHangerBlockEntityRenderer @@ -225,8 +226,8 @@ public ItemHangerBlockEntity(BlockPos blockPos, BlockState blockState) { } @Override - public CompoundTag getUpdateTag() { - return saveWithoutMetadata(); + public CompoundTag getUpdateTag(HolderLookup.Provider holderLookup) { + return saveWithoutMetadata(holderLookup); } @Nullable @@ -236,29 +237,26 @@ public Packet getUpdatePacket() { } @Override - public void handleUpdateTag(CompoundTag tag) { - load(tag); + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider lookupProvider) { + handleUpdateTag(pkt.getTag(), lookupProvider); } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { - handleUpdateTag(pkt.getTag()); - } - - @Override - protected void saveAdditional(CompoundTag tag) { + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.saveAdditional(tag, holderLookup); var c = new CompoundTag(); if (heldItem != null) { - heldItem.save(c); + heldItem.save(holderLookup, c); tag.put("item", c); } } @Override - public void load(CompoundTag tag) { + public void loadAdditional(CompoundTag tag, HolderLookup.Provider holderLookup) { + super.loadAdditional(tag, holderLookup); if (tag.contains("item")) { var c = tag.getCompound("item"); - heldItem = ItemStack.of(c); + heldItem = ItemStack.parse(holderLookup, c).orElseThrow(); } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/MegaModelTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/MegaModelTest.java index 36582b1a5c..46f1c88d78 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/MegaModelTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/model/MegaModelTest.java @@ -18,10 +18,11 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; @@ -110,15 +111,15 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { var entity = level.getBlockEntity(pos); if (entity instanceof Entity e) { e.y += Mth.sign(hit.getLocation().y - pos.getY() - 0.5); e.requestModelDataUpdate(); level.sendBlockUpdated(pos, state, state, 8); - return InteractionResult.sidedSuccess(level.isClientSide()); + return ItemInteractionResult.sidedSuccess(level.isClientSide()); } - return super.use(state, level, pos, player, hand, hit); + return super.useItemOn(stack, state, level, pos, player, hand, hit); } public static class Entity extends BlockEntity { diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java index ab7deca758..56b73c8a9a 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/client/rendering/RenderableTest.java @@ -127,8 +127,10 @@ else if (stage == Stage.AFTER_WEATHER) xOffset = 5; Vec3 cam = event.getCamera().getPosition(); - if (xOffset > -1) - render(stage, event.getPoseStack(), event.getRenderTick(), event.getPartialTick(), cam.x, cam.y, cam.z, xOffset); + if (xOffset > -1) { + PoseStack poseStack = event.getPoseStack(); + render(stage, poseStack, event.getRenderTick(), event.getPartialTick(), cam.x, cam.y, cam.z, xOffset); + } } private static void render(Stage stage, PoseStack poseStack, int renderTick, float partialTick, double camX, double camY, double camZ, int xOffset) { diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/conditions/ConditionalCodecTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/conditions/ConditionalCodecTest.java index b0d27319fd..e08b925d20 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/conditions/ConditionalCodecTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/conditions/ConditionalCodecTest.java @@ -234,7 +234,7 @@ private static JsonElement read(String s) { } private static String write(Codec codec, T input) { - return GSON.toJson(codec.encodeStart(JsonOps.INSTANCE, input).get().left().get()); + return GSON.toJson(codec.encodeStart(JsonOps.INSTANCE, input).getOrThrow()); } /** diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/GravityAttributeTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/GravityAttributeTest.java deleted file mode 100644 index 3e0320bbd4..0000000000 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/GravityAttributeTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.oldtest.entity; - -import com.google.common.collect.Multimap; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.tags.BiomeTags; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Item.Properties; -import net.minecraft.world.item.Rarity; -import net.minecraft.world.level.Level; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.common.NeoForgeMod; -import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; -import net.neoforged.neoforge.event.TickEvent; -import net.neoforged.neoforge.registries.DeferredItem; -import net.neoforged.neoforge.registries.DeferredRegister; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Mod(GravityAttributeTest.MODID) -public class GravityAttributeTest { - public static final boolean ENABLE = false; - public static final String MODID = "gravity_attribute_test"; - private static Logger logger = LogManager.getLogger(MODID); - private int ticks; - private static final UUID REDUCED_GRAVITY_ID = UUID.fromString("DEB06000-7979-4242-8888-00000DEB0600"); - private static final AttributeModifier REDUCED_GRAVITY = (new AttributeModifier(REDUCED_GRAVITY_ID, "Reduced gravity", (double) -0.80, Operation.MULTIPLY_TOTAL)); - private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); - private static final DeferredItem TEST_ITEM = ITEMS.register("gravity_stick", () -> new ItemGravityStick(new Properties().rarity(Rarity.RARE))); - - public GravityAttributeTest(IEventBus modEventBus) { - if (ENABLE) { - NeoForge.EVENT_BUS.register(this); - modEventBus.register(this); - ITEMS.register(modEventBus); - modEventBus.addListener(this::addCreative); - } - } - - @SubscribeEvent - public void worldTick(TickEvent.LevelTickEvent event) { - if (!event.level.isClientSide) { - if (ticks++ > 60) { - ticks = 0; - Level w = event.level; - List list; - if (w.isClientSide) { - ClientLevel cw = (ClientLevel) w; - list = new ArrayList<>(100); - for (Entity e : cw.entitiesForRendering()) { - if (e.isAlive() && e instanceof LivingEntity) - list.add((LivingEntity) e); - } - } else { - ServerLevel sw = (ServerLevel) w; - Stream s = StreamSupport.stream(sw.getEntities().getAll().spliterator(), false) - .filter(Entity::isAlive) - .filter(e -> e instanceof LivingEntity) - .map(e -> (LivingEntity) e); - list = s.collect(Collectors.toList()); - } - - for (LivingEntity liv : list) { - AttributeInstance grav = liv.getAttribute(NeoForgeMod.ENTITY_GRAVITY.value()); - - 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); - grav.addTransientModifier(REDUCED_GRAVITY); - } else if (!inPlains && grav.hasModifier(REDUCED_GRAVITY)) { - logger.info("Removed low gravity from Entity: {}", liv); - grav.removeModifier(REDUCED_GRAVITY_ID); - } - } - } - - } - } - - private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) - event.accept(TEST_ITEM); - } - - public static class ItemGravityStick extends Item { - private static final UUID GRAVITY_MODIFIER = UUID.fromString("DEB06001-7979-4242-8888-10000DEB0601"); - - public ItemGravityStick(Properties properties) { - super(properties); - } - - @Override - public Multimap getDefaultAttributeModifiers(EquipmentSlot slot) { - @SuppressWarnings("deprecation") - Multimap multimap = super.getDefaultAttributeModifiers(slot); - if (slot == EquipmentSlot.MAINHAND) - multimap.put(NeoForgeMod.ENTITY_GRAVITY.value(), new AttributeModifier(GRAVITY_MODIFIER, "More Gravity", 1.0D, Operation.ADDITION)); - - return multimap; - } - } -} diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/PartEntityTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/PartEntityTest.java index 04caf4c57a..bb6d397bd0 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/PartEntityTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/PartEntityTest.java @@ -139,32 +139,41 @@ public TestEntityPart(TestEntity parent, float width, float height) { this.parent = parent; } - protected void defineSynchedData() {} + @Override + protected void defineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder p_326003_) {} + @Override protected void readAdditionalSaveData(CompoundTag nbt) {} + @Override protected void addAdditionalSaveData(CompoundTag nbt) {} + @Override public boolean isPickable() { return true; } + @Override public boolean hurt(DamageSource source, float amount) { return !this.isInvulnerableTo(source) && this.parent.hurt(source, amount); } + @Override public boolean is(Entity entity) { return this == entity || this.parent == entity; } + @Override public Packet getAddEntityPacket() { throw new UnsupportedOperationException(); } + @Override public EntityDimensions getDimensions(Pose matrix) { return this.size; } + @Override public boolean shouldBeSaved() { return false; } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/player/ItemUseAnimationTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/player/ItemUseAnimationTest.java index 50bb41ca22..c4de20b9d0 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/player/ItemUseAnimationTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/entity/player/ItemUseAnimationTest.java @@ -36,7 +36,7 @@ public class ItemUseAnimationTest { private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MOD_ID); - private static final DeferredItem THING = ITEMS.register("thing", () -> new ThingItem(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).alwaysEat().build()))); + private static final DeferredItem THING = ITEMS.register("thing", () -> new ThingItem(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).alwaysEdible().build()))); public ItemUseAnimationTest(IEventBus modBus) { ITEMS.register(modBus); diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/fluid/MilkFluidTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/fluid/MilkFluidTest.java index 302b7f8492..083dd3841e 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/fluid/MilkFluidTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/fluid/MilkFluidTest.java @@ -29,7 +29,7 @@ public MilkFluidTest() { private static void useMilk(PlayerInteractEvent event) { ItemStack stack = event.getItemStack(); if (stack.getItem() == Items.MILK_BUCKET) { - FluidUtil.getFluidContained(stack).ifPresent((fluid) -> event.getEntity().displayClientMessage(Component.literal("Contains ").append(fluid.getDisplayName()), true)); + FluidUtil.getFluidContained(stack).ifPresent((fluid) -> event.getEntity().displayClientMessage(Component.literal("Contains ").append(fluid.getHoverName()), true)); } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomElytraTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomElytraTest.java index ea128f8135..cfce1bb45c 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomElytraTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomElytraTest.java @@ -85,7 +85,7 @@ public boolean elytraFlightTick(ItemStack stack, LivingEntity entity, int flight int nextFlightTick = flightTicks + 1; if (nextFlightTick % 10 == 0) { if (nextFlightTick % 20 == 0) { - stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(EquipmentSlot.CHEST)); + stack.hurtAndBreak(1, entity, EquipmentSlot.CHEST); } entity.gameEvent(GameEvent.ELYTRA_GLIDE); } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomFluidContainerTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomFluidContainerTest.java index a0932646a5..34198867b5 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomFluidContainerTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/CustomFluidContainerTest.java @@ -8,6 +8,8 @@ import java.util.Arrays; import java.util.concurrent.atomic.AtomicReference; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -26,7 +28,9 @@ import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.FluidType; import net.neoforged.neoforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.SimpleFluidContent; import net.neoforged.neoforge.fluids.capability.templates.FluidHandlerItemStackSimple; +import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredRegister; @@ -34,14 +38,19 @@ public class CustomFluidContainerTest { public static final String MODID = "custom_fluid_container_test"; public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); + public static final DeferredRegister> COMPONENT_TYPES = DeferredRegister.create(Registries.DATA_COMPONENT_TYPE, MODID); public static final boolean ENABLED = true; public static final DeferredItem CUSTOM_FLUID_CONTAINER = ITEMS.register("custom_fluid_container", () -> new CustomFluidContainer((new Item.Properties()).stacksTo(1))); + public static final DeferredHolder, DataComponentType> SIMPLE_FLUID_CONTENT = COMPONENT_TYPES.register("simple_fluid_content", () -> DataComponentType.builder() + .persistent(SimpleFluidContent.CODEC) + .networkSynchronized(SimpleFluidContent.STREAM_CODEC).build()); public CustomFluidContainerTest(IEventBus modEventBus) { if (ENABLED) { ITEMS.register(modEventBus); + COMPONENT_TYPES.register(modEventBus); modEventBus.addListener(this::addCreative); modEventBus.addListener(this::registerCaps); } @@ -53,7 +62,7 @@ private void addCreative(BuildCreativeModeTabContentsEvent event) { } private void registerCaps(RegisterCapabilitiesEvent event) { - event.registerItem(Capabilities.FluidHandler.ITEM, (stack, ctx) -> new FluidHandlerItemStackSimple(stack, FluidType.BUCKET_VOLUME), CUSTOM_FLUID_CONTAINER.get()); + event.registerItem(Capabilities.FluidHandler.ITEM, (stack, ctx) -> new FluidHandlerItemStackSimple(SIMPLE_FLUID_CONTENT.get(), stack, FluidType.BUCKET_VOLUME), CUSTOM_FLUID_CONTAINER.get()); } /** diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/HiddenTooltipPartsTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/HiddenTooltipPartsTest.java index 8815180ce7..f619f756c1 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/HiddenTooltipPartsTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/HiddenTooltipPartsTest.java @@ -5,16 +5,14 @@ package net.neoforged.neoforge.oldtest.item; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ItemAttributeModifiers; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; @@ -25,7 +23,7 @@ public class HiddenTooltipPartsTest { public static final String MOD_ID = "hidden_tooltip_parts"; public static final boolean ENABLED = true; - private static final AttributeModifier MODIFIER = new AttributeModifier(MOD_ID, 10f, Operation.ADDITION); + private static final AttributeModifier MODIFIER = new AttributeModifier(MOD_ID, 10f, Operation.ADD_VALUE); private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MOD_ID); private static final DeferredItem TEST_ITEM = ITEMS.register("test_item", () -> new TestItem(new Item.Properties())); @@ -45,15 +43,16 @@ public TestItem(Properties properties) { } @Override - public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { - return ImmutableMultimap.builder() - .put(Attributes.ARMOR, MODIFIER) + public ItemAttributeModifiers getAttributeModifiers(ItemStack stack) { + return ItemAttributeModifiers.builder() + .add(Attributes.ARMOR, MODIFIER, EquipmentSlotGroup.ANY) .build(); } - @Override - public int getDefaultTooltipHideFlags(ItemStack stack) { - return ItemStack.TooltipPart.MODIFIERS.getMask(); - } + // TODO PORTING 1.20.5 - fix or remove test +// @Override +// public int getDefaultTooltipHideFlags(ItemStack stack) { +// return ItemStack.TooltipPart.MODIFIERS.getMask(); +// } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/ItemStackedOnOtherTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/ItemStackedOnOtherTest.java index 13c816df56..875918f06e 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/ItemStackedOnOtherTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/ItemStackedOnOtherTest.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.oldtest.item; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.item.ItemStack; @@ -34,7 +35,7 @@ private void onStackedOn(ItemStackedOnOtherEvent event) { ItemStack carried = event.getCarriedItem(); ItemStack current = event.getStackedOnItem(); if (carried.is(Items.DIAMOND_SWORD) && current.isDamageableItem()) { - current.hurtAndBreak(1, player, p -> {}); + current.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); event.setCanceled(true); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/MayFlyAttributeTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/MayFlyAttributeTest.java index 0b9b98df81..1d886b3af9 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/MayFlyAttributeTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/MayFlyAttributeTest.java @@ -5,17 +5,14 @@ package net.neoforged.neoforge.oldtest.item; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ItemAttributeModifiers; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredRegister; @@ -36,7 +33,7 @@ public class MayFlyAttributeTest { protected static final String MODID = "may_fly_attribute_item"; private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); - private static final AttributeModifier MODIFIER = new AttributeModifier(MODID, 1D, AttributeModifier.Operation.ADDITION); + private static final AttributeModifier MODIFIER = new AttributeModifier(MODID, 1D, AttributeModifier.Operation.ADD_VALUE); public MayFlyAttributeTest(IEventBus modEventBus) { ITEMS.register(modEventBus); @@ -58,9 +55,9 @@ public InvertedTelescope(Properties props) { } @Override - public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { - return ImmutableMultimap.builder() - .put(NeoForgeMod.CREATIVE_FLIGHT.value(), MODIFIER) + public ItemAttributeModifiers getAttributeModifiers(ItemStack stack) { + return ItemAttributeModifiers.builder() + .add(net.neoforged.neoforge.common.NeoForgeMod.CREATIVE_FLIGHT, MODIFIER, EquipmentSlotGroup.ANY) .build(); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/RangedMobsUseModdedWeaponsTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/RangedMobsUseModdedWeaponsTest.java index 27d3c09117..5e1e31639a 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/RangedMobsUseModdedWeaponsTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/RangedMobsUseModdedWeaponsTest.java @@ -6,12 +6,14 @@ package net.neoforged.neoforge.oldtest.item; import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BowItem; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.ChargedProjectiles; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; @@ -31,8 +33,8 @@ public class RangedMobsUseModdedWeaponsTest { public static final String MOD_ID = "ranged_mobs_use_modded_weapons_test"; private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MOD_ID); - private static final DeferredItem MODDED_BOW = ITEMS.register("modded_bow", () -> new BowItem(new Item.Properties().defaultDurability(384))); - private static final DeferredItem MODDED_CROSSBOW = ITEMS.register("modded_crossbow", () -> new CrossbowItem(new Item.Properties().defaultDurability(326))); + private static final DeferredItem MODDED_BOW = ITEMS.register("modded_bow", () -> new BowItem(new Item.Properties().durability(384))); + private static final DeferredItem MODDED_CROSSBOW = ITEMS.register("modded_crossbow", () -> new CrossbowItem(new Item.Properties().durability(326))); public RangedMobsUseModdedWeaponsTest(IEventBus modEventBus) { if (ENABLE) { @@ -76,7 +78,10 @@ static void initCrossbowModelProperties() { }); ItemProperties.register(MODDED_CROSSBOW.get(), new ResourceLocation("pulling"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getUseItem() == itemStack && !CrossbowItem.isCharged(itemStack) ? 1.0F : 0.0F); ItemProperties.register(MODDED_CROSSBOW.get(), new ResourceLocation("charged"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && CrossbowItem.isCharged(itemStack) ? 1.0F : 0.0F); - ItemProperties.register(MODDED_CROSSBOW.get(), new ResourceLocation("firework"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && CrossbowItem.isCharged(itemStack) && CrossbowItem.containsChargedProjectile(itemStack, Items.FIREWORK_ROCKET) ? 1.0F : 0.0F); + ItemProperties.register(MODDED_CROSSBOW.get(), new ResourceLocation("firework"), (itemStack, clientWorld, livingEntity, seed) -> { + ChargedProjectiles chargedprojectiles = itemStack.get(DataComponents.CHARGED_PROJECTILES); + return chargedprojectiles != null && chargedprojectiles.contains(Items.FIREWORK_ROCKET) ? 1.0F : 0.0F; + }); } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/StopUsingItemTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/StopUsingItemTest.java index b8355ee901..38aab787cc 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/StopUsingItemTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/StopUsingItemTest.java @@ -86,7 +86,7 @@ private void addCreative(BuildCreativeModeTabContentsEvent event) { } private void onVanillaEvent(VanillaGameEvent event) { - if (event.getVanillaEvent() == GameEvent.ITEM_INTERACT_FINISH && event.getCause() instanceof LivingEntity living && living.isUsingItem() && living.getUseItem().is(BAD.get())) + if (event.getVanillaEvent().is(GameEvent.ITEM_INTERACT_FINISH) && event.getCause() instanceof LivingEntity living && living.isUsingItem() && living.getUseItem().is(BAD.get())) InvertedTelescope.removeFov(living); } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/TagBasedToolTypesTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/item/TagBasedToolTypesTest.java deleted file mode 100644 index 21da5d4eb7..0000000000 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/item/TagBasedToolTypesTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.oldtest.item; - -import java.util.List; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import net.minecraft.core.HolderLookup; -import net.minecraft.data.DataGenerator; -import net.minecraft.data.PackOutput; -import net.minecraft.data.loot.BlockLootSubProvider; -import net.minecraft.data.loot.LootTableProvider; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.flag.FeatureFlags; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Tier; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.MapColor; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.client.model.generators.BlockStateProvider; -import net.neoforged.neoforge.client.model.generators.ItemModelProvider; -import net.neoforged.neoforge.client.model.generators.ModelFile.UncheckedModelFile; -import net.neoforged.neoforge.common.SimpleTier; -import net.neoforged.neoforge.common.TierSortingRegistry; -import net.neoforged.neoforge.common.data.BlockTagsProvider; -import net.neoforged.neoforge.common.data.ExistingFileHelper; -import net.neoforged.neoforge.data.event.GatherDataEvent; -import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; -import net.neoforged.neoforge.registries.DeferredBlock; -import net.neoforged.neoforge.registries.DeferredItem; -import net.neoforged.neoforge.registries.DeferredRegister; - -@Mod(TagBasedToolTypesTest.MODID) -public class TagBasedToolTypesTest { - static final String MODID = "tag_based_tool_types"; - - private static final TagKey MINEABLE_TAG = BlockTags.create(new ResourceLocation(MODID, "minable/my_tool")); - private static final TagKey REQUIRES_TAG = BlockTags.create(new ResourceLocation(MODID, "needs_my_tier_tool")); - - private static final Tier MY_TIER = TierSortingRegistry.registerTier( - new SimpleTier(5, 5000, 10, 100, 0, REQUIRES_TAG, () -> Ingredient.of(Items.BEDROCK)), - new ResourceLocation(MODID, "my_tier"), - List.of(Tiers.DIAMOND), List.of()); - - private static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID); - private static final DeferredBlock STONE = BLOCKS.registerSimpleBlock("test_stone", BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(1.5F, 6.0F)); - - private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); - @SuppressWarnings("unused") - private static final DeferredItem ORE_ITEM = ITEMS.registerSimpleBlockItem(STONE); - private static final DeferredItem TOOL = ITEMS.register("test_tool", () -> { - return new DiggerItem(1, 1, MY_TIER, MINEABLE_TAG, new Item.Properties()) { - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - if (state.is(BlockTags.MINEABLE_WITH_AXE)) return speed; - if (state.is(BlockTags.MINEABLE_WITH_PICKAXE)) return speed; - return super.getDestroySpeed(stack, state); - } - - @Override - public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { - if (state.is(BlockTags.MINEABLE_WITH_PICKAXE)) - return TierSortingRegistry.isCorrectTierForDrops(Tiers.WOOD, state); - if (state.is(BlockTags.MINEABLE_WITH_AXE)) - return TierSortingRegistry.isCorrectTierForDrops(MY_TIER, state); - if (state.is(MINEABLE_TAG)) - return TierSortingRegistry.isCorrectTierForDrops(MY_TIER, state); - return false; - } - }; - }); - - public TagBasedToolTypesTest(IEventBus modEventBus) { - BLOCKS.register(modEventBus); - ITEMS.register(modEventBus); - modEventBus.addListener(this::gatherData); - modEventBus.addListener(this::addCreative); - } - - private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) - event.accept(TOOL); - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(ORE_ITEM); - } - - @SubscribeEvent - public void gatherData(GatherDataEvent event) { - DataGenerator gen = event.getGenerator(); - ExistingFileHelper existing = event.getExistingFileHelper(); - final PackOutput output = gen.getPackOutput(); - - gen.addProvider(event.includeServer(), new BlockTagsProvider(output, event.getLookupProvider(), MODID, existing) { - @Override - protected void addTags(HolderLookup.Provider registry) { - this.tag(MINEABLE_TAG).add(STONE.get()); - this.tag(REQUIRES_TAG).add(STONE.get()); - } - }); - - final class TestBlockLootProvider extends BlockLootSubProvider { - public TestBlockLootProvider() { - super(Set.of(), FeatureFlags.REGISTRY.allFlags()); - } - - @Override - protected Iterable getKnownBlocks() { - return BLOCKS.getEntries().stream().map(Supplier::get).collect(Collectors.toList()); - } - - @Override - protected void generate() { - this.dropSelf(STONE.get()); - } - } - - gen.addProvider(event.includeServer(), new LootTableProvider(event.getGenerator().getPackOutput(), Set.of(), List.of(new LootTableProvider.SubProviderEntry(TestBlockLootProvider::new, LootContextParamSets.BLOCK)))); - - gen.addProvider(event.includeClient(), new BlockStateProvider(output, MODID, existing) { - @Override - protected void registerStatesAndModels() { - simpleBlockWithItem(STONE.get(), models().cubeAll(STONE.getId().getPath(), mcLoc("block/debug"))); - } - }); - gen.addProvider(event.includeClient(), new ItemModelProvider(output, MODID, existing) { - @Override - protected void registerModels() { - getBuilder(TOOL.getId().getPath()) - .parent(new UncheckedModelFile("item/generated")) - .texture("layer0", mcLoc("item/wooden_pickaxe")); - } - }); - } -} diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/misc/ModMismatchTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/misc/ModMismatchTest.java index 8d67d198fa..4030b8f566 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/misc/ModMismatchTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/misc/ModMismatchTest.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.oldtest.misc; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; @@ -55,8 +56,8 @@ private void onRegisterPacketHandler(RegisterPayloadHandlerEvent event) { .registrar(MOD_ID) .versioned(CHANNEL_PROTOCOL_VERSION) .configuration( - ModMismatchPayload.ID, - ModMismatchPayload::new, + ModMismatchPayload.TYPE, + ModMismatchPayload.STREAM_CODEC, this); } } @@ -67,18 +68,12 @@ public void handle(ModMismatchPayload payload, ConfigurationPayloadContext conte } public record ModMismatchPayload() implements CustomPacketPayload { - private static final ResourceLocation ID = new ResourceLocation(MOD_ID, "mod_mismatch"); - - public ModMismatchPayload(FriendlyByteBuf buf) { - this(); - } - - @Override - public void write(FriendlyByteBuf p_294947_) {} + private static final CustomPacketPayload.Type TYPE = new Type<>(new ResourceLocation(MOD_ID, "mod_mismatch")); + private static final StreamCodec STREAM_CODEC = StreamCodec.unit(new ModMismatchTest.ModMismatchPayload()); @Override - public ResourceLocation id() { - return ID; + public CustomPacketPayload.Type type() { + return TYPE; } } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestMenu.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestMenu.java index 1c44ca6d26..1e1b34b347 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestMenu.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestMenu.java @@ -72,7 +72,7 @@ public void onTake(Player player, ItemStack stack) { if (!toReplace.isEmpty()) { if (toRemove.isEmpty()) craftingContainer.setItem(i, toRemove); - else if (ItemStack.isSameItemSameTags(toRemove, toReplace)) { + else if (ItemStack.isSameItemSameComponents(toRemove, toReplace)) { toReplace.grow(toRemove.getCount()); craftingContainer.setItem(i, toReplace); } else if (!player.getInventory().add(toReplace)) diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipe.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipe.java index 1fdcf35273..3774e7897b 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipe.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipe.java @@ -8,6 +8,7 @@ import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.ArrayList; import java.util.Collections; @@ -17,8 +18,8 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -85,7 +86,7 @@ private boolean matches(RecipeBookExtensionTest.RecipeBookTestContainer containe } @Override - public ItemStack assemble(RecipeBookExtensionTest.RecipeBookTestContainer p_44001_, RegistryAccess registryAccess) { + public ItemStack assemble(RecipeBookExtensionTest.RecipeBookTestContainer p_44001_, HolderLookup.Provider registryAccess) { return this.getResultItem(registryAccess).copy(); } @@ -95,7 +96,7 @@ public boolean canCraftInDimensions(int p_43999_, int p_44000_) { } @Override - public ItemStack getResultItem(RegistryAccess registryAccess) { + public ItemStack getResultItem(HolderLookup.Provider registryAccess) { return this.ingredients.result(); } @@ -144,7 +145,7 @@ public record Ingredients(String group, List pattern, Map> VERIFY_LENGTH_1 = s -> s.length() == 1 ? DataResult.success(s) : DataResult.error(() -> "Key must be a single character!"); - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> inst.group( Codec.STRING.fieldOf("group").forGetter(Ingredients::group), Codec.STRING.flatXmap(VERIFY_LENGTH_2, VERIFY_LENGTH_2).listOf().flatXmap(VERIFY_SIZE, VERIFY_SIZE).fieldOf("pattern").forGetter(Ingredients::pattern), Codec.unboundedMap(Codec.STRING.flatXmap(VERIFY_LENGTH_1, VERIFY_LENGTH_1), Ingredient.CODEC).fieldOf("key").forGetter(Ingredients::recipe), diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipeSerializer.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipeSerializer.java index 4fb7020637..e0ecbc9180 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipeSerializer.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/recipebook/RecipeBookTestRecipeSerializer.java @@ -5,29 +5,24 @@ package net.neoforged.neoforge.oldtest.recipebook; -import com.mojang.serialization.Codec; -import net.minecraft.nbt.NbtOps; -import net.minecraft.network.FriendlyByteBuf; +import com.mojang.serialization.MapCodec; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.crafting.RecipeSerializer; import net.neoforged.neoforge.oldtest.recipebook.RecipeBookTestRecipe.Ingredients; -import org.jetbrains.annotations.Nullable; public class RecipeBookTestRecipeSerializer implements RecipeSerializer { - private static final Codec CODEC = Ingredients.CODEC.xmap(RecipeBookTestRecipe::new, recipeBookTestRecipe -> recipeBookTestRecipe.ingredients); + private static final MapCodec CODEC = Ingredients.CODEC.xmap(RecipeBookTestRecipe::new, recipeBookTestRecipe -> recipeBookTestRecipe.ingredients); + private static final StreamCodec STREAM_CODEC = ByteBufCodecs.fromCodecWithRegistries(CODEC.codec()); @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } @Override - public @Nullable RecipeBookTestRecipe fromNetwork(FriendlyByteBuf buf) { - Ingredients ingredients = buf.readWithCodecTrusted(NbtOps.INSTANCE, Ingredients.CODEC); - return new RecipeBookTestRecipe(ingredients); - } - - @Override - public void toNetwork(FriendlyByteBuf buffer, RecipeBookTestRecipe recipe) { - buffer.writeWithCodec(NbtOps.INSTANCE, Ingredients.CODEC, recipe.ingredients); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/BiomeModifierTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/BiomeModifierTest.java index 6da329ae0f..8788a418fe 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/BiomeModifierTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/BiomeModifierTest.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.oldtest.world; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; import java.util.Locale; @@ -66,8 +67,8 @@ public class BiomeModifierTest { /* Static registry objects */ // Biome Modifier Serializers - private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID); - private static final DeferredHolder, Codec> MODIFY_BIOMES = BIOME_MODIFIER_SERIALIZERS.register("modify_biomes", () -> RecordCodecBuilder.create(builder -> builder.group( + private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID); + private static final DeferredHolder, MapCodec> MODIFY_BIOMES = BIOME_MODIFIER_SERIALIZERS.register("modify_biomes", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(TestModifier::biomes), Codec.STRING.xmap(s -> Precipitation.valueOf(s.toUpperCase(Locale.ROOT)), e -> e.name().toLowerCase(Locale.ROOT)).fieldOf("precipitation").forGetter(TestModifier::precipitation), Codec.INT.fieldOf("water_color").forGetter(TestModifier::waterColor)).apply(builder, TestModifier::new))); @@ -151,7 +152,7 @@ public void modify(Holder biome, Phase phase, Builder builder) { } @Override - public Codec codec() { + public MapCodec codec() { return MODIFY_BIOMES.get(); } } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/LoginPacketSplitTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/LoginPacketSplitTest.java index 836944f1da..c5d902f74a 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/LoginPacketSplitTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/LoginPacketSplitTest.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Map; +import java.util.Optional; import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -30,17 +31,17 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import net.minecraft.SharedConstants; -import net.minecraft.Util; import net.minecraft.commands.Commands; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; -import net.minecraft.core.RegistryCodecs; import net.minecraft.network.CompressionDecoder; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; +import net.minecraft.server.packs.PackSelectionConfig; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.repository.BuiltInPackSource; @@ -82,16 +83,14 @@ public LoginPacketSplitTest(IEventBus bus) { if (ENABLED) { bus.addListener((final AddPackFindersEvent event) -> { if (event.getPackType() == PackType.SERVER_DATA) { - final InMemoryResourcePack pack = new InMemoryResourcePack("virtual_bigdata"); + PackLocationInfo info = new PackLocationInfo("virtual_bigdata", Component.literal("Pack containing big datapack registries"), PackSource.BUILT_IN, Optional.empty()); + final InMemoryResourcePack pack = new InMemoryResourcePack(info); generateEntries(pack); event.addRepositorySource(packs -> packs.accept(Pack.readMetaAndCreate( - pack.id, - Component.literal("Pack containing big datapack registries"), - true, + pack.location(), BuiltInPackSource.fixedResources(pack), PackType.SERVER_DATA, - Pack.Position.TOP, - PackSource.BUILT_IN))); + new PackSelectionConfig(true, Pack.Position.TOP, false)))); } }); @@ -123,9 +122,10 @@ private void generateEntries(InMemoryResourcePack pack) { LOG.warn("Setting up big data registry took " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " miliseconds."); final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); - record RegistryData(Registry registry) {} - writeJsonWithCodec(buf, RecordCodecBuilder.create(in -> in.group( - RegistryCodecs.networkCodec(BIG_DATA, Lifecycle.stable(), BigData.CODEC).fieldOf("registry").forGetter(RegistryData::registry)).apply(in, RegistryData::new)), new RegistryData(dummyRegistry)); // RegistryCodecs.networkCodec returns a list codec, and writeWithNbt doesn't like non-compounds + dummyRegistry.holders().forEach(ref -> { + buf.writeUtf(ref.getRegisteredName()); + buf.writeJsonWithCodec(BigData.CODEC, ref.value()); + }); final int size = buf.writerIndex(); LOG.warn("Dummy big registry size: " + size + ", or " + ((double) size / CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH * 100) + "% of the maximum packet size."); @@ -148,10 +148,10 @@ public static final class InMemoryResourcePack implements PackResources { private final Map> data = new ConcurrentHashMap<>(); private final Map> root = new ConcurrentHashMap<>(); - private final String id; + private final PackLocationInfo info; - public InMemoryResourcePack(String id) { - this.id = id; + public InMemoryResourcePack(PackLocationInfo info) { + this.info = info; final JsonObject mcmeta = new JsonObject(); final JsonObject packJson = new JsonObject(); @@ -219,8 +219,8 @@ public T getMetadataSection(MetadataSectionSerializer section) throws IOE } @Override - public String packId() { - return id; + public PackLocationInfo location() { + return info; } @Override @@ -251,7 +251,7 @@ public static byte[] fromJson(JsonElement json) { public void writeJsonWithCodec(FriendlyByteBuf buf, Codec codec, T instance) { DataResult dataresult = codec.encodeStart(JsonOps.INSTANCE, instance); - final String s = GSON.toJson(Util.getOrThrow(dataresult, p_261421_ -> new EncoderException("Failed to encode: " + p_261421_ + " " + instance))); + final String s = GSON.toJson(dataresult.getOrThrow(error -> new EncoderException("Failed to encode: " + error + " " + instance))); buf.writeVarInt(s.length()); buf.writeUtf(s, s.length()); } diff --git a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/StructureModifierTest.java b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/StructureModifierTest.java index 4dd104cb39..b9fa57e2f5 100644 --- a/tests/src/main/java/net/neoforged/neoforge/oldtest/world/StructureModifierTest.java +++ b/tests/src/main/java/net/neoforged/neoforge/oldtest/world/StructureModifierTest.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.oldtest.world; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -51,7 +52,7 @@ public StructureModifierTest(IEventBus modBus) { return; // Serializer types can be registered via deferred register. - final DeferredRegister> serializers = DeferredRegister.create(Keys.STRUCTURE_MODIFIER_SERIALIZERS, MODID); + final DeferredRegister> serializers = DeferredRegister.create(Keys.STRUCTURE_MODIFIER_SERIALIZERS, MODID); serializers.register(modBus); serializers.register(TEST, TestModifier::makeCodec); @@ -83,7 +84,7 @@ private void onGatherData(GatherDataEvent event) { public record TestModifier(HolderSet structures, MobCategory category, MobSpawnSettings.SpawnerData spawn) implements StructureModifier { - private static final DeferredHolder, Codec> SERIALIZER = DeferredHolder.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, ADD_SPAWNS_TO_STRUCTURE_RL); + private static final DeferredHolder, MapCodec> SERIALIZER = DeferredHolder.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, ADD_SPAWNS_TO_STRUCTURE_RL); @Override public void modify(Holder structure, Phase phase, Builder builder) { if (phase == Phase.ADD && this.structures.contains(structure)) { @@ -94,12 +95,12 @@ public void modify(Holder structure, Phase phase, Builder builder) { } @Override - public Codec codec() { + public MapCodec codec() { return SERIALIZER.get(); } - private static Codec makeCodec() { - return RecordCodecBuilder.create(builder -> builder.group( + private static MapCodec makeCodec() { + return RecordCodecBuilder.mapCodec(builder -> builder.group( STRUCTURE_LIST_CODEC.fieldOf("structures").forGetter(TestModifier::structures), MobCategory.CODEC.fieldOf("category").forGetter(TestModifier::category), MobSpawnSettings.SpawnerData.CODEC.fieldOf("spawn").forGetter(TestModifier::spawn)).apply(builder, TestModifier::new)); diff --git a/tests/src/main/resources/META-INF/mods.toml b/tests/src/main/resources/META-INF/neoforge.mods.toml similarity index 97% rename from tests/src/main/resources/META-INF/mods.toml rename to tests/src/main/resources/META-INF/neoforge.mods.toml index aa65d98c0c..59d624dfd6 100644 --- a/tests/src/main/resources/META-INF/mods.toml +++ b/tests/src/main/resources/META-INF/neoforge.mods.toml @@ -50,8 +50,6 @@ modId="slipperiness_test" [[mods]] modId="entity_selector_test" [[mods]] -modId="gravity_attribute_test" -[[mods]] modId="new_fluid_test" [[mods]] modId="milk_fluid_test" @@ -100,8 +98,6 @@ modId="scaffolding_test" [[mods]] modId="forge_chunk_manager_test" [[mods]] -modId="forge_codecs_test" -[[mods]] modId="render_local_player_test" [[mods]] modId="custom_sound_type_test" @@ -126,8 +122,6 @@ modId="entity_renderer_events_test" [[mods]] modId="remove_tag_datagen_test" [[mods]] -modId="tag_based_tool_types" -[[mods]] modId="spawn_placement_test" [[mods]] modId="redstone_sided_connectivity_test" diff --git a/tests/src/main/resources/data/custom_tooltip_test/recipes/custom_item.json b/tests/src/main/resources/data/custom_tooltip_test/recipes/custom_item.json index 9ca264081b..63bd75e310 100644 --- a/tests/src/main/resources/data/custom_tooltip_test/recipes/custom_item.json +++ b/tests/src/main/resources/data/custom_tooltip_test/recipes/custom_item.json @@ -9,6 +9,6 @@ } }, "result": { - "item": "custom_tooltip_test:test_item" + "id": "custom_tooltip_test:test_item" } -} \ No newline at end of file +} diff --git a/tests/src/main/resources/data/neoforge/advancements/dummy_parent.json b/tests/src/main/resources/data/neoforge/advancements/dummy_parent.json index 10bc90a6bb..15def849d6 100644 --- a/tests/src/main/resources/data/neoforge/advancements/dummy_parent.json +++ b/tests/src/main/resources/data/neoforge/advancements/dummy_parent.json @@ -1,7 +1,7 @@ { "display": { "icon": { - "item": "minecraft:dirt" + "id": "minecraft:dirt" }, "title": { "translate": "block.minecraft.dirt" @@ -32,4 +32,4 @@ "has_dirt" ] ] -} \ No newline at end of file +} diff --git a/tests/src/main/resources/data/recipe_extensions/recipes/smelting_multi_output.json b/tests/src/main/resources/data/recipe_extensions/recipes/smelting_multi_output.json index 8e4da10127..0829180450 100644 --- a/tests/src/main/resources/data/recipe_extensions/recipes/smelting_multi_output.json +++ b/tests/src/main/resources/data/recipe_extensions/recipes/smelting_multi_output.json @@ -4,7 +4,7 @@ "item": "minecraft:diamond_block" }, "result": { - "item": "minecraft:diamond", + "id": "minecraft:diamond", "count": 9 }, "cookingtime": 100