MC Modding
Please register and join the community!


Join the forum, it's quick and easy

MC Modding
Please register and join the community!
MC Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[unanswered] making new materials and tools

3 posters

Page 1 of 2 1, 2  Next

Go down

[unanswered] making new materials and tools Empty [unanswered] making new materials and tools

Post by ikke009 Fri Oct 28, 2011 3:33 pm

So here is what i am trying to do for my mod:
I made a new block, emerald block, and i want to create a new tool, which is not a pickaxe or shovel but a new tool called a chisel. if you use the chisel on the emerald block how you would normally use a pickaxe on a coal ore, you get an emerald crystal.
So if anyone can explain to me how to do this, it will be greatly appreciated Smile
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by lcass Fri Oct 28, 2011 5:37 pm

hmmm well I will look into this and will give you the code if needs be I suggest looking the enum tool files to then declare a new tool and its affinitys I will give you the code as soon as I can

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Fri Oct 28, 2011 5:41 pm

Thanks! I just got help from Jayden on skype and he gave me this code on the Blocknamehere class
Code:

    public int idDropped(int i, Random random)
    {
       if(blockID == mod_jasper.chisel.shiftedIndex)
       {
          return mod_jasper.lapiscrystal.shiftedIndex;
       }
       else
       {
          return blockID;
       }
    }
    public int quantityDropped(Random random)
    {
            return 1;
    }
but it doesnt work :S i dislike using the RightClicked method because it is not as 'smooth' and if this bit of code would work it wouldnt be exactly what i wanted since the chisel doenst get any durability etc. (chisel is only defined in my mod_jasper as an item)
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by lcass Fri Oct 28, 2011 5:46 pm

omfg I cant post in the code sorry about this anyway if you want an efficent code that means you have the item already coded without having to make major changes to the block use the code in ItemSpade.java or Itempickaxe.java

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Fri Oct 28, 2011 6:56 pm

the code in ItemSpade.java
Code:

package net.minecraft.src;


// Referenced classes of package net.minecraft.src:
//            ItemTool, Block, EnumToolMaterial

public class ItemSpade extends ItemTool
{

    public ItemSpade(int i, EnumToolMaterial enumtoolmaterial)
    {
        super(i, 1, enumtoolmaterial, blocksEffectiveAgainst);
    }

    public boolean canHarvestBlock(Block block)
    {
        if(block == Block.snow)
        {
            return true;
        }
        return block == Block.blockSnow;
    }

    private static Block blocksEffectiveAgainst[];

    static
    {
        blocksEffectiveAgainst = (new Block[] {
            Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField
        });
    }
}

i am not sure what to do with this.. well i could change the blocksEffectiveAgainst and the part with the snow, but i need some help here xD
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Sat Oct 29, 2011 4:05 am

I think you can take the shovel, change the blocks effective against and just do yours.... but what are the exact specifications? is it you can only receive the ore from using the chisel?

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Sat Oct 29, 2011 6:45 pm

no i have a block called emeraldblock. if you mine it using a chisel you will get a emeraldcrystal (item), if you mine it with a pickaxe you will get 4 emerald(item), if you mine it with anything else you will get nothing.
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Sat Oct 29, 2011 11:01 pm

ahhhh I see... I'll try to figure something out, just to help my modding skills xD

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Sun Oct 30, 2011 5:10 pm

any succes?
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Sun Oct 30, 2011 6:24 pm

nope xD... I'll keep trying though

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Sun Oct 30, 2011 8:04 pm

Well i figured i find it too hard to do it my way.. so now i want to make it so when you right click a emerald block or lapischunk with a chisel you get a emerald crystal or lapis crystal according on which block it is.
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Sun Oct 30, 2011 8:12 pm

yeah I could probably do that by making them act as shears, basically.

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Sun Oct 30, 2011 9:39 pm

I tried to mess around with the code in ItemShears.java
but i cant figure it out xD i hope you can :S
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Sun Oct 30, 2011 11:17 pm

haha yeah same problem. i think it's actually what goes in to the block section that makes it work... I'll keep trying

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Sun Oct 30, 2011 11:52 pm

I hope youll have more success then me.. also i owe you 100 diamonds when you succeed xD
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Mon Oct 31, 2011 1:34 am

I think I'm on to something here...


Code:
    public boolean interact(EntityPlayer entityplayer)
    {
        ItemStack itemstack = entityplayer.inventory.getCurrentItem();
        if(itemstack != null && itemstack.itemID == Item.chisel.shiftedIndex && !getChiseled())
        {
                setChiseled(true);
                int i = 2 + rand.nextInt(1);

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Mon Oct 31, 2011 1:35 am

that's the section I pulled from the sheep that i thought might help

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Mon Oct 31, 2011 1:58 am

Ok I think I'm getting something. It's weird putting the code together though

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Mon Oct 31, 2011 10:35 am

This might or might not be what we need.. xD ill try to mess with it a bit in a while...
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Mon Oct 31, 2011 2:46 pm

yeah I can't get it figured out but I definitely think it has something to do with that.

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by lcass Mon Oct 31, 2011 5:46 pm

ok Putting up a tutorial now

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by jesshankin22 Tue Nov 01, 2011 1:33 am

haha this guy^ Man you're awesome!

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by lcass Tue Nov 01, 2011 1:33 am

Very Happy

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by ikke009 Wed Nov 02, 2011 10:23 pm

i got it working due to Jaydenbadboii Very Happy
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by lcass Wed Nov 02, 2011 11:47 pm

What did you use for it

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

[unanswered] making new materials and tools Empty Re: [unanswered] making new materials and tools

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum