MC Modding
Please register and join the community!

[unanswered] making new materials and tools

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

[unanswered] making new materials and tools

Post by ikke009 on 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
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by lcass on 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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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)
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by lcass on 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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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.
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

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

any succes?
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

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

nope xD... I'll keep trying though

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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.
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by ikke009 on 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...
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

Post by jesshankin22 on 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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

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

ok Putting up a tutorial now

lcass
Member

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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [unanswered] making new materials and tools

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

haha this guy^ Man you're awesome!

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

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

Very Happy

lcass
Member

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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [unanswered] making new materials and tools

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

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

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

View user profile

Back to top Go down

Re: [unanswered] making new materials and tools

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

What did you use for it

lcass
Member

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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

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

View previous topic View next topic Back to top


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