Jump to content

Recommended Posts

Posted

In my mod, I have an item that looks at all blocks of a specific type (tester) connected to the block (like a drawer controller from storage drawers), and calls a method on the tile entity of each tester.

The tile entity has 2 fields, an integer and a boolean. The function called uses both fields.

If I change the integer to a non-zero value, and then call the function that looks at all the testers, The value of the integer is zero.

This is the part where I gather all the tileentities (This is defined in the class extending Block):

Set<TileEntityTester> testPositions = new HashSet<>();
  Queue<BlockPos> posQueue = new LinkedList<>();
  posQueue.add(pos);
  while(posQueue.size() > 0) {
    BlockPos position = posQueue.poll();
    BlockPos[] neighbours = PosUtil.getNeighbours(position);
    for (BlockPos npos : neighbours) {
      if (worldIn.getTileEntity(npos) instanceof TileEntityTester) {
        testPositions.add((TileEntityTester) worldIn.getTileEntity(npos));
        posQueue.add(npos);
      }
    }
  }

This is the part where I change the values of the tester tileentity (Defined in the GUI):

tileEntity.expect = Integer.parseInt(text.getText());
tileEntity.markDirty();
tileEntity.errorMode = stateTriggered;
tileEntity.markDirty();

 

Posted
1 minute ago, Kantaga said:

So are there any default vanilla ways of sending this data to the server?

No, you're misunderstanding. The client is always lying. You need to do all your logic on the server and send the result to the client. NOT the other way around

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.