Jump to content

Recommended Posts

Posted (edited)

Hello,

is it possible to make network/package sending class handler a non static member? When i try to register it as a non-static, errors occur. When all members are static, it works fine.

Is it because NetworkEvent.Context must be static? 

 

Edited part for network example further bellow:

 

Error java.lang.IllegalArgumentException: Registration of network channels is locked

 

Registering message:

//Packet packet = new Packet();   //if handle is non-static

simpleChannel.registerMessage(index++, Packet.class, Packet::encode,
        Packet::new, Packet::handle); //Packet::new, packet::handle;   if handle is non-static

 // Maybe i pass handle wrong, when its non-static?

 

Packet class:

public class Packet{

    private static BlockPos blockPos;

    //public Packet () {};     //For passing handler on non-static

    public Packet(PacketBuffer buffer) {
        Packet.blockPos = buffer.readBlockPos();
    }

    public Packet(BlockPos blockPos) {
        Packet.blockPos = blockPos;
    }

    public void encode(PacketBuffer buffer) {
        buffer.writeBlockPos(Packet.blockPos);
    }

    public static void handle(packetmessage, Supplier<NetworkEvent.Context> contextSupplier) {   //if i make this class non-static, task execution fails

        contextSupplier.get().enqueueWork(() -> {

 

Edit from here: 

So I didnt manage to make methods non static etc..., but I managed to solve this problem by using other stuff, which completely diminished necessity of a non-static handler.

Also, because I didnt manage to find detailed examples or tutorials (apart official documentation on forge website and few posts, which came in handy but coverd mostly/only basics), on how to make network packet system on new minecraft forge (1.14.4) versions, im posting my code here for future people who might stumble on the same problems:

DISCLAIMER: Im not an experienced Minecraft forge mod programmer, nor good programmer in a nutshell, so this code might be non-efficient or have flaws / crashes, especially when testing on DEDICATED_SERVER (tests on LAN worked flawlessly), so read with caution.

 

Registering network packet:

public MainModCLass() {
  
    // Register the setup method for modloading
    FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);

    PacketHandler.registerMessages();  //<--Packet class

}

PacketHandler class:

public class PacketHandler {

    public static String string = "1";  //<--Just a filler string
    
    public static ResourceLocation resourceLocation = new ResourceLocation("mod", "main_channel");    //<--Channel name needs to be unique and cant contain more advanced symbols
    public static ResourceLocation resourceLocation0 = new ResourceLocation("mod", "main_channel0");

    public static final SimpleChannel simpleChannel = NetworkRegistry.ChannelBuilder   //<--Registering channels
            .named(resourceLocation)
            .clientAcceptedVersions(string::equals)
            .serverAcceptedVersions(string::equals)
            .networkProtocolVersion(() -> string)
            .simpleChannel();

    public static final SimpleChannel simpleChannel0 = NetworkRegistry.ChannelBuilder
            .named(resourceLocation0)
            .clientAcceptedVersions(string::equals)
            .serverAcceptedVersions(string::equals)
            .networkProtocolVersion(() -> string)
            .simpleChannel();

    public static void registerMessages() {

        int index = 0;

        simpleChannel.registerMessage(index++, PacketTriggerSEG.class, PacketTriggerSEG::encode,      newhandlesimpleChannel0classnewhandle

PacketTriggerSEG (when the client requests the server for synchronization to begin)

 

public class PacketTriggerSEG {
    
    private BlockPos blockPos;

   public PacketTriggerSEG(PacketBuffer buffer) {
       this.blockPos = buffer.readBlockPos();
    }

    public PacketTriggerSEG(BlockPos blockPos) {
        this.blockPos = blockPos;
    }

    public void encode(PacketBuffer buffer) {
       buffer.writeBlockPos(this.blockPos);
    }

    public static void handle(PacketTriggerSEG message, Supplier<NetworkEvent.Context> contextSupplier) {

        contextSupplier.get().enqueueWork(() -> {                                                                  //<--Adding a thread-safe, future-runnable task for server

            contextSupplier.get().getSender().getServerWorld().getTileEntity(message.blockPos).    
                    getCapability(new UtilCapabilities().UTIL_CAP).ifPresent(st -> {                               //<--Getting server world and finding entity in it with a custom capability assigned to tile entity (from other classes which arent shown here)
                        int tickCounter = st.getCounterForTicks();                                                 //<--getCounterForTicks() - function from manually created custom capability
                        PacketHandler.simpleChannel0.send(PacketDistributor.PLAYER.with(() ->                      //<--Sending packet back to client, to sync value on both sides
                        contextSupplier.get().getSender()), new ValueSynchronizeSEG(message.blockPos, tickCounter));
                    });
        });
        contextSupplier.get().setPacketHandled(true);                                                               //<--Setting packed as handled, so main thread knows its successful and doesnt show warnings/crashes when it completes
    }
}

ValueSynchronizeSEG (when packet of requested info from the server arrives back at the client):

public class ValueSynchronizeSEG {

    private BlockPos blockPos;
    private int tickCounter;

    public ValueSynchronizeSEG(PacketBuffer buffer) {
        this.blockPos = buffer.readBlockPos();
        this.tickCounter = buffer.readInt();
    }

    public ValueSynchronizeSEG(BlockPos blockPos, int tickCounter) {
        this.blockPos = blockPos;
        this.tickCounter = tickCounter;
    }

    public void encode(PacketBuffer buffer) {
        buffer.writeBlockPos(this.blockPos);
        buffer.writeInt(this.tickCounter);
    }

    public static void handle(ValueSynchronizeSEG message, Supplier<NetworkEvent.Context> contextSupplier) {

        contextSupplier.get().enqueueWork(() -> {

            Minecraft.getInstance().world.getTileEntity(message.blockPos).getCapability(new UtilCapabilities().UTIL_CAP).ifPresent(      //<--Setting server side capability values
                    ct -> ct.setCounterForTicks(message.tickCounter));
        });
        contextSupplier.get().setPacketHandled(true);
    }
}

Requesting for packet from only client-side:

private int loop;            <--Simple int to make packets to be sent every second-tick, not every tick

@Override
public void tick() {

        if(loop == 1) {
            PacketHandler.simpleChannel.sendToServer(new PacketTriggerSEG(container.getBlockPos()));
            loop = 0;
        }
        else {
            loop++;
        }
}   //This class is a client-side class, which extends ContainerScreen<YourTileEntityContainerScreenClass> and is efficient, because packets are sent ONLY when GUI is opened by a PlayerEntity.

If you rode all this, I hope it was of some help to you. Enjoy.

Edited by Mr Bonobo
Example of Packet handling - Networking
Posted (edited)

By the way, your thread title is completely useless.

  On 6/24/2020 at 11:14 PM, Mr Bonobo said:

When i try to register it as a non-static, errors occur.

Expand  

I mean...why do you care? Just leave it static.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
  On 6/24/2020 at 11:14 PM, Mr Bonobo said:

Error java.lang.IllegalArgumentException: Registration of network channels is locked

Expand  

You are registering your packets in the wrong place. Where are you registering your packets (when non-static)?

 

  On 6/24/2020 at 11:14 PM, Mr Bonobo said:

private static BlockPos blockPos;

Expand  

That is not going to work. Packets are not singletons.

A packet is constructed per sending/receiving, and therefore the block pos needs to be an attribute (property?) of the packet object.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)
  On 6/25/2020 at 12:15 AM, Draco18s said:

By the way, your thread title is completely useless.

I mean...why do you care? Just leave it static.

Expand  

Thank you for reply, I'm posting by myself first time, so I'm not familiar with this environment.

And non-static is preferable, because I don't want client side to initialize value and use ram when it's not necessary (static values are initialized in both sides, even if I assigned value on server side). So by using non-static value it should be more efficient (if I'm wrong, and it uses ram only when client side requests value from a static member, please correct me, i was using c++ previously, so static and non-static members are kinda new for me)

Edited by Mr Bonobo
Posted (edited)
  On 6/25/2020 at 12:49 AM, DavidM said:

You are registering your packets in the wrong place. Where are you registering your packets (when non-static)?

 

That is not going to work. Packets are not singletons.

A packet is constructed per sending/receiving, and therefore the block pos needs to be an attribute (property?) of the packet object.

Expand  

This is where i register packet:

public MyMod() {
    ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_CONFIG);
    ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.CLIENT_CONFIG);

    // Register the setup method for modloading
    FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);

    // Register ourselves for server and other game events we are interested in
    Config.loadConfig(Config.COMMON_CONFIG, FMLPaths.CONFIGDIR.get().resolve("mymod-common.toml"));
    Config.loadConfig(Config.CLIENT_CONFIG, FMLPaths.CONFIGDIR.get().resolve("mymod-client.toml"));

//Registering packets here:
    PacketHandler packetHandler = new PacketHandler(); //if non-static class - doesnt work
    packetHandler.registerMessages();

    PacketHandler.registerMessages();   //if static class - works

}

 

And im pretty sure,that BlocPos value isnt a problem, because it worked when everything was static. Though i will test that tomorrow with a simple value. (the code im showing works if its static, but the moment I try to convert everything to non-static and register it as a non-static, it fails to do so).

Edited by Mr Bonobo
Posted (edited)
  On 6/25/2020 at 1:16 AM, Mr Bonobo said:

And im pretty sure,that BlocPos value isnt a problem, because it worked when everything was static.

Expand  

It does not. It might appear to be working for you as you either tested it in single player, did an inconclusive test, or got lucky, but making it static is fundamentally broken as it goes against the packet system. In your case, as soon as another packet is constructed in the same JVM before a previous packet is sent, the whole thing breaks.

 

You should not make something "static" just because "I have no idea what the error means; let me just randomly change something and hope it will work"; instead, static should only be used if you want to make something class-specific (probably not the proper definition).

 

  On 6/25/2020 at 1:12 AM, Mr Bonobo said:

(static values are initialized in both sides, even if I assigned value on server side)

Expand  

That is only the case if you are playing on a client distribution, where the two sides exist in the same virtual machine. You should never rely on this, as it will break immediately once the mod is installed on the server distribution.

 

  On 6/25/2020 at 1:16 AM, Mr Bonobo said:

because it worked when everything was static.

Expand  

Please elaborate. What doesn't work? What is the error it is giving you? There is no concept of "static class" (unless you meant a static subclass, which doesn't seem to be the case here).

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)
  On 6/25/2020 at 1:12 AM, Mr Bonobo said:

i was using c++ previously, so static and non-static members are kinda new for me

Expand  

Static in Java is almost exactly like in C++, except for two points (that I can think of):

1. It does not denote the localness of a header member.

2. It cannot be used on a local variable to associate it with the static storage area (as opposed to stack).

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)
  On 6/25/2020 at 1:40 AM, DavidM said:

 

