Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Purplicious_Cow

Forge Modder
  • Joined

  • Last visited

  1. Even more odd, it's still listed as supported by Forge in the Forge Docs... but it's clearly missing: https://docs.minecraftforge.net/en/latest/items/#basic-items Anyone alive in here?
  2. It appears that the setNoRepair() method has been removed in 1.21.x versions of the Item Class, along with canRepair or other support from the IForgeItem class extension. I searched these forums and and looked at many other repositories, but I don't see how to handle this anymore in Forge. There is no mention of it being deprecated or how to handle. Did I miss something somewhere? How do you prevent an item from being marked as repairable now in Anvil or Grindstone. It's no longer part of Item.Properties. Any advice appreciated. PC
  3. Just to put a cap on this one in case anyone falls into this trap, I had originally been confused by the Minecraft Forge notes found in the update to the ModConfig class, where it states that Common and Client sides are not synced, meanwhile the Server side is. From https://github.com/MinecraftForge/MinecraftForge/blob/1.16.x/src/main/java/net/minecraftforge/fml/config/ModConfig.java The description below from the Forge code could use some clarification. In the end the COMMON spec was the correct one for the case I presented above, and the error I was seeing was somewhere else in my own code. public enum Type { /** * Common mod config for configuration that needs to be loaded on both environments. * Loaded on both servers and clients. * Stored in the global config directory. * Not synced. * Suffix is "-common" by default. */ COMMON, /** * Client config is for configuration affecting the ONLY client state such as graphical options. * Only loaded on the client side. * Stored in the global config directory. * Not synced. * Suffix is "-client" by default. */ CLIENT, // /** // * Player type config is configuration that is associated with a player. // * Preferences around machine states, for example. // */ // PLAYER, /** * Server type config is configuration that is associated with a server instance. * Only loaded during server startup. * Stored in a server/save specific "serverconfig" directory. * Synced to clients during connection. * Suffix is "-server" by default. */ SERVER; public String extension() { return StringUtils.toLowerCase(name()); } }
  4. God, sometimes I wonder about my brain. I just tested several cases and proved your point. The bug was in my checking of the configuration value. No need for packets. Maybe another cup of coffee.
  5. Look under Biome.Category, which can also be referenced in the BiomeLoadingEvent, under event.getCategory()
  6. I have a general question about Configs in 1.15/1.16. Is there a way to force sync Common config between server and client (where Server is the owner of record)? I have several common config values that should be controlled by the values from the server (when on server). With Common spec, however, users can change Common values client side and the server does not override them. This allows certain players to take advantage of game play by lowering difficulty or enabling features they shouldn't have in a group setting. If I use the Server type spec, this puts all of these 'protected' values into the Server config, which is actually stored within the 'Save' file on the World server. This means that players who use the mod primarily in a single player setting will have to update their config preferences every time they create a new world, which seems like an extraordinary inconvenience for single players. What is the recommended approach for solving this issue? Thank you for any guidance.
  7. Thanks, GenElectrovise. I had the same thought, but couldn't figure out how to force DimensionSettings to use field_242736_e (for the Nether). From my understanding of the code in func_242745_a, it looks like it pulls the world correct key prior to applying final settings, but I could be wrong. I may try this again, using access transformers to see if I can force the Nether key for this particular structure.
  8. I'm having issues trying to get Custom Structures to generate in the Nether. The same structure generates correctly in the Overworld (e.g., Swamp Biome works fine), but it doesn't even fire the event generation in the Nether. I suspect it's something in the way I've done registration or with the way Biome loading works in the Nether, but after two days, I haven't been able to move the needle. Any help appreciated: package com.inventorypets.worldgen; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.inventorypets.InventoryPets; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.WorldGenRegistries; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.DimensionSettings; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.StructureFeature; import net.minecraft.world.gen.feature.structure.IStructurePieceType; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.settings.DimensionStructuresSettings; import net.minecraft.world.gen.settings.StructureSeparationSettings; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class WorldGen { static DeferredRegister<Structure<?>> STRUCTURES = DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, InventoryPets.MODID); static List<Structure<?>> STRUCTURE_LIST = new ArrayList<>(); static Map<ResourceLocation, StructureSeparationSettings> STRUCTURE_SETTINGS = new HashMap<>(); static IStructurePieceType register(IStructurePieceType type, String name) { net.minecraft.util.registry.Registry.register(net.minecraft.util.registry.Registry.STRUCTURE_PIECE, new ResourceLocation(InventoryPets.MODID, name), type); return type; } static <C extends IFeatureConfig, S extends Structure<C>> StructureFeature<C, S> register(StructureFeature<C, S> feature, String name) { WorldGenRegistries.register(WorldGenRegistries.CONFIGURED_STRUCTURE_FEATURE, new ResourceLocation(InventoryPets.MODID, name), feature); return feature; } static <C extends IFeatureConfig> RegistryObject<Structure<C>> addStructure(String name, Structure<C> structure, GenerationStage.Decoration stage, StructureSeparationSettings settings) { Structure.NAME_STRUCTURE_BIMAP.put(InventoryPets.MODID + ":" + name, structure); Structure.STRUCTURE_DECORATION_STAGE_MAP.put(structure, stage); STRUCTURE_LIST.add(structure); STRUCTURE_SETTINGS.put(new ResourceLocation(InventoryPets.MODID, name), settings); if (stage == GenerationStage.Decoration.SURFACE_STRUCTURES) { Structure.field_236384_t_ = ImmutableList.<Structure<?>>builder().addAll(Structure.field_236384_t_).add(structure).build(); } return STRUCTURES.register(name, () -> structure); } public static IStructurePieceType SKY_DUNGEON_PIECE; public static IStructurePieceType SPACE_DUNGEON_PIECE; public static IStructurePieceType NETHER_DUNGEON_PIECE; public static IStructurePieceType UNDERGROUND_DUNGEON_PIECE; public static IStructurePieceType TREE_TOP_PIECE; public static IStructurePieceType SEA_CAVE_PIECE; public static RegistryObject<Structure<NoFeatureConfig>> SKY_DUNGEON_STRUCTURE = addStructure("sky_dungeon", new SkyDungeonStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.RAW_GENERATION, new StructureSeparationSettings(7, 6, 1236)); public static RegistryObject<Structure<NoFeatureConfig>> SPACE_DUNGEON_STRUCTURE = addStructure("space_dungeon", new SpaceDungeonStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.RAW_GENERATION, new StructureSeparationSettings(9, 5, 1337)); public static RegistryObject<Structure<NoFeatureConfig>> NETHER_DUNGEON_STRUCTURE = addStructure("nether_dungeon", new NetherDungeonStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.RAW_GENERATION, new StructureSeparationSettings(6, 3, 1438)); public static RegistryObject<Structure<NoFeatureConfig>> UNDERGROUND_DUNGEON_STRUCTURE = addStructure("underground_dungeon", new UndergroundDungeonStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.RAW_GENERATION, new StructureSeparationSettings(8, 6, 1539)); public static RegistryObject<Structure<NoFeatureConfig>> TREE_TOP_STRUCTURE = addStructure("tree_top", new TreeTopStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.SURFACE_STRUCTURES, new StructureSeparationSettings(4, 3, 1640)); public static RegistryObject<Structure<NoFeatureConfig>> SEA_CAVE_STRUCTURE = addStructure("sea_cave", new SeaCaveStructure(NoFeatureConfig.field_236558_a_), GenerationStage.Decoration.RAW_GENERATION, new StructureSeparationSettings(8, 6, 1741)); public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> SKY_DUNGEON_FEATURE; public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> SPACE_DUNGEON_FEATURE; public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> NETHER_DUNGEON_FEATURE; public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> UNDERGROUND_DUNGEON_FEATURE; public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> TREE_TOP_FEATURE; public static StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> SEA_CAVE_FEATURE; public static void preInit() { STRUCTURES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static void init() { SKY_DUNGEON_PIECE = register(SkyDungeonStructure.Piece::new, "sky_dungeon"); SKY_DUNGEON_FEATURE = register(SKY_DUNGEON_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "sky_dungeon"); SPACE_DUNGEON_PIECE = register(SpaceDungeonStructure.Piece::new, "space_dungeon"); SPACE_DUNGEON_FEATURE = register(SPACE_DUNGEON_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "space_dungeon"); UNDERGROUND_DUNGEON_PIECE = register(UndergroundDungeonStructure.Piece::new, "underground_dungeon"); UNDERGROUND_DUNGEON_FEATURE = register(UNDERGROUND_DUNGEON_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "underground_dungeon"); TREE_TOP_PIECE = register(TreeTopStructure.Piece::new, "tree_top"); TREE_TOP_FEATURE = register(TREE_TOP_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "tree_top"); SEA_CAVE_PIECE = register(SeaCaveStructure.Piece::new, "sea_cave"); SEA_CAVE_FEATURE = register(SEA_CAVE_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "sea_cave"); NETHER_DUNGEON_PIECE = register(NetherDungeonStructure.Piece::new, "nether_dungeon"); NETHER_DUNGEON_FEATURE = register(NETHER_DUNGEON_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "nether_dungeon"); for (Structure<?> s : STRUCTURE_LIST) { ImmutableSet.of(DimensionSettings.field_242734_c, DimensionSettings.field_242736_e); DimensionStructuresSettings.field_236191_b_ = ImmutableMap.<Structure<?>, StructureSeparationSettings>builder() .putAll(DimensionStructuresSettings.field_236191_b_) .put(s, STRUCTURE_SETTINGS.get(s.getRegistryName())) .build(); DimensionSettings.field_242740_q.getStructures().field_236193_d_.put(s, STRUCTURE_SETTINGS.get(s.getRegistryName())); } } @SubscribeEvent(priority = EventPriority.HIGHEST) public void onBiomeLoad(BiomeLoadingEvent event) { event.getGeneration().withStructure(SKY_DUNGEON_FEATURE); event.getGeneration().withStructure(SPACE_DUNGEON_FEATURE); event.getGeneration().withStructure(UNDERGROUND_DUNGEON_FEATURE); if (event.getCategory() == Biome.Category.FOREST || event.getCategory() == Biome.Category.PLAINS || event.getCategory() == Biome.Category.SAVANNA || event.getCategory() == Biome.Category.TAIGA || event.getCategory() == Biome.Category.EXTREME_HILLS ) { event.getGeneration().withStructure(TREE_TOP_FEATURE); } else if (event.getCategory() == Biome.Category.OCEAN) { event.getGeneration().withStructure(SEA_CAVE_FEATURE); } else if (event.getCategory() == Biome.Category.SWAMP || event.getCategory() == Biome.Category.NETHER) { event.getGeneration().withStructure(NETHER_DUNGEON_FEATURE); } } }
  9. Ahhhhh! Brilliant. Thank you. I didn't realize you could create a dummy register object from another mod.
  10. Thanks diesieben07. I use the getItem() method for 99.9% of cases. I had used the unlocalized name in earlier version of inventory pets to check cross-mod (e.g., identifying the bosses from OreSpawn for example, or to avoid conflicts with other mod items). The fact that the unlocalized name can change is a good reason to use getRegistryName(). Thanks both for filling in the gaps.
  11. Yes, clearly the registry name, which I will change going forward (on the versions I can still do so), but that was not my question. You are hinting at a Client vs. Server issue, but not quite. This method has been in the Inventory Pets code since 1.7.10 and players have not seen issues. Is it simply a recommendation to avoid future deprecation, or is it just a performance recommendation? Was hoping for a technical answer.
  12. On diesieben07's great issues and recommendations post (linked below), item #7 reads: 7. Do not use the unlocalized names for things other than displaying the name of a block/item. If you want to access the registry name for a registry entry, use IForgeRegistryEntry::getRegistryName. Can someone explain why this is an issue? I have some small bit of code doing this now, and have not experienced any issues....
  13. Nice! Yes, I think I can use this. Will report back if I run into issues/questions.
  14. Hello Forge friends. Long time. I'm finally updating my mods to 1.15.x (and up), and have run into an issue with one of the features in Inventory Pets, which dynamically determined which recipe set the player saw based on a config value (thereby increasing the difficulty of game by using harder to find ingredients). I see that we can no longer use the 'remove' feature from the Registry. And I see williewillus' note in his super-valuable primer that super dynamic recipes still haven't been implemented in 1.14/1.15.x (not sure if that's the same thing). The one idea I came up with was to restrict a set of recipes to be based on an advancement which is would be unlocked after checking config settings. Probably not the best experience. Am I missing another method? Thanks for any assistance. Purp
  15. FYI, I went with Lycanite's solution, which is to use try/catch on all attempts to access the data. On failure, it reverts to a default state. It's not ideal, but it prevents crashing in the case there is a conflict. Example: public float getFloatFromDataManager(DataParameter<Float> key) { try { return this.getDataManager().get(key); } catch (Exception e) { return 0; } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.