Jump to content

[SOLVED] [1.12.2] Every 100 packets there's a memory leak, relogging doesn't sync player capabilities


Recommended Posts

Posted (edited)

I'm working on a mod where I have to sync player capabilities from the server to the client and vice versa quite often, but every 100th packet sent causes a memory leak causing the client to not get the data from the server. Also when I exit a singleplayer world and enter it again (haven't tested on servers yet, it's probably the same though) the data from the server doesn't get synced with the client. What could be causing this?

Leak message:

Quote

[16:24:29] [Netty Local Client IO #1/FATAL] [FML]: Detected ongoing potential memory leak. 100 packets have leaked. Top offenders
[16:24:29] [Netty Local Client IO #1/FATAL] [FML]:      fnm : 100

PacketMana (all packets are set up this way):

import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class PacketMana implements IMessage {
	EntityPlayerMP player;
    private int data;

    @Override
    public void fromBytes(ByteBuf buf) {
        IMana mana = Minecraft.getMinecraft().player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
        data = mana.setMana(buf.readInt());
    }

    @Override
    public void toBytes(ByteBuf buf) {
        IMana mana = Minecraft.getMinecraft().player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
        buf.writeInt(mana.getMana());
    }

    public PacketMana() {
        IMana mana = Minecraft.getMinecraft().player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
        data = mana.getMana();
    }
    
    public PacketMana(EntityPlayerMP player) {
    	this.player = player;
        IMana mana = player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
        data = mana.getMana();
    }

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(PacketMana message, MessageContext ctx) {
            EntityPlayerMP playerEntity = ctx.getServerHandler().player;
            playerEntity.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(message.data);
        }
    }
}

 

Events for syncing data (sync(player) is a function that sends all packets to the player):

	@SubscribeEvent
    public static void loginEvent(final PlayerLoggedInEvent event) {
    	EntityPlayerMP player = (EntityPlayerMP)event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void changeDimesionEvent(final PlayerChangedDimensionEvent event) {
    	EntityPlayerMP player = (EntityPlayerMP)event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void respawnEvent(final PlayerRespawnEvent event) {
    	EntityPlayerMP player = (EntityPlayerMP)event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    }

 

Player Clone Event:

	@SubscribeEvent
    public static void playerClone(final PlayerEvent.Clone event) {
        final IMana oldMana = getMana(event.getOriginal());
        final IMana newMana = getMana(event.getEntityPlayer());

        if (newMana != null && oldMana != null) {
            newMana.setMaxMana(oldMana.getMaxMana());
            newMana.setManaTimer(oldMana.getManaTimer());
            newMana.setMana(oldMana.getMana());
            
            newMana.setClan(oldMana.getClan());
            newMana.setLand(oldMana.getLand());
            newMana.setAffiliation(oldMana.getAffiliation());

            newMana.setGenjutsu(oldMana.getGenjutsu());
            newMana.setTaijutsu(oldMana.getTaijutsu());
            newMana.setKenjutsu(oldMana.getKenjutsu());

            newMana.setSharingan(oldMana.getSharingan());
            newMana.setSharinganSize(oldMana.getSharinganSize());
            newMana.setSharinganPattern(oldMana.getSharinganPattern());
            newMana.setSharinganActive(oldMana.getSharinganActive());
            newMana.setByakugan(oldMana.getByakugan());
            newMana.setByakuganSize(oldMana.getByakuganSize());
            newMana.setByakuganActive(oldMana.getByakuganActive());
            newMana.setKetsuryuugan(oldMana.getKetsuryuugan());
            newMana.setKetsuryuuganActive(oldMana.getKetsuryuuganActive());
            
            newMana.setCurseMark(oldMana.getCurseMark());
            newMana.setCurseMarkSize(oldMana.getCurseMarkSize());
            newMana.setCurseMarkType(oldMana.getCurseMarkType());
            newMana.setCurseMarkActive(oldMana.getCurseMarkActive());
            
            newMana.setFireRelease(oldMana.getFireRelease());
            newMana.setWindRelease(oldMana.getWindRelease());
            newMana.setWaterRelease(oldMana.getWaterRelease());
            newMana.setLightningRelease(oldMana.getLightningRelease());
            newMana.setEarthRelease(oldMana.getEarthRelease());
            newMana.setWoodRelease(oldMana.getWoodRelease());
            newMana.setYinRelease(oldMana.getYinRelease());
            newMana.setYangRelease(oldMana.getYangRelease());
            newMana.setIceRelease(oldMana.getIceRelease());

            newMana.setShikotsumyaku(oldMana.getShikotsumyaku());

        	Minecraft.getMinecraft().addScheduledTask(() -> sync((EntityPlayerMP)event.getEntityPlayer()));
        }
        System.out.println("Player Clone Event Successful");
    }

 

Edited by FlashHUN
marked as solved
Posted
1 hour ago, diesieben07 said:

Your code shows a complete lack of understanding about sides. Read and understand the documentation.

  • Your packet needs to be sent from server to client. Not client to server.
  • Accessing the capability on the client player every time in the packet makes no sense. You need to grab the data from the server side player and send it to the client.
  • Do not send packets in PlayerEvent.Clone. 

What if I need to edit player capability data through a GUI? How would I get the server side player in a GUI and edit their server side capabilities through the GUI? Also, when I don't send packets in the PlayerEvent.Clone the capabilities don't sync between the client and server.

Posted
6 hours ago, FlashHUN said:

What if I need to edit player capability data through a GUI? How would I get the server side player in a GUI and edit their server side capabilities through the GUI?

You don't. When the data changes on in the GUI, you send a packet from the client to the server containing the new information. The server will receive that packet and pass it to the packet handler together with the player, where you can verify if the data is correct (to prevent cheating) and set the capability data.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
11 hours ago, larsgerrits said:

You don't. When the data changes on in the GUI, you send a packet from the client to the server containing the new information. The server will receive that packet and pass it to the packet handler together with the player, where you can verify if the data is correct (to prevent cheating) and set the capability data.

Alright, I was just confused because diesieben said

19 hours ago, diesieben07 said:

Your packet needs to be sent from server to client. Not client to server

 

Anyways, I still don't know why the memory leak is happening and why the player data doesn't sync when the player relogs.

Posted

I haven't updated anything because I don't know what to update and how. Like I said, if I don't send packets in PlayerEvent.Clone, then the stuff doesn't get synced from the server to the client when the event happens. I need to be able to access data from the client side player to be able to send it to the server from the GUI. What should I do?

Posted

I did, but I don't know what to do. I'm just a beginner developer asking for help. I understand that I should be using sides, but I don't know where and when.

Posted

I understand what I should be doing now, I just don't know how and can't really find anything on it. Sorry for making you waste your time on me like this.

How can I get the data only from the server side player in the events?

How can I apply the data to the client player in the client proxy? Just simply send packets to them?

If I don't access the client side player in the IMessage, should I do this in the packets, or am I just a completely lost cause: (Sorry for not putting it in code blocks but it wouldn't load)

Spoiler

public class PacketMana implements IMessage {
    @SidedProxy(clientSide = References.client_proxy_class, serverSide = References.common_proxy_class)
    static CommonProxy proxy;
    static MessageContext ctx;
    static EntityPlayer player = proxy.getPlayerEntityFromContext(ctx);
    IMana mana = player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
    private int data;

 

    @Override
    public void fromBytes(ByteBuf buf) {
        data = mana.setMana(buf.readInt());
    }

 

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(mana.getMana());
    }


    public PacketMana(EntityPlayerMP player) {
        this.player = player;
        data = mana.getMana();
    }

 

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

 

        private void handle(PacketMana message, MessageContext ctx) {
            EntityPlayerMP playerEntity = (EntityPlayerMP)player;
            playerEntity.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(message.data);
        }
    }
}

 

