Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved][1.15.2] Adding elemental properties to LivingEntities


Tavi007
 Share

Recommended Posts

Hello, people who came here from google.

You can find a summary at the end of this post. Basically what i wanted to do, was to add public variables to an entity using a capability and then give it default values through json files. These default values can also be changed through the use of a datapack. This method should in theory also work with itemstacks or other things.

-----------------------------------------

Hello community,
 

I recently started with my first minecraft mod. I usually programm in c++, but I wanted to try something new. The whole Idea of my mod is to give every LivingEntity elemental properties for defence and attack. While the player can equip the right gear for the job, most mobs will have set weaknesses/resistance and may have certain elemental attacks. For example a Blaze will naturally be prone to ice attacks, while his projectiles obviously have the element 'fire'. I want to give each mobs these properties through the 'Capabilities'-system. Every LivingEntity should have 4 lists, which should be filled by loading data from .json files. This will make adding mobs from other mods/newer minecraft versions much easier, I hope. So how can I do that? For example the zombie_elemetalproperties.json file looks like this right now:

{
	"weakness": [
		"fire"
	],
	
	"resistance": [
		"ice",
		"water"
	],
	
	"absorb": [
	],
	
	"wall": [
		"thunder"
	]
}

So some of the list can be empty and some can have multiple values.

My best guess is, that I use the 'compability'-system, which is why I have the ElementalCombatData class and the appropiate interface:

package Tavi007.ElementalCombat.capabilities;

import java.util.List;

public class ElementalCombatData implements IElementalCombatData
{
	private List<String> weaknessList = null;
	private List<String> resistanceList = null;
	private List<String> wallList = null;
	private List<String> absorbList = null;
	
	
	// Setter
	@Override
	public void setWeaknessList(List<String> elementList)
	{
		this.weaknessList = elementList;
	}
	@Override
	public void setResistanceList(List<String> elementList)
	{
		this.resistanceList = elementList;
	}
	@Override
	public void setWallList(List<String> elementList)
	{
		this.wallList = elementList;
	}
	@Override
	public void setAbsorbList(List<String> elementList)
	{
		this.absorbList = elementList;
	}
	
	
	//Getter
	@Override
	public List<String> getWeaknessList()
	{
		return this.weaknessList;
	}
	@Override
	public List<String> getResistanceList()
	{
		return this.resistanceList;
	}
	@Override
	public List<String> getWallList()
	{
		return this.wallList;
	}
	@Override
	public List<String> getAbsorbList()
	{
		return this.absorbList;
	}
}

 

Once I know how I get one of these list to work, I can adjust the rest.

Now I also have the capability-class:

package Tavi007.ElementalCombat.capabilities;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.LazyOptional;

public class ElementalCombatDataCapability implements ICapabilitySerializable<ListNBT> 
{

    @CapabilityInject(IElementalCombatData.class)
    public static final Capability<IElementalCombatData> DATA_CAPABILITY = null;
    private LazyOptional<IElementalCombatData> instance = LazyOptional.of(DATA_CAPABILITY::getDefaultInstance);

    public static void register()
    {
        CapabilityManager.INSTANCE.register(IElementalCombatData.class, new ElementalCombatDataStorage(), ElementalCombatData::new);
    }

    @Nonnull
    @Override
    public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) 
    {
        return DATA_CAPABILITY.orEmpty(cap, instance);
    }

    @Override
    public ListNBT serializeNBT() 
    {
        return (ListNBT) DATA_CAPABILITY.getStorage().writeNBT(DATA_CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional cannot be empty!")), null);
    }

    @Override
    public void deserializeNBT(ListNBT nbt) 
    {
    	DATA_CAPABILITY.getStorage().readNBT(DATA_CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional cannot be empty!")), null, nbt);
    }
}

Granted, I only copied it from another thread, that I found through google, which I modified a little bit. I'm not sure, if I did everything correct so far. So please correct me, if you found anything. :)
 

My problem right now lies within the storage-class, where the readNBT and writeNBT function reside. Right now it looks like this:

package Tavi007.ElementalCombat.capabilities;

import javax.annotation.Nullable;

import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;

public class ElementalCombatDataStorage implements Capability.IStorage<IElementalCombatData> 
{
    @Nullable
    @Override
    public INBT writeNBT(Capability<IElementalCombatData> capability, IElementalCombatData instance, Direction side) 
    {
    	CompoundNBT tag = JsonToNBT.getTagFromJson(jsonString)
    	
    	return tag;
    }

    @Override
    public void readNBT(Capability<IElementalCombatData> capability, IElementalCombatData instance, Direction side, INBT nbt) 
    {
        if (!(instance instanceof ElementalCombatData))
            throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation");

        
    }
}

What do I have to enter for jsonString and what do I have to do in the read-function? Also what is 'Direction' supposed to mean?

 

Thanks in advance :)

 

SOLUTION:
First of, here is my repo.

