Jump to content

Recommended Posts

Posted

I made a pedestal, you right click items on and off of it, or shift right click to open the gui. most of it works fine except when you right click an item off the pedestal it still renders there until you log out or open the gui. I am at a loss as to what to do.

 

Pedestal Block Code

Pedestal TE Code

Pedestal TESR

You need to sync the inventory using markDirty() meaning call markDirty() after removing/adding the item.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

public void setStack(ItemStack stack) 
{
        this.stack = stack;
        this.markDirty();
        if (worldObj != null)
        {
            IBlockState state = worldObj.getBlockState(getPos());
            worldObj.notifyBlockUpdate(getPos(), state, state, 3);
        }    
    }

 

Is it suppose to be somewhere else? because it doesn't work. -_-

Posted

public void setStack(ItemStack stack) 
{
        this.stack = stack;
        this.markDirty();
        if (worldObj != null)
        {
            IBlockState state = worldObj.getBlockState(getPos());
            worldObj.notifyBlockUpdate(getPos(), state, state, 3);
        }    
    }

 

Is it suppose to be somewhere else? because it doesn't work. -_-

Did you override getUpdatePacket(...) and handleUpdatePacket(...) or something like that.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Is this what you mean?

    @Override
    public SPacketUpdateTileEntity getUpdatePacket()
    {
        NBTTagCompound nbtTag = new NBTTagCompound();
        this.writeToNBT(nbtTag);
        return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
    }

    @Override
    public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
    {
        this.readFromNBT(packet.getNbtCompound());
    }

Posted

I've been trying to figure this out for a while, the proper way of calling a TileEntity sync. I knew how to do it back in 1.8 by calling markBlockForUpdate(BlockPos) and markDirty() which would immediately trigger a call to getDescriptionPacket(). After removal of the first function I don't know how to do it any more as calling markDirty() alone doesn't seem to do anything or am I missing something... Does anyone know how we're suppose to do it in 1.10?

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

Posted

I've been trying to figure this out for a while, the proper way of calling a TileEntity sync. I knew how to do it back in 1.8 by calling markBlockForUpdate(BlockPos) and markDirty() which would immediately trigger a call to getDescriptionPacket(). After removal of the first function I don't know how to do it any more as calling markDirty() alone doesn't seem to do anything or am I missing something... Does anyone know how we're suppose to do it in 1.10?

 

Call

World#notifyBlockUpdate

on the server to send the

TileEntity

's update packet and re-render the chunk containing it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Call

World#notifyBlockUpdate

on the server to send the

TileEntity

's update packet and re-render the chunk containing it.

 

Do I actually need to provide two different BlockStates? I would like to call an instant entity sync without actually changing the BlockState. And what about the flags, any idea what I should enter there?

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

Posted

Do I actually need to provide two different BlockStates? I would like to call an instant entity sync without actually changing the BlockState.

 

No, the two

IBlockState

arguments can be (and usually are) the same.

 

 

And what about the flags, any idea what I should enter there?

 

The flags are completely ignored by

ServerWorldEventHandler

(the server-side

IWorldEventListener

instance).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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



×
×
  • Create New...

Important Information

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