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. 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++;
}
}
}
}
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. 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!
Ok, found it. Hopefully the order is acceptable -