Is there a method to set the minimum tool material needed to break your ore/block? I know this can be achieved by editing ItemPickaxe, but I don't want to edit baseclasses.
I've also tried this (in the ore block file)
public int quantityDropped(Random random, Item par1item)
{
if (par1item == Item.pickaxeDiamond.shiftedIndex)
{
return 1;
} else {
return 0;
}
}
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
when you add a new custom ToolMaterial, you can define what blocks it can hervest succesfully by setting the hervestLevel for this Block.
EnumToolMaterialNamehere
package net.minecraft.src;
public enum EnumToolMaterialNamehere
{
MATERIALNAMEHERE(0, 59, 2.0F, 0, 15); //the first parameter is the harvestlevel for your ToolMaterial
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private EnumToolMaterialNamehere(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
}
Valid inputs are: diamond = 3, iron = 2, stone = 1, gold and wood = 0 If you want to use this also on your own blocks, you have to define a HarvestLevel for them.
How do I go about doing that, i.e. what file do I put that information in? Do I make a new Material file and define Material.ore or something? Sorry, I've been modding for a while but some thins stump me...
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
I found a "MoorBiome" using F3, but the Trees were the idle ones and the lakes were filled with water, not with my custom liquid. BUT the System.out.println() script is activated so the code is reached.
I'm not really sure of the issue. I am having similar problems with my own Decorator at the moment.
Is there a method to set the minimum tool material needed to break your ore/block? I know this can be achieved by editing ItemPickaxe, but I don't want to edit baseclasses.
I've also tried this (in the ore block file)
public int quantityDropped(Random random, Item par1item)
{
if (par1item == Item.pickaxeDiamond.shiftedIndex)
{
return 1;
} else {
return 0;
}
}
To no avail; I get this error:
Incompatible operand types Item and int
You can use a hook in Minecraft Forge called setHarvestLevel and that will set the harvest level of your block. But if you are only going to use Forge for this and not its other benefits, the way you're doing this is correct.
The problem is that you are using Item for a parameter. shiftedIndex is the id of the item that is kept as an int. What this means is that it is trying to convert Item to an int but that isn't possible so it throws an error.
Your new quatityDropped method won't be called anyway as you have added a parameter to it. The simple way to fix all of this is to do something like the following:
public int quantityDropped(Random random)
{
if (ModLoader.getMinecraftInstance().thePlayer.getHeldItem() == new ItemStack(Item.pickaxeDiamond))
{
return 1;
}
else
{
return 0;
}
}
I think that will work, not too sure of the new ItemStack part.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I'm not really sure of the issue. I am having similar problems with my own Decorator at the moment.
You can use a hook in Minecraft Forge called setHarvestLevel and that will set the harvest level of your block. But if you are only going to use Forge for this and not its other benefits, the way you're doing this is correct.
The problem is that you are using Item for a parameter. shiftedIndex is the id of the item that is kept as an int. What this means is that it is trying to convert Item to an int but that isn't possible so it throws an error.
Your new quatityDropped method won't be called anyway as you have added a parameter to it. The simple way to fix all of this is to do something like the following:
public int quantityDropped(Random random)
{
if (ModLoader.getMinecraftInstance().thePlayer.getHeldItem() == new ItemStack(Item.pickaxeDiamond))
{
return 1;
}
else
{
return 0;
}
}
I think that will work, not too sure of the new ItemStack part.
Thanks. I may start using Minecraft Forge soon. The only thing stopping me is I'm using modloader already.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thanks. I may start using Minecraft Forge soon. The only thing stopping me is I'm using modloader already.
Forge includes ModLoader now. FML = ForgeModLoader.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Dude, I just want to say, I love your tutorials. Now that modloader 1.3.1 is out and people will whine for updates and I just want to say, TAKE YOUR TIME! I've seen already two famous mods come out terrible for the rushing (like TMI, it quits an SSP game every time you make new chunks).
Forge includes ModLoader now. FML = ForgeModLoader.
Oh, wow. I don't mean to ask questions unrelated to your tutorials, but do I have to change my class structure i.e. change what the class extends? Like change it from BaseMod to something else? I'd rather take it from someone with Forge experience.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
I found this code from someone who lead me to it but it makes no attempt of reading the new mods classes when loading up minecraft (I found this out by using a error check.bat) it will read all the items/new blocks but the ore blocks/generation code.
package net.minecraft.src;
import java.util.Random;
public class mod_oreblocks extends ItemBlock
{
public static String[] blockNames =
{
"Tin Ore",
"Copper Ore",
};
public mod_oreblocks(int id)
{
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
public String getItemNameIS(ItemStack itemStack)
{
return (new StringBuilder())
.append(super.getItemName())
.append(".")
.append(blockNames[itemStack.getItemDamage()])
.toString();
}
public static int Tinore = ModLoader.addOverride("/terrain.png", "dock/block/tin.png");
public static int Copperore = ModLoader.addOverride("/terrain.png", "dock/block/copper.png");
public String getVersion()
{
return "1.2.5";
}
{
Block mod_ingotblockmain = new mod_ingotblockmain(241);
ModLoader.registerBlock(mod_ingotblockmain, net.minecraft.src.mod_oreblocks.class);
ModLoader.addName(new ItemStack(mod_ingotblockmain, 241, 0), "Tin ore");
ModLoader.addName(new ItemStack(mod_ingotblockmain, 241, 1), "Copper ore");
}}
Dude, I just want to say, I love your tutorials. Now that modloader 1.3.1 is out and people will whine for updates and I just want to say, TAKE YOUR TIME! I've seen already two famous mods come out terrible for the rushing (like TMI, it quits an SSP game every time you make new chunks).
Thanks for the support . If I get too many people complaining about updates I'll just get the thread locked until it is all updated.
Oh, wow. I don't mean to ask questions unrelated to your tutorials, but do I have to change my class structure i.e. change what the class extends? Like change it from BaseMod to something else? I'd rather take it from someone with Forge experience.
No. Forge just adds more methods and hooks. The only real change is that you have to make a new class for every item and block, if they don't have one, if you are going to use terrain sprites.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Hey TechGuy543, im back with another question!! YEY!!
a while ago you gave me the code for a switch statement on the sounds a mob makes, but when i put it in, it doesnt like the 'void' part of it, please help??
public void getLivingSound()
{
int sound = 1;
String soundString;
switch (sound) {
case 1: soundString = "mob.spottygranny.default";
break;
case 2: soundString = "mob.spottygranny.chatty";
}
System.out.println(soundString);
}
It needs to be a String. Also add a return statement.
public String getLivingSound()
{
int sound = 1;
String soundString;
switch (sound) {
case 1: soundString = "mob.spottygranny.default";
break;
case 2: soundString = "mob.spottygranny.chatty";
}
System.out.println(soundString);
return soundString;
}
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Hey TechGuy, big question for you. Are you by chance going to release any tutorials explaining the basics of what's changed, and what things now have to be handled differently? Because I'm honestly lost currently.
Hey TechGuy, big question for you. Are you by chance going to release any tutorials explaining the basics of what's changed, and what things now have to be handled differently? Because I'm honestly lost currently.
Probably not. What can't you understand?
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
...I just derped big time. I've been making this a lot harder than it needs to be.
This is just basic converting to SMP, isn't it?
We have to make the mods for both Client and Server still, right? If so, how would one even install the server version, if the client is all ModLoader has access too? That's what I'm fuzzy on.
One thing I don't get is how I made some basic block mods earlier, without even touching the server source.
...I just derped big time. I've been making this a lot harder than it needs to be.
This is just basic converting to SMP, isn't it?
We have to make the mods for both Client and Server still, right? If so, how would one even install the server version, if the client is all ModLoader has access too? That's what I'm fuzzy on.
One thing I don't get is how I made some basic block mods earlier, without even touching the server source.
Risugami has done the hard yards for us, so to speak. We are making mods exactly the same as we were before (except for entities and world gen) and they work fine on single player, even though it is running a local server. All the tutorials on the OP with green names are updated to 1.3.1. Basically all I did for them was change the number in getVersion. I also fixed up some stupid mistakes but nothing actually needed changing to work.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Could you do a tutorial on how to make a block only mine-able by a certain tier of tool? Like how diamond can only be mined by iron and diamond.
EDIT: Ummm, when i tried to decompile my mod and modloader 1.3.1 so i can update my mod. The decompiling had 100 errors. I got the new mcp and copied all the stuff over the old one but it didn't work. Any ideas why? I have v7.0 of mcp and it says so when i run the .bat files I'll try getting a whole new mcp instead of copying over. And clean new jars.
EDIT2: I decompiled with nothing and it worked. Now trying with my mod and modloader 1.3.1 again.
EDIT3: Alright... The same thing happened as edit1. There where 100 errors. I tried with just Modloader and it worked. there were only 2 hunk failures. I'll try again with my mod and look at the code.
How would someone go about making entities and such work then, if mods only effect the client?
The client is a server. Technically, you shouldn't need to change anything to make your mod work on a server but I haven't tried it yet. Because entities are tracked on the server you need to edit EntityTracker to get them to render in single player. I am working on a fix for this with someone at the moment.
Could you do a tutorial on how to make a block only mine-able by a certain tier of tool? Like how diamond can only be mined by iron and diamond.
EDIT: Ummm, when i tried to decompile my mod and modloader 1.3.1 so i can update my mod. The decompiling had 100 errors. I got the new mcp and copied all the stuff over the old one but it didn't work. Any ideas why? I have v7.0 of mcp and it says so when i run the .bat files I'll try getting a whole new mcp instead of copying over. And clean new jars.
Not taking requests at the moment. You have to get a new MCP, fresh jars and new ModLoader. Then put ModLoader in the jar and decompile. Copy the source(.java files) of only your mod to the src of the new MCP folder.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffI've also tried this (in the ore block file)
public int quantityDropped(Random random, Item par1item)
{
if (par1item == Item.pickaxeDiamond.shiftedIndex)
{
return 1;
} else {
return 0;
}
}
-
View User Profile
-
View Posts
-
Send Message
Retired StaffHow do I go about doing that, i.e. what file do I put that information in? Do I make a new Material file and define Material.ore or something? Sorry, I've been modding for a while but some thins stump me...
I'm not really sure of the issue. I am having similar problems with my own Decorator at the moment.
You can use a hook in Minecraft Forge called setHarvestLevel and that will set the harvest level of your block. But if you are only going to use Forge for this and not its other benefits, the way you're doing this is correct.
The problem is that you are using Item for a parameter. shiftedIndex is the id of the item that is kept as an int. What this means is that it is trying to convert Item to an int but that isn't possible so it throws an error.
Your new quatityDropped method won't be called anyway as you have added a parameter to it. The simple way to fix all of this is to do something like the following:
public int quantityDropped(Random random) { if (ModLoader.getMinecraftInstance().thePlayer.getHeldItem() == new ItemStack(Item.pickaxeDiamond)) { return 1; } else { return 0; } }I think that will work, not too sure of the new ItemStack part.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffThanks. I may start using Minecraft Forge soon. The only thing stopping me is I'm using modloader already.
Forge includes ModLoader now. FML = ForgeModLoader.
together they are powerful beyond imagination."
Soon to be made!
-
View User Profile
-
View Posts
-
Send Message
Retired StaffOh, wow. I don't mean to ask questions unrelated to your tutorials, but do I have to change my class structure i.e. change what the class extends? Like change it from BaseMod to something else? I'd rather take it from someone with Forge experience.
package net.minecraft.src; import java.util.Random; public class mod_oreblocks extends ItemBlock { public static String[] blockNames = { "Tin Ore", "Copper Ore", }; public mod_oreblocks(int id) { super(id); setMaxDamage(0); setHasSubtypes(true); } public String getItemNameIS(ItemStack itemStack) { return (new StringBuilder()) .append(super.getItemName()) .append(".") .append(blockNames[itemStack.getItemDamage()]) .toString(); } public static int Tinore = ModLoader.addOverride("/terrain.png", "dock/block/tin.png"); public static int Copperore = ModLoader.addOverride("/terrain.png", "dock/block/copper.png"); public String getVersion() { return "1.2.5"; } { Block mod_ingotblockmain = new mod_ingotblockmain(241); ModLoader.registerBlock(mod_ingotblockmain, net.minecraft.src.mod_oreblocks.class); ModLoader.addName(new ItemStack(mod_ingotblockmain, 241, 0), "Tin ore"); ModLoader.addName(new ItemStack(mod_ingotblockmain, 241, 1), "Copper ore"); }}package net.minecraft.src; import java.util.Random; public class mod_oreitems extends WorldGenerator { private int minableBlockId; private int numberOfBlocks; private int metadataID; public mod_oreitems(int par1, int par2, int par3) { this.minableBlockId = par1; this.numberOfBlocks = par2; this.metadataID = par3; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float var6 = par2Random.nextFloat() * (float)Math.PI; double var7 = (double)((float)(par3 + 8) + MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); double var9 = (double)((float)(par3 + 8) - MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F); double var11 = (double)((float)(par5 + 8) + MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); double var13 = (double)((float)(par5 + 8) - MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F); double var15 = (double)(par4 + par2Random.nextInt(3) - 2); double var17 = (double)(par4 + par2Random.nextInt(3) - 2); for (int var19 = 0; var19 <= this.numberOfBlocks; ++var19) { double var20 = var7 + (var9 - var7) * (double)var19 / (double)this.numberOfBlocks; double var22 = var15 + (var17 - var15) * (double)var19 / (double)this.numberOfBlocks; double var24 = var11 + (var13 - var11) * (double)var19 / (double)this.numberOfBlocks; double var26 = par2Random.nextDouble() * (double)this.numberOfBlocks / 16.0D; double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D; int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); for (int var38 = var32; var38 <= var35; ++var38) { double var39 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D); if (var39 * var39 < 1.0D) { for (int var41 = var33; var41 <= var36; ++var41) { double var42 = ((double)var41 + 0.5D - var22) / (var30 / 2.0D); if (var39 * var39 + var42 * var42 < 1.0D) { for (int var44 = var34; var44 <= var37; ++var44) { double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D); if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.stone.blockID) { par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, this.metadataID); } } } } } } } return true; } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int l = 0; l < 7; l++) { int i1 = chunkX + rand.nextInt(16); int j1 = rand.nextInt(128); int k1 = chunkZ + rand.nextInt(16); (new mod_oreitems(mod_oreblocks.Tinore, 12, 0)).generate(world, rand, i1, j1, k1); (new mod_oreitems(mod_oreblocks.Copperore, 12, 1)).generate(world, rand, i1, j1, k1); }}}package net.minecraft.src; import java.util.Random; public class mod_ingotblockmain extends Block { public mod_ingotblockmain(int id) { super(id, Material.rock); this.setHardness(3.0f); this.setResistance(3.0f); this.setStepSound(Block.soundStoneFootstep); this.setBlockName("stone"); } public int idDropped(int metadata, Random Random) { return blockID; } protected int damageDropped(int metadata) { return metadata; } public int getBlockTextureFromSideMetaData(int par1, int par2) { switch (par2) { default: return mod_oreblocks.Tinore; case 1: return mod_oreblocks.Copperore; } } }Thanks for the support
A picture would help greatly in working out the problem.
No. Forge just adds more methods and hooks. The only real change is that you have to make a new class for every item and block, if they don't have one, if you are going to use terrain sprites.
together they are powerful beyond imagination."
ModLoader.addSmelting(Block.dirt.blockID, new ItemStack(Item.ingotGold, 1));
to this
ModLoader.addSmelting(Block.dirt.blockID, new ItemStack(Item.ingotGold, 1), 1.0F);
the float at the end is the XP
It needs to be a String. Also add a return statement.
public String getLivingSound() { int sound = 1; String soundString; switch (sound) { case 1: soundString = "mob.spottygranny.default"; break; case 2: soundString = "mob.spottygranny.chatty"; } System.out.println(soundString); return soundString; }together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumUse the ModLoader.addBiome line a few times.
public void load() { ModLoader.addBiome(nameHere); ModLoader.addBiome(nameHere); ModLoader.addBiome(nameHere); ModLoader.addBiome(nameHere); }That should work.
Probably not. What can't you understand?
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThis is just basic converting to SMP, isn't it?
We have to make the mods for both Client and Server still, right? If so, how would one even install the server version, if the client is all ModLoader has access too? That's what I'm fuzzy on.
One thing I don't get is how I made some basic block mods earlier, without even touching the server source.
Risugami has done the hard yards for us, so to speak. We are making mods exactly the same as we were before (except for entities and world gen) and they work fine on single player, even though it is running a local server. All the tutorials on the OP with green names are updated to 1.3.1. Basically all I did for them was change the number in getVersion. I also fixed up some stupid mistakes but nothing actually needed changing to work.
together they are powerful beyond imagination."
EDIT: Ummm, when i tried to decompile my mod and modloader 1.3.1 so i can update my mod. The decompiling had 100 errors. I got the new mcp and copied all the stuff over the old one but it didn't work. Any ideas why? I have v7.0 of mcp and it says so when i run the .bat files I'll try getting a whole new mcp instead of copying over. And clean new jars.
EDIT2: I decompiled with nothing and it worked. Now trying with my mod and modloader 1.3.1 again.
EDIT3: Alright... The same thing happened as edit1. There where 100 errors. I tried with just Modloader and it worked. there were only 2 hunk failures. I'll try again with my mod and look at the code.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe client is a server. Technically, you shouldn't need to change anything to make your mod work on a server but I haven't tried it yet. Because entities are tracked on the server you need to edit EntityTracker to get them to render in single player. I am working on a fix for this with someone at the moment.
Not taking requests at the moment. You have to get a new MCP, fresh jars and new ModLoader. Then put ModLoader in the jar and decompile. Copy the source(.java files) of only your mod to the src of the new MCP folder.
together they are powerful beyond imagination."