Jump to content

Recommended Posts

Posted

I dont want it to store any in an internal inventory/slot, i just want it to push the blocks it breaks into an adjacent inventory such as a hopper or chest directly without the need of a hopper under it other mod's transfer conduits and such

Posted

Being passive and requiring a hopper beneath it to perform the movement task would probably be simpler to code, and that paradigm (parallel to furnace and brewing stand) would make good game sense.

 

This is the better solution, you'd just have to take care not to destroy the hopper as part of your mining.  Might want to ignore the 3x3 area directly below your quarry device.

 

The only machine I've ever made that doesn't work like that was a millstone, for grinding ore, that when it got "full" (stack of 8 tiny dusts) it would drop it into the world below it, because it was intended to be built before you had regular access to iron (so spending 5 ingots would be an expensive investment) and had no GUI.  Then I had a sifter that could suck items dropped on it (like a hopper) to combine the dusts into large piles, but it didn't drop those into the world (it has a GUI).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

A suggestion i got was

"i gather drops from Block class, and put those items in internal inventory. Then quarry looks for all sides except EnumFacing.DOWN, and look for TileEntity, that implements IInventory. And the last thing is extracting from internal to those tiles using HammerCore."

 

would this be a good idea?

how would i be able to do it?

Posted

A suggestion i got was

"i gather drops from Block class, and put those items in internal inventory. Then quarry looks for all sides except EnumFacing.DOWN, and look for TileEntity, that implements IInventory. And the last thing is extracting from internal to those tiles using HammerCore."

 

would this be a good idea?

how would i be able to do it?

You shouldn't be looking for IIventory anymore instead you should be looking for an IItemHandler capability. And i do not know what "Hammer Core" is.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I don't want it to store any in an internal inventory/slot, i just want it to push the blocks it breaks into an adjacent inventory such as a hopper or chest directly without the need of a hopper under it other mod's transfer conduits and such

 

In that case, what you have there is two devices in one (excavator and hopper, without GUI to access inventory). Look at how hoppers are placed (default output DOWN, but can be attached to blocks having inventory such as chests).

 

Copy the hopper's functionality except for the GUI. Because you must contend with broken attachments, full chests etc, you'll still have an internal inventory (I recommend one slot per likely drop type), but you can hide it from the players. Mined drops won't be accessible until the machine is broken or can push them to an attached storage block.

 

PS: Make sure your excavator doesn't break any chests. As a general rule, don't break any blocks where there are tile entities. What will you do with trees/logs in the vicinity?

 

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Trees/logs will be quarried aswell.

iv been tinkering for a little bit and have gotten "some progress" accomplished, basically the blocks the quarry mines will be spawned on top of where the quarry is, and i tried a method to get it to output to nearby inventories but that didnt work

@Override
    public void update() {
        BlockPos quarrypos = getPos();
        if (y == -1) y = pos.getY() - 1;
        int chunkX, chunkZ;

        {
            Chunk c = worldObj.getChunkFromBlockCoords(pos);
            chunkX = c.xPosition;
            chunkZ = c.zPosition;
        }


        if (atTickRate(10) && storage.getEnergyStored() >= 100) {
            storage.setEnergyStored(storage.getEnergyStored() - 100);
            boolean hasBrokenBlock = false;
            start:
            for (int x = 0; x < 16; ++x)
                for (int z = 0; z < 16; ++z) {
                    BlockPos pos = new BlockPos(chunkX * 16 + x, y, chunkZ * 16 + z);
                    Block bb = worldObj.getBlockState(pos).getBlock();
                    if (!hasBrokenBlock && !worldObj.isAirBlock(pos) && FluidRegistry.lookupFluidForBlock(bb) == null && bb != Blocks.FLOWING_LAVA && bb != Blocks.FLOWING_WATER) {
                        IBlockState state = worldObj.getBlockState(pos);
                        World world;
                        Block b = state.getBlock();
                        if (b.getBlockHardness(state, worldObj, pos) < 0F) continue;

                        List<ItemStack> drops;

                        drops = new ArrayList<ItemStack>();
                        drops = state.getBlock().getDrops(getWorld(), pos, state, 0);
                        for (ItemStack drop : drops) {
                            for (EnumFacing side : EnumFacing.VALUES) {
                                BlockPos cip = pos.offset(side);
                                TileEntity ite = worldObj.getTileEntity(cip);
                                if (ite instanceof IInventory) {
                                    drop = TileEntityHopper.putStackInInventoryAllSlots(null, (IInventory) ite, drop, side.getOpposite());
                                }
                                if (drop == null) {
                                    break;
                                }
                            }
                            if (drop != null) {
                                EntityItem ent = new EntityItem(getWorld(), quarrypos.getX() + 0.5, quarrypos.getY() + 1, quarrypos.getZ() + 0.5);
                                ent.setEntityItemStack(drop);
                                getWorld().spawnEntityInWorld(ent);
                            }
                        }
                        hasBrokenBlock = true;
                        worldObj.destroyBlock(pos, false);

                        break start;
                    }
                }
            if (!hasBrokenBlock) y--;
        }
    }

