Jump to content

Help with 3x3x3 Pickaxe


Recommended Posts

I am making a mod and for my pickaxe i would like it to mine a 3x3x3 if you have any ideas or you know the code please help! Here is my current code:

[embed=425,349]package com.idtech.item;

 

import com.idtech.BaseMod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityLiving;

import net.minecraft.item.ItemPickaxe;

import net.minecraft.item.ItemStack;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

 

public class ItemGelPickaxe extends ItemPickaxe {

 

      public static final String name = "GelPickaxe";

   

         

   

     

    protected ItemGelPickaxe() {

        super(ItemMod.toolMaterialGel);

        // TODO Auto-generated constructor stub

        setUnlocalizedName(BaseMod.MODID + "_" + name);

        this.setCreativeTab(CreativeTabs.tabTools);

    }

 

 

 

     

     

    }

 

 

 

    [/embed]

 

Thanks,

Charles (Java Town Owner)

Link to comment
Share on other sites

Damn, forum names should have length cap. Also - no need for titles (I know, I know, publicity).

 

Back to problem at hand:

1. What version?

2. What kind of 3x3x3 destruction are we looking at?

* Block can be destroyed from side (side of hit) and from rotation (relative rotation of player-block). So e.g you can very well be under block, but hit it from west side.

 

"Facing" destruction is as simple as getting block and destroying all 3x3x3 behind/around it (other side of face being hit).

Pros: easy AF.

Cons: Box-destruction (kinda fakeish)

 

"Rotation" destruction will require ray tracing to know at what rotation block has been hit and using some math to pawn blocks in given direction.

Pros: You can make destruction like this: (P = player, O = block)

P

OOO

  OOO

    OOO

Cons: Quite hard if you know nothing about java/math and especially minecraft.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Override Item#onBlockDestroyed and also destroy blocks around.

 

As to directions - I think I saw better approach, but if you won't find it:

In your Item#onBlockDestroyed use World#rayTraceBlocks to get block and face you pawned, then, as said before - destroy blocks behind it.

Big note - all is pure theory so idk if at the moment of block #onBlockDestroyed, the Block is still in world - if not, the rayTrace will return block behind it. You could probably use other methods to do ray tracing, but then you would proabably save result in e.g @Capability (something like "last block digged").

 

Does it mean you can place cobble near obsidian wall and destroy 3x3 obsidian by pawning cobble?

So yeah - you also can use plenty other methods to slow down digging speed based on surrounding blocks, but that will require hella lot more of knowledge.

 

Everything is quite advanced (tho there  might be better ways).

If you want to learn - look into source and callbacks and actually spend few hours READING code.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

What help are you expecting? There are (probably) no tutorials on this. This is pretty advanced stuff if you want to make it properly and WILL require reading actual source code. If you know nothing about how internals work, even if we would write step by step actions, you wouldn't be able to apply them.

 

I told you where to look (but note that there might be other ideas), if you have questions - ask directly where you need help.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I Can't find the code any where i am trying to see if any one know it do you?

 

He gave you the outline of what you have to do, now you as the developer have to actually implement it in code.

 

There is no way around that.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

If you're doing a simple 3x3x3 cube around the block being broken, you can do that with a dirt-cheap 3-layer for-loop.  One for x, -1 to 1, one for y, -1 to 1, and one for z, -1 to 1.

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.

Link to comment
Share on other sites

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.