Jump to content

[1.10.2] TE rendering update


Janellope

Recommended Posts

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.

Link to comment
Share on other sites

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. -_-

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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());
    }

Link to comment
Share on other sites

Hi

 

I don't see an obvious problem; have you tried placing breakpoints in your getUpdatePacket() to see if it's being called properly

 

You could try comparing your code to this example project

https://github.com/TheGreyGhost/MinecraftByExample

 

MBE30 and MBE31 are two working examples which sound similar to what you're doing.

 

-TGG

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

    • Hi I have an issue with a server it solved deleting the ice and fire but my friends and me really want to use it does any of these mods are causing the issue due to incompatibility  Security craft Aquaculture Architectury Artifacts Astikorcarts Baubles BetterCaves yungs BetterStrongholds yungs BetterMineshafts yungs Bountiful Byg  Callablehorses Carry on Chococraft Citadel Clumps Collective Comforts Corailrecycler Craftable horse armor Comes alive Curios forge Decocraft Dungeonsarise  Open blocks elevator Expandability Farlanders Goblin traders Hwyla  Ice and fire Infernal expansion Jei Jump over fences Mantle  Macaws bridges Macaws doors Macaws fences Macaws furniture  Macaws fencesbyg Morpheus Mouse tweaks Mowzies mobs Obfuscate Paraglider Patchouli  Pick up notifier Random village names Spartan shields Small ships Sophisticated backpacks Spartan weaponry Storage drawers straw golem Structure gel Twilight forest  Tinkers construct Two players one horse  Valhesia core  Valhesia structures  Way stones  Vehicle mod  Wall jump Wings Wolves with armor Xptome  Xaeros minimap  Yungsapi  
    • { "type": "magic_overhaul:rune_inscribing", "base": { "item": "//base item" }, "template": { "item": "//template item" }, "output": { "count": 1, "item": "//output item" } } ^ Ok, where is your recipe JSON placed in your file structure? What's it called? And paste the actual JSON you're testing with, because it needs to be valid.
    • I'm trying to run Forge 1.12.2 on Minecraft  so I can use certain mods, but this error popped up. I've seen multiple errors but I just can't figure this one out. Unable to locate the Java runtime. Error details: 0x00000000 - system: The operation completed successfully. Filename on disk:  Path: . Exists: Directory
    • https://mclo.gs/b422RFc
    • Плагин и Приват
  • Topics

×
×
  • Create New...

Important Information

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