Jump to content

Recommended Posts

Posted

Hello there,

 

So I'm syncing my capability between the server and client, however, when I try to extract mana, I get this error:

Dec 12, 2016 9:10:01 PM io.netty.channel.embedded.EmbeddedChannel recordException
WARNING: More than one exception was raised. Will report only the first one and log others.
java.lang.RuntimeException: PLAYER target expects a Player arg
at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125)
at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112)
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741)
0
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895)
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240)
at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254)
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractMana(CapabilityManaData.java:85)
8520
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:43)
[21:10:01] [server thread/ERROR]: FMLIndexedMessageCodec exception caught
at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41)
java.lang.RuntimeException: PLAYER target expects a Player arg
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193)
at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) ~[FMLOutboundHandler$OutboundTarget$4.class:?]
at net.minecraft.world.World.updateEntities(World.java:1968)
at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) ~[FMLOutboundHandler.class:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) ~[MessageToMessageEncoder.class:4.0.23.Final]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547)
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final]
at java.lang.Thread.run(Thread.java:745)

at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[AbstractChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) [simpleNetworkWrapper.class:?]
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractMana(CapabilityManaData.java:85) [CapabilityManaData.class:?]
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:43) [CapabilityManaData.class:?]
at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) [TileEntityChargeStand.class:?]
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) [TileEntityBase.class:?]
at net.minecraft.world.World.updateEntities(World.java:1968) [World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
[21:10:01] [server thread/ERROR]: FMLIndexedMessageCodec exception caught
java.lang.RuntimeException: PLAYER target expects a Player arg
at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) ~[FMLOutboundHandler$OutboundTarget$4.class:?]
at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) ~[FMLOutboundHandler.class:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) ~[MessageToMessageEncoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[AbstractChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) [simpleNetworkWrapper.class:?]
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:44) [CapabilityManaData.class:?]
at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) [TileEntityChargeStand.class:?]
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) [TileEntityBase.class:?]
at net.minecraft.world.World.updateEntities(World.java:1968) [World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
Dec 12, 2016 9:10:01 PM io.netty.channel.embedded.EmbeddedChannel recordException
WARNING: More than one exception was raised. Will report only the first one and log others.
java.lang.RuntimeException: PLAYER target expects a Player arg
at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125)
at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112)
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741)
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895)
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240)
at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254)
at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:44)
at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41)
at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193)
at net.minecraft.world.World.updateEntities(World.java:1968)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547)
at java.lang.Thread.run(Thread.java:745)

 

I needed to send a packet everytime that it is changed, so in my capability data, I have these:

 

        PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity());

In every function that is changing the current mana.

This is where the error occurs however, here is the entire class for reference:

public class CapabilityManaData extends ManaHandler
{
    private EntityLivingBase entity;

    public CapabilityManaData(){
        super(500000);
    }

    public CapabilityManaData(int capacity, int maxReceive, int maxExtract){
        super(capacity, maxReceive, maxExtract);
    }

    public EntityLivingBase getEntity()
    {
        return entity;
    }

    public void setEntity(EntityLivingBase entity)
    {
        this.entity = entity;
    }

    public int extractManaInternal(int maxExtract, boolean simulate){
        int before = this.maxExtract;
        this.maxExtract = Integer.MAX_VALUE;

        int toReturn = this.extractMana(maxExtract, simulate);
        PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity());
        this.maxExtract = before;
        return toReturn;
    }

    public int receiveManaInternal(int maxReceive, boolean simulate){
        int before = this.maxReceive;
        this.maxReceive = Integer.MAX_VALUE;

        int toReturn = this.receiveMana(maxReceive, simulate);
        PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity());
        this.maxReceive = before;
        return toReturn;
    }

    @Override
    public int receiveMana(int maxReceive, boolean simulate){
        if(!this.canReceive()){
            return 0;
        }
        int mana = this.getManaStored();

        int manaReceived = Math.min(this.capacity-mana, Math.min(this.maxReceive, maxReceive));
        if(!simulate){
            this.setManaStored(mana+manaReceived);
        }
            PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity());
        return manaReceived;
    }

    @Override
    public int extractMana(int maxExtract, boolean simulate){
        if(!this.canExtract()){
            return 0;
        }
        int mana = this.getManaStored();

        int manaExtracted = Math.min(mana, Math.min(this.maxExtract, maxExtract));
        if(!simulate){
            this.setManaStored(mana-manaExtracted);
        }
            PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity());
           // PlentifulMisc.network.sendToServer(new ManaNetworkSyncServer(this.getManaStored()));

        return manaExtracted;
    }

    public void readFromNBT(NBTTagCompound compound){
        this.setManaStored(compound.getInteger("Mana"));
    }

    public NBTBase writeData()
    {
        NBTTagCompound tag = new NBTTagCompound();
        tag.setInteger("Mana", mana);
        return tag;
    }

    public void readData(NBTBase nbt)
    {
        NBTTagCompound tag = (NBTTagCompound) nbt;
        this.setManaStored(tag.getInteger("Mana"));
    }

    public void writeToNBT(NBTTagCompound compound){
        compound.setInteger("Mana", this.getManaStored());
    }

    public int getPercentedMana() {
        return this.getManaStored() / this.getMaxManaStored();
    }

    public void setManaStored(int energy){
        this.mana = energy;
    }
}

 

