Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

 

  • Author

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

Or should I create my own message for this using SimpleImpl?

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.