CommonProxy:

Spoiler

public class CommonProxy {

    public void registerItemRenderer(Item item, int meta, String id) {}
    
    public EntityPlayer getPlayerEntityFromContext(MessageContext ctx)
    {
        return ctx.getServerHandler().player;
    }
    
    public void handleData() {}
}

 

ClientProxy:

Spoiler

public class ClientProxy extends CommonProxy {

    public void registerItemRenderer(Item item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item,  meta,  new ModelResourceLocation(item.getRegistryName(), id));
    }
    
    public EntityPlayer getPlayerEntity(MessageContext ctx)
    {
        return (ctx.side.isClient() ? Minecraft.getMinecraft().player : ctx.getServerHandler().player);
    }
    
    public void handleData() {
        
    }
}

 

Posted

Should the packet look something like this then? (I don't really know how else to do it without the @SidedProxy)

public class PacketMana implements IMessage {
	@SidedProxy(clientSide = References.client_proxy_class, serverSide = References.common_proxy_class)
	static CommonProxy proxy;
    MessageContext ctx;
    private int data;

    @Override
    public void fromBytes(ByteBuf buf) {
    	EntityPlayer player = proxy.getPlayerEntityFromContext(ctx);
        data = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(buf.readInt());
    }

    @Override
    public void toBytes(ByteBuf buf) {
    	EntityPlayer player = proxy.getPlayerEntityFromContext(ctx);
        buf.writeInt(player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana());
    }

    public PacketMana() {
    	EntityPlayer player = proxy.getPlayerEntityFromContext(ctx);
        data = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana();
    }
    
    public PacketMana(EntityPlayer player) {
        data = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana();
    }

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(PacketMana message, MessageContext ctx) {
            EntityPlayerMP playerEntity = ctx.getServerHandler().player;
            playerEntity.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(message.data);
        }
    }
}

 

I need all packets in my mod to be bi-directional.

 

Events for syncing:

    private static void sync(EntityPlayer player) {
    	player.getCapability(MANA_CAPABILITY, null);
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    }

    @SubscribeEvent
    public static void loginEvent(final PlayerLoggedInEvent event) {
    	EntityPlayer player = event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void changeDimesionEvent(final PlayerChangedDimensionEvent event) {
    	EntityPlayer player = event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void respawnEvent(final PlayerRespawnEvent event) {
    	EntityPlayer player = event.player;
    	Minecraft.getMinecraft().addScheduledTask(() -> sync(player));
    	System.out.println("Synced");
    }
    }

 

Should the handle method in my ClientProxy look like this? Or does casting EntityPlayerMP to EntityPlayer in the ClientProxy cause any problems?

    public void handleData(MessageContext ctx) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
		
		PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
	}

 

How do I pass the data from the received data from PacketHandler to the proxy?

Posted

So, should it look something like this? (At least am I getting closer to how it should look like?)

public class PacketMana implements IMessage {
    private int data;

    public PacketMana() {}
    
    public PacketMana(EntityPlayer player) {
        data = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana();
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    	data = buf.readInt();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(data);
    }

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(PacketMana message, MessageContext ctx) {
            EntityPlayer playerEntity = ctx.getServerHandler().player;
            playerEntity.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(message.data);
        }
    }
}

Should the

EntityPlayer playerEntity = ctx.getServerHandler().player;

be something else?

 

If I do

    @SubscribeEvent
    public static void loginEvent(final PlayerLoggedInEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void changeDimesionEvent(final PlayerChangedDimensionEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void respawnEvent(final PlayerRespawnEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }

the EntityPlayer hasn't constructed yet in the PlayerLoggedInEvent since it fires a tick before that happens.

 

Should I just do

    public void handleData(MessageContext ctx) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		player.getCapability(CapabilityMana.MANA_CAPABILITY, null);
	}

in the ClientProxy?

Posted
1 hour ago, diesieben07 said:

Yes, except you are still using the server player in the handle method. In that method you need to actually call the method in your proxy, which needs to take the data as an argument and then apply the data to the client-side player (like you do now in handle with the server-side player).

So, then the packet should look like this?

public class PacketMana implements IMessage {
    static CommonProxy proxy;
    private int mana;

    public PacketMana() {}
    
    public PacketMana(EntityPlayer player) {
        mana = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana();
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    	mana = buf.readInt();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(mana);
    }

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(PacketMana message, MessageContext ctx) {
        	proxy.handleMana(mana);
        }
    }
}

 

The problem then is that the

proxy.handleMana(mana);

method asks for the

mana

int to be static. Is that fine?

 

handleMana() in CommonProxy:

public void handleMana(int mana) {}

 

handleMana() in ClientProxy:

    public void handleMana(int mana) {
    	EntityPlayer player = Minecraft.getMinecraft().player;
    	player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(mana);
    }

 

 

1 hour ago, diesieben07 said:
1 hour ago, FlashHUN said:

the EntityPlayer hasn't constructed yet in the PlayerLoggedInEvent since it fires a tick before that happens.

This is not true. 

Odd. When I did it that way the data didn't sync unless I did it through the scheduled task way.

Posted

Alright, this is how it looks now:

 

PacketHandler:

public class PacketHandler 
{
	
	 private static int packetId = 0;

	    public static SimpleNetworkWrapper INSTANCE = null;

	    public PacketHandler() {
	    }

	    public static int nextID() {
	        return packetId++;
	    }

	    public static void registerMessages(String channelName) {
	        INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(channelName);
	        registerMessages();	
	    }

	    public static void registerMessages() {
	        INSTANCE.registerMessage(PacketMana.Handler.class, PacketMana.class, nextID(), Side.SERVER);
	    }
}

 

PacketMana:

public class PacketMana implements IMessage {
	static CommonProxy proxy;
    private int mana;

    public PacketMana() {}
    
    public PacketMana(EntityPlayer player) {
        mana = player.getCapability(CapabilityMana.MANA_CAPABILITY, null).getMana();
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    	mana = buf.readInt();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(mana);
    }

    public static class Handler implements IMessageHandler<PacketMana, IMessage> {
        @Override
        public IMessage onMessage(PacketMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(PacketMana message, MessageContext ctx) {
        	proxy.handleMana(message.mana);
        }
    }
}

 

ClientProxy:

public class ClientProxy extends CommonProxy {

	public void registerItemRenderer(Item item, int meta, String id) {
		ModelLoader.setCustomModelResourceLocation(item,  meta,  new ModelResourceLocation(item.getRegistryName(), id));
	}
	
	public EntityPlayer getPlayerEntityFromContext(MessageContext ctx)
	{
		return Minecraft.getMinecraft().player;
	}
	
	public void handleMana(int mana) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(mana);
	}
}

 

CommonProxy:

public class CommonProxy {

    public void registerItemRenderer(Item item, int meta, String id) {}
	
    public EntityPlayer getPlayerEntityFromContext(MessageContext ctx)
    {
        return ctx.getServerHandler().player;
    }
	
	public void handleMana(int mana) {}
}

 

CapabilityMana:

public class CapabilityMana {
	
    @CapabilityInject(IMana.class)
    public static final Capability<IMana> MANA_CAPABILITY = null;

    public static final EnumFacing DEFAULT_FACING = null;

    public static final ResourceLocation ID = new ResourceLocation(References.mod_id, "Mana");