The TE thats crashing it:

public class TileEntityChargeStand extends TileEntityCrystalSearchBase {

    public final int MANA_PER_TICK = 50;

    public UUID uuid;

    public TileEntityChargeStand() {
        super("chargeStand");
    }



    @Override
    public void updateEntity() {
        super.updateEntity();
        if(!worldObj.isRemote) {
            System.out.println(storage.getManaStored());

            EntityPlayer player = worldObj.getClosestPlayer(pos.getX(), pos.getY() + 1, pos.getZ(), 1, false);
            if (player != null) {
                if (player.getUniqueID().equals(uuid) && uuid != null) {
                    if (player.hasCapability(CapabilityMagic.MANA, null)) {
                        if (storage.getManaStored() >= 0) {
                            CapabilityManaData cap = player.getCapability(CapabilityMagic.MANA, null);
                            cap.receiveManaInternal(MANA_PER_TICK, false);
                            this.storage.extractManaInternal(MANA_PER_TICK, false);
                        }
                    }
                }
            }
        }
    }


    @Override
    public void writeSyncableNBT(NBTTagCompound compound, NBTType type) {
        if(type != NBTType.SAVE_BLOCK) {
//e            compound.setUniqueId("ChargeUUID", uuid);
        }
        uuid = compound.getUniqueId("ChargeUUID");
        super.writeSyncableNBT(compound, type);
    }

    @Override
    public void readSyncableNBT(NBTTagCompound compound, NBTType type) {
        if(type != NBTType.SAVE_BLOCK) {
        }
        uuid = compound.getUniqueId("ChargeUUID");
        super.readSyncableNBT(compound, type);
    }

}

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

Posted

Sounds like when you're sending it to the client you're not supplying a correct EntityPlayerMP or none at all. Send the correct one. If you're using an event or action you should have the Entity. just check to see if it is the player, then make sure you're on the serverside, cast it to EntityPlayerMP and then use it in your packet

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

    • Ok, I updated to the latest version and now the models are visible, the problem now is that the glowing eyes are not rendered nor any texture I render there when using shaders, even using the default Minecraft eyes RenderType, I use entityTranslucent and entityCutout, but it still won't render. Something I noticed when using shaders is that a texture, instead of appearing at the world position, would appear somewhere on the screen, following a curved path, it was strange, I haven't been able to reproduce it again. I thought it could be that since I render the texture in the AFTER ENTITIES stage which is posted after the batches used for entity rendering are finished, maybe that was the reason why the render types were not being drawn correctly, so I tried injecting code before finishing the batches but it still didn't work, plus the model was invisible when using shaders, there was a bug where if I look at the model from above it is visible but if I look at it from below it is invisible. So in summary, models are now visible but glowing eyes and textures are not rendered, that hasn't changed.
    • https://pastebin.com/99FA0zvK Attempting to run genIntellijRuns, this task fails with pasted error. IntelliJ IDEA 2024.3 (Community Edition) eclipse_adoptium-21-x86_64-os_x.2/jdk-21.0.6+7 Steps followed: Step 1: Open your command-line and browse to the folder where you extracted the zip file. Step 2: You're left with a choice. If you prefer to use Eclipse: 1. Run the following command: `./gradlew genEclipseRuns` 2. Open Eclipse, Import > Existing Gradle Project > Select Folder    or run `gradlew eclipse` to generate the project. If you prefer to use IntelliJ: 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. 3. Run the following command: `./gradlew genIntellijRuns` 4. Refresh the Gradle Project in IDEA if required.
    • By the way, I don't think I made this as clear as possible. When the server would not start, I copied the world from the server and am now trying to load it in from Single Player. When I said I removed the mods, I meant I did so from the client, as the server was out of the picture, as I was loading the world locally from single player. The log I provided before was from the server, but same thing happens on Single player. I did disable all of those mods in the screenshot, and the world would not load past 14%. Adding them back i'm loading up to 80% and then nothing. This is the full startup log of trying to join it from singleplayer: https://mclo.gs/Or8U7N6 And here is the debug.log from BEFORE when I was trying on the server. https://mclo.gs/2uTQucK
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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