You should not make something "static" just because "I have no idea what the error means; let me just randomly change something and hope it will work"; instead, static should only be used if you want to make something class-specific (probably not the proper definition).

 

Please elaborate. What doesn't work? What is the error it is giving you? There is no concept of "static class" (unless you meant a static subclass, which doesn't seem to be the case here).

Expand  

Thank you for replies, I made it static and thought its the way to go because only example I stumbled upon on the internet (atleast as new forge versions goes) about packets, handling and creating was with Static Itemhandler on packet class (which is as bad as Static BlockPos if I understood it correctly?)

And yes, its because Im testing everything on singleplayer, and I don't think its possible to do it server-client separate at least with Intelij-gradle.

 

And about other question, I will now post whole code which is non-static, with every single usage / function and try to make it as simple and understandable as possible (I renamed classes/functions/variables):

 

Full error code:

 

Error code {

[22:02:22] [Client thread/ERROR] [ne.mi.fm.ne.NetworkRegistry/NETREGISTRY]: Attempted to register channel mod:main_channel even though registry phase is over
[22:02:22] [Client thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client
java.lang.IllegalArgumentException: Registration of network channels is locked
    at net.minecraftforge.fml.network.NetworkRegistry.createInstance(NetworkRegistry.java:130) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.NetworkRegistry.access$000(NetworkRegistry.java:49) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.NetworkRegistry$ChannelBuilder.createNetworkInstance(NetworkRegistry.java:400) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.NetworkRegistry$ChannelBuilder.simpleChannel(NetworkRegistry.java:409) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at com.Vidas.Mod.Packages.PacketHandler.<init>(PacketHandler.java:16) ~[main/:?] {}
    at com.Vidas.Mod.TileEntities.ElectricGeneratorScreen.<init>(ElectricGeneratorScreen.java:48) ~[main/:?] {}
    at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.lambda$null$0(FMLPlayMessages.java:287) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_241] {}
    at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.lambda$handle$1(FMLPlayMessages.java:284) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.NetworkEvent$Context.enqueueWork(NetworkEvent.java:185) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.handle(FMLPlayMessages.java:282) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:114) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_241] {}
    at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:114) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:147) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:65) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-1.0.0-service.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-1.0.0-service.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-1.0.0-service.jar:?] {}
    at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:82) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$0(NetworkHooks.java:69) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_241] {}
    at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:69) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraft.client.network.play.ClientPlayNetHandler.handleCustomPayload(ClientPlayNetHandler.java:1916) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:runtimedistcleaner:A}
    at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:61) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:11) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:accesstransformer:B}
    at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:accesstransformer:B}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:accesstransformer:B}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:893) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-3.2.0.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-3.2.0.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68) [modlauncher-3.2.0.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:80) [modlauncher-3.2.0.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-3.2.0.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
}

 

