...
5. how do you make an achievment where you kill a specific mob, eg. creeper?
If you want to do it when you kill a vanilla mob you will have to do it the way that b0mbshellAntics said to, if it is your own custom mob, then you should look at the skeleton code (EntitySkeleton) as that has the trigger for the "sniper duel" achievement in it
i've a problem with my code for a smelting recipe i hope someone can help me out
this is the code:
ModLoader.addSmelting(Potato.shiftedIndex, new ItemStack(KookedPotato));
and this is the error i'm getting
src/minecraft/net/minecraft/src/mod_MF.java:32: addSmelting(int,net.minecraft.src.ItemStack,float) in net.minecraft.src.ModLoader cannot be applied to (int,net.minecraft.src.ItemStack)
ModLoader.addSmelting(Potato.shiftedIndex, new ItemStack(KookedPotato));
replace your code to this
ModLoader.addSmelting(mod_MF.Potato.shiftedIndex, new ItemStack(mod_MF.KookedPotato , 1),1.0F);
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs
, param csvs, renumber csv, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0_05\bin\javac" -Xlint:-options -deprecation -g -
source 1.6 -target 1....' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\BlockDolomite.java:3: error: class Dolomite is p
ublic, should be declared in a file named Dolomite.java
public class Dolomite extends Block
^
src\minecraft\net\minecraft\src\BlockDolomite.java:11: error: cannot find symbol
return mod_zombie.Dolomite.shiftedIndex;
^
symbol: variable shiftedIndex
location: variable Dolomite of type Block
2 errors
==================
This is my code
package net.minecraft.src;
import java.util.Random;
public class Dolomite extends Block
{
public Dolomite(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_zombie.dirt.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 5;
}
}
and this
package net.minecraft.src;
public class mod_zombie extends BaseMod
{
public static final Block Dolomite = new Dolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png");
ModLoader.registerBlock(Dolomite);
ModLoader.addName(Dolomite, "Dolomite");
ModLoader.addRecipe(new ItemStack(Dolomite, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
I keep getting 3 errors, and I have tried repeatedly to fix them, but nothing I do seems to work, so I was hoping you guys, who are probably MUCH better modders than me, could help me out.
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs
, param csvs, renumber csv, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files (x86)\Java\jdk1.6.0_30\bin\javac" -Xlint:-options -deprecatio
n -g -source 1.6 -tar...' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: illegal start of expressi
on
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: ';' expected
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:42: reached end of file while
parsing
}→
^
3 errors
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
The actual code
package net.minecraft.src;
import java.util.Random;
public class mod_MoreTools extends BaseMod
{
public static final Item Ruby = new Item(5000).setItemName("Ruby");
public static final Block Blockruby= new Block(160, 0, Material.iron).setBlockName("Blockruby").setHardness(3F).setResistance(4F);
public static final Block Oreruby = new Oreruby(161, 0).setBlockName("Oreruby").setHardness(3F).setResistance(4F);
public void load()
{
Ruby.iconIndex = ModLoader.addOverride("/gui/items.png", "/MoreTools/Ruby.png");
Blockruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Blockruby.png");
Oreruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Oreruby.png");
ModLoader.registerBlock(Blockruby);
ModLoader.registerBlock(Oreruby);
ModLoader.addName(Ruby, "Ruby");
ModLoader.addName(Blockruby, "Ruby Block");
ModLoader.addName(Oreruby, "Ruby Ore");
ModLoader.addRecipe(new ItemStack(Ruby, 9), new Object [] {"#", Character.valueOf('#'), Blockruby});
ModLoader.addRecipe(new ItemStack(Blockruby, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), Ruby});
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 3; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(32);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Oreruby.blockID, 5)).generate(world, random, randPosX, randPosY, randPosZ);
}
public String getVersion()
{
return "1.3.1";
}
}
I keep getting 3 errors, and I have tried repeatedly to fix them, but nothing I do seems to work, so I was hoping you guys, who are probably MUCH better modders than me, could help me out.
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs
, param csvs, renumber csv, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files (x86)\Java\jdk1.6.0_30\bin\javac" -Xlint:-options -deprecatio
n -g -source 1.6 -tar...' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: illegal start of expressi
on
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: ';' expected
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:42: reached end of file while
parsing
}→
^
3 errors
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
The actual code
package net.minecraft.src;
import java.util.Random;
public class mod_MoreTools extends BaseMod
{
public static final Item Ruby = new Item(5000).setItemName("Ruby");
public static final Block Blockruby= new Block(160, 0, Material.iron).setBlockName("Blockruby").setHardness(3F).setResistance(4F);
public static final Block Oreruby = new Oreruby(161, 0).setBlockName("Oreruby").setHardness(3F).setResistance(4F);
public void load()
{
Ruby.iconIndex = ModLoader.addOverride("/gui/items.png", "/MoreTools/Ruby.png");
Blockruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Blockruby.png");
Oreruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Oreruby.png");
ModLoader.registerBlock(Blockruby);
ModLoader.registerBlock(Oreruby);
ModLoader.addName(Ruby, "Ruby");
ModLoader.addName(Blockruby, "Ruby Block");
ModLoader.addName(Oreruby, "Ruby Ore");
ModLoader.addRecipe(new ItemStack(Ruby, 9), new Object [] {"#", Character.valueOf('#'), Blockruby});
ModLoader.addRecipe(new ItemStack(Blockruby, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), Ruby});
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 3; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(32);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Oreruby.blockID, 5)).generate(world, random, randPosX, randPosY, randPosZ);
}
public String getVersion()
{
return "1.3.1";
}
}
You're missing a closing bracket. Just insert another '}' at the end of your file and it should work.
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.
@TechGuy543's tutorial for achievements says that to have one leading on from another, you have to use it from the achievmentslist.java for the second half:
static Achievement name = AchievementList.diamonds;
how do you do it for your achievement linking to another of your achievements??
[EDIT] also error code, just added about 7 achievements... it wouldnt be that would it??
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader init
FINE: ModLoader 1.2.5 Initializing...
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Theo\Desktop\mcp\src\minecraft
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Directory found.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRHelmet.png,38). 84 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRChest.png,102). 83 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRPants.png,118). 82 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRBoots.png,119). 81 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addMod
FINE: Failed to load mod from "mod_Spot.class"
Aug 06, 2012 9:20:19 PM ModLoader addMod
FINER: THROW
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.(RenderManager.java:85)
at net.minecraft.src.RenderManager.(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemStack.(ItemStack.java:43)
at net.minecraft.src.Achievement.(Achievement.java:46)
at net.minecraft.src.mod_Spot.(mod_Spot.java:31)
... 15 more
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addAllRenderers
FINE: Initialized
static Achievement name = AchievementList.diamonds;
The "name" part is the achievement list of the achievements you made.
public static final Achievement AchievementNameHurr = new Achievement(4560, "blah", 8, 7, Blah, THIS).registerAchievement();
The highlighted part is the thing that goes in the "name" part. The "static Achievement name = AchievementList.diamonds;" code makes the achievements only acquirable if you have gotten the "Diamonds!/whatever" achievement(s). If you want your achievements to be available without any conditions (i.e., without having to do anything beforehand), don't put that line there.
As for linking your achievements, you'll have to make another AchievementList and use it in the regular AchievementList's place.
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.
package net.minecraft.src;
import java.util.Random;
public class mod_Oodles extends BaseMod
{
//DECLARATION
public static final Block VanillaFlower = new VanillaFlower(165, 0).setBlockName("VanillaFlower");
//DECLARATION
public void load()
{
//REGISTER
ModLoader.registerBlock(VanillaFlower);
//REGISTER
//TEXTURE
VanillaFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Oodles/VanillaFlower.png");
//TEXURE
//IGN
ModLoader.addName(VanillaFlower, "Vanilla");
//IGN
//CRAFTING
ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {"X ", "Y ", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle});
ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {" X", " Y", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle});
//CRAFTING
}
public void generateSurface(World world, Random random, int i, int j)
{
for(int k = 0; k < 7; k++)
{
int randPosX = i + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = j = random.nextInt(16);
(new WorldGenFlowers(VanillaFlower.blockID)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion()
{
return "1.3.1";
}
}
VanillaFlower.java
package net.minecraft.src;
import java.util.Random;
public class VanillaFlower extends Block
{
protected VanillaFlower(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
this.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/Oodles/VanillaFlower.png");
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
checkFlowerChange(world, i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
checkFlowerChange(world, i, j, k);
}
protected final void checkFlowerChange(World world, int i, int j, int k)
{
if (!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
The [.Code] on this forum doesn't seem to work too well for me, hopefully it does now. I deleted everything else that isn't even a bit related to the flower.
Rollback Post to RevisionRollBack
Intel Core i5 2500k - Asus Radeon HD 7870 - 8GB Memory - Seagate Barracuda 2TB 7200RPM - Corsair Builder Series X600 - MSI Z77 G45
I'm having an issue with tools. They work perfectly except for one thing. They take no damage when used. As far as I can tell there aren't any differences between your example and mine.
mod_ObsidianTools
package net.minecraft.src;
public class mod_ObsidianTools extends BaseModMp
{
public static final Item ObsidianShovel = new ItemObsidianShovel(1001, EnumToolObsidian.OBSIDIAN).setItemName("ObsidianShovel");
public static final Item ObsidianIngot = new ItemObsidianIngot(1000).setItemName("Obsidian Ingot");
public static final Item ObsidianAxe = new ItemObsidianAxe(1002, EnumToolObsidian.OBSIDIAN).setItemName("Obsidian Axe");
public mod_ObsidianTools()
{
}
public void load()
{
ObsidianShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianShovel.png");
ModLoader.addName(ObsidianShovel, "Shovel");
ModLoader.addRecipe(new ItemStack(ObsidianShovel, 1), new Object [] {" # ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick});
ObsidianAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianAxe.png");
ModLoader.addName(ObsidianAxe, "Axe");
ModLoader.addRecipe(new ItemStack(ObsidianAxe, 1), new Object [] {"## ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick});
ObsidianIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianIngot.png");
ModLoader.addName(ObsidianIngot, "Obsidian Ingot");
ModLoader.addSmelting(Block.obsidian.blockID, new ItemStack(ObsidianIngot), 1);
}
public String getVersion()
{
return "1.3.1";
}
}
EnumToolObsidian
package net.minecraft.src;
public enum EnumToolObsidian
{
OBSIDIAN("OBSIDIAN", 5, 4, 500, 15F, 3, 20);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final EnumToolObsidian allToolMaterials[];
private EnumToolObsidian(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getEnchantability()
{
return enchantability;
}
public int getHarvestLevel()
{
return harvestLevel;
}
static
{
allToolMaterials = (new EnumToolObsidian[] {OBSIDIAN});
}
}
ItemObsidianTool
package net.minecraft.src;
import java.util.Arrays;
public class ItemObsidianTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected EnumToolObsidian toolMaterial;
protected ItemObsidianTool(int i, int j, EnumToolObsidian enumToolMaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4f;
toolMaterial = enumToolMaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
efficiencyOnProperMaterial = enumToolMaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumToolMaterial.getDamageVsEntity();
this.setTabToDisplayOn(CreativeTabs.tabTools);
}
public float getStrVsBlock(ItemStack itemStack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemStack, EntityLiving entityLiving, EntityLiving entityLiving1)
{
itemStack.damageItem(2, entityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack itemStack, int i, int j, int k, int l, EntityLiving entityLiving)
{
itemStack.damageItem(1, entityLiving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getitemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
ItemObsidianShovel
package net.minecraft.src;
public class ItemObsidianShovel extends ItemObsidianTool
{
private static Block blocksEffectiveAgainst[];
public ItemObsidianShovel(int i, EnumToolObsidian enumToolMaterial)
{
super(i, 1, enumToolMaterial, blocksEffectiveAgainst);
}
public boolean canHarvestBlock(Block block)
{
if(block == Block.snow)
{
return true;
}
return block == Block.blockSnow;
}
static
{
blocksEffectiveAgainst = (new Block[] {Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium});
}
}
I'm having an issue with tools. They work perfectly except for one thing. They take no damage when used. As far as I can tell there aren't any differences between your example and mine.
mod_ObsidianTools
package net.minecraft.src;
public class mod_ObsidianTools extends BaseModMp
{
public static final Item ObsidianShovel = new ItemObsidianShovel(1001, EnumToolObsidian.OBSIDIAN).setItemName("ObsidianShovel");
public static final Item ObsidianIngot = new ItemObsidianIngot(1000).setItemName("Obsidian Ingot");
public static final Item ObsidianAxe = new ItemObsidianAxe(1002, EnumToolObsidian.OBSIDIAN).setItemName("Obsidian Axe");
public mod_ObsidianTools()
{
}
public void load()
{
ObsidianShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianShovel.png");
ModLoader.addName(ObsidianShovel, "Shovel");
ModLoader.addRecipe(new ItemStack(ObsidianShovel, 1), new Object [] {" # ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick});
ObsidianAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianAxe.png");
ModLoader.addName(ObsidianAxe, "Axe");
ModLoader.addRecipe(new ItemStack(ObsidianAxe, 1), new Object [] {"## ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick});
ObsidianIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianIngot.png");
ModLoader.addName(ObsidianIngot, "Obsidian Ingot");
ModLoader.addSmelting(Block.obsidian.blockID, new ItemStack(ObsidianIngot), 1);
}
public String getVersion()
{
return "1.3.1";
}
}
EnumToolObsidian
package net.minecraft.src;
public enum EnumToolObsidian
{
OBSIDIAN("OBSIDIAN", 5, 4, 500, 15F, 3, 20);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final EnumToolObsidian allToolMaterials[];
private EnumToolObsidian(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getEnchantability()
{
return enchantability;
}
public int getHarvestLevel()
{
return harvestLevel;
}
static
{
allToolMaterials = (new EnumToolObsidian[] {OBSIDIAN});
}
}
ItemObsidianTool
package net.minecraft.src;
import java.util.Arrays;
public class ItemObsidianTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected EnumToolObsidian toolMaterial;
protected ItemObsidianTool(int i, int j, EnumToolObsidian enumToolMaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4f;
toolMaterial = enumToolMaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
efficiencyOnProperMaterial = enumToolMaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumToolMaterial.getDamageVsEntity();
this.setTabToDisplayOn(CreativeTabs.tabTools);
}
public float getStrVsBlock(ItemStack itemStack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemStack, EntityLiving entityLiving, EntityLiving entityLiving1)
{
itemStack.damageItem(2, entityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack itemStack, int i, int j, int k, int l, EntityLiving entityLiving)
{
itemStack.damageItem(1, entityLiving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getitemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
ItemObsidianShovel
package net.minecraft.src;
public class ItemObsidianShovel extends ItemObsidianTool
{
private static Block blocksEffectiveAgainst[];
public ItemObsidianShovel(int i, EnumToolObsidian enumToolMaterial)
{
super(i, 1, enumToolMaterial, blocksEffectiveAgainst);
}
public boolean canHarvestBlock(Block block)
{
if(block == Block.snow)
{
return true;
}
return block == Block.blockSnow;
}
static
{
blocksEffectiveAgainst = (new Block[] {Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium});
}
}
You have to update your Enum and Item classes with the new code. Your tools will take damage in 1.2.5, but due to a change, they won't in 1.3.1. I had the same problem and updated them, then they took damage appropriately.
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.
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
I am currently in the process of creating a mod, I have a question though.
I didn't think I needed to, but now it seems it would be easiest to add a button to the main inventory GUI. Is the only way to do this by editing the base files of GUIInventory or is there a ModLoader function to add a button to a previously existing GUI?
Please help, it is basically the last thing needed before the release!
Hey thanks for the great tutorial but do you know anyone who has a tutorial on how to make monsters based on already existing minecraft mobs in 1.3.1?
Just make your entity class extend theirs. Except, new mobs are invisible at the moment without adding them into EntityTracker so you'll have to do that as well.
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs
, param csvs, renumber csv, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0_05\bin\javac" -Xlint:-options -deprecation -g -
source 1.6 -target 1....' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\BlockDolomite.java:3: error: class Dolomite is p
ublic, should be declared in a file named Dolomite.java
public class Dolomite extends Block
^
src\minecraft\net\minecraft\src\BlockDolomite.java:11: error: cannot find symbol
return mod_zombie.Dolomite.shiftedIndex;
^
symbol: variable shiftedIndex
location: variable Dolomite of type Block
2 errors
==================
This is my code
package net.minecraft.src;
import java.util.Random;
public class Dolomite extends Block
{
public Dolomite(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_zombie.dirt.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 5;
}
}
and this
package net.minecraft.src;
public class mod_zombie extends BaseMod
{
public static final Block Dolomite = new Dolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png");
ModLoader.registerBlock(Dolomite);
ModLoader.addName(Dolomite, "Dolomite");
ModLoader.addRecipe(new ItemStack(Dolomite, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
Blocks use blockID instead of shiftedIndex.
public int idDropped(int i, Random random, int j)
{
return mod_zombie.dirt.blockID;
}
I keep getting 3 errors, and I have tried repeatedly to fix them, but nothing I do seems to work, so I was hoping you guys, who are probably MUCH better modders than me, could help me out.
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs
, param csvs, renumber csv, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files (x86)\Java\jdk1.6.0_30\bin\javac" -Xlint:-options -deprecatio
n -g -source 1.6 -tar...' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: illegal start of expressi
on
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:36: ';' expected
public String getVersion()
^
src\minecraft\net\minecraft\src\mod_MoreTools.java:42: reached end of file while
parsing
}→
^
3 errors
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
The actual code
package net.minecraft.src;
import java.util.Random;
public class mod_MoreTools extends BaseMod
{
public static final Item Ruby = new Item(5000).setItemName("Ruby");
public static final Block Blockruby= new Block(160, 0, Material.iron).setBlockName("Blockruby").setHardness(3F).setResistance(4F);
public static final Block Oreruby = new Oreruby(161, 0).setBlockName("Oreruby").setHardness(3F).setResistance(4F);
public void load()
{
Ruby.iconIndex = ModLoader.addOverride("/gui/items.png", "/MoreTools/Ruby.png");
Blockruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Blockruby.png");
Oreruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Oreruby.png");
ModLoader.registerBlock(Blockruby);
ModLoader.registerBlock(Oreruby);
ModLoader.addName(Ruby, "Ruby");
ModLoader.addName(Blockruby, "Ruby Block");
ModLoader.addName(Oreruby, "Ruby Ore");
ModLoader.addRecipe(new ItemStack(Ruby, 9), new Object [] {"#", Character.valueOf('#'), Blockruby});
ModLoader.addRecipe(new ItemStack(Blockruby, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), Ruby});
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 3; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(32);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Oreruby.blockID, 5)).generate(world, random, randPosX, randPosY, randPosZ);
}
public String getVersion()
{
return "1.3.1";
}
}
Add one more} after the generateSurface method and before getVersion().
When could you update the NPC mod? I tried the old one, but when the mob spawn, MC crashes.
The title of the NPC tutorials are not green. Therefore they are not updated. Therefore they will not work. The top of the OP states not to ask about updates or I will get this thread locked.
@TechGuy543's tutorial for achievements says that to have one leading on from another, you have to use it from the achievmentslist.java for the second half:
static Achievement name = AchievementList.diamonds;
how do you do it for your achievement linking to another of your achievements??
Just don't add the AchievementList part of it.
public static final Achievement nameHere = new Achievement(4560, "nameHere", 5, 7, Item.diamond, null).registerAchievement();
public static final Achievement nameHere2 = new Achievement(4560, "nameHere", 5, 7, Item.diamond, nameHere).registerAchievement();
package net.minecraft.src;
import java.util.Random;
public class mod_Oodles extends BaseMod
{
//DECLARATION
public static final Block VanillaFlower = new VanillaFlower(165, 0).setBlockName("VanillaFlower");
//DECLARATION
public void load()
{
//REGISTER
ModLoader.registerBlock(VanillaFlower);
//REGISTER
//TEXTURE
VanillaFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Oodles/VanillaFlower.png");
//TEXURE
//IGN
ModLoader.addName(VanillaFlower, "Vanilla");
//IGN
//CRAFTING
ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {"X ", "Y ", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle});
ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {" X", " Y", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle});
//CRAFTING
}
public void generateSurface(World world, Random random, int i, int j)
{
for(int k = 0; k < 7; k++)
{
int randPosX = i + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = j = random.nextInt(16);
(new WorldGenFlowers(VanillaFlower.blockID)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion()
{
return "1.3.1";
}
}
VanillaFlower.java
package net.minecraft.src;
import java.util.Random;
public class VanillaFlower extends Block
{
protected VanillaFlower(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
this.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/Oodles/VanillaFlower.png");
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
super.onNeighborBlockChange(world, i, j, k, l);
checkFlowerChange(world, i, j, k);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
checkFlowerChange(world, i, j, k);
}
protected final void checkFlowerChange(World world, int i, int j, int k)
{
if (!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
The [.Code] on this forum doesn't seem to work too well for me, hopefully it does now. I deleted everything else that isn't even a bit related to the flower.
In the super statement in the constructor of the block class you need to add in the blockIndexInTexture parameter, j.
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
}
You need to edit RenderBiped. I haven't found another way to do it yet.
I am currently in the process of creating a mod, I have a question though.
I didn't think I needed to, but now it seems it would be easiest to add a button to the main inventory GUI. Is the only way to do this by editing the base files of GUIInventory or is there a ModLoader function to add a button to a previously existing GUI?
Please help, it is basically the last thing needed before the release!
Thanks!
Do you mean you want to add a button to the player's inventory?
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I'm currently trying to add random structures. My structure has stair blocks, but i can't figure out how to set the direction/facing. Do you know how? If you do, you may want to add it to your tutorial, stair blocks are pretty common in structures.
Could you also explain the difference between setBlockWithNotify and setBlockAndMetadataWithNotify? You're using both in your tutorial without explaining the difference between them.
Some block stores metadata on them, like torches, stairs, and other blocks like wool. If your structure is big, it will be hard to code it line by line. You can code it using loops, but if you're really lazy like me, you can use this.
I'm currently trying to add random structures. My structure has stair blocks, but i can't figure out how to set the direction/facing. Do you know how? If you do, you may want to add it to your tutorial, stair blocks are pretty common in structures.
Could you also explain the difference between setBlockWithNotify and setBlockAndMetadataWithNotify? You're using both in your tutorial without explaining the difference between them.
I actually do explain it. It is there, you just have to read it.
btw. yesterday when i code it first, it works. the sword was on the right place.
Srry for my question but im not really good in Java ._.
Actually, let me just test something.
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.
Thanks for ore generation update
Can you tell how add more then one block generation in one mod_***
write the full code of mod_*** and Items NetherBall and NetherBar
Update
I am not sure that this is how it will help because I am newbie too in modding
\/
\/
\/
\/
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIf you want to do it when you kill a vanilla mob you will have to do it the way that b0mbshellAntics said to, if it is your own custom mob, then you should look at the skeleton code (EntitySkeleton) as that has the trigger for the "sniper duel" achievement in it
replace your code to this
ModLoader.addSmelting(mod_MF.Potato.shiftedIndex, new ItemStack(mod_MF.KookedPotato , 1), 1.0F);
This is my code
package net.minecraft.src; import java.util.Random; public class Dolomite extends Block { public Dolomite(int i, int j) { super(i, j, Material.wood); } public int idDropped(int i, Random random, int j) { return mod_zombie.dirt.shiftedIndex; } public int quantityDropped(Random random) { return 5; } }and this
package net.minecraft.src; public class mod_zombie extends BaseMod { public static final Block Dolomite = new Dolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F); public void load() { Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png"); ModLoader.registerBlock(Dolomite); ModLoader.addName(Dolomite, "Dolomite"); ModLoader.addRecipe(new ItemStack(Dolomite, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt}); } public String getVersion() { return "1.3.1"; } }The actual code
package net.minecraft.src; import java.util.Random; public class mod_MoreTools extends BaseMod { public static final Item Ruby = new Item(5000).setItemName("Ruby"); public static final Block Blockruby= new Block(160, 0, Material.iron).setBlockName("Blockruby").setHardness(3F).setResistance(4F); public static final Block Oreruby = new Oreruby(161, 0).setBlockName("Oreruby").setHardness(3F).setResistance(4F); public void load() { Ruby.iconIndex = ModLoader.addOverride("/gui/items.png", "/MoreTools/Ruby.png"); Blockruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Blockruby.png"); Oreruby.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MoreTools/Oreruby.png"); ModLoader.registerBlock(Blockruby); ModLoader.registerBlock(Oreruby); ModLoader.addName(Ruby, "Ruby"); ModLoader.addName(Blockruby, "Ruby Block"); ModLoader.addName(Oreruby, "Ruby Ore"); ModLoader.addRecipe(new ItemStack(Ruby, 9), new Object [] {"#", Character.valueOf('#'), Blockruby}); ModLoader.addRecipe(new ItemStack(Blockruby, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), Ruby}); } public void generateSurface(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 3; i++) { int randPosX = chunkX + random.nextInt(16); int randPosY = random.nextInt(32); int randPosZ = chunkZ + random.nextInt(16); (new WorldGenMinable(Oreruby.blockID, 5)).generate(world, random, randPosX, randPosY, randPosZ); } public String getVersion() { return "1.3.1"; } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou're missing a closing bracket. Just insert another '}' at the end of your file and it should work.
It fixed one of the errors, the first 2 are still a problem
-
View User Profile
-
View Posts
-
Send Message
Retired StaffThe "name" part is the achievement list of the achievements you made.
public static final Achievement AchievementNameHurr = new Achievement(4560, "blah", 8, 7, Blah, THIS).registerAchievement();
The highlighted part is the thing that goes in the "name" part. The "static Achievement name = AchievementList.diamonds;" code makes the achievements only acquirable if you have gotten the "Diamonds!/whatever" achievement(s). If you want your achievements to be available without any conditions (i.e., without having to do anything beforehand), don't put that line there.
As for linking your achievements, you'll have to make another AchievementList and use it in the regular AchievementList's place.
mod_Oodles.java
package net.minecraft.src; import java.util.Random; public class mod_Oodles extends BaseMod { //DECLARATION public static final Block VanillaFlower = new VanillaFlower(165, 0).setBlockName("VanillaFlower"); //DECLARATION public void load() { //REGISTER ModLoader.registerBlock(VanillaFlower); //REGISTER //TEXTURE VanillaFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Oodles/VanillaFlower.png"); //TEXURE //IGN ModLoader.addName(VanillaFlower, "Vanilla"); //IGN //CRAFTING ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {"X ", "Y ", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle}); ModLoader.addRecipe(new ItemStack(Vanilla, 2), new Object[] {" X", " Y", Character.valueOf('X'), VanillaFlower, Character.valueOf('Y'), Item.glassBottle}); //CRAFTING } public void generateSurface(World world, Random random, int i, int j) { for(int k = 0; k < 7; k++) { int randPosX = i + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = j = random.nextInt(16); (new WorldGenFlowers(VanillaFlower.blockID)).generate(world, random, randPosX, randPosY, randPosZ); } } public String getVersion() { return "1.3.1"; } }VanillaFlower.java
package net.minecraft.src; import java.util.Random; public class VanillaFlower extends Block { protected VanillaFlower(int i, int j) { super(i, Material.plants); blockIndexInTexture = j; setTickRandomly(true); float f = 0.2F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f); this.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/Oodles/VanillaFlower.png"); } public boolean canPlaceBlockAt(World world, int i, int j, int k) { return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k)); } protected boolean canThisPlantGrowOnThisBlockID(int i) { return i == Block.grass.blockID || i == Block.dirt.blockID; } public void onNeighborBlockChange(World world, int i, int j, int k, int l) { super.onNeighborBlockChange(world, i, j, k, l); checkFlowerChange(world, i, j, k); } public void updateTick(World world, int i, int j, int k, Random random) { checkFlowerChange(world, i, j, k); } protected final void checkFlowerChange(World world, int i, int j, int k) { if (!canBlockStay(world, i, j, k)) { dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); world.setBlockWithNotify(i, j, k, 0); } } public boolean canBlockStay(World world, int i, int j, int k) { return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k)) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k)); } public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) { return null; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 1; } }mod_ObsidianTools
package net.minecraft.src; public class mod_ObsidianTools extends BaseModMp { public static final Item ObsidianShovel = new ItemObsidianShovel(1001, EnumToolObsidian.OBSIDIAN).setItemName("ObsidianShovel"); public static final Item ObsidianIngot = new ItemObsidianIngot(1000).setItemName("Obsidian Ingot"); public static final Item ObsidianAxe = new ItemObsidianAxe(1002, EnumToolObsidian.OBSIDIAN).setItemName("Obsidian Axe"); public mod_ObsidianTools() { } public void load() { ObsidianShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianShovel.png"); ModLoader.addName(ObsidianShovel, "Shovel"); ModLoader.addRecipe(new ItemStack(ObsidianShovel, 1), new Object [] {" # ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick}); ObsidianAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianAxe.png"); ModLoader.addName(ObsidianAxe, "Axe"); ModLoader.addRecipe(new ItemStack(ObsidianAxe, 1), new Object [] {"## ", " $ ", " $ ", Character.valueOf('#'), ObsidianIngot, '$', Item.stick}); ObsidianIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/ObsidianIngot.png"); ModLoader.addName(ObsidianIngot, "Obsidian Ingot"); ModLoader.addSmelting(Block.obsidian.blockID, new ItemStack(ObsidianIngot), 1); } public String getVersion() { return "1.3.1"; } }EnumToolObsidian
package net.minecraft.src; public enum EnumToolObsidian { OBSIDIAN("OBSIDIAN", 5, 4, 500, 15F, 3, 20); private final int harvestLevel; private final int maxUses; private final float efficiencyOnProperMaterial; private final int damageVsEntity; private final int enchantability; private static final EnumToolObsidian allToolMaterials[]; private EnumToolObsidian(String s, int i, int j, int k, float f, int l, int i1) { harvestLevel = j; maxUses = k; efficiencyOnProperMaterial = f; damageVsEntity = l; enchantability = i1; } public int getMaxUses() { return maxUses; } public float getEfficiencyOnProperMaterial() { return efficiencyOnProperMaterial; } public int getDamageVsEntity() { return damageVsEntity; } public int getEnchantability() { return enchantability; } public int getHarvestLevel() { return harvestLevel; } static { allToolMaterials = (new EnumToolObsidian[] {OBSIDIAN}); } }ItemObsidianTool
package net.minecraft.src; import java.util.Arrays; public class ItemObsidianTool extends Item { private Block blocksEffectiveAgainst[]; public float efficiencyOnProperMaterial; public int damageVsEntity; protected EnumToolObsidian toolMaterial; protected ItemObsidianTool(int i, int j, EnumToolObsidian enumToolMaterial, Block ablock[]) { super(i); efficiencyOnProperMaterial = 4f; toolMaterial = enumToolMaterial; blocksEffectiveAgainst = ablock; maxStackSize = 1; setMaxDamage(enumToolMaterial.getMaxUses()); efficiencyOnProperMaterial = enumToolMaterial.getEfficiencyOnProperMaterial(); damageVsEntity = j + enumToolMaterial.getDamageVsEntity(); this.setTabToDisplayOn(CreativeTabs.tabTools); } public float getStrVsBlock(ItemStack itemStack, Block block) { for(int i = 0; i < blocksEffectiveAgainst.length; i++) { if(blocksEffectiveAgainst[i] == block) { return efficiencyOnProperMaterial; } } return 1.0F; } public boolean hitEntity(ItemStack itemStack, EntityLiving entityLiving, EntityLiving entityLiving1) { itemStack.damageItem(2, entityLiving); return true; } public boolean onBlockDestroyed(ItemStack itemStack, int i, int j, int k, int l, EntityLiving entityLiving) { itemStack.damageItem(1, entityLiving); return true; } public int getDamageVsEntity(Entity entity) { return damageVsEntity; } public boolean isFull3D() { return true; } public int getitemEnchantability() { return toolMaterial.getEnchantability(); } }ItemObsidianShovel
package net.minecraft.src; public class ItemObsidianShovel extends ItemObsidianTool { private static Block blocksEffectiveAgainst[]; public ItemObsidianShovel(int i, EnumToolObsidian enumToolMaterial) { super(i, 1, enumToolMaterial, blocksEffectiveAgainst); } public boolean canHarvestBlock(Block block) { if(block == Block.snow) { return true; } return block == Block.blockSnow; } static { blocksEffectiveAgainst = (new Block[] {Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium}); } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou have to update your Enum and Item classes with the new code. Your tools will take damage in 1.2.5, but due to a change, they won't in 1.3.1. I had the same problem and updated them, then they took damage appropriately.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumall my tools are normal items, but works normal like an pickaxe or so.
In the code is no error and when i start the game theres no error too.
package net.minecraft.src;
public class ItemCoSword extends Item
{
private int weaponDamage;
private final EnumCoToolMaterial toolMaterial;
public ItemCoSword(int par1, EnumCoToolMaterial par2EnumToolMaterial)
{
super(par1);
toolMaterial = par2EnumToolMaterial;
maxStackSize = 1;
setMaxDamage(par2EnumToolMaterial.getMaxUses());
weaponDamage = 10 + par2EnumToolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
}
I didn't think I needed to, but now it seems it would be easiest to add a button to the main inventory GUI. Is the only way to do this by editing the base files of GUIInventory or is there a ModLoader function to add a button to a previously existing GUI?
Please help, it is basically the last thing needed before the release!
Thanks!
Just make your entity class extend theirs. Except, new mobs are invisible at the moment without adding them into EntityTracker so you'll have to do that as well.
Check your PMs.
Blocks use blockID instead of shiftedIndex.
public int idDropped(int i, Random random, int j) { return mod_zombie.dirt.blockID; }Add one more} after the generateSurface method and before getVersion().
The title of the NPC tutorials are not green. Therefore they are not updated. Therefore they will not work. The top of the OP states not to ask about updates or I will get this thread locked.
Just don't add the AchievementList part of it.
Haven't tested it but it should work.
In the super statement in the constructor of the block class you need to add in the blockIndexInTexture parameter, j.
You need to edit RenderBiped. I haven't found another way to do it yet.
Do you mean you want to add a button to the player's inventory?
Just change the 0 next to the block's id in the public static final line of the block. Then delete the line
Have a look around in EntityPlayer. I think there is something in there for that.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhat do i have to edit in the class?
package net.minecraft.src; import org.lwjgl.opengl.GL11; public class RenderBiped extends RenderLiving { protected ModelBiped modelBipedMain; protected float field_77070_b; public RenderBiped(ModelBiped par1ModelBiped, float par2) { this(par1ModelBiped, par2, 1.0F); this.modelBipedMain = par1ModelBiped; } public RenderBiped(ModelBiped par1ModelBiped, float par2, float par3) { super(par1ModelBiped, par2); this.modelBipedMain = par1ModelBiped; this.field_77070_b = par3; } protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2) { super.renderEquippedItems(par1EntityLiving, par2); ItemStack var3 = par1EntityLiving.getHeldItem(); if (var3 != null) { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); float var4; if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) { var4 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); var4 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(var4, -var4, var4); } else if (var3.itemID == Item.bow.shiftedIndex) { var4 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(var4, -var4, var4); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else if (Item.itemsList[var3.itemID].isFull3D()) { var4 = 0.625F; GL11.glTranslatef(0.0F, 0.1875F, 0.0F); GL11.glScalef(var4, -var4, var4); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else { var4 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(var4, var4, var4); GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); } this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 0); if (var3.getItem().requiresMultipleRenderPasses()) { this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1); } GL11.glPopMatrix(); } } }btw. yesterday when i code it first, it works. the sword was on the right place.
Srry for my question but im not really good in Java ._.
Some block stores metadata on them, like torches, stairs, and other blocks like wool. If your structure is big, it will be hard to code it line by line. You can code it using loops, but if you're really lazy like me, you can use this.
Thanks
I actually do explain it. It is there, you just have to read it.
Actually, let me just test something.
together they are powerful beyond imagination."