    public static void register(){
        CapabilityManager.INSTANCE.register(IMana.class, new Capability.IStorage<IMana>() {
            @Override
            public NBTBase writeNBT(Capability<IMana> capability, IMana instance, EnumFacing side) {
                NBTTagCompound nbt = new NBTTagCompound();
                nbt.setInteger("mana", instance.getMana());
                
                System.out.println("Writing");
                return nbt;
            }

            @Override
            public void readNBT(Capability<IMana> capability, IMana instance, EnumFacing side, NBTBase nbt) {
                instance.setMana(((NBTTagCompound) nbt).getInteger("mana"));
                
                System.out.println("Reading");
            }
        }, () -> new Mana());
    }

    @Nullable
    public static IMana getMana(final EntityLivingBase entity){
        return CapabilityUtils.getCapability(entity, MANA_CAPABILITY, DEFAULT_FACING);

    }

    public static ICapabilityProvider createProvider(final IMana mana){
        return new CapabilityProviderSerializable<>(MANA_CAPABILITY, DEFAULT_FACING, mana);
    }	

    @Mod.EventBusSubscriber(modid = References.mod_id)
    private static class EventHandler {@SubscribeEvent
    public static void attachCapabilities(final AttachCapabilitiesEvent<Entity> event) {
        if (event.getObject() instanceof EntityPlayer) {
            final Mana mana = new Mana();
            event.addCapability(ID, createProvider(mana));
        }
    }

    @SubscribeEvent
    public static void playerClone(final PlayerEvent.Clone event) {
        final IMana oldMana = getMana(event.getOriginal());
        final IMana newMana = getMana(event.getEntityPlayer());

        if (newMana != null && oldMana != null) {
            newMana.setMana(oldMana.getMana());
            System.out.println("Player Clone Event Successful");
        }
    }
    
    @SubscribeEvent
    public static void onUpdate(final PlayerTickEvent event) {
    	final IMana mana = getMana(event.player);
    	if(event.player instanceof EntityPlayerMP){
    		mana.fillMana(1);
    		PacketHandler.INSTANCE.sendTo(new PacketMana(event.player), (EntityPlayerMP)event.player);
    	}
    }
    
    @SubscribeEvent
    public static void loginEvent(final PlayerLoggedInEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void changeDimesionEvent(final PlayerChangedDimensionEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }
    
    @SubscribeEvent
    public static void respawnEvent(final PlayerRespawnEvent event) {
    	EntityPlayer player = event.player;
    	PacketHandler.INSTANCE.sendTo(new PacketMana(player), (EntityPlayerMP)player);
    	System.out.println("Synced");
    }
    }
}

 

Is there anything else I should be doing? Since the memory leak still happens.

Posted
54 minutes ago, diesieben07 said:
1 hour ago, FlashHUN said:

INSTANCE.registerMessage(PacketMana.Handler.class, PacketMana.class, nextID(), Side.SERVER);

No. This packet is sent to the client.

So, should I change the Side.SERVER to Side.CLIENT?

55 minutes ago, diesieben07 said:
1 hour ago, FlashHUN said:

static CommonProxy proxy;

This will always be null.

How can I make that not be null? Use @SidedProxy?

55 minutes ago, diesieben07 said:
1 hour ago, FlashHUN said:

public EntityPlayer getPlayerEntityFromContext(MessageContext ctx) { return Minecraft.getMinecraft().player; }

This is not correct on the client. You have to check if you are on the integrated server or not.

That is done with world.isRemote, right?

Posted
19 minutes ago, diesieben07 said:

Yes.

 

You could do that. Or just remove this field and use the one you likely already have in your main mod class.

 

Usually yes, but in this case you do not have a World available, just the MessageContext. The MessageContext has a field side though, which you can check.

Thank you so much for all the help! I really appreciate it. Now I finally don't have memory leaks. I have two hopefully last questions though:

 

  • Can I make the ClientProxy method handle multiple capabilities?

For example instead of

    public void handleMana(int mana) {
    	EntityPlayer player = Minecraft.getMinecraft().player;
    	player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(mana);
    }

could I make it take a String too, and depending on what that is make it handle other capabilities? Something like this:

    public void handleMana(int data, String type) {
    	EntityPlayer player = Minecraft.getMinecraft().player;
    	if (type.equals("Mana") {
    		player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(data);
    	}
    	else if (type.equals("MaxMana") {
    		player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMaxMana(data);
    	}
    }

and then in PacketMana do:

Main.proxy.handleMana(message.mana, "Mana");

and in PacketMaxMana do:

Main.proxy.handleMana(message.mana, "MaxMana");

 

 

  • If I have to send one of these packets to the server, do I have to change anything? Like I said before, most of these packets need to be bi-directional since most of them could be edited through a GUI. Do I have to just copy the
handleMana()

in the ClientProxy to the CommonProxy so the data changes on both sides, or do I have to change something in the PacketHandler aswell, or even create a new packet that handles specifically receiving packets on the server?

Posted
1 hour ago, diesieben07 said:

Yes, you could use a string as an identifier. But that is just... terrible.

Why is it terrible? I can see through it quite clearly that way. What would be a better way of doing it?

 

1 hour ago, diesieben07 said:

Also, if the values belong to the same capability, why not just send them in one packet?

I would have A LOT of different values. How could I make it so the packet differentiates which one I want changed?

 

1 hour ago, diesieben07 said:

The client-to-server packets mean "the player just entered this value on the GUI, do with that what you want". And then the server decides what to do with that information. Do not blindly trust the client. Assume the client is always lying. 

How could I do that? I would not like if players cheated, but how can I make the server decide what to do with said information?

Posted
1 minute ago, diesieben07 said:

Do not let the client just send over the new value. Instead (for example) send over "player pressed button x". Then perform the action solely on the server.

If there are other restrictions, such as "must only be done every x seconds" enforce those on the server, not just the client.

So, for example, I have a GUI where a player can spend their acquired points in skills. If the player wants to do that, then when they click the button in the GUI to do so, a packet is sent where the data is that the button was pressed. Then how can I get that data from the packet, and in what type of method should I enforce the restrictions on the server?

Posted
1 minute ago, diesieben07 said:

What data? You said it was just a button, so the fact that the packet arrives at all on the server is enough to signify that the button was pressed. If you have a text field that lets you choose how much to spend, that is what you would send in the packet. In the same way you send the mana value now.

Then on the server, in your packet handler, you can check that the player actually has enough points and if so, perform the "spend points" operation.

Then the data in the packet would equal something like GUISkillMenu.pointstospend in the constructor? How can I detect if a packet arrives on a server? Sorry for all of these stupid questions, but these anti cheating things are new to me.

Posted

Wait, nevermind, the constructor would take the int itself and then the data would equal to the int in the constructor. I realized that now, but then again, how do I detect the packet arriving on a server?

Posted

We literally sent the message at the same time. So it would just be in the onMessage part? (or should I do it through a scheduled task this way too and schedule a handle method?)

Posted
Just now, diesieben07 said:

Please, actually try and understand what these things are. You are just stabbing in the dark.

I'm trying to understand, but all of this was a bit too much information to handle at once after a tiring day for my brain.

Posted (edited)

So, the packet that the client sends to the server should look something like this, right?

public class ClientMana implements IMessage {
    private int data;

    public ClientMana(int data) {
    	this.data = data;
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    	data = buf.readInt();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(data);
    }

    public static class Handler implements IMessageHandler<ClientMana, IMessage> {
        @Override
        public IMessage onMessage(ClientMana message, MessageContext ctx) {
            FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx));
            return null;
        }

        private void handle(ClientMana message, MessageContext ctx) {
        	Main.proxy.handleServerMana(message.data, 1, ctx);
        }
    }
}

 

And the data would then get handled in the CommonProxy where this happens:

public class CommonProxy {

