Jump to content

[1.16.5] Refreshing capability between server and client


ImNotJahan

Recommended Posts

In 1.12.2 I was able to use messages between the client and server (https://github.com/ImNotJahan/danmachi-mod/tree/master/v1.12.2/src/main/java/imnotjahan/mod/danmachi/network) I can't figure out how to get any of that to work for 1.16.5 though. This is all my capability code

IStatus

Spoiler

package imnotjahan.mod.danmachi.capabilities;

import java.util.Set;

public interface IStatus
{
    void giveFalna();
    boolean getFalna();

    String getFamilia();

    void setFamilia(String familiaName);

    /**
     * @param points how much the stat should increase by,
     *               is cut in half n - 1 times, n being level.
     *               doesn't cut in half if your adding excelia
     * @param id the id of the stat your increasing
     */
    void increase(int points, int id);

    /**
     * @param id the id of the stat your changing
     * @param amount the amount your setting the stat to
     */
    void set(int id, int amount);

    /**
     * @param id the id of the stat your changing
     * @param amount the amount your setting the stat to
     */
    void setP(int id, int amount);

    /**
     * @param id the id of the stat your grabbing
     */
    int get(int id);

    /**
     * @param id the id of the stat your grabbing
     */
    int getP(int id);

    int updateStatus();

    int getLevel();

    void grantAbility(Status.Ability ability);
    boolean grantSkill();
    boolean grantMagic();

    void setAbilities(Status.Ability[] abilities);
    void setSkills(Status.Skill[] skills);
    void setSpells(Status.Magic[] spells);

    Set<Status.Ability> levelUp();

    boolean canLevelUp();
    void setCanLevelUp(boolean canLevelUp);

    Status.Ability[] getAbilities();
    Status.Skill[] getSkills();
    Status.Magic[] getSpells();
}

 

StatusStorage

Spoiler

package imnotjahan.mod.danmachi.capabilities;

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

public class StatusStorage implements Capability.IStorage<IStatus>
{
    @Override
    public INBT writeNBT(Capability<IStatus> capability, IStatus instance, Direction side)
    {
        if(Status.capSide == side)
        {
            CompoundNBT status = new CompoundNBT();
            status.putInt("hasFalna", instance.get(0));
            status.putInt("strength", instance.get(1));
            status.putInt("endurance", instance.get(2));
            status.putInt("dexterity", instance.get(3));
            status.putInt("agility", instance.get(4));
            status.putInt("magic", instance.get(5));
            status.putInt("level", instance.get(6));
            status.putInt("excelia", instance.get(7));

            status.putInt("strengthP", instance.getP(0));
            status.putInt("enduranceP", instance.getP(1));
            status.putInt("dexterityP", instance.getP(2));
            status.putInt("agilityP", instance.getP(3));
            status.putInt("magicP", instance.getP(4));
            status.putInt("exceliaP", instance.getP(5));

            status.putString("familia", instance.getFamilia());

            Status.Skill[] instanceSkills = instance.getSkills();
            int[] skills = new int[instanceSkills.length];

            for(int k = 0; k < skills.length; k++)
            {
                skills[k] = instanceSkills[k].toInt();
            }

            status.putIntArray("skills", skills);

            Status.Ability[] instanceAbilities = instance.getAbilities();
            int[] abilities = new int[instanceAbilities.length];
            int[] abilityStats = new int[instanceAbilities.length];

            for(int k = 0; k < abilities.length; k++)
            {
                abilities[k] = instanceAbilities[k].toInt();
                abilityStats[k] = instanceAbilities[k].getStat();
            }

            status.putIntArray("abilities", abilities);
            status.putIntArray("abilityStats", abilityStats);

            return status;
        }

        return new CompoundNBT();
    }

    @Override
    public void readNBT(Capability<IStatus> capability, IStatus instance, Direction side, INBT nbt)
    {
        if(Status.capSide == side)
        {
            if(nbt instanceof CompoundNBT)
            {
                CompoundNBT tag = (CompoundNBT)nbt;

                instance.set(0, tag.getInt("hasFalna"));
                instance.set(1, tag.getInt("strength"));
                instance.set(2, tag.getInt("endurance"));
                instance.set(3, tag.getInt("dexterity"));
                instance.set(4, tag.getInt("agility"));
                instance.set(5, tag.getInt("magic"));
                instance.set(6, tag.getInt("level"));
                instance.set(7, tag.getInt("excelia"));

                instance.setP(0, tag.getInt("strengthP"));
                instance.setP(1, tag.getInt("enduranceP"));
                instance.setP(2, tag.getInt("dexterityP"));
                instance.setP(3, tag.getInt("agilityP"));
                instance.setP(4, tag.getInt("magicP"));
                instance.setP(5, tag.getInt("exceliaP"));

                instance.setFamilia(tag.getString("familia"));

                int[] oldSkills = tag.getIntArray("skills");
                Status.Skill[] skills = new Status.Skill[oldSkills.length];

                for(int k = 0; k < oldSkills.length; k++)
                {
                    skills[k] = Status.Skill.values()[oldSkills[k]];
                }

                instance.setSkills(skills);

                int[] oldAbilities = tag.getIntArray("abilities");
                int[] oldAbilityStats = tag.getIntArray("abilityStats");
                Status.Ability[] abilities = new Status.Ability[oldAbilities.length];

                for(int k = 0; k < oldAbilities.length; k++)
                {
                    abilities[k] = Status.Ability.values()[oldAbilities[k]];
                    abilities[k].setStat(oldAbilityStats[k]);
                }

                instance.setAbilities(abilities);
            }
        }
    }
}

 

Status

Spoiler

package imnotjahan.mod.danmachi.capabilities;
import net.minecraft.util.Direction;

import java.util.*;

public class Status implements IStatus
{
    public static final Direction capSide = Direction.UP;

    public enum Ability
    {
        AbnormalResistance(0),
        Blacksmith(1),
        Mage(2),
        Mystery(3),
        Hunter(4),
        SpiritHealing(5),
        Luck(6);

        private int stat;
        private final int id;
        Ability(int id)
        {
            this.stat = 0;
            this.id = id;
        }

        public int getStat()
        {
            return stat;
        }

        public void increaseStat(int amount)
        {
            stat += amount;
        }

        public void setStat(int amount)
        {
            stat = amount;
        }

        public int toInt()
        {
            return id;
        }

        @Override
        public String toString()
        {
            String name = super.toString();

            name = name.replaceAll("\\d+", "").replaceAll("(.)([A-Z])", "$1_$2").toLowerCase();

            return name;
        }

        private static final List<Ability> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
        private static final Random RANDOM = new Random();
        private static final int SIZE = VALUES.size();

        public static Ability randomAbility()
        {
            return VALUES.get(RANDOM.nextInt(SIZE));
        }
    }

    public enum Skill
    {
        AeroMana(0, 10),
        AilMacMidna(1, 10),
        Avenger(2, 5),
        MindLoad(3, 6);

        private final int index;
        private final int rarity;
        Skill(int index, int rarity)
        {
            this.index = index;
            this.rarity = rarity;
        }

        public int toInt()
        {
            return index;
        }

        private static final List<Skill> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
        private static final int SIZE = VALUES.size();
        private static final Random RANDOM = new Random();

        public static Skill randomSkill()
        {
            Skill skill = Skill.AeroMana;
            Boolean gotOne = false;
            while(!gotOne)
            {
                skill = VALUES.get(RANDOM.nextInt(SIZE));
                if(Math.random() * 10 < skill.rarity)
                {
                    gotOne = true;
                }
            }

            return skill;
        }

        @Override
        public String toString()
        {
            String name = super.toString();

            name = name.replaceAll("\\d+", "").replaceAll("(.)([A-Z])", "$1_$2").toLowerCase();

            return name;
        }
    }

    public enum Magic
    {
        Firebolt(0);

        private final int index;
        Magic(int index)
        {
            this.index = index;
        }

        public int toInt()
        {
            return index;
        }

        private static final List<Magic> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
        private static final int SIZE = VALUES.size();
        private static final Random RANDOM = new Random();

        public static Magic randomSkill()
        {
            return VALUES.get(RANDOM.nextInt(SIZE));
        }

        @Override
        public String toString()
        {
            String name = super.toString();

            name = name.replaceAll("\\d+", "").replaceAll("(.)([A-Z])", "$1_$2").toLowerCase();

            return name;
        }
    }

    private int hasFalna = 0;
    private int strength = 0;
    private int endurance = 0;
    private int dexterity = 0;
    private int agility = 0;
    private int magic = 0;
    private int level = 1;
    private int excelia = 0;
    private int mind = 100;

    private String familia = "";
    private List<Skill> skills = new ArrayList<>();
    private List<Ability> abilities = new ArrayList<>();
    private List<Magic> spells = new ArrayList<>();

    private int strengthP = 0;
    private int enduranceP = 0;
    private int dexterityP = 0;
    private int agilityP = 0;
    private int magicP = 0;
    private int exceliaP = 0;

    public boolean canLevelUp = false;

    @Override
    public void increase(int points, int id)
    {
        if(id != 7)
        {
            for(int k = 0; k < level - 1; k++)
            {
                points /= 2;
            }
        }

        points *= 1; //ModConfig.statMultiplier

        switch(id)
        {
            case 0:
                this.hasFalna += points;
                break;

            case 1:
                this.strengthP += points;
                break;

            case 2:
                this.enduranceP += points;
                break;

            case 3:
                this.dexterityP += points;
                break;

            case 4:
                this.agilityP += points;
                break;

            case 5:
                this.magicP += points;
                break;

            case 6:
                this.level += points;
                break;

            case 7:
                this.exceliaP += points;
                break;
        }
    }

    @Override
    public void set(int id, int stat)
    {
        switch(id)
        {
            case 0:
                this.hasFalna = stat;
                break;

            case 1:
                this.strength = stat;
                break;

            case 2:
                this.endurance = stat;
                break;

            case 3:
                this.dexterity = stat;
                break;

            case 4:
                this.agility = stat;
                break;

            case 5:
                this.magic = stat;
                break;

            case 6:
                this.level = stat;
                break;

            case 7:
                this.excelia = stat;
                break;
        }
    }

    @Override
    public void setP(int id, int stat)
    {
        switch(id)
        {
            case 0:
                this.strengthP = stat;
                break;

            case 1:
                this.enduranceP = stat;
                break;

            case 2:
                this.dexterityP = stat;
                break;

            case 3:
                this.agilityP = stat;
                break;

            case 4:
                this.magicP = stat;
                break;

            case 5:
                this.exceliaP = stat;
                break;
        }
    }

    @Override
    public int get(int id)
    {
        switch(id)
        {
            case 0:
                return this.hasFalna;

            case 1:
                return this.strength;

            case 2:
                return this.endurance;

            case 3:
                return this.dexterity;

            case 4:
                return this.agility;

            case 5:
                return this.magic;

            case 6:
                return this.level;

            case 7:
                return this.excelia;
        }

        return 0;
    }

    @Override
    public int getP(int id)
    {
        switch (id)
        {
            case 0:
                return this.strengthP;

            case 1:
                return this.enduranceP;

            case 2:
                return this.dexterityP;

            case 3:
                return this.agilityP;

            case 4:
                return this.magicP;

            case 5:
                return this.exceliaP;
        }

        return 0;
    }

    @Override
    public void giveFalna()
    {
        hasFalna = 1;
    }

    @Override
    public boolean getFalna()
    {
        return (hasFalna == 1);
    }

    @Override
    public String getFamilia()
    {
        return familia;
    }

    @Override
    public void setFamilia(String familia)
    {
        this.familia = familia;
    }

    @Override
    public int getLevel()
    {
        int level = this.level;
        if(excelia / (300 * level) >= 1 && strength > 400 ||
                endurance > 400 ||
                dexterity > 400 ||
                agility > 400 ||
                magicP > 400)
        {
            canLevelUp = true;
            level++;
        }

        return level;
    }

    @Override
    public Set<Ability> levelUp()
    {
        level += 1;
        excelia = 0;

        strength = 0;
        endurance = 0;
        dexterity = 0;
        agility = 0;
        magic = 0;

        canLevelUp = false;

        Set<Ability> abilities = new HashSet<>();
        for(int k = 0; k < 3; k++)
        {
            abilities.add(Ability.randomAbility());
        }

        return abilities;
    }

    @Override
    public int updateStatus()
    {
        strength += strengthP;
        endurance += enduranceP;
        dexterity += dexterityP;
        agility += agilityP;
        magic += magicP;
        excelia += exceliaP;
        level = getLevel();

        int increase = exceliaP;

        strengthP = 0;
        enduranceP = 0;
        dexterityP = 0;
        agilityP = 0;
        magicP = 0;
        exceliaP = 0;

        return increase;
    }

    @Override
    public void grantAbility(Ability ability)
    {
        abilities.add(ability);
    }

    @Override
    public boolean grantSkill()
    {
        Skill chosenSkill = Skill.randomSkill();
        if(!skills.contains(chosenSkill))
        {
            skills.add(chosenSkill);
            return true;
        }

        return false;
    }

    @Override
    public boolean grantMagic()
    {
        Magic chosenMagic = Magic.randomSkill();
        if(!spells.contains(chosenMagic))
        {
            spells.add(chosenMagic);
            return true;
        }

        return false;
    }

    @Override
    public void setAbilities(Ability[] abilities)
    {
        for(int k = 0; k < abilities.length; k++)
        {
            this.abilities.add(k, abilities[k]);
        }
    }

    @Override
    public void setSkills(Skill[] skills)
    {
        for(int k = 0; k < skills.length; k++)
        {
            this.skills.add(k, skills[k]);
        }
    }

    @Override
    public void setSpells(Magic[] spells)
    {
        for(int k = 0; k < spells.length; k++)
        {
            this.spells.add(k, spells[k]);
        }
    }

    @Override
    public Ability[] getAbilities()
    {
        Ability[] abilityArray = new Ability[abilities.toArray().length];

        for(int k = 0; k < abilityArray.length; k++)
        {
            abilityArray[k] = abilities.get(k);
        }

        return abilityArray;
    }

    @Override
    public Skill[] getSkills()
    {
        Skill[] skillArray = new Skill[skills.toArray().length];

        for(int k = 0; k < skillArray.length; k++)
        {
            skillArray[k] = skills.get(k);
        }

        return skillArray;
    }

    @Override
    public Magic[] getSpells()
    {
        Magic[] spellArray = new Magic[spells.toArray().length];

        for(int k = 0; k < spellArray.length; k++)
        {
            spellArray[k] = spells.get(k);
        }

        return spellArray;
    }

    @Override
    public boolean canLevelUp()
    {
        return canLevelUp;
    }

    @Override
    public void setCanLevelUp(boolean canLevelUp)
    {
        this.canLevelUp = canLevelUp;
    }
}

 

StatusProvider

Spoiler

package imnotjahan.mod.danmachi.capabilities;

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

public class StatusProvider implements ICapabilitySerializable<INBT>
{
    @CapabilityInject(IStatus.class)
    public static final Capability<IStatus> STATUS_CAP = null;

    private IStatus instance = STATUS_CAP.getDefaultInstance();

    public boolean hasCapability(Capability<?> capability, Direction facing)
    {
        return capability == STATUS_CAP && facing == Status.capSide;
    }

    @Override
    public <IStatus> LazyOptional<IStatus> getCapability(Capability<IStatus> capability, Direction facing)
    {
        return hasCapability(capability, facing) ? (LazyOptional<IStatus>)this.instance : null;
    }

    @Override
    public INBT serializeNBT()
    {
        return STATUS_CAP.getStorage().writeNBT(STATUS_CAP, this.instance, Status.capSide);
    }

    @Override
    public void deserializeNBT(INBT nbt)
    {
        STATUS_CAP.getStorage().readNBT(STATUS_CAP, this.instance, Status.capSide, nbt);
    }
}

 

Where I'm accessing the capability:

StatusGui

Spoiler

package imnotjahan.mod.danmachi.gui.container;

import com.mojang.blaze3d.matrix.MatrixStack;
import imnotjahan.mod.danmachi.Reference;
import imnotjahan.mod.danmachi.capabilities.IStatus;
import imnotjahan.mod.danmachi.capabilities.Status;
import imnotjahan.mod.danmachi.capabilities.StatusProvider;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.util.LazyOptional;

public final class StatusGui extends Screen
{
    LazyOptional<IStatus> lazyStatus;
    IStatus status;

    public StatusGui()
    {
        super(new StringTextComponent("StatusGui"));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float tick)
    {
        this.renderBackground(stack);

        if(minecraft != null)
        {
            lazyStatus = minecraft.player.getCapability(StatusProvider.STATUS_CAP, Status.capSide);
            status = lazyStatus.orElse(new Status());
        }

        int level = status.get(6);
        int strength = status.get(1);
        int endurance = status.get(2);
        int dexterity = status.get(3);
        int agility = status.get(4);
        int magic = status.get(5);

        minecraft.getTextureManager().bind(new ResourceLocation(String.format("%s:textures/gui/falnas/%s.png",
                Reference.MODID, "hestia")));
        blit(stack, 0, 0, 0, 0, width,height, width, height);

        drawCenteredString(stack, font, new StringTextComponent("Level " + level),
                width / 2, 20, 0xFFFFFF);
        drawCenteredString(stack, font, new StringTextComponent("Strength: " + strength),
                width / 2, 40, 0xFFFFFF);
        drawCenteredString(stack, font, new StringTextComponent("Endurance: " + endurance),
                width / 2, 60, 0xFFFFFF);
        drawCenteredString(stack, font, new StringTextComponent("Dexterity: " + dexterity),
                width / 2, 80, 0xFFFFFF);
        drawCenteredString(stack, font, new StringTextComponent("Agility: " + agility),
                width / 2, 100, 0xFFFFFF);
        drawCenteredString(stack, font, new StringTextComponent("Magic: " + magic),
                width / 2, 120, 0xFFFFFF);

        super.render(stack, mouseX, mouseY, tick);
    }
}

 

MonsterBase (Inside die method)

Spoiler

package imnotjahan.mod.danmachi.entities.templates;

import imnotjahan.mod.danmachi.capabilities.IStatus;
import imnotjahan.mod.danmachi.capabilities.Status;
import imnotjahan.mod.danmachi.capabilities.StatusProvider;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

public class MonsterBase extends ZombieEntity
{
    String name = "";

    public MonsterBase(EntityType<? extends ZombieEntity> entityType, World world, String name)
    {
        super(entityType, world);
        this.name = name;
    }

    @Override
    protected boolean isSunSensitive()
    {
        return false;
    }

    @Override
    protected ResourceLocation getDefaultLootTable()
    {
        return super.getDefaultLootTable();
    }

    @Override
    public void die(DamageSource cause)
    {
        super.die(cause);

        if(cause.getEntity() instanceof PlayerEntity)
        {
            PlayerEntity player = (PlayerEntity) cause.getEntity();
            IStatus status = player.getCapability(StatusProvider.STATUS_CAP, Status.capSide)
                    .orElse(new Status());
            if (status.getFalna())
            {
                for (int k = 0; k < 5; k++)
                {
                    status.increase(5, k + 1);
                }

                status.increase(5, 7);
            } else
            {
                return;
            }

        }
    }

    @Override
    public boolean isBaby()
    {
        return false;
    }

    @Override
    public boolean canBeLeashed(PlayerEntity player)
    {
        return true;
    }

    /*@Override
    protected void dropLoot(boolean wasRecentlyHit, int lootingModifier, DamageSource source)
    {
        super.dropLoot(wasRecentlyHit, lootingModifier, source);

        if(ModConfig.dropMagicCrystals)
        {
            ResourceLocation resource = LootTableHandler.magicStones.get(name);
            LootTable loottable = this.world.getLootTableManager().getLootTableFromLocation(resource);

            LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.world)).withLootedEntity(this).withDamageSource(source);

            if (wasRecentlyHit && this.attackingPlayer != null)
            {
                lootcontext$builder = lootcontext$builder.withPlayer(this.attackingPlayer).withLuck(this.attackingPlayer.getLuck());
            }

            ItemStack stack = loottable.generateLootForPools(this.rand, lootcontext$builder.build()).get(0);
            entityDropItem(stack, 0);
        }
    }*/
}

 

 

Link to comment
Share on other sites

On 9/3/2021 at 12:35 AM, diesieben07 said:

This is invalid.

  1. instance is not a LazyOptional, this cast will always fail.

Bit off-course from the original question, but I've changed my getCapability code to this

@Override
public <T> LazyOptional<T> getCapability(Capability<T> capability, Direction side)
{
	return capability == STATUS_CAP ? lazyStatus.cast() : LazyOptional.empty();
}

based off of what I found in the forge docs on capabilities, but capability is now never equaling STATUS_CAP, so I'm not sure what's going wrong

Here's what the STATUS_CAP code looks like:

    @CapabilityInject(IStatus.class)
    public static final Capability<IStatus> STATUS_CAP = null;

And also the lazyStatus incase that's important

private static final LazyOptional<IStatus> lazyStatus = LazyOptional.of(Status::new);

 

Edit: It also looks like the getCapability function isn't used at all? At least that's what I've gotten from placing random System.out.println's everywhere. I'm guessing I'm not registering the capability correctly 

    @SubscribeEvent
    public void attachCapability(AttachCapabilitiesEvent<Entity> event) 
    {
        if (!(event.getObject() instanceof PlayerEntity)) return;

        event.addCapability(new ResourceLocation(Reference.MODID, "status"),
                new StatusProvider());
    }

but this seems to be what the docs say to do so I'm not sure if anything's wrong with it

Edited by ImNotJahan
Link to comment
Share on other sites

It wasn't!

This isn't really a good thing but now I figured out that it shouldn't be on the mod bus, and so now it's attaching correctly and the getCapability function is being ran, and everything else seems to be working even without networking (for now at least) so thank you very very much

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello. I've been having a problem when launching minecraft forge. It just doesn't open the game, and leaves me with this "(exit code 1)" error. Both regular and optifine versions of minecraft launch just fine, tried both with 1.18.2 and 1.20.1. I can assure that my drivers are updated so that can't be it, and i've tried using Java 17, 18 and 21 to no avail. Even with no mods installed, the thing won't launch. I'll leave the log here, although it's in spanish: https://jmp.sh/s/FPqGBSi30fzKJDt2M1gc My specs are this: Ryzen 3 4100 || Radeon R9 280x || 16gb ram || Windows 10 I'd appreciate any help, thank you in advance.
    • Hey, Me and my friends decided to start up a Server with "a few" mods, the last few days everything went well we used all the items we wanted. Now our Game crashes the moment we touch a Lava Bucket inside our Inventory. It just instantly closes and gives me an "Alc Cleanup"  Crash screen (Using GDLauncher). I honestly dont have a clue how to resolve this error. If anyone could help id really appreciate it, I speak German and Englisch so you can choose whatever you speak more fluently. Thanks in Advance. Plus I dont know how to link my Crash Report help for that would be nice too whoops
    • I hosted a minecraft server and I modded it, and there is always an error on the console which closes the server. If someone knows how to repair it, it would be amazing. Thank you. I paste the crash report down here: ---- Minecraft Crash Report ---- WARNING: coremods are present:   llibrary (llibrary-core-1.0.11-1.12.2.jar)   WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)   AstralCore (astralsorcery-1.12.2-1.10.27.jar)   CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)   SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)   ForgelinPlugin (Forgelin-1.8.4.jar)   midnight (themidnight-0.3.5.jar)   FutureMC (Future-MC-0.2.19.jar)   SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)   Backpacked (backpacked-1.4.3-1.12.2.jar)   LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar) Contact their authors BEFORE contacting forge // There are four lights! Time: 3/28/24 12:17 PM Description: Exception in server tick loop net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:612)     at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at java.lang.Class.getDeclaredMethods0(Native Method)     at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)     at java.lang.Class.privateGetPublicMethods(Class.java:2902)     at java.lang.Class.getMethods(Class.java:1615)     at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:82)     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82)     ... 31 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 37 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@4e558728 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 39 more Caused by: java.lang.RuntimeException: Attempted to load class bsb for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 41 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 5.10.0-28-cloud-amd64     Java Version: 1.8.0_382, Temurin     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin     Memory: 948745536 bytes (904 MB) / 1564999680 bytes (1492 MB) up to 7635730432 bytes (7282 MB)     JVM Flags: 2 total; -Xmx8192M -Xms256M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2860 63 mods loaded, 63 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                 | Version                 | Source                                                | Signature                                |     |:----- |:------------------ |:----------------------- |:----------------------------------------------------- |:---------------------------------------- |     | LC    | minecraft          | 1.12.2                  | minecraft.jar                                         | None                                     |     | LC    | mcp                | 9.42                    | minecraft.jar                                         | None                                     |     | LC    | FML                | 8.0.99.99               | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge              | 14.23.5.2860            | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | creativecoredummy  | 1.0.0                   | minecraft.jar                                         | None                                     |     | LC    | backpacked         | 1.4.2                   | backpacked-1.4.3-1.12.2.jar                           | None                                     |     | LC    | itemblacklist      | 1.4.3                   | ItemBlacklist-1.4.3.jar                               | None                                     |     | LC    | securitycraft      | v1.9.8                  | [1.12.2] SecurityCraft v1.9.8.jar                     | None                                     |     | LC    | aiimprovements     | 0.0.1.3                 | AIImprovements-1.12-0.0.1b3.jar                       | None                                     |     | LC    | jei                | 4.16.1.301              | jei_1.12.2-4.16.1.301.jar                             | None                                     |     | LC    | appleskin          | 1.0.14                  | AppleSkin-mc1.12-1.0.14.jar                           | None                                     |     | LC    | baubles            | 1.5.2                   | Baubles-1.12-1.5.2.jar                                | None                                     |     | LC    | astralsorcery      | 1.10.27                 | astralsorcery-1.12.2-1.10.27.jar                      | a0f0b759d895c15ceb3e3bcb5f3c2db7c582edf0 |     | LC    | attributefix       | 1.0.12                  | AttributeFix-Forge-1.12.2-1.0.12.jar                  | None                                     |     | LC    | atum               | 2.0.20                  | Atum-1.12.2-2.0.20.jar                                | None                                     |     | LC    | bloodmoon          | 1.5.3                   | Bloodmoon-MC1.12.2-1.5.3.jar                          | d72e0dd57935b3e9476212aea0c0df352dd76291 |     | LC    | forgelin           | 1.8.4                   | Forgelin-1.8.4.jar                                    | None                                     |     | LC    | bountiful          | 2.2.2                   | Bountiful-2.2.2.jar                                   | None                                     |     | LC    | camera             | 1.0.10                  | camera-1.0.10.jar                                     | None                                     |     | LC    | chisel             | MC1.12.2-1.0.2.45       | Chisel-MC1.12.2-1.0.2.45.jar                          | None                                     |     | LC    | collective         | 3.0                     | collective-1.12.2-3.0.jar                             | None                                     |     | LC    | reskillable        | 1.12.2-1.13.0           | Reskillable-1.12.2-1.13.0.jar                         | None                                     |     | LC    | compatskills       | 1.12.2-1.17.0           | CompatSkills-1.12.2-1.17.0.jar                        | None                                     |     | LC    | creativecore       | 1.10.0                  | CreativeCore_v1.10.71_mc1.12.2.jar                    | None                                     |     | LC    | customnpcs         | 1.12                    | CustomNPCs_1.12.2-(05Jul20).jar                       | None                                     |     | LC    | darknesslib        | 1.1.2                   | DarknessLib-1.12.2-1.1.2.jar                          | 220f10d3a93b3ff5fbaa7434cc629d863d6751b9 |     | LC    | dungeonsmod        | @VERSION@               | DungeonsMod-1.12.2-1.0.8.jar                          | None                                     |     | LC    | enhancedvisuals    | 1.3.0                   | EnhancedVisuals_v1.4.4_mc1.12.2.jar                   | None                                     |     | LC    | extrautils2        | 1.0                     | extrautils2-1.12-1.9.9.jar                            | None                                     |     | LC    | futuremc           | 0.2.6                   | Future-MC-0.2.19.jar                                  | None                                     |     | LC    | geckolib3          | 3.0.30                  | geckolib-forge-1.12.2-3.0.31.jar                      | None                                     |     | LC    | gottschcore        | 1.15.1                  | GottschCore-mc1.12.2-f14.23.5.2859-v1.15.1.jar        | None                                     |     | LC    | hardcorerevival    | 1.2.0                   | HardcoreRevival_1.12.2-1.2.0.jar                      | None                                     |     | LC    | waila              | 1.8.26                  | Hwyla-1.8.26-B41_1.12.2.jar                           | None                                     |     | LE    | imsm               | 1.12                    | Instant Massive Structures Mod 1.12.2.jar             | None                                     |     | L     | journeymap         | 1.12.2-5.7.1p2          | journeymap-1.12.2-5.7.1p2.jar                         | None                                     |     | L     | mobsunscreen       | @version@               | mobsunscreen-1.12.2-3.1.5.jar                         | None                                     |     | L     | morpheus           | 1.12.2-3.5.106          | Morpheus-1.12.2-3.5.106.jar                           | None                                     |     | L     | llibrary           | 1.7.20                  | llibrary-1.7.20-1.12.2.jar                            | None                                     |     | L     | mowziesmobs        | 1.5.8                   | mowziesmobs-1.5.8.jar                                 | None                                     |     | L     | nocubessrparmory   | 3.0.0                   | NoCubes_SRP_Combat_Addon_3.0.0.jar                    | None                                     |     | L     | nocubessrpnests    | 3.0.0                   | NoCubes_SRP_Nests_Addon_3.0.0.jar                     | None                                     |     | L     | nocubessrpsurvival | 3.0.0                   | NoCubes_SRP_Survival_Addon_3.0.0.jar                  | None                                     |     | L     | nocubesrptweaks    | V4.1                    | nocubesrptweaks-V4.1.jar                              | None                                     |     | L     | patchouli          | 1.0-23.6                | Patchouli-1.0-23.6.jar                                | None                                     |     | L     | artifacts          | 1.1.2                   | RLArtifacts-1.1.2.jar                                 | None                                     |     | L     | rsgauges           | 1.2.8                   | rsgauges-1.12.2-1.2.8.jar                             | None                                     |     | L     | rustic             | 1.1.7                   | rustic-1.1.7.jar                                      | None                                     |     | L     | silentlib          | 3.0.13                  | SilentLib-1.12.2-3.0.14+168.jar                       | None                                     |     | L     | scalinghealth      | 1.3.37                  | ScalingHealth-1.12.2-1.3.42+147.jar                   | None                                     |     | L     | lteleporters       | 1.12.2-3.0.2            | simpleteleporters-1.12.2-3.0.2.jar                    | None                                     |     | L     | spartanshields     | 1.5.5                   | SpartanShields-1.12.2-1.5.5.jar                       | None                                     |     | L     | spartanweaponry    | 1.5.3                   | SpartanWeaponry-1.12.2-1.5.3.jar                      | None                                     |     | L     | srparasites        | 1.9.18                  | SRParasites-1.12.2v1.9.18.jar                         | None                                     |     | L     | treasure2          | 2.2.0                   | Treasure2-mc1.12.2-f14.23.5.2859-v2.2.1.jar           | None                                     |     | L     | treeharvester      | 4.0                     | treeharvester_1.12.2-4.0.jar                          | None                                     |     | L     | twilightforest     | 3.11.1021               | twilightforest-1.12.2-3.11.1021-universal.jar         | None                                     |     | L     | variedcommodities  | 1.12.2                  | VariedCommodities_1.12.2-(31Mar23).jar                | None                                     |     | L     | voicechat          | 1.12.2-2.4.32           | voicechat-forge-1.12.2-2.4.32.jar                     | None                                     |     | L     | wolfarmor          | 3.8.0                   | WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar | None                                     |     | L     | worldborder        | 2.3                     | worldborder_1.12.2-2.3.jar                            | None                                     |     | L     | midnight           | 0.3.5                   | themidnight-0.3.5.jar                                 | None                                     |     | L     | structurize        | 1.12.2-0.10.277-RELEASE | structurize-1.12.2-0.10.277-RELEASE.jar               | None                                     |     Loaded coremods (and transformers):  llibrary (llibrary-core-1.0.11-1.12.2.jar)   net.ilexiconn.llibrary.server.core.plugin.LLibraryTransformer   net.ilexiconn.llibrary.server.core.patcher.LLibraryRuntimePatcher WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)    AstralCore (astralsorcery-1.12.2-1.10.27.jar)    CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)    SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)    ForgelinPlugin (Forgelin-1.8.4.jar)    midnight (themidnight-0.3.5.jar)   com.mushroom.midnight.core.transformer.MidnightClassTransformer FutureMC (Future-MC-0.2.19.jar)   thedarkcolour.futuremc.asm.CoreTransformer SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)    Backpacked (backpacked-1.4.3-1.12.2.jar)   com.mrcrayfish.backpacked.asm.BackpackedTransformer LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   codersafterdark.reskillable.base.asm.ClassTransformer LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar)   lumien.bloodmoon.asm.ClassTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
    • When i add mods like falling leaves, visuality and kappas shaders, even if i restart Minecraft they dont show up in the mods menu and they dont work
    • Delete the forge-client.toml file in your config folder  
  • Topics

×
×
  • Create New...

Important Information

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