The whole problem can be divided into 2 main problems: the capability and the loading. First of the capability. I used 4 classes: an interface and its implementation of the data you want, a storage function, that implements Capability.IStorage<your interface> and the capability class. Note, that you can change the compoundNBT to whatever NBT type you need. I choose compound, because it is basically the same as the json format. I hope the comments in these files describes enought for you. Also don't forget to register the capability at the FMLCommonSetupEvent and attach them to the entity/itemstack/whatever. To use the capability in an event, you can use 2 different method. Check out some of my events.

For the loading you need a class with the same structure as your json file. Even the variable names need to be same (I think). I assume you could use the same class as for the capability, but in my case that was not possible. Next you need a class, that extends the JsonReloadListener. This thing, once registered, will fire everytime data needs to be loaded (i.e. using the /reload command in minecraft). This class now holds a mapping of the resourceLocation to your data. This map can be used to access the loaded data. You also need a a class, which handles the overriding of data through datapacks (I think. A lot of guesses from my side, cause I'm also new to forge). Again don't forget to register your reloadListener at FMLServerAboutToStartEvent (see my main class)

 

I hope I could help you :D

Edited by Tavi007
Link to comment
Share on other sites

28 minutes ago, Tavi007 said:

CompoundNBT tag = JsonToNBT.getTagFromJson(jsonString)

I'm not sure where you got this from, but it doesn't make much sense her.e

In the write method you have to serialize all your data into NBT and return that. In read you have to read it back in.

 

28 minutes ago, Tavi007 said:

Also what is 'Direction' supposed to mean?

A capability provider can expose different capabilities on each direction. This is mostly useful for blocks, but the player entity for example exposes the armor and other inventories using specific Direction values as a convention. null can usually be used.

Link to comment
Share on other sites

2 hours ago, diesieben07 said:

I'm not sure where you got this from, but it doesn't make much sense her.eIn the write method you have to serialize all your data into NBT and return that. In read you have to read it back in.

Ah, yeah. That was me testing.

 

2 hours ago, diesieben07 said:

A capability provider can expose different capabilities on each direction. This is mostly useful for blocks, but the player entity for example exposes the armor and other inventories using specific Direction values as a convention. null can usually be used.

Can you elaborate on how to handle NBT data or link me to some explanation, please? I would like to know, how to handle this properly.

Link to comment
Share on other sites

2 minutes ago, Tavi007 said:

Can you elaborate on how to handle NBT data or link me to some explanation, please? I would like to know, how to handle this properly.

NBT is kinda like JSON, but binary. You have CompoundNBT which is like a JSON object (string keys and values of arbitrary type), you have ListNBT, which is a homogenous array, etc.

You can read more about the actual format here: https://minecraft.gamepedia.com/NBT_format.

Link to comment
Share on other sites

I've been reading through the docs and used google a bit more. I do understand now, what I have to do, but I have trouble with actual writing the code. What I have so far:
 

package Tavi007.ElementalCombat.capabilities;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Nullable;

import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;

public class ElementalDefenceDataStorage implements Capability.IStorage<IElementalDefenceData> 
{
    @Nullable
    @Override
    public INBT writeNBT(Capability<IElementalDefenceData> capability, IElementalDefenceData instance, Direction side) 
    {
    	List<String> weaknessList = instance.getWeaknessList();
    	
    	//fill nbt with data
    	CompoundNBT nbt = new CompoundNBT();
    	ListNBT weaknessNBTList = new ListNBT();
    	
    	nbt.put("elem_weakness", weaknessNBTList);
    	
    	return nbt;
    }

    @Override
    public void readNBT(Capability<IElementalDefenceData> capability, IElementalDefenceData instance, Direction side, INBT nbt) 
    {
        if (!(instance instanceof ElementalDefenceData))
            throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation");

        List<String> weaknessList = new ArrayList<String>();
        
        //fill list with nbt data
        CompoundNBT cnbt = (CompoundNBT)nbt;
        
        
        instance.setWeaknessList(weaknessList);
    }
}

How do I get the Information from List<String> to ListNBT and vice versa? Also I'm not sure, if I even need cnbt. I do understand the difference of the NBT Formats, but I have trouble using them in Java...

 

Link to comment
Share on other sites

I tried to do, what you told me. But I still have 2 remaining problems. First my code again:

package Tavi007.ElementalCombat.capabilities;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.annotation.Nullable;

import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;

public class ElementalDefenceDataStorage implements Capability.IStorage<IElementalDefenceData> 
{
    @Nullable
    @Override
    public INBT writeNBT(Capability<IElementalDefenceData> capability, IElementalDefenceData instance, Direction side) 
    {
    	List<String> weakList = instance.getWeaknessList();
    	
    	//fill nbt with data
    	CompoundNBT nbt = new CompoundNBT();
    	nbt.put("elem_weak", fromListToNBT(weakList));
    	
    	return nbt;
    }

    @Override
    public void readNBT(Capability<IElementalDefenceData> capability, IElementalDefenceData instance, Direction side, INBT nbt) 
    {
        if (!(instance instanceof ElementalDefenceData))
            throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation");
        
        //fill lists with nbt data
        CompoundNBT nbtCompound = (CompoundNBT)nbt;
        instance.setWeaknessList(  fromNBTToList(nbtCompound.getList("elem_weak", ????)));
    }
    
    private List<String> fromNBTToList(ListNBT nbt)
    {
    	List<String> list = new ArrayList<String>();
    	Iterator<INBT> iterator = nbt.iterator(); 
    	while (iterator.hasNext()) 
    	{
    		list.add(iterator.toString());
    	}
    	return list;
    }
    
    private ListNBT fromListToNBT(List<String> list)
    {
    	ListNBT nbt = new ListNBT();
    	Iterator<String> iterator = list.iterator(); 
    	while (iterator.hasNext()) 
    	{
    		String s = iterator.toString();
    		StringNBT snbt = new StringNBT(s);
    		
    		nbt.add(snbt);
    	}
    	return nbt;
    }
}

 

When I use nbtCompound.getList, it expects an Integer. I thought, that the key string (so "elem_weak", correct?) would be enough to get all corresponding values. So what does this Integer do?

My second problem is with StringNBT. I can't get the constructor to work properly. Even a simple new StringNBT() did not work. I also somehowc can't look at the source code (but I could import it...). Is my project setup incorrectly?

 

Hope you can help me out one more time :)

