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

    • I am trying to make an attack animation works for this entity, I have followed tutorials on youtube, looked into Geckolib's documentation but I can't find why it isn't working. The walking animation works, the mob recognizes the player and attack them. The model and animations were made in Blockbench.   public class RedSlimeEntity extends TensuraTamableEntity implements IAnimatable { private final AnimationFactory factory = GeckoLibUtil.createFactory(this); private boolean swinging; private long lastAttackTime; public RedSlimeEntity(EntityType<? extends RedSlimeEntity> type, Level worldIn) { super(type, worldIn); this.xpReward = 20; } public static AttributeSupplier.Builder createAttributes() { AttributeSupplier.Builder builder = Mob.createMobAttributes(); builder = builder.add(Attributes.MOVEMENT_SPEED, 0.1); builder = builder.add(Attributes.MAX_HEALTH, 50); builder = builder.add(Attributes.ARMOR, 0); builder = builder.add(Attributes.ATTACK_DAMAGE, 25); builder = builder.add(Attributes.FOLLOW_RANGE, 16); return builder; } public static void init() { } @Override protected void registerGoals() { this.goalSelector.addGoal(3, new FloatGoal(this)); this.goalSelector.addGoal(1, new RedSlimeAttackGoal(this, 1.2D, false)); this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.0D)); this.goalSelector.addGoal(5, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(2, new RedSlimeAttackGoal.StopNearPlayerGoal(this, 1)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); } private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) { if (event.isMoving()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.model.walk", true)); return PlayState.CONTINUE; } event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.model.idle", true)); return PlayState.CONTINUE; } private <E extends IAnimatable> PlayState attackPredicate(AnimationEvent<E> event) { if (this.swinging && event.getController().getAnimationState() == AnimationState.Stopped) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.model.attack", false)); this.swinging = false; return PlayState.CONTINUE; } return PlayState.STOP; } @Override public void swing(InteractionHand hand, boolean updateSelf) { super.swing(hand, updateSelf); this.swinging = true; } @Override public void registerControllers(AnimationData data) { data.addAnimationController(new AnimationController<>(this, "controller", 0, this::predicate)); data.addAnimationController(new AnimationController<>(this, "attackController", 0, this::attackPredicate)); } @Override public AnimationFactory getFactory() { return factory; } class RedSlimeAttackGoal extends MeleeAttackGoal { private final RedSlimeEntity entity; public RedSlimeAttackGoal(RedSlimeEntity entity, double speedModifier, boolean longMemory) { super(entity, speedModifier, longMemory); this.entity = entity; if (this.mob.getTarget() != null && this.mob.getTarget().isAlive()) { long currentTime = this.entity.level.getGameTime(); if (!this.entity.swinging && currentTime - this.entity.lastAttackTime > 20) { // 20 ticks = 1 second this.entity.swinging = true; this.entity.lastAttackTime = currentTime; } } } protected double getAttackReach(LivingEntity target) { return this.mob.getBbWidth() * 2.0F * this.mob.getBbWidth() * 2.0F + target.getBbWidth(); } @Override protected void checkAndPerformAttack(LivingEntity target, double distToEnt) { double reach = this.getAttackReach(target); if (distToEnt <= reach && this.getTicksUntilNextAttack() <= 0) { this.resetAttackCooldown(); this.entity.swinging = true; this.mob.doHurtTarget(target); } } public static class StopNearPlayerGoal extends Goal { private final Mob mob; private final double stopDistance; public StopNearPlayerGoal(Mob mob, double stopDistance) { this.mob = mob; this.stopDistance = stopDistance; } @Override public boolean canUse() { Player nearestPlayer = this.mob.level.getNearestPlayer(this.mob, stopDistance); if (nearestPlayer != null) { double distanceSquared = this.mob.distanceToSqr(nearestPlayer); return distanceSquared < (stopDistance * stopDistance); } return false; } @Override public void tick() { // Stop movement this.mob.getNavigation().stop(); } @Override public boolean canContinueToUse() { Player nearestPlayer = this.mob.level.getNearestPlayer(this.mob, stopDistance); if (nearestPlayer != null) { double distanceSquared = this.mob.distanceToSqr(nearestPlayer); return distanceSquared < (stopDistance * stopDistance); } return false; } } @Override public void tick() { super.tick(); if (this.mob.getTarget() != null && this.mob.getTarget().isAlive()) { if (!this.entity.swinging) { this.entity.swinging = true; } } } } @Override public @Nullable AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) { return null; } @Override public int getRemainingPersistentAngerTime() { return 0; } @Override public void setRemainingPersistentAngerTime(int i) { } @Override public @Nullable UUID getPersistentAngerTarget() { return null; } @Override public void setPersistentAngerTarget(@Nullable UUID uuid) { } @Override public void startPersistentAngerTimer() { } protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(SoundEvents.SLIME_SQUISH, 0.15F, 1.0F); } protected SoundEvent getAmbientSound() { return SoundEvents.SLIME_SQUISH; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.SLIME_HURT; } protected SoundEvent getDeathSound() { return SoundEvents.SLIME_DEATH; } protected float getSoundVolume() { return 0.2F; } }  
    • CAN ANYBODY HELP ME? JVM info: Oracle Corporation - 1.8.0_431 - 25.431-b10 java.net.preferIPv4Stack=true Current Time: 15/01/2025 17:45:17 Host: files.minecraftforge.net [104.21.58.163, 172.67.161.211] Host: maven.minecraftforge.net [172.67.161.211, 104.21.58.163] Host: libraries.minecraft.net [127.0.0.1] Host: launchermeta.mojang.com [127.0.0.1] Host: piston-meta.mojang.com [127.0.0.1] Host: sessionserver.mojang.com [127.0.0.1] Host: authserver.mojang.com [Unknown] Error checking https://launchermeta.mojang.com/: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Data kindly mirrored by CreeperHost at https://www.creeperhost.net/ Considering minecraft server jar Downloading libraries Found 1 additional library directories Considering library cpw.mods:securejarhandler:2.1.10   Downloading library from https://maven.creeperhost.net/cpw/mods/securejarhandler/2.1.10/securejarhandler-2.1.10.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm:9.7.1   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm/9.7.1/asm-9.7.1.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-commons:9.7.1   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-commons/9.7.1/asm-commons-9.7.1.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-tree:9.7.1   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-tree/9.7.1/asm-tree-9.7.1.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-util:9.7.1   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-util/9.7.1/asm-util-9.7.1.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-analysis:9.7.1   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-analysis/9.7.1/asm-analysis-9.7.1.jar     Download completed: Checksum validated. Considering library net.minecraftforge:accesstransformers:8.0.4   Downloading library from https://maven.creeperhost.net/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar     Download completed: Checksum validated. Considering library org.antlr:antlr4-runtime:4.9.1   Downloading library from https://maven.creeperhost.net/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar     Download completed: Checksum validated. Considering library net.minecraftforge:eventbus:6.0.5   Downloading library from https://maven.creeperhost.net/net/minecraftforge/eventbus/6.0.5/eventbus-6.0.5.jar     Download completed: Checksum validated. Considering library net.minecraftforge:forgespi:7.0.1   Downloading library from https://maven.creeperhost.net/net/minecraftforge/forgespi/7.0.1/forgespi-7.0.1.jar     Download completed: Checksum validated. Considering library net.minecraftforge:coremods:5.2.1   Downloading library from https://maven.creeperhost.net/net/minecraftforge/coremods/5.2.1/coremods-5.2.1.jar     Download completed: Checksum validated. Considering library cpw.mods:modlauncher:10.0.9   Downloading library from https://maven.creeperhost.net/cpw/mods/modlauncher/10.0.9/modlauncher-10.0.9.jar     Download completed: Checksum validated. Considering library net.minecraftforge:unsafe:0.2.0   Downloading library from https://maven.creeperhost.net/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar     Download completed: Checksum validated. Considering library net.minecraftforge:mergetool:1.1.5:api   Downloading library from https://maven.creeperhost.net/net/minecraftforge/mergetool/1.1.5/mergetool-1.1.5-api.jar     Download completed: Checksum validated. Considering library com.electronwill.night-config:core:3.6.4   Downloading library from https://maven.creeperhost.net/com/electronwill/night-config/core/3.6.4/core-3.6.4.jar     Download completed: Checksum validated. Considering library com.electronwill.night-config:toml:3.6.4   Downloading library from https://maven.creeperhost.net/com/electronwill/night-config/toml/3.6.4/toml-3.6.4.jar     Download completed: Checksum validated. Considering library org.apache.maven:maven-artifact:3.8.5   Downloading library from https://maven.creeperhost.net/org/apache/maven/maven-artifact/3.8.5/maven-artifact-3.8.5.jar     Download completed: Checksum validated. Considering library net.jodah:typetools:0.6.3   Downloading library from https://maven.creeperhost.net/net/jodah/typetools/0.6.3/typetools-0.6.3.jar     Download completed: Checksum validated. Considering library net.minecrell:terminalconsoleappender:1.2.0   Downloading library from https://maven.creeperhost.net/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar     Download completed: Checksum validated. Considering library org.jline:jline-reader:3.12.1   Downloading library from https://maven.creeperhost.net/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar     Download completed: Checksum validated. Considering library org.jline:jline-terminal:3.12.1   Downloading library from https://maven.creeperhost.net/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar     Download completed: Checksum validated. Considering library org.spongepowered:mixin:0.8.5   Downloading library from https://maven.creeperhost.net/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar     Download completed: Checksum validated. Considering library org.openjdk.nashorn:nashorn-core:15.4   Downloading library from https://maven.creeperhost.net/org/openjdk/nashorn/nashorn-core/15.4/nashorn-core-15.4.jar     Download completed: Checksum validated. Considering library net.minecraftforge:JarJarSelector:0.3.19   Downloading library from https://maven.creeperhost.net/net/minecraftforge/JarJarSelector/0.3.19/JarJarSelector-0.3.19.jar     Download completed: Checksum validated. Considering library net.minecraftforge:JarJarMetadata:0.3.19   Downloading library from https://maven.creeperhost.net/net/minecraftforge/JarJarMetadata/0.3.19/JarJarMetadata-0.3.19.jar     Download completed: Checksum validated. Considering library cpw.mods:bootstraplauncher:1.1.2   Downloading library from https://maven.creeperhost.net/cpw/mods/bootstraplauncher/1.1.2/bootstraplauncher-1.1.2.jar     Download completed: Checksum validated. Considering library net.minecraftforge:JarJarFileSystems:0.3.19   Downloading library from https://maven.creeperhost.net/net/minecraftforge/JarJarFileSystems/0.3.19/JarJarFileSystems-0.3.19.jar     Download completed: Checksum validated. Considering library net.minecraftforge:fmlloader:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/fmlloader/1.20.1-47.3.12/fmlloader-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library net.minecraftforge:fmlearlydisplay:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/fmlearlydisplay/1.20.1-47.3.12/fmlearlydisplay-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library com.github.jponge:lzma-java:1.3   Downloading library from https://maven.creeperhost.net/com/github/jponge/lzma-java/1.3/lzma-java-1.3.jar     Download completed: Checksum validated. Considering library com.google.code.findbugs:jsr305:3.0.2   Downloading library from https://libraries.minecraft.net/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar Failed to establish connection to https://libraries.minecraft.net/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar  Host: libraries.minecraft.net [127.0.0.1] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.ssl.Alert.createSSLException(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(Unknown Source)     at sun.security.ssl.SSLHandshake.consume(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.TransportContext.dispatch(Unknown Source)     at sun.security.ssl.SSLTransport.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)     at java.net.HttpURLConnection.getResponseCode(Unknown Source)     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:240)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:174)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:164)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:149)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:73)     at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:72)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:271)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:182)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.validator.PKIXValidator.doBuild(Unknown Source)     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)     at sun.security.validator.Validator.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)     ... 27 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)     at java.security.cert.CertPathBuilder.build(Unknown Source)     ... 33 more Considering library com.google.code.gson:gson:2.10.1   Downloading library from https://libraries.minecraft.net/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar Failed to establish connection to https://libraries.minecraft.net/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar  Host: libraries.minecraft.net [127.0.0.1] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.ssl.Alert.createSSLException(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(Unknown Source)     at sun.security.ssl.SSLHandshake.consume(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.TransportContext.dispatch(Unknown Source)     at sun.security.ssl.SSLTransport.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)     at java.net.HttpURLConnection.getResponseCode(Unknown Source)     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:240)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:174)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:164)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:149)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:73)     at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:72)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:271)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:182)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.validator.PKIXValidator.doBuild(Unknown Source)     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)     at sun.security.validator.Validator.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)     ... 27 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)     at java.security.cert.CertPathBuilder.build(Unknown Source)     ... 33 more Considering library com.google.errorprone:error_prone_annotations:2.1.3   Downloading library from https://maven.creeperhost.net/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar     Download completed: Checksum validated. Considering library com.google.guava:guava:25.1-jre   Downloading library from https://maven.creeperhost.net/com/google/guava/guava/25.1-jre/guava-25.1-jre.jar     Download completed: Checksum validated. Considering library com.google.j2objc:j2objc-annotations:1.1   Downloading library from https://maven.creeperhost.net/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar     Download completed: Checksum validated. Considering library com.nothome:javaxdelta:2.0.1   Downloading library from https://maven.creeperhost.net/com/nothome/javaxdelta/2.0.1/javaxdelta-2.0.1.jar     Download completed: Checksum validated. Considering library commons-io:commons-io:2.4   Downloading library from https://libraries.minecraft.net/commons-io/commons-io/2.4/commons-io-2.4.jar Failed to establish connection to https://libraries.minecraft.net/commons-io/commons-io/2.4/commons-io-2.4.jar  Host: libraries.minecraft.net [127.0.0.1] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.ssl.Alert.createSSLException(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(Unknown Source)     at sun.security.ssl.SSLHandshake.consume(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.TransportContext.dispatch(Unknown Source)     at sun.security.ssl.SSLTransport.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)     at java.net.HttpURLConnection.getResponseCode(Unknown Source)     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:240)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:174)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:164)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:149)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:73)     at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:72)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:271)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:182)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.validator.PKIXValidator.doBuild(Unknown Source)     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)     at sun.security.validator.Validator.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)     ... 27 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)     at java.security.cert.CertPathBuilder.build(Unknown Source)     ... 33 more Considering library de.oceanlabs.mcp:mcp_config:1.20.1-20230612.114412@zip   Downloading library from https://maven.creeperhost.net/de/oceanlabs/mcp/mcp_config/1.20.1-20230612.114412/mcp_config-1.20.1-20230612.114412.zip     Download completed: Checksum validated. Considering library de.siegmar:fastcsv:2.2.2   Downloading library from https://maven.creeperhost.net/de/siegmar/fastcsv/2.2.2/fastcsv-2.2.2.jar     Download completed: Checksum validated. Considering library net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all   Downloading library from https://maven.creeperhost.net/net/minecraftforge/ForgeAutoRenamingTool/0.1.22/ForgeAutoRenamingTool-0.1.22-all.jar     Download completed: Checksum validated. Considering library net.minecraftforge:binarypatcher:1.1.1   Downloading library from https://maven.creeperhost.net/net/minecraftforge/binarypatcher/1.1.1/binarypatcher-1.1.1.jar     Download completed: Checksum validated. Considering library net.minecraftforge:fmlcore:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/fmlcore/1.20.1-47.3.12/fmlcore-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library net.minecraftforge:fmlearlydisplay:1.20.1-47.3.12   File exists: Checksum validated. Considering library net.minecraftforge:fmlloader:1.20.1-47.3.12   File exists: Checksum validated. Considering library net.minecraftforge:forge:1.20.1-47.3.12:universal   Downloading library from https://maven.creeperhost.net/net/minecraftforge/forge/1.20.1-47.3.12/forge-1.20.1-47.3.12-universal.jar     Download completed: Checksum validated. Considering library net.minecraftforge:installertools:1.4.1   Downloading library from https://maven.creeperhost.net/net/minecraftforge/installertools/1.4.1/installertools-1.4.1.jar     Download completed: Checksum validated. Considering library net.minecraftforge:jarsplitter:1.1.4   Downloading library from https://maven.creeperhost.net/net/minecraftforge/jarsplitter/1.1.4/jarsplitter-1.1.4.jar     Download completed: Checksum validated. Considering library net.minecraftforge:javafmllanguage:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/javafmllanguage/1.20.1-47.3.12/javafmllanguage-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library net.minecraftforge:lowcodelanguage:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/lowcodelanguage/1.20.1-47.3.12/lowcodelanguage-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library net.minecraftforge:mclanguage:1.20.1-47.3.12   Downloading library from https://maven.creeperhost.net/net/minecraftforge/mclanguage/1.20.1-47.3.12/mclanguage-1.20.1-47.3.12.jar     Download completed: Checksum validated. Considering library net.minecraftforge:srgutils:0.4.3   Downloading library from https://maven.creeperhost.net/net/minecraftforge/srgutils/0.4.3/srgutils-0.4.3.jar     Download completed: Checksum validated. Considering library net.minecraftforge:srgutils:0.4.9   Downloading library from https://maven.creeperhost.net/net/minecraftforge/srgutils/0.4.9/srgutils-0.4.9.jar     Download completed: Checksum validated. Considering library net.minecraftforge:srgutils:0.5.6   Downloading library from https://maven.creeperhost.net/net/minecraftforge/srgutils/0.5.6/srgutils-0.5.6.jar     Download completed: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:5.0.4   Downloading library from https://libraries.minecraft.net/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar Failed to establish connection to https://libraries.minecraft.net/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar  Host: libraries.minecraft.net [127.0.0.1] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.ssl.Alert.createSSLException(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.TransportContext.fatal(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(Unknown Source)     at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(Unknown Source)     at sun.security.ssl.SSLHandshake.consume(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.HandshakeContext.dispatch(Unknown Source)     at sun.security.ssl.TransportContext.dispatch(Unknown Source)     at sun.security.ssl.SSLTransport.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.decode(Unknown Source)     at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)     at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)     at java.net.HttpURLConnection.getResponseCode(Unknown Source)     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:240)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:174)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:164)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:149)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:73)     at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:72)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:271)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:182)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.validator.PKIXValidator.doBuild(Unknown Source)     at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)     at sun.security.validator.Validator.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)     at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)     ... 27 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target     at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)     at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)     at java.security.cert.CertPathBuilder.build(Unknown Source)     ... 33 more Considering library net.sf.jopt-simple:jopt-simple:6.0-alpha-3   Downloading library from https://maven.creeperhost.net/net/sf/jopt-simple/jopt-simple/6.0-alpha-3/jopt-simple-6.0-alpha-3.jar     Download completed: Checksum validated. Considering library org.checkerframework:checker-qual:2.0.0   Downloading library from https://maven.creeperhost.net/org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar     Download completed: Checksum validated. Considering library org.codehaus.mojo:animal-sniffer-annotations:1.14   Downloading library from https://maven.creeperhost.net/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-analysis:9.2   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-analysis/9.2/asm-analysis-9.2.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-commons:9.2   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-commons/9.2/asm-commons-9.2.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-commons:9.6   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-commons/9.6/asm-commons-9.6.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-tree:9.2   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-tree/9.2/asm-tree-9.2.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm-tree:9.6   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm-tree/9.6/asm-tree-9.6.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm:9.2   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm/9.2/asm-9.2.jar     Download completed: Checksum validated. Considering library org.ow2.asm:asm:9.6   Downloading library from https://maven.creeperhost.net/org/ow2/asm/asm/9.6/asm-9.6.jar     Download completed: Checksum validated. Considering library trove:trove:1.0.2   Downloading library from https://maven.creeperhost.net/trove/trove/1.0.2/trove-1.0.2.jar     Download completed: Checksum validated. These libraries failed to download. Try again. com.google.code.findbugs:jsr305:3.0.2 com.google.code.gson:gson:2.10.1 commons-io:commons-io:2.4 net.sf.jopt-simple:jopt-simple:5.0.4 There was an error during installation  
    • Maybe some kind of bug with Pixelmon - something with Raids   Report it to the Creators
    • Did you make changes at the paper-global.yml file?   If not, delete this file and restart the server
    • My friends and I are playing a modified version of BMC4 and we're noticing stuff like passive mobs. (I think) like creatures/animals from Alex mobs, naturalist, let's do nature and even vanilla MC (sheep, cow, pigs, chickens, horses, donkeys) don't really spawn in, unlike the sea creatures and hostile monsters spawn in just fine and normal numbers. Here is a mod list from a crash report: https://pastebin.ubuntu.com/p/K9vJxxx6n4/ Just a quick copy and paste of the mod list from an unrelated crash report If anything please let me know if I should post pics of the mods from my mods folder I want to know how to increase their spawn rate/amount and if there are any mods that are causing the scarce appearances of these mobs
  • Topics

×
×
  • Create New...

Important Information

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