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.

wendrom

Members
  • Joined

  • Last visited

  1. Thank you very much! It works exactly as I need it to now. I just changed [embed=425,349]World world = Minecraft.getMinecraft().theWorld;[/embed] to [embed=425,349]World world = MinecraftServer.getServer().worldServers[0];[/embed]
  2. So I got a list of block positions that I iterate through. They are locations of chests to put random items in. [embed=425,349]public List<BlockPos> chestGeneric = new ArrayList<BlockPos>();[/embed] I use this method to go to each chest and put some items in (I'm using paper just to test). [embed=425,349] public void fillChests() { World world = Minecraft.getMinecraft().theWorld; System.out.println("Filling chests..."); Random rand = new Random(); for (Iterator<BlockPos> iter = chestGeneric.iterator(); iter.hasNext() { BlockPos position = iter.next(); TileEntityChest chest = (TileEntityChest)world.getTileEntity(position); System.out.println("> Looking for chest..."); if (chest.getBlockType() == Blocks.chest) { System.out.println(">> chest at x: " + position.getX() + " y: " + position.getY() + " z: " + position.getZ()); for (int i = 0; i < 5; i++) { System.out.println(">>> Setting slot: " + i); chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), new ItemStack(Items.paper, 5)); } world.markBlockForUpdate(position); } } System.out.println("Chests filled."); } [/embed] This runs when I do a command and the log outputs this with no errors: [embed=425,349] [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:41]: Filling chests... [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:47]: > Looking for chest... [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:50]: >> chest at x: -71 y: 87 z: 257 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 0 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 1 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 2 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 3 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 4 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:47]: > Looking for chest... [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:50]: >> chest at x: -66 y: 87 z: 257 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 0 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 1 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 2 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 3 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:53]: >>> Setting slot: 4 [17:05:01] [server thread/INFO] [sTDOUT]: [wendrom.quarry.Room:fillChests:59]: Chests filled. [/embed] But in game when I look in the chests, there are no items found and I don't know why. Any ideas?

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.