Posted

Chunkx and chunkz aren't the blockpos coordinates of the chunk's 0,0 corner. You need to multiply by 16 to get those.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Chunkx and chunkz aren't the blockpos coordinates of the chunk's 0,0 corner. You need to multiply by 16 to get those.

What do u mean? i am multiplying them by 16

and the quarry works fine, the blocks it mines get spit out on top of it, but its not outputting to a chest or inventory thats touching it is what im implying

Posted

You're right, I missed that. Tablet makes it hard to see, sometimes.

 

Ahh. I found your problem. What happens at y=0 when it can't break blocks?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You're right, I missed that. Tablet makes it hard to see, sometimes.

 

Ahh. I found your problem. What happens at y=0 when it can't break blocks?

As of right now it will continuously try to mine the bedrock but not be able to

is that really the reason of it not being able to output the items to a nearby inventory?

Posted

As of right now it will continuously try to mine the bedrock but not be able to

 

And never, ever stop.  The method will never return.  It will continue trying to do something and never do so, thereby never exiting your statement as far as I can tell.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

As of right now it will continuously try to mine the bedrock but not be able to

 

And never, ever stop.  The method will never return.  It will continue trying to do something and never do so, thereby never exiting your statement as far as I can tell.

 

How would i allow it to detect when it hits y level 0 to stop

Posted