Registering PacketHandler class in Main mod class:

public Mod() {
 
PacketHandler packetHandler = new PacketHandler(); 
packetHandler.registerMessages();

}

private void setup(final FMLCommonSetupEvent event) {

//PacketHandler packetHandler = new PacketHandler();
//packetHandler.registerMessages();

} //Disclaimer: I tried it registering in both setup and main constructor - it fails both times here?

 

PacketHandler class:

public class PacketHandler {

    public String string = "1";

    public SimpleChannel simpleChannel = NetworkRegistry.ChannelBuilder     //Creaing SimpleChannel object
            .named(new ResourceLocation("mod", "main_channel"))
            .clientAcceptedVersions(string::equals)
            .serverAcceptedVersions(string::equals)
            .networkProtocolVersion(() -> string)
            .simpleChannel();

    public void registerMessages() {

        int index = 0;
        Packet packet = new Packet ();
        simpleChannel.registerMessage(index++, Packet.class, Packet::encode,
                Packet::new, packet::handle);

 

Packet class: 

public class Packet {


    private BlockPos blockPos;


    public Packet (PacketBuffer buffer) {
        this.blockPos = buffer.readBlockPos();
    }

    public Packet (BlockPos blockPos) {
        this.blockPos = blockPos;
    }

    public Packet () { }          //This constructor is only to create object without any value for PacketHandler class 

    public void encode(PacketBuffer buffer) {
        buffer.writeBlockPos(this.blockPos);
    }

    public void handle(Packet message, Supplier<NetworkEvent.Context> contextSupplier) {

        contextSupplier.get().enqueueWork(() -> {   //Thread-safe zone

            if (contextSupplier.get().getDirection().getOriginationSide().isClient()) {           //this is always CLIENT side

 

Where I try to send packet (and where error occurs):

 

private PacketHandler packetHandler = new PacketHandler();

@Override          //Minecraft-forge implemented class/method for Screen Gui
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {  //Happens every tick, after block container is opened. Only on CLIENT

    packetHandler.simpleChannel.sendToServer(new Packet(container.getBlockPos()));  //Error occurs here

//Further code just for context:
    GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    assert this.minecraft != null;
    this.minecraft.getTextureManager().bindTexture(GUI);
    int relX = (this.width - this.xSize) / 2;
    int relY = (this.height - this.ySize) / 2;

Error code suggests that it cant register, because its unavailable/locked at that phase, so it fails registering first time on game setup? (though i tried searching for keywords with ctrl-f and didnt find any errors)

Also, I tried changing BlockPos to simple Int variable, still same error occured.

Edited by Mr Bonobo
Posted
  On 6/25/2020 at 7:40 PM, Mr Bonobo said:

Attempted to register channel mod:main_channel even though registry phase is over

Expand  

This seems pretty self explanatory.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 6/25/2020 at 7:40 PM, Mr Bonobo said:

Thank you for replies, I made it static and thought its the way to go because only example I stumbled upon on the internet (atleast as new forge versions goes) about packets, handling and creating was with Static Itemhandler on packet class (which is as bad as Static BlockPos if I understood it correctly?)

Expand  

The packet handler method can be static, as it does not depend on a handler instance (unlike 1.12.2 and before).

 

 

Some tips:

  Reveal hidden contents

 

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

    • Rubidium and Embeddium are versions of the same mod, you can only have one. I believe Embeddium is the one that's actively maintained.
    • Hello, New to modding, but have a solid CS foundation. I've created multiple custom BlockEntities that all have the same issue, which is that the inventory only updates on right click (overriding the useItemOn method). I've seen multiple posts on here outlining a similar issue to mine, but I've already implemented the solution of: overriding the correct methods in the BlockEntity class and calling setChanged(). I've tried every different place for setChanged() to no success. I'm wondering if I'm missing something else or if there was some change to sending data to the client in 1.21.5? Or will I have to use a custom packet sender? Here is the code for one of my BlockEntity classes with a single inventory slot: public class MyCustomBlockEntity extends BlockEntity { public final ItemStackHandler inventory = new ItemStackHandler(1) { @Override protected int getStackLimit(int slot, @NotNull ItemStack stack) { return 1; } @Override protected void onContentsChanged(int slot) { setChanged(); if (!level.isClientSide()) { level.setBlockAndUpdate(getBlockPos(), getBlockState()); } } }; public MyCustomBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.MY_CUSTOM_BE.get(), pPos, pBlockState); } public void clearContents() { inventory.setStackInSlot(0, ItemStack.EMPTY); } public void dropItem() { SimpleContainer inv = new SimpleContainer(inventory.getSlots()); inv.setItem(0, inventory.getStackInSlot(0)); Containers.dropContents(this.level, this.worldPosition, inv); } @Override public void setRemoved() { dropItem(); super.setRemoved(); } @Override protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.saveAdditional(pTag, pRegistries); pTag.put("inventory", inventory.serializeNBT(pRegistries)); } @Override protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.loadAdditional(pTag, pRegistries); inventory.deserializeNBT(pRegistries, pTag.getCompound("inventory").get()); } @Override public Packet<ClientGamePacketListener> getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } @Override public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { return saveWithoutMetadata(pRegistries); } } Mostly encountering the issue when calling the clearContents() method anywhere outside of useItemOn() in the Block class. I've also tried overriding both the handleUpdateTag() and onDataPacket() methods, calling their super along with loadAdditional(), but neither changed the outcome. Thanks in advance for any replies.
    • Hi all! I’m working on a Jurassic Park-themed mod for Minecraft 1.20.1, aiming to include dinosaurs, fossils, DNA extraction, and cool machines. This is a free project, mainly passion-driven, and I’ll give full credit to everyone involved. this is the perfect opportunity for beginners of modeling and coding. This project will give you experience and a creative freedom If you love dinosaurs and Minecraft modding, hit me up! Thanks! Add Me ogfrost. <--- Discord
    • I'm just really confused. This bug only applies to modpacks made by me. i have tried using different launchers prism, modrinth etc. I have tried with multiple modpacks. All of this has not prevented this bug. Relevant part of log is here: [06Jun2025 16:18:49.882] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Failed to build unique mod list after mod discovery. net.minecraftforge.fml.loading.EarlyLoadingException: Duplicate mods found     at net.minecraftforge.fml.loading.UniqueModListBuilder.buildUniqueList(UniqueModListBuilder.java:87) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:106) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:164) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) ~[loader-47.2.2.jar:47.2]     at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) ~[modlauncher-10.0.9.jar:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]     at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) ~[?:?]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]     at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]     at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]     at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:88) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?]     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 io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]     at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?]     at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]     at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?] [06Jun2025 16:18:49.894] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Mod Discovery failed. Skipping dependency discovery.     Full log [06Jun2025 16:18:48.612] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, DeltaBlack_, --version, 1.20.1, --gameDir, C:/Users/sammi/AppData/Roaming/PrismLauncher/instances/SITE 111/minecraft, --assetsDir, C:/Users/sammi/AppData/Roaming/PrismLauncher/assets, --assetIndex, 5, --uuid, 0ff86c0727f444f1a926b954a58d8c44, --accessToken, ????????, --userType, msa, --versionType, release, --launchTarget, forgeclient, --fml.forgeVersion, 47.1.105, --fml.fmlVersion, 47.2.2, --fml.mcVersion, 1.20.1, --fml.mcpVersion, 20230612.114412, --width, 854, --height, 480] [06Jun2025 16:18:48.615] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [06Jun2025 16:18:49.050] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [06Jun2025 16:18:49.173] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 [06Jun2025 16:18:49.311] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 [06Jun2025 16:18:49.496] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/sammi/AppData/Roaming/PrismLauncher/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%23152!/ Service=ModLauncher Env=CLIENT [06Jun2025 16:18:49.502] [pool-2-thread-1/INFO] [EARLYDISPLAY/]: GL info: AMD Radeon Graphics GL version 4.6.0 Core Profile Context 24.10.21.03.240627, ATI Technologies Inc. [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "[1.20.1] SecurityCraft v1.10.0.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ad_astra-forge-1.20.1-1.15.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "architectury-9.2.14-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "bellsandwhistles-0.4.5-1.20.x-Create6.0+.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "botarium-forge-1.20.1-2.3.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "chloride-FORGE-mc1.20.1-v1.7.2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "copycats-3.0.1+mc.1.20.1-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Create Encased-1.20.1-1.7.1-fix2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create-1.20.1-6.0.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create_enchantment_industry-1.3.2-for-create-6.0.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create_security-0.1.2-forge-1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "createdeco-2.0.3-1.20.1-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "createframed-1.20.1-1.6.5.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "creategoggles-1.20.1-6.0.0-[FORGE].jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Crystal-Clear-2.1-Beta-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "design_decor-0.4.0b-1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "embeddium-0.3.31+mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "entityculling-forge-1.7.4-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "interiors-0.5.6+forge-mc1.20.1-local.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Jade-1.20.1-Forge-11.13.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "jei-1.20.1-forge-15.20.0.112.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ManyIdeasCore-1.20.1-1.4.2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ManyIdeasDoors-1.20.1-1.2.3.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "prma-1.20.1-0.4.4-cr6.0-SIMPLE-beta-all.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "RecipesLibrary-1.20.1-2.0.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "resourcefulconfig-forge-1.20.1-2.1.3.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "resourcefullib-forge-1.20.1-2.1.29.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "rubidium-extra-0.5.4.4+mc1.20.1-build.131.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "rubidium-mc1.20.1-0.7.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "skinlayers3d-forge-1.7.5-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Steam_Rails-1.6.7+forge-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "tacz-1.20.1-1.1.5.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Xaeros_Minimap_25.2.6_Forge_1.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "XaerosWorldMap_1.39.9_Forge_1.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.853] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\core\47.2.2\core-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.856] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-java\47.2.2\language-java-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.858] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-lowcode\47.2.2\language-lowcode-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.861] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-minecraft\47.2.2\language-minecraft-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.866] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "core-47.2.2.jar" of type LIBRARY with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-java-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-lowcode-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-minecraft-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "client-1.20.1-20230612.114412-srg.jar" of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "forge-1.20.1-47.1.105-universal.jar" of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.872] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "events-47.2.2.jar" of type GAMELIBRARY with provider net.minecraftforge.fml.loading.moddiscovery.BuiltinGameLibraryLocator@38834000 [06Jun2025 16:18:49.881] [main/ERROR] [net.minecraftforge.fml.loading.UniqueModListBuilder/LOADING]: Found duplicate mods:     Mod ID: 'rubidium' from mod files: rubidium-mc1.20.1-0.7.1.jar, embeddium-0.3.31+mc1.20.1.jar [06Jun2025 16:18:49.882] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Failed to build unique mod list after mod discovery. net.minecraftforge.fml.loading.EarlyLoadingException: Duplicate mods found     at net.minecraftforge.fml.loading.UniqueModListBuilder.buildUniqueList(UniqueModListBuilder.java:87) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:106) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:164) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) ~[loader-47.2.2.jar:47.2]     at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) ~[modlauncher-10.0.9.jar:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]     at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) ~[?:?]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]     at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]     at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]     at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:88) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?]     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 io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]     at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?]     at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]     at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?] [06Jun2025 16:18:49.894] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Mod Discovery failed. Skipping dependency discovery.    
    • I've just started modding, and I'm trying to make custom swords. When I try to import SwordItem, I get the error:  What confuses me is that other item classes work fine: package io.github.xxx.denseswords.item; import io.github.xxx.denseswords.DenseSwords; import net.minecraft.world.item.Item; // works fine import net.minecraft.world.item.ShovelItem; // works fine import net.minecraft.world.item.SwordItem; // Error: The import cannot be resolved import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; Forge MDK v55.0.15 - Minecraft 1.21.5 Java v24.0.1 Windows 11 IDE: Visual Studio Code
  • Topics

×
×
  • Create New...

Important Information

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