Jump to content

Recommended Posts

Posted

good days 
this is a kind of cursed block intended to to be set in some dungeons and give lot as a chest 


The problem is it saves the items only when it feels like  the gold and the emeralds just get loss after reload the world the block entity just goes back to the last saved state data the one whit 
the carbono armor item in the chest slot 

 

i made some experiments i made a custome itemhandler whit system outs to see whats happening 

  Reveal hidden contents

 

the important part is this  here this system out must only print when a change afects the itemhandler in the server side and here i manually force the block entity to save that custom itemhandler to the Block entity nbt and then save the BlockEnt to the world 

	    // ########## ########## ########## ##########
    public void save() {
        if (this.container == null) {
            System.out.println("\n#this.container is Null at save()#\n");
        }
	        if (this.container != null) {
            Level warudo = this.container.getLevel();
            if(!warudo.isClientSide()) {
                System.out.println("\n#this.container is saving()#\n");
                CompoundTag nbt = this.container.serializeNBT();
                nbt.put("inventory", this.serializeNBT());
                this.container.load(nbt);
                warudo.setBlockEntity(this.container);
            }
            return;
        }
        //this.container.saveAdditional( this.serializeNBT() );
    }
	

 

in the console i see this every time i take or move some item from the gui

	#this.container is saving()#
	 
	#this.container is saving()#
	 
	#this.container is saving()#
	 
	#this.container is saving()#
	 
	#this.container is saving()#
	

####################################################

this means the menu is working and sending the changes to the server side but this blockentity nbt data is not getting save to the world   

warudo.setBlockEntity(this.container);

is doing nothing 

i have more block entities and those entities has the same problem i just no notice it until know  

 

my guest is

coze this happends before in 1.19 and that time whats coze i dont register the blockentities to the bus 

but this time im doing it 
 

  Reveal hidden contents

 

 

the thing is that i think this is not valid for 1.20.4 coze i get it from a 1.20.1 tutorial an probably the way of declaring it has change again 

    public static final RegistryObject<BlockEntityType<BlockEntityBodyBlock>> BLOCKENTITYMOBBLOCK =
            BLOCK_ENTITIES.register( "blockentitymobblock", () ->
                    BlockEntityType.Builder.of( BlockEntityBodyBlock::new,
                            BlockInit.DEAD_BODY.get() ).build(null)  );

 

############################################################################################

what i think i need is an example a working code gits whit block entities register soo i could fix the mines according to 1.20.4 

 

 

thanks for reading the long post 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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 can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • 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.