Jump to content

Tavi007

Members
  • Posts

    145
  • Joined

  • Last visited

Everything posted by Tavi007

  1. Hello! I've got 2 questions about to different things. The first is about filling a capability and the second about particles. 1. So I've got a working capabilities for projectile entities and I want to fill it with data from its source. I also got other capabilities, where I use the AttachCapabilitiesEvent to fill them (I use data, that I loaded from json). Now in the case for the projectile entity I wanted to use func_234616_v_(), which should return the shooter of my projectile. But this functions always returns null, mostly likely because the shooter hasn't be set yet. Should I use an other event or is there some other way to get the shooter, that I'm not aware of? 2. I have 4 particles, which are all working as intended. But I also have a lot of code duplication going on, because all 4 particles behave the same, except the texture and when they are supposed to be displayed. What would be the better solution, than copying the code 4 times like I did? Just in case you want to look at my code, here is my repository. The code for the particles is here and they are getting generated here. Trying to get the shooter of a particle can be found here.
  2. Is this better now? @SubscribeEvent public static void registerEnchantments(Register<Enchantment> event) { event.getRegistry().register(new ElementalResistanceEnchantment(ElementalResistanceEnchantment.Type.FIRE).setRegistryName(Enchantments.FIRE_PROTECTION.getRegistryName())); event.getRegistry().register(new ElementalResistanceEnchantment(ElementalResistanceEnchantment.Type.ICE).setRegistryName("ice_protection")); event.getRegistry().register(new ElementalResistanceEnchantment(ElementalResistanceEnchantment.Type.WATER).setRegistryName("water_protection")); event.getRegistry().register(new ElementalResistanceEnchantment(ElementalResistanceEnchantment.Type.THUNDER).setRegistryName("thunder_protection")); event.getRegistry().register(new ElementalWeaponEnchantment(ElementalWeaponEnchantment.Type.ICE).setRegistryName("ice_aspect")); event.getRegistry().register(new ElementalWeaponEnchantment(ElementalWeaponEnchantment.Type.WATER).setRegistryName("water_aspect")); event.getRegistry().register(new ElementalWeaponEnchantment(ElementalWeaponEnchantment.Type.THUNDER).setRegistryName("thunder_aspect")); } sometimes I wish the example mod would provide more code. A proper example for a particle/an item/a block/an enchantment/whatever could reduce a lot of question... I would support you, but since I'm a newbie, I wouldn't be helpful
  3. oh, okay. I will fix this
  4. Nevermind, I just had an idea and it worked out. I have to set the registryName in the constructor of my costum enchantment like this public FireResistanceEnchantment() { super(Rarity.VERY_RARE, EnchantmentType.ARMOR, ARMOR_SLOTS); //this.setRegistryName("fire_protection"); this.setRegistryName(Enchantments.FIRE_PROTECTION.getRegistryName()); super.name = "New Fire Protection"; }
  5. Here is what I tried. I call this line in a Register<Enchantment> event, which should replace the vanilla enchantment with my costum one. event.getRegistry().register(ElementalEnchantments.FIRE_PROTECTION.setRegistryName(Enchantments.FIRE_PROTECTION.getRegistryName())); However this fails on runtime: [31Jul2020 17:00:48.655] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Attempted to set registry name with existing registry name! New: minecraft:fire_protection Old: elementalcombat:fire_protection Index: 2 Listeners: 0: NORMAL 1: ASM: class Tavi007.ElementalCombat.StartupCommon onIParticleTypeRegistration(Lnet/minecraftforge/event/RegistryEvent$Register;)V 2: ASM: class Tavi007.ElementalCombat.StartupCommon registerEnchantments(Lnet/minecraftforge/event/RegistryEvent$Register;)V java.lang.IllegalStateException: Attempted to set registry name with existing registry name! New: minecraft:fire_protection Old: elementalcombat:fire_protection at net.minecraftforge.registries.ForgeRegistryEntry.setRegistryName(ForgeRegistryEntry.java:43) at net.minecraftforge.registries.ForgeRegistryEntry.setRegistryName(ForgeRegistryEntry.java:50) at Tavi007.ElementalCombat.StartupCommon.registerEnchantments(StartupCommon.java:61) at net.minecraftforge.eventbus.ASMEventHandler_1_StartupCommon_registerEnchantments_Register.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) at java.util.function.Consumer.lambda$andThen$0(Unknown Source) at java.util.function.Consumer.lambda$andThen$0(Unknown Source) at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:126) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:126) at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96) at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:214) at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$25(ModLoader.java:206) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:973) at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:206) at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97) at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) at net.minecraft.client.Minecraft.<init>(Minecraft.java:397) at net.minecraft.client.main.Main.main(Main.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) I'm kinda stumped now. An idea how I could fix this?
  6. Please take a look at https://github.com/Tavi007/ElementalCombat/blob/00f3f7b3bef6f065f4ef264b82bdba53bce853ac/1.15.2/src/main/java/Tavi007/ElementalCombat/events/ElementifyLivingHurtEvent.java#L185 ignore the setCanceled(), because this was from testing (I hoped this would cancel the red overlay from being applied). In my method I could differentiate between the 3 damage cases (damage>0, damage=0 and damage<0). If damage>0, I want to apply the red overlay. if damage=0, apply yellow overlay and so on. So I would have to cancel the red overlay (if the right conditions are met) and instead apply my costum overlays. But I don't know where to start with this. Do you know by chance, which vanilla class I should take a look at? I will try this and hopefully it works as I want
  7. That helped a lot! I could fix both these issues. This sounds like I would override the red overlayTexture completly and only my yellow/green one would be applied, which I don't want. I formulated my question badly, so this is on me. What I want is to change this overlayTexture to a yellow one, if the damage is 0 and to a green one, if the damage is negativ (aka healing the entity). Would your suggestion still work in this case? (I haven't started to read the code yet. All I want is a heads up from someone more advanced on this topic.) From a player perspective I would be annoyed, if I have an enchanted book, that can't be applied to any of my items. I want this enchantment to be removed, because I changed the damage calculation and currently this enchantment would reduce fire damage twice. If I could disable the calculation in ProtectionEnchantment::calcModifierDamage for the FIRE case, I would be happy too. With 1.16 forge added mixins, which I played around with through fabric. Could applying a mixin in this method be a solution? If you don't have a better idea, I might go with your suggested solution.
  8. Hello! I know, the title is not saying much, but I didn't want to open multiple threads for maybe easy questions. First thing first, here is my repository. 1. I use a capability to store extra information for an itemstack. I want to fill this capability, with default values (this works) and also when the item has a certain enchantment. For the default values I use the attachCapabilityEvent and this works just fine. However I can't do the same for the enchantments, because the enchantments haven't be applied to the itemstack in this event yet. If I call "EnchantmentHelper.getEnchantments(item)" in this event, I will always get an empty map, even if the actual itemstack has an enchantment ingame. My question is, which event should I use instead? The event only needs to be fired once, so I can check for the right enchantment and add the data to the capability. 2. Speaking of capabilities. I still have one problem with mine. Please take a look at the defense capability. It has 2 sets, but theire data won't get saved. This is most likely due to an error in the readNBT functions, because I don't know how use "NBTHelper.fromNBTToSet(...)" properly. 3. I would like to change the 'hurt'-animation of an LivingEntity (the mob-flashes-red-animation). In fact, I only want to change the color of it to either be yellow or green. Is this possible at all and if so, which event would I need to use? 4. How can I disable vanilla enchantments? In this case, I don't want the fire resistance enchantment to be obtainable ingame. Unregistering this enchantment is probably to much and will only cause problems down the line. Thank you in advance, if you have an answere for any of my questions
  9. I completly rewrote the whole capability to be more like the testmod example. I think everything is working now, but i need time for a more in depth testing. I just wanted to let you know, that your link helped me a lot
  10. I used minecraftByExample as reference. I did not know, that this is bad practise... they have the same capability, but are completly independent of each other. Otherwise I would create 2 classes with identical code (but different names). I will take a look at the test mod to see, how I could improve my code. But please answere me this: Why isn't the capability storing the data? What is going wrong?
  11. That's a good idea, however the data doesn't get saved. Here is my repo. Right now I moved my code from ElementifyLivingSpawn and ElementifyProjectileSpawn to private functions in AttachCapabilityEvent. Once this is working I can change elementifyItemstack in the same fashion. package Tavi007.ElementalCombat.events; import java.util.HashMap; import java.util.Map; import java.util.Set; import Tavi007.ElementalCombat.ElementalCombat; import Tavi007.ElementalCombat.ElementalCombatAPI; import Tavi007.ElementalCombat.capabilities.CapabilityProviderEntityAndItem; import Tavi007.ElementalCombat.capabilities.CapabilityProviderProjectile; import Tavi007.ElementalCombat.capabilities.ElementalAttack; import Tavi007.ElementalCombat.capabilities.ElementalDefense; import Tavi007.ElementalCombat.loading.AttackFormat; import Tavi007.ElementalCombat.loading.EntityData; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.projectile.DamagingProjectileEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome.TempCategory; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = ElementalCombat.MOD_ID, bus = Bus.FORGE) public class AttachCapabilityEvent { private static final ResourceLocation ENTITY = new ResourceLocation(ElementalCombat.MOD_ID, "entity_cap"); private static final ResourceLocation PROJECTILE = new ResourceLocation(ElementalCombat.MOD_ID, "projectile_cap"); private static final ResourceLocation ITEM = new ResourceLocation(ElementalCombat.MOD_ID, "item_cap"); @SubscribeEvent public static void onAttachEntity(AttachCapabilitiesEvent<Entity> e) { Entity entity = e.getObject(); if(entity instanceof LivingEntity) { e.addCapability(ENTITY, new CapabilityProviderEntityAndItem()); elementifyLivingEntity((LivingEntity) entity); } if(entity instanceof DamagingProjectileEntity) { e.addCapability(PROJECTILE, new CapabilityProviderProjectile()); elementifyProjectile((DamagingProjectileEntity) entity); } } @SubscribeEvent public static void onAttachItemStack(AttachCapabilitiesEvent<ItemStack> i) { i.addCapability(ITEM, new CapabilityProviderEntityAndItem()); elementifyItemstack(i.getObject()); } private static void elementifyLivingEntity(LivingEntity entity) { // load default data from dataManager ResourceLocation rl = new ResourceLocation(entity.getType().getRegistryName().getNamespace(), "elementalproperties/entities/" + entity.getType().getRegistryName().getPath()); EntityData entityData = ElementalCombat.DATAMANAGER.getEntityDataFromLocation(rl); Set<String> weaknessSet = entityData.getWeaknessSet(); Set<String> resistanceSet = entityData.getResistanceSet(); Set<String> immunitySet = entityData.getImmunitySet(); Set<String> absorbSet = entityData.getAbsorbSet(); // rewrite set to mapping Set<AttackFormat> attackFormatSet = entityData.getAttackSet(); Map<String, Integer> attackMap = new HashMap<String, Integer>(); attackFormatSet.forEach((attack) -> { Integer value = attack.getValue(); if (value <= 0){ ElementalCombat.LOGGER.info("Elemental damage value of " + attack.getName() + " for " + entity.getName().toString() + " is <= 0. Using 1 instead."); value = 1; } attackMap.put(attack.getName(), value); }); // player spawn should be biome independent if(entityData.getBiomeDependency()) { String biomeProperties = null; BlockPos blockPos = new BlockPos(entity.getPositionVec()); TempCategory category = entity.getEntityWorld().getBiome(blockPos).getTempCategory(); if(category == TempCategory.COLD){ biomeProperties = "ice"; } else if(category == TempCategory.WARM){ biomeProperties = "fire"; } else if(category == TempCategory.OCEAN){ biomeProperties = "water"; } if(biomeProperties != null){ resistanceSet.add(biomeProperties); } } // set capability ElementalAttack elemAtckCap = ElementalCombatAPI.getElementalAttackData(entity); ElementalDefense elemDefCap = ElementalCombatAPI.getElementalDefenseData(entity); elemAtckCap.setAttackMap(attackMap); elemDefCap.setWeaknessSet(weaknessSet); elemDefCap.setResistanceSet(resistanceSet); elemDefCap.setImmunitySet(immunitySet); elemDefCap.setAbsorbSet(absorbSet); } public static void elementifyProjectile(DamagingProjectileEntity entity) { if(entity.ticksExisted == 0){ System.out.println("Newly spawned projectile found"); DamagingProjectileEntity projectile = (DamagingProjectileEntity) entity; Entity source = projectile.shootingEntity; if(source != null && source instanceof LivingEntity){ LivingEntity sourceEntity = (LivingEntity) source; System.out.println("Shooter: " +sourceEntity.getDisplayName().getString()); // If sourceEntity holds an item, use item data. // If not, use data from sourceEntity as default. ElementalAttack sourceData; if(sourceEntity.hasItemInSlot(EquipmentSlotType.MAINHAND)){ ItemStack item = sourceEntity.getActiveItemStack(); sourceData = ElementalCombatAPI.getElementalAttackData(item); } else{ sourceData = ElementalCombatAPI.getElementalAttackData(sourceEntity); } //copy elemental attack capability ElementalAttack projectileData = ElementalCombatAPI.getElementalAttackData(projectile); projectileData.setAttackMap(sourceData.getAttackMap()); } } } public static void elementifyItemstack(ItemStack item) { } } In these functions everything is happening as it should be, like accessing the data from DATAMANGER. However in ElementifyLivingHurtEvent I only get the (default) empty capability. I know that my capability currently doesn't save its contents when leaving the world and restarting it. This is mostly likely due to an error in my saveNBT or readNBT function. Are these problems connected?
  12. Hello! I want to fill a capability from itemstack with default values only once. I had the same problem with livingEntities, but here I simply modified the spawning event. It seems like I won't be able to do the same for itemstacks, since there are so many possible ways for them to be created (picking up itemEntities, crafting, brewing, smelting. With other mods even more...) One solution i had in mind was to add another boolean to the capability, called isFirstSpawn. It default values is true and once I copy the default values into the capability, I will also set this bool to false. This way, I could trigger the change of the cability in LivingEquipmentChangeEvent (for example) once and then never again. This method seems to be rather complicated however.. Do you have a better idea?
  13. Ahh, a rookie mistake... The Capaility is now working as it should, so big thank you . How come, that registering the capability changes the variables from null to something else? All i saw was the null pointer exception and i couldn't deduce, that this is due to the missing registration. Anyway since I have your attention, could you give me advice on another of my issue please? I want to fill the capability from the livingEntity and itemstack with default values (hence the reloadListener. I use it, to load these values from json). For the entities I modify the spawning event, where I use my dataManger to copy the data into the capability. Now I plan on doing something similar for the itemstacks, but I'm not sure, if I can do the same here... So do you have a good idea on how to fill the capability of an itemstack?
  14. Thanks for all your help. Much appreciated! I added the SubscribeEvent annotation and changed the functions to static. I also kept the ServerAboutToStartEvent in my main class, because it is the only event so far, that fires on the forge bus. Now upon starting a world I run into a nullPointer exception in CapabilityProviderEntityAndItem.java (line 42). Apperently ElementalAttackCapability.CAPABILITY_ELEMENTAL_ATTACK is null, which isn't that suprising, cause it is instantiated as null. But minecraftByExample did it the same way and I can't find any difference between his and my code. Any ideas?
  15. Hey, I once had a working mod, but I did a few changes to my class structure to be a bit more like MinecraftByExample. However in this process I messed up some parts of my mod and I don't know, why stuff is not working anymore. So please answere my question and maybe give a solution too. I would like to know, why my stuff is broken. Here is my current repository, so you know, what I'm talking about The first thing, that I did was to split the registration into server side and client side (much like minecraftByExample). But when I try to move the registration of my reloadListener from ElementalCombat.java to StartupCommon.java the FMLServerAboutToStartEvent won't get called anymore. What is the reason? Next up are my capabalities. My mod usually fills the ElementalAttack- and ElementalDefenseCapability of a mob whenever it spawns. But when I try to access this data later, I only get the default (empty) capability instead. What is my error? My best guess is, that the capability isn't attached properly. At least I never reach the breakpoint in AttachCapabilityEvent. At last I want to hear your feedback on my particles. It feels like I could do this part better, because there is a lot of code duplication happening. Sadly I couldn't come up with anything working. All 4 particles behaves basically the same, with the only difference being the texture. So is there an easier way to do it? Thanks a lot in advance PS: I didn't know, if I should create a topic for each of my issues or not...
  16. Thank you! Now it's working
  17. You mean, that I should change target.getEntityWorld().addParticle(new CombatParticleData(tint, diameter), xpos, ypos, zpos, xSpeed, ySpeed, zSpeed); to target.getEntityWorld().spawnParticle(new CombatParticleData(tint, diameter), xpos, ypos, zpos, xSpeed, ySpeed, zSpeed); ? When I do that, I only get the error, that spawnParticle is an unknown method. ( I expected this error, but I tried anyway. I don't know, if I'm missing something crucial)
  18. I took a deeper look at vanilla minecraft code and noticed, that the addParticle()- function of the class World is empty. However ClientWorld extends World and implements the addParticle function properly. I also looked at the working 1.16 mod 'Rats'. Here he simply calls event.getWorld(), with event being an instance of PlayerInteractEvent.EntityInteract. Calling event.getWorld() should also return a World (not a ClientWorld!), but somehow he can then call .spawnParticle(). I'm kinda confused, why his mod is working. Also I still have no idea, how I should get the right ClientWorld, so I can use its addParticle() function.
  19. Hello, I'm currently working on my first particle by following TheGreyGhosts tutorial mod (MinecraftByExample). For now I copied most of the code and changed some lines from 'World' to 'ClientWorld'. I did this change, because the example is for 1.15 and I'm using 1.16 (for example line 26 in CombatParticle needs ClientWorld, because otherwise the constructor was unknown). The code is compiling just fine, but my particle is nowhere to be seen. The particle is supposed to be spawning, when I hit an enemy (see line 108-121 in ElementifyLivingHurtEvent). My best assumption is, that I'm trying to spawn the particle on the server side instead of client side, which is why makeParticle(...) of the CombatParticleFactory is never called. Could someone please explain to me, what I'm doing wrong and how I can fix it?
  20. I bump this thread up, since I still have the same issue. The DataManager never calls the apply() function and therefor never loads the json files. I also look through the forge issue tracker to see, if it is a known issue, but it's not listed.
  21. Thank you! That solved all my issues.
  22. I updated, but I still have the same issue. Maybe I will wait until a safe 1.16 version is realeased.
  23. Hey all, I'm trying to locate the source of any projectileEntity (so I can set some data on the projectile). Please take a look at my current 'solution'. It does work, but I have a bunch of problems, that I would like to discuss. @Mod.EventBusSubscriber(modid = ElementalCombat.MOD_ID, bus = Bus.FORGE) public class ElementifyProjectileSpawnEvent { @SubscribeEvent public static void elementifyProjectileSpawnEvent(EntityJoinWorldEvent event) { if(!event.getWorld().isRemote()){ // only server side should check Entity entity = event.getEntity(); //check if entity is a new spawning projectile. if(entity instanceof ProjectileEntity) { if(entity.ticksExisted == 0) { System.out.println("Newly spawned projectile found"); ProjectileEntity projectile = (ProjectileEntity) entity; //find livingEntity source. (aka the nearest LivingEntity, that isn't the spawning projectzileEntity? What about dispensers?) Vector3d pos = projectile.getPositionVec(); AxisAlignedBB boundingBox = new AxisAlignedBB(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z); List<Entity> nearbyEntities = event.getWorld().getEntitiesWithinAABBExcludingEntity(projectile, boundingBox); System.out.println("Entity in List: "+ nearbyEntities); //check if only one entity was found. This should be the sourceEntity //if List is empty, then source is a TileEntity (i.e Dispenser). if(nearbyEntities.size() == 1) { LivingEntity sourceEntity = (LivingEntity) nearbyEntities.get(0); // If sourceEntity holds an item, use item data. // If not, use data from sourceEntity as default. IElementalAttackData sourceData; if(sourceEntity.hasItemInSlot(EquipmentSlotType.MAINHAND)){ ItemStack item = sourceEntity.getActiveItemStack(); sourceData = ElementalCombatAPI.getElementalAttackData(item); } else{ sourceData = ElementalCombatAPI.getElementalAttackData(sourceEntity); } //copy elemental attack capability IElementalAttackData projectileData = ElementalCombatAPI.getElementalAttackData(projectile); projectileData.setAttackMap(sourceData.getAttackMap()); } } } } } } The idea was to check the position of a projectile the second it's spawning to figure out the source. This does usually work, but in some cases unintended behaviour occurs: Projectiles shot from Dispensers usually returns an empty list (as it should be). But if an entity stands right in front of the dispenser, the list will be filled with that entity. If the position of the new projectile is not within the hitbox of the sourceEntity, the list will stay empty. This happens for example for Llama spit. In this case, the list should include the Llama Entity, but it doesn't. If sourceEntity is crammed into a hole with other entities, the list will be filled with these other entities aswell. Therefor it is not possible to identify the right sourceEntity. (Put a bunch of creepers into a 1x1 hole and then shot an arrow from within that hole. The list will include some of the creepers, since their hitbox overlaps with the player-hitbox) When joining a world with projectileEntities laying on the ground, the game will be stuck on getEntitiesWithinAABBExcludingEntity() function (happens in Singleplayer. Multiplayer is not tested yet). I have no idea, why this happens. Trying to figure out the source of the projectile through hitbox comparison, isn't really an elegant solution anyway. Does anyone know of a better method or a fix for my problems? PS: here is my repo: https://github.com/Tavi007/ElementalCombat
  24. Thank you for your answer! I got the code to compile and I assume my ReloadListener was added. However none of the data got loaded. I tested a little bit and noticed, that my implemented apply() function of DataManager is never called. Previously this function was called whenever I start playing a world or when I use the /reload-command . That's not happining now. Any idea, what the problem might be? My repo if you want to have a deeper look: https://github.com/Tavi007/ElementalCombat
  25. Hello, I'm updating my mod to 1.16 and I can't find a way to add my reloadListener. Here is a code-snipped: @SubscribeEvent public void onServerAboutToStart(FMLServerAboutToStartEvent event) { // worked in 1.15.2 //event.getServer().getResourcePacks().addReloadListener(DATAMANAGER); LOGGER.info("Elemental data registered."); } DATAMANGER is a class, that extends jsonReloadListener. I looked through the options of ResourcePacks, but I can't find a similar function to addReloadListener.
×
×
  • Create New...

Important Information

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