Link to comment
Share on other sites

1 hour ago, Tavi007 said:

When I use nbtCompound.getList, it expects an Integer. I thought, that the key string (so "elem_weak", correct?) would be enough to get all corresponding values. So what does this Integer do?

Every NBT type has an ID. Forge creates constants for them in Constants.NBT. You need to specify what type of NBT your list is made up of (remember, ListNBT is a homogenous list).

 

1 hour ago, Tavi007 said:

My second problem is with StringNBT. I can't get the constructor to work properly. Even a simple new StringNBT() did not work.

The constructor is private. Use the factory method valueOf.

 

1 hour ago, Tavi007 said:

I also somehowc can't look at the source code (but I could import it...). Is my project setup incorrectly?

Normally you can look at the source code if you set up the MDK, so yes, something is wrong here.

 

1 hour ago, Tavi007 said:

String s = iterator.toString();

This doesn't make sense. Why are you calling toString on the iterator? Why are you using an iterator in the first place? Use a normal for-each loop.

Link to comment
Share on other sites

I finally got my code to compile, but it crashes, whenever I try to play a world due to a NullPointerException. Here is the crash report:

---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 07.06.20 17:37
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
	at Tavi007.ElementalCombat.capabilities.ElementalDefenceDataCapability.<init>(ElementalDefenceDataCapability.java:20) ~[main/:?] {re:classloading,pl:capability_inject_definalize:A}
	at Tavi007.ElementalCombat.ElementalCombatForgeEventBusSub.onAttachEntity(ElementalCombatForgeEventBusSub.java:19) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_1_ElementalCombatForgeEventBusSub_onAttachEntity_AttachCapabilitiesEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.2.0-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?] {}
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:564) ~[?:?] {re:classloading}
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:558) ~[?:?] {re:classloading}
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:48) ~[?:?] {re:classloading}
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:44) ~[?:?] {re:classloading}
	at net.minecraft.entity.Entity.<init>(Entity.java:221) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:198) ~[?:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.<init>(PlayerEntity.java:163) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.player.ServerPlayerEntity.<init>(ServerPlayerEntity.java:158) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:382) ~[?:?] {re:classloading}
	at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:116) ~[?:?] {re:classloading}
	at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:63) ~[?:?] {re:classloading}
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:224) ~[?:?] {re:classloading}
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:135) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:866) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:784) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:114) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:637) [?:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at Tavi007.ElementalCombat.capabilities.ElementalDefenceDataCapability.<init>(ElementalDefenceDataCapability.java:20)
	at Tavi007.ElementalCombat.ElementalCombatForgeEventBusSub.onAttachEntity(ElementalCombatForgeEventBusSub.java:19)
	at net.minecraftforge.eventbus.ASMEventHandler_1_ElementalCombatForgeEventBusSub_onAttachEntity_AttachCapabilitiesEvent.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:564)
	at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:558)
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:48)
	at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:44)
	at net.minecraft.entity.Entity.<init>(Entity.java:221)
	at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:198)
	at net.minecraft.entity.player.PlayerEntity.<init>(PlayerEntity.java:163)
	at net.minecraft.entity.player.ServerPlayerEntity.<init>(ServerPlayerEntity.java:158)
	at net.minecraft.server.management.PlayerList.createPlayerForUser(PlayerList.java:382)
	at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:116)
	at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:63)
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:224)

-- Ticking connection --
Details:
	Connection: net.minecraft.network.NetworkManager@1f59faee
Stacktrace:
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:135)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:866)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:784)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:114)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:637)
	at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
	Minecraft Version: 1.15.2
	Minecraft Version ID: 1.15.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_251, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 102800968 bytes (98 MB) / 694681600 bytes (662 MB) up to 954728448 bytes (910 MB)
	CPUs: 2
	JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1024m
	ModLauncher: 5.1.0+69+master.79f13f7
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/eventbus-2.2.0-service.jar eventbus PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 31.2
	Forge: net.minecraftforge:31.2.0
	FML Language Providers: 
		javafml@31.2
		minecraft@1
	Mod List: 
		client-extra.jar Minecraft {minecraft@1.15.2 DONE}
		forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1.jar Forge {forge@31.2.0 DONE}
		main Elemental Combat {elementalcombat@0.1 DONE}
	Player Count: 0 / 8; []
	Data Packs: vanilla, mod:forge (incompatible), mod:elementalcombat
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'forge'

 

I tried to get it to work yesterday, but couldn't figure it out. I've been writing this compability like in this repository: https://github.com/soravoid/Exceed/tree/master/src/main/java/com/github/soravoid/exceed

This repository does indeed work (I tested it), but uses forge 31.1.12, while I use 31.2.0. Not sure if this makes a huge difference.

By the way, here is a link to my repository: https://github.com/Tavi007/ElementalCombat.

 

On a completly different note I'm trying to design this mod to be efficient and I was wondering, if I'm on the right path. Basically I want every LivingEntity to have elemental weaknesses/resistance lists as public variables (So I can check them in combat). I also want to set these variables for each entity type (Zombie/Skeleton/Pig/...) once and not every time the entity spawns into the world. I dont't want the game to load up the weakness/resistance list from the json-file everytime the entity spawns, because that seems to be heavy on the computation side...

Edited by Tavi007
Link to comment
Share on other sites

On 6/8/2020 at 2:55 PM, diesieben07 said:

You never call this method as far as I can tell, so your capability is never registered.

Well, now I feel dumb. I think, I'm doing every noobish error there is :D

Anyway, I did a little bit more progress and now I finally have a working capability (I think). The last remaing part, would be the actual loading of the data from a json file. Preferably I would like to load the data from the files once and set them as default values for the different LivingEntities. I.e. load ZombieData.json once at set its content as default values for every spawning zombie entity. Is this somehow possible?

Link to comment
Share on other sites

12 hours ago, Tavi007 said:

Anyway, I did a little bit more progress and now I finally have a working capability (I think). The last remaing part, would be the actual loading of the data from a json file. Preferably I would like to load the data from the files once and set them as default values for the different LivingEntities. I.e. load ZombieData.json once at set its content as default values for every spawning zombie entity. Is this somehow possible?

You should look into how Minecraft loads it's data from JSON files.

E.g. look at LootTableManager and the class it extends. It should make it possible to load JSON files from data packs, like loot tables.

Link to comment
Share on other sites

Oh man, what did I get myself into. Understanding uncommmented code is such a pain, especially with so many classes.

If I understood everything correctly I need a bunch of difference classes. First the actually storage for all the resourceLocation: ElementalDataStorage


 

public class ElementalEntityData
{
	   private static final Set<ResourceLocation> ELEMENTAL_ENTITY_DATA = Sets.newHashSet();
	   public static final ResourceLocation EMPTY = new ResourceLocation(ElementalCombat.MOD_ID, "empty");
	   
	   public ElementalEntityData()
	   {
		   Set<String> modFolderList = Sets.newHashSet();
		   for (final String modFolder : modFolderList)//loop over supported mods 
		   {
			   Set<String> mobFileList = Sets.newHashSet();
			   
			   for (final String mobFile : mobFileList)//loop over supported mobs (not listed mobs will use 'empty' as default)
			   {
				   register("entities/" + modFolder + "/" + mobFile);
			   }
		   }
	   }
	   
	   private static ResourceLocation register(String id) 
	   {
		   return register(new ResourceLocation(ElementalCombat.MOD_ID, id));
	   }

	   private static ResourceLocation register(ResourceLocation id) 
	   {
		   if (ELEMENTAL_ENTITY_DATA.add(id)) 
		   {
			   return id;
		   }
		   else
		   {
			   throw new IllegalArgumentException(id + " is already registered elemental entity data");
		   }
	   }
}

My first problem arises, when i want to find every json-file. My folder hierarchy looks like this: data/entities/<supported mod>/<mobs from mod>, where <supported mod> should be the mod id. For the vanilla mobs, this will be named 'minecraft'. Inside this folder one can find the json-file for a mob, i.e zombie_elementalproperties.json. Now I would like to find every file, that uses this directory format. This should hopefully make adding support for other mods easier later on. But how can I find modFolderList and mobFile?

After ElementalEntityData is done, I need to create the class ElementalDataManager, which extends JsonReloadListener just like LootTableManager or RecipeManager. If I understood it correctly, this class handles the json-object, that got loaded with the help of ElementalEntityData. Could you give me some insight on the function apply(), please? I don't fully understand, what it is doing.

Link to comment
Share on other sites

56 minutes ago, Tavi007 said:

Set<String> modFolderList = Sets.newHashSet();
for (final String modFolder : modFolderList)//loop over supported mods 
{
    Set<String> mobFileList = Sets.newHashSet();
    for (final String mobFile : mobFileList)//loop over supported mobs (not listed mobs will use 'empty' as default)
    {
      ...

 

You create a new (empty) set, then loop through it. Twice.

Neither of your loops will do anything, as they are both always going to be empty when the loop is run.

 

58 minutes ago, Tavi007 said:

My folder hierarchy looks like this: data/entities/<supported mod>/<mobs from mod>, where <supported mod> should be the mod id. For the vanilla mobs, this will be named 'minecraft'.

I would suggest including your modid in the path, to stop there being conflicts.

I would also not limit it to "supported" mods. That way support for third party mods can be added by datapacks (or even included in those mods if your mod becomes popular enough).

I would recommend using a path such as data/<datapackid>/<your mod id>/entities/<modid>/<mobname>.json

That would mean that your zombie definition would be at data/<your mod id>/<your mod id>/entities/minecraft/zombie.json

It means your modid is duplicated, but there is no risk of another mod using the entities path and causing your mod to crash.

Link to comment
Share on other sites

49 minutes ago, Alpvax said:

You create a new (empty) set, then loop through it. Twice.

Neither of your loops will do anything, as they are both always going to be empty when the loop is run.

I know. They are placeholders for now, so nothing breaks when i compile.

50 minutes ago, Alpvax said:

I would suggest including your modid in the path, to stop there being conflicts.

I would also not limit it to "supported" mods. That way support for third party mods can be added by datapacks (or even included in those mods if your mod becomes popular enough).

I would recommend using a path such as data/<datapackid>/<your mod id>/entities/<modid>/<mobname>.json

That would mean that your zombie definition would be at data/<your mod id>/<your mod id>/entities/minecraft/zombie.json

It means your modid is duplicated, but there is no risk of another mod using the entities path and causing your mod to crash.

Good call. But I still don't know, how I would get the complete hierarchy. I need to find out, which folder/file (aka mods or mobs) exist.

Link to comment
Share on other sites

16 minutes ago, Tavi007 said:

But I still don't know, how I would get the complete hierarchy. I need to find out, which folder/file (aka mods or mobs) exist.

I don't believe that is the case. Look at the subclasses of JSONReloadListener (recipes, loot tables, advancements etc.).

You don't care which files exist, just try to load all of them.

Link to comment
Share on other sites

I tried to understand it a little bit more, but I sitll have problems wrapping my head around some functions of LootTableManager.

//from LoottableManager:

   public static void func_227508_a_(ValidationTracker p_227508_0_, ResourceLocation p_227508_1_, LootTable p_227508_2_) {
      p_227508_2_.func_227506_a_(p_227508_0_.func_227529_a_(p_227508_2_.getParameterSet()).func_227531_a_("{" + p_227508_1_ + "}", p_227508_1_));
   }

Why are the function and variable names so cryptic? Is there any reason? What is even happening here?

Anyway please take a look at my current files. First ElementalData, where I do not know, if it's the right approach.

package Tavi007.ElementalCombat;

import java.util.Set;

import com.google.common.collect.Sets;

import net.minecraft.util.ResourceLocation;

public class ElementalData
{
	   public static final ResourceLocation EMPTY = new ResourceLocation(ElementalCombat.MOD_ID, "empty");
	   
	   private final Set<String> weakSet;
	   private final Set<String> resiSet;
	   private final Set<String> wallSet;
	   private final Set<String> absoSet;
	   private final Set<String> atckSet;
	   
	   public ElementalData(Set<String> weak, Set<String> resi, Set<String> wall, Set<String> abso, Set<String> atck)
	   {
		   this.weakSet = weak;
		   this.resiSet = resi;
		   this.wallSet = wall;
		   this.absoSet = abso;
		   this.atckSet = atck;
	   }
	   
	   public ElementalData()
	   {
		   this.weakSet = Sets.newHashSet();
		   this.resiSet = Sets.newHashSet();
		   this.wallSet = Sets.newHashSet();
		   this.absoSet = Sets.newHashSet();
		   this.atckSet = Sets.newHashSet();
	   }
	   
	   public Set<String> getWeaknessSet()
	   {
		   return this.weakSet;
	   }
	   
	   public Set<String> getResistanceSet()
	   {
		   return this.resiSet;
	   }
	   
	   public Set<String> getWallSet()
	   {
		   return this.wallSet;
	   }
	   
	   public Set<String> getAbsorbSet()
	   {
		   return this.absoSet;
	   }
	   
	   public Set<String> getAttackSet()
	   {
		   return this.atckSet;
	   }
}

 

 

 And secondly the ElementalDataManager, which I've been building up like LootTableManager:

package Tavi007.ElementalCombat;

import java.util.Map;
import java.util.Set;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import net.minecraft.client.resources.JsonReloadListener;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.ValidationTracker;

public class ElementalDataManager extends JsonReloadListener 
{
	private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
	private static final Logger LOGGER = LogManager.getLogger();
	private Map<ResourceLocation, ElementalData> registeredElementalData = ImmutableMap.of();
   
	public ElementalDataManager() 
	{
		super(GSON, "elementalcombat");
	}
	
	protected void apply(Map<ResourceLocation, JsonObject> objectIn, IResourceManager resourceManagerIn, IProfiler profilerIn) 
	{
		Builder<ResourceLocation, ElementalData> builder = ImmutableMap.builder();
		JsonObject jsonobject = objectIn.remove(ElementalData.EMPTY);
	    if (jsonobject != null) 
	    {
	         LOGGER.warn("Datapack tried to redefine {} elemental entity data, ignoring", (Object)ElementalData.EMPTY);
	    }
	    
	    objectIn.forEach((rl, json) -> 
	    {
	       try (net.minecraft.resources.IResource res = resourceManagerIn.getResource(getPreparedPath(rl));)
	       {
	    	   
	    	   ElementalData elementalData = new ElementalData(); //what do I have to do here? Empty for now
	    	   //copied from LootTableManager:
	    	   //LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(GSON_INSTANCE, rl, json, res == null || !res.getPackName().equals("Default"), this);
	    	   
	    	   builder.put(rl, elementalData);
	       }
	       catch (Exception exception)
	       {
	           LOGGER.error("Couldn't parse elemental entity data {}", rl, exception);
	       }
	    });
	    
	    builder.put(ElementalData.EMPTY, new ElementalData());
	    ImmutableMap<ResourceLocation, ElementalData> immutablemap = builder.build(); //this mapping contains attack and defense data.
	    
	    //validation of immutablemap missing
	    //copied from LootTable:
	    //ValidationTracker validationtracker = new ValidationTracker(LootParameterSets.GENERIC, this.field_227507_d_::func_227517_a_, immutablemap::get);
	    //immutablemap.forEach((rl, json) -> 
	    //{
	    //   func_227508_a_(validationtracker, rl, json);
	    //});
	    //validationtracker.getProblems().forEach((rl, json) -> 
	    //{
	    //   LOGGER.warn("Found validation problem in " + rl + ": " + json);
	    //});

	    
	    this.registeredElementalData = immutablemap;  
	}
	   
    public static JsonElement toJson(ElementalData elementalData)
    {
	    return GSON.toJsonTree(elementalData);
	}

	public Set<ResourceLocation> getElementalDataKeys() 
	{
	    return this.registeredElementalData.keySet();
	}
}

I do know, that I should not create an empty ElementalData. But I also don't understand, what is happening at the same line in LootTableManager. Can anyone please elaborate?
Is there an easy way for me to validate the immutableMap or do I have to write my own function for it?
And my last question: Where do I have to use the Manager? Do I have to register it somewhere or do I have to call a certain event?

Edited by Tavi007
Link to comment
Share on other sites

27 minutes ago, Tavi007 said:

Why are the function and variable names so cryptic? Is there any reason? What is even happening here?

Minecraft is obfuscated. Names are provided by the community and not everything is named.

 

28 minutes ago, Tavi007 said:

//what do I have to do here? Empty for now

You have to parse the JSON into your object.

Link to comment
Share on other sites

14 hours ago, diesieben07 said:

Minecraft is obfuscated. Names are provided by the community and not everything is named.

Ahhh okay.

 

14 hours ago, diesieben07 said:

You have to parse the JSON into your object.

I think, I got it now. I copied a lot from LootTableManager and changed some bits accordingly. My mod compiles and nothing crashes so far, but I don't know, if it ran through my code. I would assume not, because I haven't registered it nor fired an event for it. So what would I have to do?

Edited by Tavi007
Link to comment
Share on other sites

What is the purpose of this capability?

 

Unless I understood you wrong, you just need other mods to tell you what elements their mobs are. This can be done with datapacks.

 

You load all the datapacks into a Hashmap<String,ElementData> where string is the mod id. And when you want to know mob's resistances, you just check that map.

 

Entity Capabilities are for saving mob specific data, a hashmap works fine if that data is set at startup and same for each mob type.

 

Link to comment
Share on other sites

Home stretch! The loading seems to be working now. To acces the data I use the map <ResourceLocation, ElementalData> from the ElemenDataManager and give it the right ResourceLocation, right? Now I only need the right ResourceLocation, which can change with the choosen datapack. Going by Alpvax I have the following folder structure:

data/<datapackid>/<your mod id>/entities/<modid>/<mobname>.json

or with actual ids:

data/default/elementalcomabt/entities/minecraft/zombie.json.
I plan on adding elemental properties to itemstacks in the same fashion, so i would have a folder on the same level as entities called 'items'. Using this format the ResourceLocation for Zombie currently looks like this:

default:entities/minecraft/zombie

I don't know much about handling a DataPack yet, but this ResourceLocation seems kinda wrong to me. Shouldn't the namespace be my mod id? Also this way I would need to figure out from which mod the entity is coming from.

On another topic: how can I set this data as default for a spawning mob? I tried using the LivingSpawnEvent, thinking it would only fire, if the spawn would be succesful. But it turns out to be firing a lot, without actually spawning anything. Using this event would drastically increase computing time, which I don't like. But it would work tho.

 

31 minutes ago, robertx555 said:

What is the purpose of this capability?

 

Unless I understood you wrong, you just need other mods to tell you what elements their mobs are. This can be done with datapacks.

 

You load all the datapacks into a Hashmap<String,ElementData> where string is the mod id. And when you want to know mob's resistances, you just check that map.

 

Entity Capabilities are for saving mob specific data, a hashmap works fine if that data is set at startup and same for each mob type.

 

The capability is a lot more flexible. By using a capability each mob of the same type can have different elemental properties. Imagine a mob which has an ice resistance aura. A zombie in range of said aura would have "ice" in its resistance list, while a zombie outside would not. Or imagine a boss, that changes his properties throught the fight. The player would have to adapt mid fight, which could be fun.

Edited by Tavi007
Link to comment
Share on other sites

5 hours ago, Tavi007 said:

On another topic: how can I set this data as default for a spawning mob? I tried using the LivingSpawnEvent, thinking it would only fire, if the spawn would be succesful. But it turns out to be firing a lot, without actually spawning anything. Using this event would drastically increase computing time, which I don't like. But it would work tho.

Figure it out myself. I didn't notice there were sub classes in LivingSpawnEvent. Using CheckSpawn and SpecialSpawn I could exactly do, what I wanted :)

5 hours ago, Tavi007 said:

I don't know much about handling a DataPack yet, but this ResourceLocation seems kinda wrong to me. Shouldn't the namespace be my mod id? Also this way I would need to figure out from which mod the entity is coming from.

Any comment on this? This is the last problem, that I need to understand

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • quiero dormir uwu
    • Hi, mod called "charging gadgets" is crushing forge minecraft 1.18.1 when i place block from this mod, im temporary playing On 1.18 cuz its not happening on 1.18 but c'mon, pls fix it, 1.18.1 is better and I Wonder i could use this version
    • I am trying to add an entity into minecraft using forge. i had gotten the game to run without errors until i tried to /summon him ingame.  I dont understand what im missing but i assume it has to do with the attributes not registering.  Entity class:https://pastebin.com/WVBGZWBZ Player Events class:https://pastebin.com/NpuTE53S Error log:  https://pastebin.com/Dj59TPSf I will be forever in debt if you decide to help with this
    • Server console errors are shown below:   [main/FATAL]: Crash report saved to ./crash-reports/crash-2022-01-28_20.38.08-fml.txt [main/FATAL]: Preparing crash report with UUID 4b95805c-d1ad-46d0-8f4b-3246b497f79c ---- Minecraft Crash Report ---- // This doesn't make any sense! Time: 1/28/22, 8:38 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] {re:classloading} at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:53) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:104) ~[server-1.18.1-20211210.034407-srg.jar%2362!/:?] {re:classloading} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:46) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: main Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:1.0] {} -- MOD notenoughanimations -- Details: Mod File: notenoughanimations-forge-1.4.0-mc1.18.jar Failure message: NotEnoughAnimations Mod (notenoughanimations) has failed to load correctly java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER Mod Version: 1.4.0 Mod Issue URL: https://github.com/tr7zw/NotEnoughAnimations/issues Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:1.0] {} at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:213) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:223) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:213) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:130) ~[securejarhandler-1.0.1.jar:?] {} at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {} at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- MOD death_compass -- Details: Caused by 0: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} Mod File: DeathCompass-0.1.1.jar Failure message: DeathCompass (death_compass) has failed to load correctly java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction Mod Version: 0.1.1 Mod Issue URL: Exception message: java.lang.ClassNotFoundException: net.minecraft.client.renderer.item.ItemPropertyFunction Stacktrace: at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-1.0.1.jar:?] {} at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {} at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- System Details -- Details: Minecraft Version: 1.18.1 Minecraft Version ID: 1.18.1 Operating System: Linux (amd64) version 4.15.0-159-generic Java Version: 17.0.1, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 800094208 bytes (763 MiB) / 1073741824 bytes (1024 MiB) up to 3221225472 bytes (3072 MiB) CPUs: 3 Processor Vendor: AuthenticAMD Processor Name: AMD EPYC 7351P 16-Core Processor Identifier: AuthenticAMD Family 23 Model 1 Stepping 2 Microarchitecture: Zen Frequency (GHz): -0.00 Number of physical packages: 1 Number of physical CPUs: 16 Number of logical CPUs: 32 Graphics card #0 name: unknown Graphics card #0 vendor: unknown Graphics card #0 VRAM (MB): 0.00 Graphics card #0 deviceId: unknown Graphics card #0 versionInfo: unknown Virtual memory max (MB): 98199.23 Virtual memory used (MB): 96554.03 Swap memory total (MB): 33789.99 Swap memory used (MB): 705.40 JVM Flags: 3 total; -Xms1024M -Xmx3072M -XX:-UsePerfData ModLauncher: 9.1.0+9.1.0+main.6690ee51 ModLauncher launch target: forgeserver ModLauncher naming: srg ModLauncher services: mixin PLUGINSERVICE eventbus PLUGINSERVICE object_holder_definalize PLUGINSERVICE runtime_enum_extender PLUGINSERVICE capability_token_subclass PLUGINSERVICE accesstransformer PLUGINSERVICE runtimedistcleaner PLUGINSERVICE mixin TRANSFORMATIONSERVICE fml TRANSFORMATIONSERVICE FML Language Providers: minecraft@1.0 javafml@null Mod List: server-1.18.1-20211210.034407-srg.jar |Minecraft |minecraft |1.18.1 |COMMON_SET|Manifest: NOSIGNATURE maessentials-1.18.1-5.0.0.jar |Ma Enchants |maenchants |1.18.1-5.0.0 |COMMON_SET|Manifest: NOSIGNATURE cleancut-mc1.18-3.0-forge.jar |Clean Cut |cleancut |3.0 |COMMON_SET|Manifest: NOSIGNATURE voicechat-forge-1.18.1-2.2.15.jar |Simple Voice Chat |voicechat |1.18.1-2.2.15 |COMMON_SET|Manifest: NOSIGNATURE torchslabmod-1.18.1_v1.7.5.jar |Torch Slab Mod |torchslabmod |1.7.5 |COMMON_SET|Manifest: NOSIGNATURE endrem_forge-5.0.1-R-1.18.1.jar |End Remastered |endrem |5.0-R-1.18.1 |COMMON_SET|Manifest: NOSIGNATURE [ERROR] notenoughanimations-forge-1.4.0-mc1.18.jar |NotEnoughAnimations Mod |notenoughanimations |1.4.0 |ERROR |Manifest: NOSIGNATURE curios-forge-1.18.1-5.0.6.0.jar |Curios API |curios |1.18.1-5.0.6.0 |COMMON_SET|Manifest: NOSIGNATURE sodium_reloaded-mc1.18.1-1.0.jar |Sodium Reloaded |sodium_reloaded |1.0 |COMMON_SET|Manifest: NOSIGNATURE Neat 1.8-30.jar |Neat |neat |1.8-30 |COMMON_SET|Manifest: NOSIGNATURE waystones-forge-1.18.1-9.0.3.jar |Waystones |waystones |9.0.3 |COMMON_SET|Manifest: NOSIGNATURE advancednetherite-1.10.0-1.18.1.jar |Advanced Netherite |advancednetherite |1.10.0 |COMMON_SET|Manifest: NOSIGNATURE journeymap-1.18.1-5.8.0beta11.jar |Journeymap |journeymap |5.8.0beta11 |COMMON_SET|Manifest: NOSIGNATURE TravelersBackpack-1.18.1-7.0.1.jar |Traveler's Backpack |travelersbackpack |7.0.1 |COMMON_SET|Manifest: NOSIGNATURE artifacts-1.18.1-4.0.2.jar |Artifacts |artifacts |1.18.1-4.0.2 |COMMON_SET|Manifest: NOSIGNATURE InventoryHud_[1.18].forge-3.4.4.jar |Inventory HUD+(Forge edition) |inventoryhud |3.4.4 |COMMON_SET|Manifest: NOSIGNATURE copper-mod-1.9.jar |Copper Armor & Tools |copperarmorandtools |1.9 |COMMON_SET|Manifest: NOSIGNATURE balm-2.4.1+0.jar |Balm |balm |2.4.1+0 |COMMON_SET|Manifest: NOSIGNATURE [ERROR] DeathCompass-0.1.1.jar |DeathCompass |death_compass |0.1.1 |ERROR |Manifest: NOSIGNATURE justzoom_forge_1.0.1_MC_1.18-1.18.1.jar |Just Zoom |justzoom |1.0.1 |COMMON_SET|Manifest: NOSIGNATURE forge-1.18.1-39.0.63-universal.jar |Forge |forge |39.0.63 |COMMON_SET|Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df::0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90 expandability-5.0.0-forge.jar |ExpandAbility |expandability |5.0.0 |COMMON_SET|Manifest: NOSIGNATURE konkrete_forge_1.3.3_MC_1.18-1.18.1.jar |Konkrete |konkrete |1.3.3 |COMMON_SET|Manifest: NOSIGNATURE corpse-1.18.1-1.0.4.jar |Corpse |corpse |1.18.1-1.0.4 |COMMON_SET|Manifest: NOSIGNATURE responsiveshields-1.1-mc1.18.x.jar |Responsive Shields |responsiveshields |1.1 |COMMON_SET|Manifest: NOSIGNATURE DungeonsArise-1.18.1-2.1.49c-beta.jar |When Dungeons Arise |dungeons_arise |2.1.49c-1.18.1 |COMMON_SET|Manifest: NOSIGNATURE Crash Report UUID: 4b95805c-d1ad-46d0-8f4b-3246b497f79c FML: 39.0 Forge: net.minecraftforge:39.0.63 [main/FATAL]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [ NotEnoughAnimations Mod (notenoughanimations) has failed to load correctly §7java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER, DeathCompass (death_compass) has failed to load correctly §7java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction ] at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:235) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:200) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:200) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:177) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:177) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:46) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] at net.minecraft.server.Main.main(Main.java:104) ~[server-1.18.1-20211210.034407-srg.jar%2362!/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:46) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?]
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.