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

I have a mod that I am converting from 1.7.10 to 1.12.2. For the most part I have it working, but two things I am noticing that I cannot seem to figure out. One part of the mod will mine ores from the surface, and here is the code that does that. It does mine the ores, but in 1.7.10 it also would give xp orbs for the mined ores. This does not. Also I am having trouble the dropped items are disappearing after spawning. I am thinking they may be sinking into a cave?? They show up for a second and then disappear, and they are not in the payers inventory. First how do I get the xp orb's to spawn again and how do I get the drops to spawn at the players Y or even better yet get them to just be added to inventory, or even attached inventory like a backpack. Thanks!

 

for (X = start.x; X <= end.x; X++) {
                for (Z = start.z; Z <= end.z; Z++) {
                    for (Y = surface; Y > 1; Y--) {
                        BlockPos pos = new BlockPos(X, Y, Z);
                        if (world.isAirBlock(pos)) continue;
                        stateAt = world.getBlockState(pos);
                        blockAt = stateAt.getBlock();
                        if (isMiningOre(blockAt, (mode.id().equals("vanilla")))) {
                            BlockPos top = new BlockPos(X, surface, Z);
                            blockAt.harvestBlock(world, entityplayer, top, stateAt, null, ItemStack.EMPTY);
                            world.setBlockState(pos, Blocks.STONE.getDefaultState());
                            blockAt.onBlockDestroyedByPlayer(world, top, stateAt);
                            cnt++;
                        }
                    }
                }
            }

 

  • Author

Ok, finally found it. I assume the order is acceptable. -

 

for (X = start.x; X <= end.x; X++) {
                for (Z = start.z; Z <= end.z; Z++) {
                    for (Y = surface; Y > 1; Y--) {
                        BlockPos pos = new BlockPos(X, Y, Z);
                        if (world.isAirBlock(pos)) continue;
                        stateAt = world.getBlockState(pos);
                        blockAt = stateAt.getBlock();
                        if (isMiningOre(blockAt, (mode.id().equals("vanilla")))) {
                            BlockPos top = new BlockPos(X, surface, Z);
                            blockAt.harvestBlock(world, entityplayer, top, stateAt, null, ItemStack.EMPTY);
                            blockAt.dropXpOnBlockBreak(world, top,blockAt.getExpDrop(stateAt, world, pos, fortune));
                            world.setBlockState(pos, Blocks.STONE.getDefaultState());
                            blockAt.onBlockDestroyedByPlayer(world, pos, stateAt);
                            cnt++;
                        }
                    }
                }
            }

 

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.