Jump to content

Adil Yilan

Members
  • Posts

    73
  • Joined

  • Last visited

1 Follower

Converted

  • Gender
    Male
  • URL
    https://www.minecraft.ba

Recent Profile Visitors

115592 profile views

Adil Yilan's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  1. After upgrade from 1.21.1 to 1.21.3, when I do gradlew runData, I get really strange error that I cannot understand: Caused by: java.lang.NullPointerException: Item id not set at java.base/java.util.Objects.requireNonNull(Objects.java:259) at TRANSFORMER/[email protected]/net.minecraft.world.item.Item$Properties.effectiveDescriptionId(Item.java:461) at TRANSFORMER/[email protected]/net.minecraft.world.item.Item.<init>(Item.java:111) at TRANSFORMER/[email protected]/ba.minecraft.uniqueweaponry.common.item.grenade.base.BaseGrenadeItem.<init>(BaseGrenadeItem.java:22) at TRANSFORMER/[email protected]/ba.minecraft.uniqueweaponry.common.item.grenade.FlashGrenadeItem.<init>(FlashGrenadeItem.java:9) at TRANSFORMER/[email protected]/ba.minecraft.uniqueweaponry.common.item.GrenadeItems.lambda$0(GrenadeItems.java:22) at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister$EventDispatcher.lambda$handleEvent$0(DeferredRegister.java:366) at TRANSFORMER/[email protected]/net.minecraftforge.registries.RegisterEvent.register(RegisterEvent.java:59) at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:366) at TRANSFORMER/[email protected]/net.minecraftforge.registries.__EventDispatcher_handleEvent_RegisterEvent.invoke(.dynamic) at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:48) at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:304) at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:290) Have there been changes related on how items should be registered now?
  2. Hi, Here is the overview of the 0.4.0 update for the Unique Weaponry mod we have been working on, that adds few new weapons: Evoker's Tome Skullcaster Infernal Scepter Mod can be downloaded from CurseForge: https://www.curseforge.com/minecraft/mc-mods/unique-weaponry Any suggestions and ideas are more than welcome!
  3. Hi all Just wanted to share an update to Unique Magic & Enchantments mods that adds 30+ new enchantments to Minecraft. In this update we have added two new enchantments: Kensei - Increases damage done based on XP level Bone Breaker - Has chance to dismantle skeletons when hit with arrow Mod can be downloaded on CurseForge: https://legacy.curseforge.com/minecraft/mc-mods/unique-magic Here is an overview of update: If you have any new ideas or suggestions, let us know. Thanks!
  4. Hi, Here is the overview of the update for the Unique Weaponry mod we have been working on: Mod can be downloaded from CurseForge: https://www.curseforge.com/minecraft/mc-mods/unique-weaponry Any suggestions and ideas are more than welcome!
  5. This is the code for my enchantment tags provider for data generation: public final class ModEnchantmentTagsProvider extends EnchantmentTagsProvider { public ModEnchantmentTagsProvider(PackOutput packOutput, CompletableFuture<Provider> lookupProvider) { super(packOutput, lookupProvider); } @Override protected void addTags(Provider provider) { tag(EnchantmentTags.ARMOR_EXCLUSIVE) .add(ArmorEnchantments.FREEZING_PROTECTION) .add(ArmorEnchantments.LIGHTNING_PROTECTION) .add(ArmorEnchantments.MAGIC_PROTECTION) .add(ArmorEnchantments.SONIC_PROTECTION); tag(ModEnchantmentTags.XP_GAIN_EXCLUSIVE) .add(Enchantments.MENDING) .add(ArmorEnchantments.EXPLORATION); } @Override public String getName() { return "Unique Magic Enchantment Tags"; } } So what am I doing here is: 1) Adding my custom protection enchantments to be ARMOR_EXCLUSIVE so they don't clash with existing protection enchantments 2) Adding tag that makes my custom EXPLORATION enchantment to be exclusive with MENDING enchantment This is then registered in ModDataGenerators: dataGen.addProvider(event.includeServer(), new ModEnchantmentTagsProvider(packOutput, lookupProvider)); When datagen is run, I end up with this error: Caused by: java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Couldn't define tag minecraft:exclusive_set/armor as it is missing following references: uniquemagic:freezing_protection,uniquemagic:lightning_protection,uniquemagic:magic_protection,uniquemagic:sonic_protection Enchantments have been migrated to 1.21 and they work in game as they did in 1.20.6. I also get enchantment JSON files in src/generated/resources so that is working well too. However, I cannot make these tags to work no matter what I try. Is there something that I am missing?
  6. If you want to access Resource from Minecraft, use: ResourceLocation.withDefaultNamespace("potato"); or If you want to access Resource from your mod, use: ResourceLocation.fromNamespaceAndPath("your_mod_id", "your_key");
  7. Recently after I update my mods to latest Forge MDK version, and update server to latest Forge, and then replace old mods versions with new ones, once when I start server I get these messages: I am not familiar with what this error is and how to resolve it. Is this something that has to be done on server or I need to add some migration code to my mods?
  8. Hi, I am implementing a mod where I have to encrypt a player's secret and persist it as an NBT. I plan to expose encryption parameters as a mod config file, where default values will be randomly generated. Since Java is not my primary language of use (I come from the C# world), I am not sure what is the best/latest/recommended approach to encrypt secrets. I've found this article which seems decent: https://www.geeksforgeeks.org/java-program-to-encrypt-password-in-configuration-files/ Is this a good way to go or there is a better/recommended way to do it with Forge/Minecraft? Thanks!
  9. Hi, I need to implement periodic background execution of specific code. It should run every second, and if a few conditions are not satisfied, it should broadcast a message to either a specific player or all players. What would be the safest/recommended way to do it in Forge/Minecraft? If there are links to examples of successful implementations, sharing would be much appreciated! Thanks!
  10. @Luis_ST Well it requires me to pass that as the parameter. This is the only way I was able to bypass the error I had originally reported. Any suggestions on how to do this properly?
  11. Alright, so the key for this is to implement a factory method in the class that extends SavedData: public static SavedData.Factory<PlayersSeenSavedData> factory() { return new SavedData.Factory<>(PlayersSeenSavedData::new, PlayersSeenSavedData::load, DataFixTypes.PLAYER); } Once the factory method is implemented, it should be provided to .get method of DimensionDataStorage: PlayersSeenSavedData savedData = storage.get(PlayersSeenSavedData.factory(), SEENS_KEY); The only thing I am not sure of is usage of DataFixTypes.PLAYER. What is this used for? How to select proper DataFixType?
  12. I have updated mod that has previously worked with Forge for 1.20.1 to latest version of Forge for 1.20.2, and then code that was previously compiling properly started to show unusual message: PlayerManager.java:107: error: incompatible types: Factory is not a functional interface PlayersSeenSavedData savedData = storage.get(PlayersSeenSavedData::load, SEENS_KEY); The code looks like this: private static PlayersSeenSavedData tryLoadPlayersSeenData(DimensionDataStorage storage) { // Load saved data based on the key. PlayersSeenSavedData savedData = storage.get(PlayersSeenSavedData::load, SEENS_KEY); // IF: Data was never saved before. if(savedData == null) { savedData = PlayersSeenSavedData.create(); } return savedData; } I have checked method signature for get method of DimensionDataStorage for 1.20.1 and 1.20.2 and I cannot find any difference. Any hints on what exactly has changed and why is my load method now rejected? Here is the code for load method: public static PlayersSeenSavedData load(CompoundTag compoundTag) { // Load list of NBTs from server data. ListTag listTag = compoundTag.getList(KEY, Tag.TAG_COMPOUND); // Create new empty list that will hold all data. ArrayList<PlayerSeenData> playersData = new ArrayList<PlayerSeenData>(); // Iterate through all NBTs. for(Tag tag : listTag) { // Deserialize NBT back to regular object. PlayerSeenData playerData = PlayerSeenData.deserialize((CompoundTag)tag); // Add object to array of data. playersData.add(playerData); } // Create new instance of saved data class and provide data that was loaded to it. return new PlayersSeenSavedData(playersData); }
  13. Nvm, I found solution myself Here is it in case someone else needs it: ResourceKey<Level> resKey = ResourceKey.create(Registries.DIMENSION, resLoc);
  14. Hi, In 1.19.2 I had this code that would give me reference to dimension based on it's name: // Get ID of resource location for dimension. String resLocId = data.getString(key + ":dim"); // Create resource location. ResourceLocation resLoc = new ResourceLocation(resLocId); // Get resource key for dimension. ResourceKey<Level> resKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, resLoc); // Get reference to server where code is running. MinecraftServer server = player.getServer(); // Get reference to level that was saved with command. ServerLevel level = server.getLevel(resKey); With DIMENSION_REGISTRY being gone from Registry class, this code no longer works. What would be a proper way to get reference to a dimension (ServerLevel) based on it's resource location identifier in 1.20.1?
  15. Thanks @warjort (and @Luis_ST), I have managed to make this work as expected. I have broken dropSelf method to pieces and added BlockState related code from createBeeNestDrop method, and wrapped all that in new helper method: protected void dropSelfWithBlockState(Block block, Property<?>[] properties) { CopyBlockState.Builder blockStateCopyBuilder = CopyBlockState.copyState(block); for(Property<?> property : properties) { blockStateCopyBuilder.copy(property); } LootPoolSingletonContainer.Builder<?> itemLootTableBuilder = LootItem.lootTableItem(block); itemLootTableBuilder.apply(blockStateCopyBuilder); LootPool.Builder lootPoolBuilder = LootPool.lootPool(); lootPoolBuilder.setRolls(ConstantValue.exactly(1.0F)); lootPoolBuilder.add(itemLootTableBuilder); lootPoolBuilder = applyExplosionCondition(block, lootPoolBuilder); LootTable.Builder lootTableBuilder = LootTable.lootTable(); lootTableBuilder.withPool(lootPoolBuilder); this.add(block, lootTableBuilder); } So I can now call this for all other scenarios like this: dropSelfWithBlockState(FluidBlocks.OIL_CASK.get(), new Property<?>[] { OilCaskBlock.LEVEL }); Hope others will find this useful.
×
×
  • Create New...

Important Information

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