would i change my if to:

        if (atTickRate(10) && storage.getEnergyStored() >= 100 && y > 0) {

?

Does it currently just dig down one line of blocks? Or does it complete a chunk?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

You still don't have a section of code that causes you to break out of ALL the loops.  You have one that breaks an inner loop and one that resets everything.

 

Really you shouldn't make the block burrow all the way down to bedrock the moment its placed.  It should do 1 block a tick, maximum, and spend energy for each one.  Right now your code is basically set up to spend 100 energy mining an entire chunk (assuming it ever actually exists all the loops).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

It is, its using 100RF/tick not just 100RF for the entire chunk, and its breaking only one block at a time at a steady speed

 

Except that no, after mining a block you tell your code to reset:

 

hasBrokenBlock = true;
break start; //go back to the beginning and run all the loops again

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

These might be silly questions, but what will happen to players and mobs in the area of effect, especially as the ground vanishes beneath their feet and lava is exposed? How will a player get to the mined drops if blocks all around have been destroyed down to bedrock? What does your excavator do to special blocks (chests etc) in the affected volume?

 

What I am getting at is that besides us solving programming issues, we should help you avoid creating a device that's over-powered or suicidally dangerous to use (YMMV).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

These might be silly questions, but what will happen to players and mobs in the area of effect, especially as the ground vanishes beneath their feet and lava is exposed? How will a player get to the mined drops if blocks all around have been destroyed down to bedrock? What does your excavator do to special blocks (chests etc) in the affected volume?

 

What I am getting at is that besides us solving programming issues, we should help you avoid creating a device that's over-powered or suicidally dangerous to use (YMMV).

I dont fine them silly at all, and i appreciate everyone here who is trying to help me, so let me answer these questions

#1 What happens is players/mobs that are standing on the area that is being quarried will basically be following the y the quarry is at, every layer mined is another layer they fall down, if lava is exposed and a player/mob is there they will be effected by it,

#2 the quarry will only mine starting 1 y below it, so anything placed on any side besides the bottom will be safe, i find it odd that anyone would want to place a chest under the quarry anyways, and as iv seen so far, iv placed a chest and hopper below the quarry, and it has not destroyed them, this is probably as it already cleared the layer below it and has moved on to the next one not coming back for that 1 block.

Posted

What I was thinking of was if any player had started working in a cave somewhere below, building a mini-base with chests, a furnace etc. Would your device eradicate everything, or will it only break certain types of blocks? If it does break a chest, will it vacuum the dropped contents and add those items to its output?

 

For SP, these considerations don't matter much (other than protecting an output pipeline from clogging). However, in MP, this device could enable one player to seriously damage the work of another. Given its potential power, it's worth some thought to decide just how destructive you want to make it.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Here is the thing though, if say my mod was used on a multiplayer server, usually it would be 1 of 2 things, public, where they would have a claim protection plugin to protect against grief, my quarry will not affect claims, and 2, private, whitelisted servers, those types of servers would usually have all friends/people who know each other well, so if the quarry was used it would be very unlikely that someone would place it on top of anothers base, also players dont usually put quarries in the overworld since they would ruin the look of the world they usually do it in another dimension like the aroma dimension, or the one that i have created in my mod, those are the considerations i did take in mind when i was making this.

Also i fixed the quarry not outputting to the chests, if anyone wants to take a look here it is:

@Override
    public void update() {
        BlockPos quarrypos = getPos();
        if (y == -1) y = pos.getY() - 1;
        int chunkX, chunkZ;

        {
            Chunk c = worldObj.getChunkFromBlockCoords(pos);
            chunkX = c.xPosition;
            chunkZ = c.zPosition;
        }


        if (atTickRate(10) && storage.getEnergyStored() >= 100) {
            storage.setEnergyStored(storage.getEnergyStored() - 100);
            boolean hasBrokenBlock = false;
            start:
            for (int x = 0; x < 16; ++x)
                for (int z = 0; z < 16; ++z) {
                    BlockPos pos = new BlockPos(chunkX * 16 + x, y, chunkZ * 16 + z);
                    Block bb = worldObj.getBlockState(pos).getBlock();
                    if (!hasBrokenBlock && !worldObj.isAirBlock(pos) && FluidRegistry.lookupFluidForBlock(bb) == null && bb != Blocks.FLOWING_LAVA && bb != Blocks.FLOWING_WATER) {
                        IBlockState state = worldObj.getBlockState(pos);
                        World world;
                        Block b = state.getBlock();
                        if (b.getBlockHardness(state, worldObj, pos) < 0F) continue;

                        List<ItemStack> drops;

                        drops = new ArrayList<ItemStack>();
                        drops = state.getBlock().getDrops(getWorld(), pos, state, 0);
                        for (ItemStack drop : drops) {
                            for (EnumFacing side : EnumFacing.VALUES) {
                                BlockPos cip = quarrypos.offset(side);
                                TileEntity ite = worldObj.getTileEntity(cip);
                                if (ite instanceof IInventory) {
                                    drop = TileEntityHopper.putStackInInventoryAllSlots(null, (IInventory) ite, drop, side.getOpposite());
                                }
                                if (drop == null) {
                                    break;
                                }
                            }
                            if (drop != null) {
                                EntityItem ent = new EntityItem(getWorld(), quarrypos.getX() + 0.5, quarrypos.getY() + 1, quarrypos.getZ() + 0.5);
                                ent.setEntityItemStack(drop);
                                getWorld().spawnEntityInWorld(ent);
                            }
                        }
                        hasBrokenBlock = true;
                        worldObj.destroyBlock(pos, false);
                            break start;
                    }
                }
            if (!hasBrokenBlock) y--;
        }
    }

Posted

I'm glad that griefing won't be a problem.

 

Are those nested loops looking at every face of the device for each drop? It's probably not necessary to be more efficient, but if it were my method, then my old-school sensibilities would probably compel me to try anyway.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

I'm glad that griefing won't be a problem.

 

Are those nested loops looking at every face of the device for each drop? It's probably not necessary to be more efficient, but if it were my method, then my old-school sensibilities would probably compel me to try anyway.

Yeah ik i was told that i should change it and i will soon, just glad i got it working rn

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.