	public void registerItemRenderer(Item item, int meta, String id) {}
	
    public EntityPlayer getPlayerEntityFromContext(MessageContext ctx)
    {
        return ctx.getServerHandler().player;
    }

	public void handleMana(int mana, int packetType) {}

	public void handleManaB(boolean mana, int packetType) {}
	
	public void handleManaD(double mana, int packetType) {}
	
	public void handleServerMana(int mana, int packetType, MessageContext ctx) {
		EntityPlayer player = ctx.getServerHandler().player;
		switch (packetType) {
			case 1: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(mana); break;
			case 2: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMaxMana(mana); break;
		}
	}
}

 

And the ClientProxy looks like this:

public class ClientProxy extends CommonProxy {

	public void registerItemRenderer(Item item, int meta, String id) {
		ModelLoader.setCustomModelResourceLocation(item,  meta,  new ModelResourceLocation(item.getRegistryName(), id));
	}
	
	public EntityPlayer getPlayerEntityFromContext(MessageContext ctx)
	{
		return ctx.side.isClient() ? Minecraft.getMinecraft().player : ctx.getServerHandler().player;
	}
	
	public void handleMana(int mana, int packetType) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		switch (packetType) {
			case 1: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMana(mana); break;
			case 2: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setMaxMana(mana); break;
			case 3: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setByakugan(mana); break;
			case 5: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setByakuganSize(mana); break;
			case 6: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setKetsuryuugan(mana); break;
			case 8: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setSharingan(mana); break;
			case 10: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setSharinganPattern(mana); break;
			case 11: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setSharinganSize(mana); break;
			case 12: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setCurseMark(mana); break;
			case 13: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setCurseMarkSize(mana); break;
			case 14: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setCurseMarkType(mana); break;
			case 15: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setShikotsumyaku(mana); break;
			case 16: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setEarthRelease(mana); break;
			case 17: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setFireRelease(mana); break;
			case 18: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setIceRelease(mana); break;
			case 19: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setLightningRelease(mana); break;
			case 20: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setWaterRelease(mana); break;
			case 21: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setWindRelease(mana); break;
			case 22: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setWoodRelease(mana); break;
			case 23: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setYangRelease(mana); break;
			case 24: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setYinRelease(mana); break;
			case 25: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setAffiliation(mana); break;
			case 26: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setClan(mana); break;
			case 27: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setLand(mana); break;
			case 28: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setGenjutsu(mana); break;
		}
	}

	public void handleManaB(boolean mana, int packetType) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		switch (packetType) {
			case 4: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setByakuganActive(mana); break;
			case 7: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setKetsuryuuganActive(mana); break;
			case 9: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setSharinganActive(mana); break;
			case 13: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setCurseMarkActive(mana); break;
		}
		
	}
	
	public void handleManaD(double mana, int packetType) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		switch (packetType) {
			case 29: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setKenjutsu(mana); break;
			case 30: player.getCapability(CapabilityMana.MANA_CAPABILITY, null).setTaijutsu(mana); break;
		}
	}
}

 

Edited by FlashHUN
Posted
1 hour ago, diesieben07 said:

This packet is the exact thing you must not do prevent cheating. A malicious client can just send over "hey, please 1,000,000 mana!" and the server will go "okay!" and apply it.

Then how else should I do it? This is a packet that would be sent when the player first starts out and picks their base stats (they can pick 2 things through a GUI and those 2 things determine what stats you get at the start), so there aren't really any restrictions. For example, depending on the clan they choose at the start they might get more mana than you'd normally start out with.

Posted
Just now, diesieben07 said:

Send over exactly what they select in the GUI. Do they select the amount of mana? No, they select their clan. So, send over the clan and then let the server decide how much mana that clan implies.

Otherwise the client decides, which means effectively every clan gets as much mana as they want. Which is not what you want.

Ah, thank you for clearing that up.

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

    • Looks like supplementaries is conflicting with the mod spawn
    • ---- Minecraft Crash Report ---- // There are four lights! Time: 2024-11-26 09:45:49 Description: Exception in server tick loop net.mehvahdjukaar.supplementaries.common.utils.VibeChecker$BadModError: Some OTHER mod loaded the Sheets class to early, causing modded banner patterns and sherds textures to not include modded ones. Refusing to proceed further. Missing entries: [ResourceKey[minecraft:decorated_pot_patterns / spawn:crown_pottery_pattern], ResourceKey[minecraft:decorated_pot_patterns / spawn:spade_pottery_pattern]] (mods listed here are NOT the cause of this, merely the ones that got broken because of it) Check previous forge log lines to find the offending mod.     at knot//net.mehvahdjukaar.supplementaries.common.utils.VibeChecker.clientStuff(VibeChecker.java:100)     at knot//net.mehvahdjukaar.supplementaries.common.utils.VibeChecker.checkVibe(VibeChecker.java:42)     at knot//net.mehvahdjukaar.supplementaries.common.events.ServerEvents.onPlayerLoggedIn(ServerEvents.java:121)     at knot//net.mehvahdjukaar.supplementaries.common.events.fabric.ServerEventsFabric.lambda$init$0(ServerEventsFabric.java:40)     at knot//net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents.lambda$static$2(ServerPlayConnectionEvents.java:48)     at knot//net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.onClientReady(ServerPlayNetworkAddon.java:66)     at knot//net.minecraft.class_3324.handler$dnm001$fabric-networking-api-v1$handlePlayerConnection(class_3324.java:10018)     at knot//net.minecraft.class_3324.method_14570(class_3324.java:215)     at knot//net.minecraft.class_3248.method_33800(class_3248.java:131)     at knot//net.minecraft.class_3248.method_14384(class_3248.java:118)     at knot//net.minecraft.class_3248.redirect$dnn000$fabric-networking-api-v1$handlePlayerJoin(class_3248.java:563)     at knot//net.minecraft.class_3248.method_18784(class_3248.java:68)     at knot//net.minecraft.class_2535.method_10754(class_2535.java:259)     at knot//net.minecraft.class_3242.method_14357(class_3242.java:172)     at knot//net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:908)     at knot//net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)     at knot//net.minecraft.class_1132.method_3748(class_1132.java:105)     at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)     at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)     at java.base/java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.20.1     Minecraft Version ID: 1.20.1     Operating System: Windows 10 (amd64) version 10.0     Java Version: 17.0.12, Azul Systems, Inc.     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Azul Systems, Inc.     Memory: 6718697432 bytes (6407 MiB) / 11031019520 bytes (10520 MiB) up to 17179869184 bytes (16384 MiB)     CPUs: 12     Processor Vendor: GenuineIntel     Processor Name: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz     Identifier: Intel64 Family 6 Model 45 Stepping 7     Microarchitecture: Sandy Bridge (Server)     Frequency (GHz): 3.20     Number of physical packages: 1     Number of physical CPUs: 6     Number of logical CPUs: 12     Graphics card #0 name: NVIDIA GeForce GTX 1070     Graphics card #0 vendor: NVIDIA (0x10de)     Graphics card #0 VRAM (MB): 4095.00     Graphics card #0 deviceId: 0x1b81     Graphics card #0 versionInfo: DriverVersion=32.0.15.6614     Memory slot #0 capacity (MB): 8192.00     Memory slot #0 clockSpeed (GHz): 1.60     Memory slot #0 type: DDR3     Memory slot #1 capacity (MB): 8192.00     Memory slot #1 clockSpeed (GHz): 1.60     Memory slot #1 type: DDR3     Memory slot #2 capacity (MB): 8192.00     Memory slot #2 clockSpeed (GHz): 1.60     Memory slot #2 type: DDR3     Memory slot #3 capacity (MB): 8192.00     Memory slot #3 clockSpeed (GHz): 1.60     Memory slot #3 type: DDR3     Virtual memory max (MB): 37550.15     Virtual memory used (MB): 24472.94     Swap memory total (MB): 4864.00     Swap memory used (MB): 0.00     JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx16384M     Fabric Mods:          additionz: AdditionZ 1.3.2         adorn: Adorn 5.0.1+1.20.1         advanced_runtime_resource_pack: Runtime Resource Pack 0.8.1         advancementsfullscreen: AdvancementsFullscreen 1.0         advancementssearch: AdvancementsSearch 1.0         adventurez: AdventureZ 1.4.20         agedaddition: Aged-Addition 1.0.6         alloy_forgery: Alloy Forgery 2.1.2+1.20         almanac: Almanac 1.0.2         amarite: Amarite 1.0.8             cardinal-components-base: Cardinal Components API (base) 5.2.2             cardinal-components-block: Cardinal Components API (blocks) 5.2.2             cardinal-components-entity: Cardinal Components API (entities) 5.2.2             reach-entity-attributes: Reach Entity Attributes 2.4.0         ambientenvironment: Ambient Environment 11.0.0.1         amendments: Amendments 1.20-1.2.12         another_furniture: Another Furniture 1.20.1-3.0.1         antique_atlas: Antique Atlas 2.10.0+1.20         appleskin: AppleSkin 2.5.1+mc1.20         architectury: Architectury 9.2.14         astrocraft: Astrocraft 1.4.5+1.20.1         asynclocator: Async Locator 1.3.0         athena: Athena 3.1.2         autotag-convention: AutoTag Convention 2.0.2+1.20             autotag: AutoTag 2.0.2+1.20         backslot: BackSlot 1.2.15             amecsapi: Amecs API 1.5.0+mc1.20-pre1         backslotaddon: BackSlot Addon 1.1.1         badoptimizations: BadOptimizations 2.2.0         bakery: [Let's Do] Bakery 2.0.3         balm-fabric: Balm 7.3.9             kuma_api: KumaAPI 20.1.8         bbb: Building But Better 1.20.1-fabric-1.0.2         betterarcheology: Better Archeology 1.2.1-1.20.1         bettercombat: Better Combat 1.8.6+1.20.1         betterdeserttemples: YUNG's Better Desert Temples 1.20-Fabric-3.0.3             org_reflections_reflections: reflections 0.10.2         betterendisland: YUNG's Better End Island 1.20-Fabric-2.0.6         betterfortresses: YUNG's Better Nether Fortresses 1.20-Fabric-2.0.6         betterjungletemples: YUNG's Better Jungle Temples 1.20-Fabric-2.0.5         betteroceanmonuments: YUNG's Better Ocean Monuments 1.20-Fabric-3.0.4         betterstats: Better Statistics Screen 3.12.6+fabric-1.20.1         bettertrims: BetterTrims 3.2.8         birds-boids: Birds Boids 1.1.0         blur: Blur (Fabric) 3.1.0             midnightlib: MidnightLib 1.4.1             satin: Satin 1.13.0         boids: Boids 1.2.2             blue_endless_jankson: jankson 1.2.3         bookshelf: Bookshelf 20.2.13         borderlessmining: Borderless Mining 1.1.8+1.20.1         brewery: [Let's Do] Brewery 2.0.3         cameraoverhaul: Camera Overhaul 1.4.1-fabric-universal         candlelight: [Let's Do] Candlelight 2.0.2         cardinal-components: Cardinal Components API 5.2.2             cardinal-components-chunk: Cardinal Components API (chunks) 5.2.2             cardinal-components-item: Cardinal Components API (items) 5.2.2             cardinal-components-level: Cardinal Components API (world saves) 5.2.2             cardinal-components-scoreboard: Cardinal Components API (scoreboard) 5.2.2             cardinal-components-world: Cardinal Components API (worlds) 5.2.2         cave_dweller: Cave Dweller 1.4.0         chalk: Chalk 2.2.4             com_github_mclegoman_releasetypeutils: releasetypeutils 2.1.0             fabric-simplelibs: Simple Fabric Libs 2.0.0         chalk-colorful-addon: Chalk: Colorful-Addon 2.1.1+1.19.3         chipped: Chipped 3.0.7         cloth-config: Cloth Config v11 11.1.136             cloth-basic-math: cloth-basic-math 0.6.1         collective: Collective 7.87         combatroll: Combat Roll 1.3.3+1.20.1         configurable: Configurable 2.2.3         connectiblechains: Connectible Chains 2.2.1+1.20.1         convenientdecor: Convenient Decor 0.4.3             omega-config: OmegaConfig 1.4.0+1.20.1         couplings: Couplings 1.9.5+1.20         craftedcore: CraftedCore 5.6         crawl: Crawl 0.12.0             mm: Manningham Mills 2.3         creeperoverhaul: Creeper Overhaul 3.0.2         crop_growth_modifier: Crop Growth Modifier 1.20.1-1.1.1         cyclepaintings: Cycle Paintings 3.6         darkpaintings: DarkPaintings 17.0.4         dawn: Dawn API 5.0.0             terraform-shapes-api-v1: Terraform Shapes API (v1) 7.0.1             terraform-wood-api-v1: Terraform Wood API (v1) 7.0.1         decorative_computers: decorative_computers 1.0.1         defaultoptions: Default Options 18.0.1         dehydration: Dehydration 1.3.6         desert_dungeon: Desert Dungeon 1.0.0         deuf_refabricated: DEUF Refabricated 1.1.0         distanthorizons: Distant Horizons 2.2.1-a         doapi: [Let's Do] API 1.2.15         dungeonnowloading: Dungeon Now Loading 1.5         dungeonz: DungeonZ 1.0.6         earlystage: EarlyStage 1.1.1         elytratrims: Elytra Trims 3.5.4             conditional-mixin: conditional mixin 0.6.2         elytratrims_extensions: Elytra Trims Extensions 2.2.1         emi: EMI 1.1.18+1.20.1+fabric         emi_enchanting: EMI Enchanting 0.1.2+1.20.1         emi_letsdo_compat: emi-letsdo-compat 1.3         emi_loot: EMI Loot 0.7.4+1.20.1+fabric         emi_ores: EMI Ores 1.0+1.20.1+fabric         emiffect: EMIffect 1.1.2+mc1.20.1         emitrades: EMI Trades 1.2.1+mc1.20.1             org_quiltmc_parsers_json: json 0.2.1         endermanoverhaul: Enderman Overhaul 1.0.4         endrem: End Remastered 5.2.4         entity_model_features: Entity Model Features 2.2.6         entity_texture_features: Entity Texture Features 6.2.7             org_apache_httpcomponents_httpmime: httpmime 4.5.10         entityculling: EntityCulling 1.7.1         environmentz: EnvironmentZ 2.0.8         euphonium: Euphonium 1.0.3+1.20             folk_sisby_kaleido-config: kaleido-config 0.3.1+1.3.2         everycomp: Every Compat 1.20-2.6.92         exposure: Exposure 1.7.7         extended_drawers: Extended Drawers 2.1.1+mc.1.20.1             config_toolkit: ConfigToolkit 1.0.0                 io_determann_shadow-api-17: shadow-api-17 0.1.1                 net_fabricmc_javapoet: javapoet 0.1.0             graphlib: Graph Lib 1.4.0+1.20                 kmodlib-overlay: KModLib Overlay 0.2.12+1.20                 libnetworkstack: Lib Network Stack 0.10.0             noindium: No Indium? 1.1.0+1.20         extendeddrawersaddon: ExtendedDrawersAddon 1.0.2         fabric-api: Fabric API 0.92.2+1.20.1             fabric-api-base: Fabric API Base 0.4.31+1802ada577             fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.36+1802ada577             fabric-biome-api-v1: Fabric Biome API (v1) 13.0.13+1802ada577             fabric-block-api-v1: Fabric Block API (v1) 1.0.11+1802ada577             fabric-block-view-api-v2: Fabric BlockView API (v2) 1.0.1+1802ada577             fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.41+1802ada577             fabric-client-tags-api-v1: Fabric Client Tags 1.1.2+1802ada577             fabric-command-api-v1: Fabric Command API (v1) 1.2.34+f71b366f77             fabric-command-api-v2: Fabric Command API (v2) 2.2.13+1802ada577             fabric-commands-v0: Fabric Commands (v0) 0.2.51+df3654b377             fabric-containers-v0: Fabric Containers (v0) 0.1.64+df3654b377             fabric-content-registries-v0: Fabric Content Registries (v0) 4.0.11+1802ada577             fabric-convention-tags-v1: Fabric Convention Tags 1.5.5+1802ada577             fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.19+1802ada577             fabric-data-attachment-api-v1: Fabric Data Attachment API (v1) 1.0.0+de0fd6d177             fabric-data-generation-api-v1: Fabric Data Generation API (v1) 12.3.4+1802ada577             fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.54+1802ada577             fabric-entity-events-v1: Fabric Entity Events (v1) 1.6.0+1c78457f77             fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.6.2+1802ada577             fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.63+df3654b377             fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.40+1802ada577             fabric-item-api-v1: Fabric Item API (v1) 2.1.28+1802ada577             fabric-item-group-api-v1: Fabric Item Group API (v1) 4.0.12+1802ada577             fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.37+1802ada577             fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.35+df3654b377             fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.2.22+1802ada577             fabric-loot-api-v2: Fabric Loot API (v2) 1.2.1+1802ada577             fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.1.45+9e7660c677             fabric-message-api-v1: Fabric Message API (v1) 5.1.9+1802ada577             fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.50+1802ada577             fabric-model-loading-api-v1: Fabric Model Loading API (v1) 1.0.3+1802ada577             fabric-models-v0: Fabric Models (v0) 0.4.2+9386d8a777             fabric-networking-api-v1: Fabric Networking API (v1) 1.3.11+1802ada577             fabric-networking-v0: Fabric Networking (v0) 0.3.51+df3654b377             fabric-object-builder-api-v1: Fabric Object Builder API (v1) 11.1.3+1802ada577             fabric-particles-v1: Fabric Particles (v1) 1.1.2+1802ada577             fabric-recipe-api-v1: Fabric Recipe API (v1) 1.0.21+1802ada577             fabric-registry-sync-v0: Fabric Registry Sync (v0) 2.3.3+1802ada577             fabric-renderer-api-v1: Fabric Renderer API (v1) 3.2.1+1802ada577             fabric-renderer-indigo: Fabric Renderer - Indigo 1.5.2+85287f9f77             fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.46+df3654b377             fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.37+92a0d36777             fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.0.28+1802ada577             fabric-rendering-v0: Fabric Rendering (v0) 1.1.49+df3654b377             fabric-rendering-v1: Fabric Rendering (v1) 3.0.8+1802ada577             fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.3.8+1802ada577             fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.11.10+1802ada577             fabric-screen-api-v1: Fabric Screen API (v1) 2.0.8+1802ada577             fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.30+1802ada577             fabric-sound-api-v1: Fabric Sound API (v1) 1.0.13+1802ada577             fabric-transfer-api-v1: Fabric Transfer API (v1) 3.3.5+8dd72ea377             fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 4.3.1+1802ada577         fabric-language-kotlin: Fabric Language Kotlin 1.12.3+kotlin.2.0.21             org_jetbrains_kotlin_kotlin-reflect: kotlin-reflect 2.0.21             org_jetbrains_kotlin_kotlin-stdlib: kotlin-stdlib 2.0.21             org_jetbrains_kotlin_kotlin-stdlib-jdk7: kotlin-stdlib-jdk7 2.0.21             org_jetbrains_kotlin_kotlin-stdlib-jdk8: kotlin-stdlib-jdk8 2.0.21             org_jetbrains_kotlinx_atomicfu-jvm: atomicfu-jvm 0.25.0             org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm: kotlinx-coroutines-core-jvm 1.9.0             org_jetbrains_kotlinx_kotlinx-coroutines-jdk8: kotlinx-coroutines-jdk8 1.9.0             org_jetbrains_kotlinx_kotlinx-datetime-jvm: kotlinx-datetime-jvm 0.6.1             org_jetbrains_kotlinx_kotlinx-io-bytestring-jvm: kotlinx-io-bytestring-jvm 0.5.4             org_jetbrains_kotlinx_kotlinx-io-core-jvm: kotlinx-io-core-jvm 0.5.4             org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm: kotlinx-serialization-cbor-jvm 1.7.3             org_jetbrains_kotlinx_kotlinx-serialization-core-jvm: kotlinx-serialization-core-jvm 1.7.3             org_jetbrains_kotlinx_kotlinx-serialization-json-jvm: kotlinx-serialization-json-jvm 1.7.3         fabricloader: Fabric Loader 0.16.9         fancymenu: FancyMenu 3.3.2             com_github_keksuccino_japng: japng 0.5.3             com_github_rtyley_animated-gif-lib-for-java: animated-gif-lib-for-java animated-gif-lib-1.7         farm_and_charm: [Let's Do] Farm & Charm 1.0.4         fastconfigapi: Fast Config API 2.1.0             com_moandjiezana_toml_toml4j: toml4j 0.7.2         fbp: FancyBlockParticles 20.1.1.1         ferritecore: FerriteCore 6.0.1         firstperson: FirstPerson 2.4.5         fishingreal: Fishingreal 1.20.1-1.7.2         fleshz: FleshZ 1.5.1         forgeconfigapiport: Forge Config API Port 8.0.0         formations: Formations 1.0.2         formationsnether: Formations Nether 1.0.5         formationsoverworld: Formations Overworld 1.0.4         fzzy_config: Fzzy Config 0.5.6+1.20.1             fabric-permissions-api-v0: fabric-permissions-api 0.3.1             net_peanuuutz_tomlkt_tomlkt-jvm: tomlkt-jvm 0.3.7         gardens_of_the_dead: Gardens of the Dead 4.0.1         geckoanimfix: GeckoLibIrisCompat 1.0.0         geckolib: GeckoLib 4 4.4.9             com_eliotlash_mclib_mclib: mclib 20         gh: Gods and Heroes 1.6.2         grassoverhaul: Grass Overhaul 23.10.11         handcrafted: Handcrafted 3.0.6         hearths: Hearths 1.0.1         herbalbrews: [Let's Do] HerbalBrews 1.0.8.1         herdspanic: Herds Panic 1.1.0         hopobettermineshaft: Hopo Better Mineshaft 1.1.8         hopobetterunderwaterruins: Hopo Better Underwater Ruins 1.1.4         immediatelyfast: ImmediatelyFast 1.3.1+1.20.4             net_lenni0451_reflect: Reflect 1.3.4         immersive_aircraft: Immersive Aircraft 1.1.2+1.20.1             org_mariuszgromada_math_mathparser_org-mxparser: MathParser.org-mXparser 5.2.1         immersive_armors: Immersive Armors 1.6.1+1.20.1         immersive_melodies: Immersive Melodies 0.3.0+1.20.1         immersivesnow: Immersive Snow 1.3.0         immersiveui: ImmersiveUI 0.2.2         indium: Indium 1.0.34+mc1.20.1         inmis: Inmis 2.7.2-1.20.1         inmisaddon: InmisAddon 1.0.4         interactic: Interactic 0.2.0+1.20         iris: Iris 1.7.5+mc1.20.1             io_github_douira_glsl-transformer: glsl-transformer 2.0.1             org_anarres_jcpp: jcpp 1.4.14             org_antlr_antlr4-runtime: antlr4-runtime 4.13.1         ironchests: Iron Chests: Restocked 5.0.2         java: OpenJDK 64-Bit Server VM 17         jobsaddon: JobsAddon 1.1.6         journeymap: Journeymap 5.10.3             journeymap-api-fabric: JourneyMap API 1.20-1.9-fabric-SNAPSHOT         jumpoverfences: Jump Over Fences 1.3.1         justoutdoorstuffs: Just Outdoor Stuffs 1.0.2         keybind_fix: Keybind Fix 1.0.0         kiwi: Kiwi Library 11.8.26+fabric         konkrete: Konkrete 1.8.1         labellingcontainers: Labelling Containers 1.8.0         labels: labels 1.20-1.20.2         lambdynlights: LambDynamicLights 2.3.2+1.20.1             pride: Pride Lib 1.2.0+1.19.4             spruceui: SpruceUI 5.0.0+1.20         lavender: Lavender 0.1.9+1.20             lavender-md: lavender-md 0.1.1+1.20             lavender-md-owo-ui: lavender-md-owo-ui 0.1.1+1.20         leahs-immersive-thunder: Immersive Thunder 1.20.1+1.2.2         letmedespawn: Let Me Despawn 1.4.4         levelz: LevelZ 1.4.13         libz: LibZ 1.0.3         lithium: Lithium 0.11.2         lmft: Load My F***ing Tags 1.0.2+1.20         loadmyresources: Load My Resources 1.0.4         logbegone: Log Begone 1.0.8         lootbeams: Lootbeams 2.1.1+1.20.1             microconfig: Microconfig 3.0.0         lootr: Lootr 0.7.33.81         luphieclutteredmod: Cluttered 2.1.0+1.20.1         mcwpaintings: Macaw's Paintings 1.0.5         meadow: [Let's Do] Meadow 1.3.19             mixinsquared: MixinSquared 0.1.2-beta.5         medieval_buildings: Medieval Buildings 1.0.1         medievalweapons: Medieval Weapons 1.4.8         melody: Melody 1.0.3         memoryleakfix: Memory Leak Fix 1.1.5         mes: Moog's End Structures 1.3.1-1.20-fabric         minecraft: Minecraft 1.20.1         mns: Moog's Nether Structures 1.0.1-1.20-fabric         modelfix: Model Gap Fix 1.15         modernfix: ModernFix 5.19.4+mc1.20.1         modmenu: Mod Menu 7.2.2         moonlight: Moonlight 1.20-2.13.25         more_armor_trims: More Armor Trims 1.4.1-1.20.1         moreculling: More Culling 1.20.4-0.24.0         mr_animated_doors: Animated Doors 1.0         mr_better_babies: Better Babies 0.6.2         mr_developer_resources: Data API 0.2         mr_dungeons: Dungeons+ 1.8.4b         mr_dungeons_andtaverns: Dungeons and Taverns 3.0.3.f         mr_dungeons_andtavernsancientcityoverhaul: Dungeons and Taverns Ancient City Overhaul 1         mr_dungeons_andtavernspillageroutpostrework: Dungeons and Taverns Pillager Outpost Rework 1.1         mr_dungeons_andtavernsstrongholdrework: Dungeons and Taverns Stronghold Rework 1         mr_lukis_grandcapitals: Luki's Grand Capitals 1.0         mr_origins_vampire: Origins: Vampire 1-v2.2.0         mr_ships: Ships 3.0.3         mr_true_ending: True Ending: Ender Dragon Overhaul 1-v1.1.0c         mr_villager_transportation: Villager Transportation 1.3.1         mru: Mineblock's Repeated Utilities 1.0.4+1.20.1+fabric         myloot: myLoot 4.0.3-1.20.1         mythicmetals: Mythic Metals 0.19.9+1.20.1             additionalentityattributes: Additional Entity Attributes 1.7.3+1.20.0             common-protection-api: Common Protection API 1.0.0         nameplate: Nameplate 1.1.4         naturalist: Naturalist 4.0.3         natures_spirit: Nature's Spirit 1.6.3-1.20.1         neruina: Neruina 2.1.2             com_fasterxml_jackson_core_jackson-annotations: jackson-annotations 2.17.0             com_fasterxml_jackson_core_jackson-core: jackson-core 2.17.0             com_fasterxml_jackson_core_jackson-databind: jackson-databind 2.17.0             org_apache_maven_maven-artifact: maven-artifact 3.8.1             org_kohsuke_github-api: github-api 1.318         nethervinery: [Let's Do] NetherVinery 1.2.14         niftycarts: NiftyCarts 20.1.3         nimble: Nimble 5.0.1         noisium: Noisium 2.3.0+mc1.20-1.20.1         nutritionz: NutritionZ 1.0.11         nyctophobia: Nyctophobia 1.9         octolib: OctoLib 0.4.2             org_yaml_snakeyaml: snakeyaml 2.2         origins: Origins 1.10.0             apoli: Apoli 2.9.0                 calio: Calio 1.11.0                 playerabilitylib: Pal 1.8.0         overflowingbars: Overflowing Bars 8.0.1         owo: oωo 0.11.2+1.20         particular: Particular 1.1.1         partyaddon: PartyAddon 1.0.4         passablefoliage: Passable Foliage 1.20.1-fabric-8.2.1         patchouli: Patchouli 1.20.1-84-FABRIC             fiber: fiber 0.23.0-2         paxi: Paxi 1.20-Fabric-4.0         pehkui: Pehkui 3.8.3+1.14.4-1.21             kanos_config: Kanos Config 0.4.1+1.14.4-1.19.4         phantom: Phantom Library 20.1.5         player-animator: Player Animator 1.0.2-rc1+1.20         plushables: Plushables 1.1.3         pockets: Pockets 1.2.0         portfolio: Portfolio 1.20.1-1.4.0-fabric         presencefootsteps: Presence Footsteps 1.9.4+1.20.1             kirin: Kirin UI 1.15.6+1.20.1         profundis: Profundis 1.6.2         promenade: Promenade 4.1.1             biolith: Biolith 1.0.0-alpha.8                 terraform-surfaces-api-v1: Terraform Surfaces API (v1) 7.0.1         puzzleslib: Puzzles Lib 8.1.24             puzzlesaccessapi: Puzzles Access Api 8.0.7         reciperemover: Recipe Remover 1.0.11         regions_unexplored: Regions Unexplored 0.5.6+1.20.1         resourcefulconfig: Resourcefulconfig 2.1.2         resourcefullib: Resourceful Lib 2.1.29             com_teamresourceful_bytecodecs: bytecodecs 1.0.2             com_teamresourceful_yabn: yabn 1.0.3         revive: Revive 1.0.7         rpgdifficulty: RpgDifficulty 1.3.15         rsls: Raise Sound Limit Simplified 1.1.5         scholar: Scholar 1.0.0         seamless_loading_screen: Seamless Loading Screen 2.0.3+1.20.1         seasonhud: SeasonHUD 1.11.2         seasons: Fabric Seasons 2.4.2-BETA+1.20         shut_up_gl_error: Shut Up GL Error 1.0.0         simplemod: SimpleMod 1.20.1         skinlayers3d: 3d-Skin-Layers 1.7.0         smallships: Small Ships 2.0.0-b1.4         smarterfarmers: Smarter Farmers 1.20-2.1.0         smitherz: SmitherZ 1.0.4         smoothscrollingrefurbished: Smooth Scrolling Refurbished 1.1.2         smoothswapping: Smooth Swapping 0.9.3.1         sodium: Sodium 0.5.11+mc1.20.1         sound_physics_remastered: Sound Physics Remastered 1.20.1-1.4.5         sounds: Sounds 2.2.0+1.20.1+fabric             mixinextras: MixinExtras 0.5.0-beta.2             yet_another_config_lib_v3: YetAnotherConfigLib 3.5.0+1.20.1-fabric                 com_twelvemonkeys_common_common-image: common-image 3.10.0                 com_twelvemonkeys_common_common-io: common-io 3.10.0                 com_twelvemonkeys_common_common-lang: common-lang 3.10.0                 com_twelvemonkeys_imageio_imageio-core: imageio-core 3.10.0                 com_twelvemonkeys_imageio_imageio-metadata: imageio-metadata 3.10.0                 com_twelvemonkeys_imageio_imageio-webp: imageio-webp 3.10.0                 org_quiltmc_parsers_gson: gson 0.2.1         sparsestructures: SparseStructures 2.2.0         spawn: Spawn 1.0.3-fabric         spawnanimations: Spawn Animations 1.9.4+mod         spider_caves: Spider Caves 20.1.0         spoiledz: SpoiledZ 1.0.10             capsaicin: Capsaicin 1.3.3+mc1.20.1         spoornpacks: SpoornPacks 5.0-1.20.1         stoneworks: Stoneworks 8.0.0         storagedelight: Storage Delight 24.9.11-1.20-fabric         superbsteeds: Superb Steeds 1.20-4         supermartijn642configlib: SuperMartijn642's Config Lib 1.1.8+a         supplementaries: Supplementaries 1.20-3.1.9         suppsquared: Supplementaries Squared 1.20-1.1.18         surveyor: Surveyor Map Framework 0.6.25+1.20         sushi_bar: Sushi Bar 0.2.2+1.20             com_moulberry_mixinconstraints: mixinconstraints 1.0.1         tawct: Time & Wind Custom Ticker 1.4.8+1.20-1.20.1         tcdcommons: TCD Commons API 3.12.3+fabric-1.20.1         tenseambience: Tense Ambience 1.7.0             com_github_umjammer_jlayer: jlayer 1.0.2         terrablender: TerraBlender 3.0.1.7             com_electronwill_night-config_core: core 3.6.7             com_electronwill_night-config_toml: toml 3.6.7         tiered: Tiered 1.3.3         tlc: The Lost Castle 1.0.1         tool_trims: Tool Trims 2.2.1         tooltipfix: ToolTip Fix 1.1.1-1.20         translucencyfix: Translucency Fix 2.2.0         travelersbackpack: Traveler's Backpack 9.1.18         travelerz: TravelerZ 1.0.1         treechop: HT's TreeChop 0.19.0         trimeffects: TrimsEffects 1.3.5         trinkets: Trinkets 3.7.2         u_desert: Unnamed Desert 1.3.1         underground_jungle: Underground Jungle 20.1.2         veinmining: Vein Mining 1.5.0+1.20.1             spectrelib: SpectreLib 0.13.15+1.20.1         villagerfix: Villager Trade Fix 1.0.4         villagesandpillages: Villages & Pillages 1.0.1         vinery: [Let's Do] Vinery 1.4.28         void_lib: Void Lib 1.1.5         voidtotem: Void Totem 3.0.1         voidz: VoidZ 1.0.11         walkers: Walkers 5.4         waterdripsound: Drip Sounds 1.19-0.3.2         welcomescreen: WelcomeScreen 1.0.1         wildlife: Wildlife 1.19.2-2.2         yungsapi: YUNG's API 1.20-Fabric-4.0.6             org_javassist_javassist: javassist 3.29.2-GA     Loaded Shaderpack: (off)     Server Running: true     Player Count: 0 / 8; []     Data Packs: vanilla, fabric, nutritionz:promenade_nutrition_compat, natures_spirit:modified_mountain_biomes, nutritionz:dehydration_x_meadow_nutrition_compat, natures_spirit:modified_dark_forest, jobsaddon:supplementaries_compat, natures_spirit:modified_birch_forest, nutritionz:candlelight_nutrition_compat, jobsaddon:earlystage_compat, nutritionz:brewery_nutrition_compat, nutritionz:herbalbrews_nutrition_compat, nutritionz:dehydration_x_vinery_nutrition_compat, nutritionz:adventurez_nutrition_compat, natures_spirit:modified_windswept_hills, jobsaddon:candlelight_compat, nutritionz:natures_spirit_nutrition_compat, nutritionz:bakery_nutrition_compat, nutritionz:spawn_nutrition_compat, nutritionz:farm_and_charm_nutrition_compat, nutritionz:naturalist_nutrition_compat, nutritionz:regions_unexplored_nutrition_compat, natures_spirit:modified_jungle, fleshz:adventurez_compat, nutritionz:vinery_nutrition_compat, natures_spirit:modified_swamp, natures_spirit:modified_flower_forest, natures_spirit:modified_desert, nutritionz:dehydration_nutrition_compat, fleshz:naturalist_compat, fleshz:meadow_compat, jobsaddon:vinery_compat, nutritionz:dehydration_x_nethervinery_nutrition_compat, nutritionz:supplementaries_nutrition_compat, jobsaddon:bakery_compat, natures_spirit:modified_savannas, nutritionz:meadow_nutrition_compat, nutritionz:nethervinery_nutrition_compat, natures_spirit:modified_badlands, Everycomp Generated Pack, Moonlight Mods Dynamic Assets, Supplementaries Generated Pack, Suppsquared Generated Pack, loadmyresources.hiddenpack (incompatible), spoornpacks, aged, aged_welcome_screen, create-the-server_datapack-v0.2, WWOO_2.3.1 (incompatible)     Enabled Feature Flags: minecraft:vanilla     World Generation: Stable     Type: Integrated Server (map_client.txt)     Is Modded: Definitely; Client brand changed to 'fabric'; Server brand changed to 'fabric'     Launched Version: 1.20.1
    • Use the public BlockEntityType constructor.
    • Use a Custom Launcher like Technic Launcher and search for a "Clean Forge 1.12.2" modpack and use this as working base
    • I've recently tried to play Minecraft in 1.12 version to use some old mods, but every time I try to start the game, no matter which version of Forge for Minecraft 1.12 I choose to download, the Launcher gives me the following error message: Failed to download file. Name: 1.12-forge1.12-14.21.1.2443.jar URL: https://s3.amazonaws.com/Minecraft.Download/versions/1.12- forge1.12-14.21.1.2443/1.12-forge1.12-14.21.1.2443.jar Filename on disk: 1.12-forge1.12-14.21.1.2443.jar Path: C:\Users\Diego\AppData\Roaming\.minecraft\versions\1.12- forge1.12-14.21.1.2443\1.12-forge1.12-14.21.1.2443.jar Exists: Nonexistent I don't know how to fix it.
  • Topics

×
×
  • Create New...

Important Information

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