Aha! I've found the code I mentioned, but recompiler doesn't like it. it is probably something small....error says "else without if".
protected int getDropItemId(int i, Random random, int j)
{
if (i == 0)
{
return Item.appleRed.shiftedIndex;
}
else
{
if (i == 1)
return mod_MangMod.orange.shiftedIndex;
}
else
{
if (i == 2)
return Item.melon.shiftedIndex;
}
else
{
if (i == 3)
return mod_MangMod.lemon.shiftedIndex;
}
else
{
if (i == 4)
return Block.pumpkin.shiftedIndex;
}
I have been a bit absent from the tutorials the last few days. I've had a look through the pages and I think everyone's issues have been solved. Please let me know if yours hasn't and I will look into it.
Woo! Thanks for this. Will come in useful... I have a few ideas. And I believe at least one of them is pretty original.
I had a problem. But I fixed it. I'll leave it there for the amusement factor, though.
Unrelated to the crops, I am having a problem with a flower. It's declared fine and all, (public static final, addName, registerBlock, addOverride, the works!) and I can access it via creative mode, but I can't for the life of me seem to get it to spawn in my world naturally. I've tried the following variations:
WorldGenFlowers:
public void generateFlowers(World world, Random random, int chunkX, int chunkZ)
{
/*-----------*/
/**Columbine**/
/*-----------*/
for(int columbine = 0; columbine < 120; ++columbine)
{
int columbineX = chunkX + random.nextInt(16) + 8;
int columbineY = random.nextInt(128);
int columbineZ = chunkZ + random.nextInt(16) + 8;
(new WorldGenFlowers(mod_Flower.plantColumbine.blockID)).generate(world, random, columbineX, columbineY, columbineZ);
}
}
Tried the above code without mod_Flower. added onto the front, (tried just plantColumbine.blockID) as it shouldn't be necessary anyways...
I've tried the above code with a copy of WorldGenMinable (renamed and whatnot) with stone changed to grass. (with the "vein size" variable, as expected.)
EDIT: Hmm. Maybe it's because generateFlowers isn't something within BaseMod. I'll try just adding it to the generateSurface. But I'm pretty sure it'll result in a crash or in a failure to create a new world though... Trying now.I was wrong, clearly.
Aha! I've found the code I mentioned, but recompiler doesn't like it. it is probably something small....error says "else without if".
protected int getDropItemId(int i, Random random, int j)
{
if (i == 0)
{
return Item.appleRed.shiftedIndex;
}
else
{
if (i == 1)
return mod_MangMod.orange.shiftedIndex;
}
else
{
if (i == 2)
return Item.melon.shiftedIndex;
}
else
{
if (i == 3)
return mod_MangMod.lemon.shiftedIndex;
}
else
{
if (i == 4)
return Block.pumpkin.shiftedIndex;
}
remember, blocks end in .blockId, not shiftedIndex.
move the ifs(i == #) to right after else, example:
package net.minecraft.src;
public enum EnumToolMaterialMod
{
SHADOWDIAMOND(10, 5500, 10.0F, 8, 100);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private EnumToolMaterialMod(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;
}
}
My ItemShadowTool
package net.minecraft.src;
public class ItemShadowTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialMod toolMaterial;
protected ItemShadowTool(int i, int j, EnumToolMaterialMod par3EnumToolMaterialMod, Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = par3EnumToolMaterialMod;
blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialMod.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialMod.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialMod.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)
{
for (int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if (blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
/**
* 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(2, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
My ItemShadowPick
package net.minecraft.src;
public class ItemShadowPick extends ItemShadowTool
{
private static Block blocksEffectiveAgainst[];
protected ItemShadowPick(int par1, EnumToolMaterialMod par2EnumToolMaterialMod)
{
super(par1, 2, par2EnumToolMaterialMod, blocksEffectiveAgainst);
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
if (par1Block == Block.obsidian)
{
return toolMaterial.getHarvestLevel() == 3;
}
if (par1Block == Block.blockDiamond || par1Block == Block.oreDiamond)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockGold || par1Block == Block.oreGold)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockSteel || par1Block == Block.oreIron)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.blockLapis || par1Block == Block.oreLapis)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.oreRedstone || par1Block == Block.oreRedstoneGlowing)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block.blockMaterial == Material.rock)
{
return true;
}
return par1Block.blockMaterial == Material.iron;
}
/**
* 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)
{
if (par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.rock))
{
return efficiencyOnProperMaterial;
}
else
{
return super.getStrVsBlock(par1ItemStack, par2Block);
}
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold,
Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail,
Block.railDetector, Block.railPowered
});
}
}
and my error
== MCP 6.2 (data: 6.2, client: 1.2.5, server: 1.2.5) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files (x86)\Java\jdk1.7.0_04\bin\javac" -Xlint:-options -deprecatio
n -g -source 1.6 -tar...' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_ShadowPack.java:30: error: constructor ItemP
ickaxe in class ItemPickaxe cannot be applied to given types;
public static final Item ShadowPick = new ItemPickaxe(799, EnumToolMaterialMod.S
HADOWDIAMOND).setItemName("shadowpick");
^
required: int,EnumToolMaterial
found: int,EnumToolMaterialMod
reason: actual argument EnumToolMaterialMod cannot be converted to EnumToolMat
erial by method invocation conversion
1 error
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
I appreciate your help
post your mod file, also, try putting the id of the pick to anything about 2011+
Oi...for an Innocent Villager, this guy isn't so innocent. So I go test him (no errors) and now he doesn't drop anything. AND, he won't flee from mobs (I don't think so anyway) and won't flee from me (could creative mode be doing that?) He SHOULD flee 16 blocks away from any mob/player. Any help?
innocentvillager
package net.minecraft.src;
import java.util.Random;
public class innocentvillager extends EntityCreature
{
public innocentvillager(World world)
{
super(world);
texture = "/mangmod/iv.png";
moveSpeed = 0.8F;
tasks.addTask(0, new EntityAISwimming(this));;
tasks.addTask(1, new EntityAIWander(this, 0.2F));
tasks.addTask(2, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 20F));
tasks.addTask(3, new EntityAIWatchClosest(this, net.minecraft.src.EntityMob.class, 20F));
tasks.addTask(4, new EntityAILookIdle(this));
tasks.addTask(5, new EntityAIOpenDoor(this, true));
tasks.addTask(6, new EntityAIAvoidEntity(this, net.minecraft.src.EntityMob.class, 16F, 0.25F, 0.3F));
tasks.addTask(7, new EntityAIAvoidEntity(this, net.minecraft.src.EntityPlayer.class, 16F, 0.25F, 0.3F));
}
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 20;
}
protected String getLivingSound()
{
return "mob.villager.default";
}
protected String getHurtSound()
{
return "mob.villager.defaulthurt";
}
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
protected int getDropItemId(int i, Random random, int j)
{
if (i == 0)
{
return Item.appleRed.shiftedIndex;
}
if (i == 1)
{
return mod_MangMod.orange.shiftedIndex;
}
if (i == 2)
{
return Item.melon.shiftedIndex;
}
if (i == 3)
{
return mod_MangMod.lemon.shiftedIndex;
}
if (i == 4)
{
return Block.pumpkin.blockID;
}
else
{
return 0;
}
}
protected boolean canDespawn()
{
return false;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.appleRed, 1);
}
private static final ItemStack defaultHeldItem;
}
Alright. Let me see the code for the 3 tool-related classes you made as well as your [i]mod_*[/i] class. Be sure to put them all in spoilers.
Ok so all the crossed out words are underlined in red squiggly thingies or in other words an error.
THIS IS THE EnumToolMaterialtitaniumsword.java
package net.minecraft.src;
public enum EnumToolMaterialtitaniumsword
{
TITANIUMSWORD(0, 59, 2.0F, 0, 15);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantibility;
private EnumToolMaterialtitaniumsword(
int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6; getEnchantability = 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;
}
}
This is the titaniumswordTool.java
package net.minecraft.src;
public class titaniumswordTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialtitaniumsword TITANIUMSWORD;
protected titaniumswordTool (int i, int j, EnumToolMaterialtitaniumsword par3EnumToolMaterialtitaniumsw
ord,
Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 4F; toolMaterial = par3EnumToolMaterialtitaniumsword;
blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialtitaniumsword.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialtitaniumsword.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialtitaniumsword.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
for (int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if (blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving
par3EntityLiving)
{
par1ItemStack.damageItem(2, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5,
EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantibility()
{
return toolMaterial.getEnchantibility();
}
}
This is the mod_james.java Don't worry, I put them in a rather orderly fasion XD
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
import java.util.Map;
import net.minecraft.client.
Minecraft;
import java.io.File;
public class mod_james extends BaseMod
{
public static final Block TitaniumBlock = new BlockTitaniumBlock(207, Material.wood).setBlockName("Aluminum Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Block ElementalBlock = new BlockElementalBlock(208, Material.wood).setBlockName("Elemental Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Item titaniumingotItem = new Item(25000).setItemName("Aluminum Ingot");
public static final Item joydrinkItem = new Itemjoydrink(24998, 6, 0.8f).setItemName("Joy Drink");
public static final Item titaniumcanItem = new Item(24999).setItemName("Aluminum Can");
public static final Item joybreadItem = new Itemjoybread(24997, 12, 0.9f).setItemName("Joy Bread");
public static final Item titaniumpickTool = new titaniumpickTool(24996, titaniumpickMaterial.TITANIUMPICK).setItemName("Aluminum Pickaxe");
public static final Item joyteaItem = new Itemjoytea(24995, 4, 0.8f).setItemName("Joy Tea");
public static final Item teaItem = new Item(24994).setItemName("Tea Leaves");
public static final Item unfiredpotItem = new Item(24993).setItemName("Unfired China");
public static final Item potItem = new Item(24992).setItemName("China");
public static final Item plantcoalItem = new Item(24991).setItemName("Plant-Coal");
public static final Item plantcharItem = new Item(24990).setItemName("Plant-Charcoal");
public static final Item titaniumaxeTool = new titaniumaxeTool(24989, titaniumaxeMaterial.TITANIUMAXE).setItemName("Aluminum Axe");
public static final Item meatbitsItem = new Item(24988).setItemName("Crushed Meat");
public static final Item pastaItem = new Itempasta(24987, 20, 10F).setItemName("Spaghetti");
public static final Item noodlesItem = new Item(24986).setItemName("Linguini");
public static final Item cookedmeatbitsItem = new Item(24985).setItemName("Cooked Crushed Meat");
public static final Item titaniumswordItem = new ItemtitaniumswordSword(24984, EnumToolMaterialtitaniumsword.TITANIUMSWORD).setItemName("Aluminum Sword");
public static final Item elementalingotItem = new Item(24983).setItemName("Elemental Ingot");
public static final Item fireingotItem = new Item(24982).setItemName("Elemental Ingot Fire");
public static final Item elementalfireHelmet = (new elementalfireItemArmor(24981,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireHelmet.png")).setItemName("elementalfireHelmet");
public static final Item elementalfireChest = (new elementalfireItemArmor(24980,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfirePlatebody.png")).setItemName("elementalfireChest");
public static final Item elementalfirePants = (new elementalfireItemArmor (24979, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),2)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireLeggings.png")).setItemName("elementalfirePants");
public static final Item elementalfireBoots = (new elementalfireItemArmor (24978, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireBoots.png")).setItemName("elementalfireBoots");
// The second number for a food is the number of chickenlegs it fills. Say, if i put 1 there, it would fill half a chickenleg.
@Override
public String getVersion() {
return "Joymod v1.2.5";
}
@Override
public void load()
{
ModLoader.registerEntityID(Entityjoy.class, "Joy", ModLoader.getUniqueEntityId(), 0xFFFFFF, 0xB57EDC); // the first hexdecimal is the background color for the spawner egg. The second hexdecimal is the dots on the spawner egg.
ModLoader.addSpawn(Entityjoy.class, 10, 0, 1, EnumCreatureType.monster);//The second number is minumum per. The third is maximum.
ModLoader.addRecipe(new ItemStack(TitaniumBlock, 2), new Object[]{
"DDD", "DDD", "DDD",
'D',Block.dirt
});
ModLoader.addSmelting(TitaniumBlock.blockID, new ItemStack(titaniumingotItem, 1));
}
public void addRenderer(Map map)
{
map.put(Entityjoy.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(Entityme.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public int addFuel(int q, int w)
{
if(q == plantcoalItem.shiftedIndex)
{
return 2000;
}
if(q == plantcharItem.shiftedIndex)
{
return 2000;
}
return 0;
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 6; i++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(TitaniumBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
for(int i2 = 0; i2 < 6; i2++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(ElementalBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
Minecraft mc = ModLoader.getMinecraftInstance();
// RECORD JOYSOUND!!!!!!!!
//mc.installResource("newsound/joymod/joyhurt.ogg", new File(mc.mcDataDir, "resources/newsound/joymod/joyhurt.ogg"));
Sorry, I don't think that code works for entities, just for blocks with damage values. Meaning if the damage value is 0 it will drop a red apple, if the damage value equals to 1, it will drop an orange. For entities, you should look in either EntityCow or EntitySpider.
Ok, but what about him not running like he is supposed to?
Ok so all the crossed out words are underlined in red squiggly thingies or in other words an error.
THIS IS THE EnumToolMaterialtitaniumsword.java
package net.minecraft.src;
public enum EnumToolMaterialtitaniumsword
{
TITANIUMSWORD(0, 59, 2.0F, 0, 15);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantibility;
private EnumToolMaterialtitaniumsword(
int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6; getEnchantability = 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;
}
}
This is the titaniumswordTool.java
package net.minecraft.src;
public class titaniumswordTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialtitaniumsword TITANIUMSWORD;
protected titaniumswordTool (int i, int j, EnumToolMaterialtitaniumsword par3EnumToolMaterialtitaniumsw
ord,
Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 4F; toolMaterial = par3EnumToolMaterialtitaniumsword;
blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialtitaniumsword.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialtitaniumsword.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialtitaniumsword.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
for (int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if (blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving
par3EntityLiving)
{
par1ItemStack.damageItem(2, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5,
EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantibility()
{
return toolMaterial.getEnchantibility();
}
}
This is the mod_james.java Don't worry, I put them in a rather orderly fasion XD
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
import java.util.Map;
import net.minecraft.client.
Minecraft;
import java.io.File;
public class mod_james extends BaseMod
{
public static final Block TitaniumBlock = new BlockTitaniumBlock(207, Material.wood).setBlockName("Aluminum Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Block ElementalBlock = new BlockElementalBlock(208, Material.wood).setBlockName("Elemental Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Item titaniumingotItem = new Item(25000).setItemName("Aluminum Ingot");
public static final Item joydrinkItem = new Itemjoydrink(24998, 6, 0.8f).setItemName("Joy Drink");
public static final Item titaniumcanItem = new Item(24999).setItemName("Aluminum Can");
public static final Item joybreadItem = new Itemjoybread(24997, 12, 0.9f).setItemName("Joy Bread");
public static final Item titaniumpickTool = new titaniumpickTool(24996, titaniumpickMaterial.TITANIUMPICK).setItemName("Aluminum Pickaxe");
public static final Item joyteaItem = new Itemjoytea(24995, 4, 0.8f).setItemName("Joy Tea");
public static final Item teaItem = new Item(24994).setItemName("Tea Leaves");
public static final Item unfiredpotItem = new Item(24993).setItemName("Unfired China");
public static final Item potItem = new Item(24992).setItemName("China");
public static final Item plantcoalItem = new Item(24991).setItemName("Plant-Coal");
public static final Item plantcharItem = new Item(24990).setItemName("Plant-Charcoal");
public static final Item titaniumaxeTool = new titaniumaxeTool(24989, titaniumaxeMaterial.TITANIUMAXE).setItemName("Aluminum Axe");
public static final Item meatbitsItem = new Item(24988).setItemName("Crushed Meat");
public static final Item pastaItem = new Itempasta(24987, 20, 10F).setItemName("Spaghetti");
public static final Item noodlesItem = new Item(24986).setItemName("Linguini");
public static final Item cookedmeatbitsItem = new Item(24985).setItemName("Cooked Crushed Meat");
public static final Item titaniumswordItem = new ItemtitaniumswordSword(24984, EnumToolMaterialtitaniumsword.TITANIUMSWORD).setItemName("Aluminum Sword");
public static final Item elementalingotItem = new Item(24983).setItemName("Elemental Ingot");
public static final Item fireingotItem = new Item(24982).setItemName("Elemental Ingot Fire");
public static final Item elementalfireHelmet = (new elementalfireItemArmor(24981,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireHelmet.png")).setItemName("elementalfireHelmet");
public static final Item elementalfireChest = (new elementalfireItemArmor(24980,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfirePlatebody.png")).setItemName("elementalfireChest");
public static final Item elementalfirePants = (new elementalfireItemArmor (24979, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),2)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireLeggings.png")).setItemName("elementalfirePants");
public static final Item elementalfireBoots = (new elementalfireItemArmor (24978, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireBoots.png")).setItemName("elementalfireBoots");
// The second number for a food is the number of chickenlegs it fills. Say, if i put 1 there, it would fill half a chickenleg.
@Override
public String getVersion() {
return "Joymod v1.2.5";
}
@Override
public void load()
{
ModLoader.registerEntityID(Entityjoy.class, "Joy", ModLoader.getUniqueEntityId(), 0xFFFFFF, 0xB57EDC); // the first hexdecimal is the background color for the spawner egg. The second hexdecimal is the dots on the spawner egg.
ModLoader.addSpawn(Entityjoy.class, 10, 0, 1, EnumCreatureType.monster);//The second number is minumum per. The third is maximum.
ModLoader.addRecipe(new ItemStack(TitaniumBlock, 2), new Object[]{
"DDD", "DDD", "DDD",
'D',Block.dirt
});
ModLoader.addSmelting(TitaniumBlock.blockID, new ItemStack(titaniumingotItem, 1));
}
public void addRenderer(Map map)
{
map.put(Entityjoy.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(Entityme.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public int addFuel(int q, int w)
{
if(q == plantcoalItem.shiftedIndex)
{
return 2000;
}
if(q == plantcharItem.shiftedIndex)
{
return 2000;
}
return 0;
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 6; i++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(TitaniumBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
for(int i2 = 0; i2 < 6; i2++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(ElementalBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
Minecraft mc = ModLoader.getMinecraftInstance();
// RECORD JOYSOUND!!!!!!!!
//mc.installResource("newsound/joymod/joyhurt.ogg", new File(mc.mcDataDir, "resources/newsound/joymod/joyhurt.ogg"));
}
}
Thanks!
You're missing a class, take another look at the tools section, you need the enum,toolname,and the actual tool.
For the ore generation can you be more specific on how to edit the size of the vien. I don't see any 3's inside of a bracket (like you said) when I'm trying to mod my ore generation. I've tested it out, and your default code gives me more ore in the vien than a coal vien for my ore which is rarer than diamonds. I would really like to know how to fix this. Thanks =].
Bump: Can someone please help me resolve this issue ^^
Oi...for an Innocent Villager, this guy isn't so innocent. So I go test him and he won't flee from mobs (I don't think so anyway) and won't flee from me (could creative mode be doing that?) He SHOULD flee 16 blocks away from any mob/player. Any help?
innocentvillager
package net.minecraft.src;
import java.util.Random;
public class innocentvillager extends EntityCreature
{
public innocentvillager(World world)
{
super(world);
texture = "/mangmod/iv.png";
moveSpeed = 0.8F;
tasks.addTask(0, new EntityAISwimming(this));;
tasks.addTask(1, new EntityAIWander(this, 0.2F));
tasks.addTask(2, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 20F));
tasks.addTask(3, new EntityAIWatchClosest(this, net.minecraft.src.EntityMob.class, 20F));
tasks.addTask(4, new EntityAILookIdle(this));
tasks.addTask(5, new EntityAIOpenDoor(this, true));
tasks.addTask(6, new EntityAIAvoidEntity(this, net.minecraft.src.EntityMob.class, 16F, 0.25F, 0.3F));
tasks.addTask(7, new EntityAIAvoidEntity(this, net.minecraft.src.EntityPlayer.class, 16F, 0.25F, 0.3F));
}
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 20;
}
protected String getLivingSound()
{
return "mob.villager.default";
}
protected String getHurtSound()
{
return "mob.villager.defaulthurt";
}
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
protected int getDropItemId(int i, Random random, int j)
{
if (i == 0)
{
return Item.appleRed.shiftedIndex;
}
if (i == 1)
{
return mod_MangMod.orange.shiftedIndex;
}
if (i == 2)
{
return Item.melon.shiftedIndex;
}
if (i == 3)
{
return mod_MangMod.lemon.shiftedIndex;
}
if (i == 4)
{
return Block.pumpkin.blockID;
}
else
{
return 0;
}
}
protected boolean canDespawn()
{
return false;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.appleRed, 1);
}
private static final ItemStack defaultHeldItem;
}
Look at the first spoiler. Thats the enumtoolmaterial thing
Oh wait, you're doing a sword only, correct? If so you only need the enum, and the tool.
In your enum, where it says "getEnchantability" change that to just enchantability.
Oi...for an Innocent Villager, this guy isn't so innocent. So I go test him and he won't flee from mobs (I don't think so anyway) and won't flee from me (could creative mode be doing that?) He SHOULD flee 16 blocks away from any mob/player. Any help?
innocentvillager
package net.minecraft.src;
import java.util.Random;
public class innocentvillager extends EntityCreature
{
public innocentvillager(World world)
{
super(world);
texture = "/mangmod/iv.png";
moveSpeed = 0.8F;
tasks.addTask(0, new EntityAISwimming(this));;
tasks.addTask(1, new EntityAIWander(this, 0.2F));
tasks.addTask(2, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 20F));
tasks.addTask(3, new EntityAIWatchClosest(this, net.minecraft.src.EntityMob.class, 20F));
tasks.addTask(4, new EntityAILookIdle(this));
tasks.addTask(5, new EntityAIOpenDoor(this, true));
tasks.addTask(6, new EntityAIAvoidEntity(this, net.minecraft.src.EntityMob.class, 16F, 0.25F, 0.3F));
tasks.addTask(7, new EntityAIAvoidEntity(this, net.minecraft.src.EntityPlayer.class, 16F, 0.25F, 0.3F));
}
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 20;
}
protected String getLivingSound()
{
return "mob.villager.default";
}
protected String getHurtSound()
{
return "mob.villager.defaulthurt";
}
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
protected int getDropItemId(int i, Random random, int j)
{
if (i == 0)
{
return Item.appleRed.shiftedIndex;
}
if (i == 1)
{
return mod_MangMod.orange.shiftedIndex;
}
if (i == 2)
{
return Item.melon.shiftedIndex;
}
if (i == 3)
{
return mod_MangMod.lemon.shiftedIndex;
}
if (i == 4)
{
return Block.pumpkin.blockID;
}
else
{
return 0;
}
}
protected boolean canDespawn()
{
return false;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.appleRed, 1);
}
private static final ItemStack defaultHeldItem;
}
You may want to try putting the "avoid" task closer to the top (so, instead of task 6 and 7, you would have them as 1 and 2) not sure if it will work, but you can try it.
1. Your texture path cannot be like /mcp/eclipse and all that stuff, do you want your code to be looking for something called mcp when you install your mod on a Minecraft? I wouldn't think so... Therefore it cannot be C:\Users\etc either because it will look after your username. Minecraft code is looking for textures within the minecraft.jar. So if you've been looking in minecraft.jar you might have noticed that terrain.png is just for itself, and items.png can be found in the gui folder.
ModLoader.addOverride("/terrain.png" or "/gui/items.png", "/path/to/some.png");
Do you get it? So if you want your textures in a folder called MyMod, you just write the path according from inside the minecraft.jar. Like "/MyMod/block.png".
Thanks, my code finally works
on a side note, could some one provide me with an index of the blocks with their hardness, resistance, etc.?
looked at block. java but its hard trying to find everything.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumprotected int getDropItemId(int i, Random random, int j) { if (i == 0) { return Item.appleRed.shiftedIndex; } else { if (i == 1) return mod_MangMod.orange.shiftedIndex; } else { if (i == 2) return Item.melon.shiftedIndex; } else { if (i == 3) return mod_MangMod.lemon.shiftedIndex; } else { if (i == 4) return Block.pumpkin.shiftedIndex; }-
View User Profile
-
View Posts
-
Send Message
Retired StaffWoo! Thanks for this. Will come in useful... I have a few ideas. And I believe at least one of them is pretty original.
I had a problem. But I fixed it. I'll leave it there for the amusement factor, though.
Unrelated to the crops, I am having a problem with a flower. It's declared fine and all, (public static final, addName, registerBlock, addOverride, the works!) and I can access it via creative mode, but I can't for the life of me seem to get it to spawn in my world naturally. I've tried the following variations:
public void generateFlowers(World world, Random random, int chunkX, int chunkZ) { /*-----------*/ /**Columbine**/ /*-----------*/ for(int columbine = 0; columbine < 120; ++columbine) { int columbineX = chunkX + random.nextInt(16) + 8; int columbineY = random.nextInt(128); int columbineZ = chunkZ + random.nextInt(16) + 8; (new WorldGenFlowers(mod_Flower.plantColumbine.blockID)).generate(world, random, columbineX, columbineY, columbineZ); } }Tried the above code without mod_Flower. added onto the front, (tried just plantColumbine.blockID) as it shouldn't be necessary anyways...
I've tried the above code with a copy of WorldGenMinable (renamed and whatnot) with stone changed to grass. (with the "vein size" variable, as expected.)
EDIT: Hmm. Maybe it's because generateFlowers isn't something within BaseMod. I'll try just adding it to the generateSurface.
But I'm pretty sure it'll result in a crash or in a failure to create a new world though... Trying now.I was wrong, clearly.remember, blocks end in .blockId, not shiftedIndex.
move the ifs(i == #) to right after else, example:
else if(i == 4){ return Block.pumpkin.blockId; }-
View User Profile
-
View Posts
-
Send Message
Curse Premiumpackage net.minecraft.src; import java.util.Random; public class innocentvillager extends EntityCreature { public innocentvillager(World world) { super(world); texture = "/mangmod/iv.png"; moveSpeed = 0.8F; tasks.addTask(0, new EntityAISwimming(this));; tasks.addTask(1, new EntityAIWander(this, 0.2F)); tasks.addTask(2, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 20F)); tasks.addTask(3, new EntityAIWatchClosest(this, net.minecraft.src.EntityMob.class, 20F)); tasks.addTask(4, new EntityAILookIdle(this)); tasks.addTask(5, new EntityAIOpenDoor(this, true)); tasks.addTask(6, new EntityAIAvoidEntity(this, net.minecraft.src.EntityMob.class, 16F, 0.25F, 0.3F)); tasks.addTask(7, new EntityAIAvoidEntity(this, net.minecraft.src.EntityPlayer.class, 16F, 0.25F, 0.3F)); } public boolean isAIEnabled() { return true; } public int getMaxHealth() { return 20; } protected String getLivingSound() { return "mob.villager.default"; } protected String getHurtSound() { return "mob.villager.defaulthurt"; } protected String getDeathSound() { return "mob.villager.defaultdeath"; } protected int getDropItemId(int i, Random random, int j) { if (i == 0) { return Item.appleRed.shiftedIndex; } else if (i == 1){ return mod_MangMod.orange.shiftedIndex; } else if (i == 2){ return Item.melon.shiftedIndex; } else if (i == 3){ return mod_MangMod.lemon.shiftedIndex; } else if (i == 4){ return Block.pumpkin.blockID; } } protected boolean canDespawn() { return false; } public ItemStack getHeldItem() { return defaultHeldItem; } static { defaultHeldItem = new ItemStack(Item.appleRed, 1); } private static final ItemStack defaultHeldItem; }post your mod file, also, try putting the id of the pick to anything about 2011+
-
View User Profile
-
View Posts
-
Send Message
Curse Premiuminnocentvillager
package net.minecraft.src; import java.util.Random; public class innocentvillager extends EntityCreature { public innocentvillager(World world) { super(world); texture = "/mangmod/iv.png"; moveSpeed = 0.8F; tasks.addTask(0, new EntityAISwimming(this));; tasks.addTask(1, new EntityAIWander(this, 0.2F)); tasks.addTask(2, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 20F)); tasks.addTask(3, new EntityAIWatchClosest(this, net.minecraft.src.EntityMob.class, 20F)); tasks.addTask(4, new EntityAILookIdle(this)); tasks.addTask(5, new EntityAIOpenDoor(this, true)); tasks.addTask(6, new EntityAIAvoidEntity(this, net.minecraft.src.EntityMob.class, 16F, 0.25F, 0.3F)); tasks.addTask(7, new EntityAIAvoidEntity(this, net.minecraft.src.EntityPlayer.class, 16F, 0.25F, 0.3F)); } public boolean isAIEnabled() { return true; } public int getMaxHealth() { return 20; } protected String getLivingSound() { return "mob.villager.default"; } protected String getHurtSound() { return "mob.villager.defaulthurt"; } protected String getDeathSound() { return "mob.villager.defaultdeath"; } protected int getDropItemId(int i, Random random, int j) { if (i == 0) { return Item.appleRed.shiftedIndex; } if (i == 1) { return mod_MangMod.orange.shiftedIndex; } if (i == 2) { return Item.melon.shiftedIndex; } if (i == 3) { return mod_MangMod.lemon.shiftedIndex; } if (i == 4) { return Block.pumpkin.blockID; } else { return 0; } } protected boolean canDespawn() { return false; } public ItemStack getHeldItem() { return defaultHeldItem; } static { defaultHeldItem = new ItemStack(Item.appleRed, 1); } private static final ItemStack defaultHeldItem; }Ok so all the crossed out words are underlined in red squiggly thingies or in other words an error.
package net.minecraft.src;
public enum EnumToolMaterialtitaniumsword
{
TITANIUMSWORD(0, 59, 2.0F, 0, 15);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantibility;
private EnumToolMaterialtitaniumsword(
int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
getEnchantability= 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;}
}
This is the titaniumswordTool.java
package net.minecraft.src;
public class titaniumswordTool extends Item
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialtitaniumsword TITANIUMSWORD;
protected titaniumswordTool (int i, int j, EnumToolMaterialtitaniumsword par3EnumToolMaterialtitaniumsw
ord,
Block par4ArrayOfBlock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial= par3EnumToolMaterialtitaniumsword;blocksEffectiveAgainst = par4ArrayOfBlock;
maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialtitaniumsword.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialtitaniumsword.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialtitaniumsword.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
for (int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if (blocksEffectiveAgainst[i] == par2Block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving
par3EntityLiving)
{
par1ItemStack.damageItem(2, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5,
EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
public int getDamageVsEntity(Entity par1Entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantibility()
{
return
toolMaterial.getEnchantibility();}
}
This is the mod_james.java Don't worry, I put them in a rather orderly fasion XD
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
import java.util.Map;
import net.minecraft.client.
Minecraft;
import java.io.File;
public class mod_james extends BaseMod
{
public static final Block TitaniumBlock = new BlockTitaniumBlock(207, Material.wood).setBlockName("Aluminum Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Block ElementalBlock = new BlockElementalBlock(208, Material.wood).setBlockName("Elemental Ore").setStepSound(Block.soundStoneFootstep).setResistance(75F). setHardness(25F);
public static final Item titaniumingotItem = new Item(25000).setItemName("Aluminum Ingot");
public static final Item joydrinkItem = new Itemjoydrink(24998, 6, 0.8f).setItemName("Joy Drink");
public static final Item titaniumcanItem = new Item(24999).setItemName("Aluminum Can");
public static final Item joybreadItem = new Itemjoybread(24997, 12, 0.9f).setItemName("Joy Bread");
public static final Item titaniumpickTool = new titaniumpickTool(24996, titaniumpickMaterial.TITANIUMPICK).setItemName("Aluminum Pickaxe");
public static final Item joyteaItem = new Itemjoytea(24995, 4, 0.8f).setItemName("Joy Tea");
public static final Item teaItem = new Item(24994).setItemName("Tea Leaves");
public static final Item unfiredpotItem = new Item(24993).setItemName("Unfired China");
public static final Item potItem = new Item(24992).setItemName("China");
public static final Item plantcoalItem = new Item(24991).setItemName("Plant-Coal");
public static final Item plantcharItem = new Item(24990).setItemName("Plant-Charcoal");
public static final Item titaniumaxeTool = new titaniumaxeTool(24989, titaniumaxeMaterial.TITANIUMAXE).setItemName("Aluminum Axe");
public static final Item meatbitsItem = new Item(24988).setItemName("Crushed Meat");
public static final Item pastaItem = new Itempasta(24987, 20, 10F).setItemName("Spaghetti");
public static final Item noodlesItem = new Item(24986).setItemName("Linguini");
public static final Item cookedmeatbitsItem = new Item(24985).setItemName("Cooked Crushed Meat");
public static final Item titaniumswordItem = new ItemtitaniumswordSword(24984, EnumToolMaterialtitaniumsword.TITANIUMSWORD).setItemName("Aluminum Sword");
public static final Item elementalingotItem = new Item(24983).setItemName("Elemental Ingot");
public static final Item fireingotItem = new Item(24982).setItemName("Elemental Ingot Fire");
public static final Item elementalfireHelmet = (new elementalfireItemArmor(24981,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireHelmet.png")).setItemName("elementalfireHelmet");
public static final Item elementalfireChest = (new elementalfireItemArmor(24980,elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_1"), 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfirePlatebody.png")).setItemName("elementalfireChest");
public static final Item elementalfirePants = (new elementalfireItemArmor (24979, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),2)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireLeggings.png")).setItemName("elementalfirePants");
public static final Item elementalfireBoots = (new elementalfireItemArmor (24978, elementalfireArmorMaterial.ELEMENTALFIRE, ModLoader.addArmor("/armor/elementalfire_2"),3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "elementalfireBoots.png")).setItemName("elementalfireBoots");
// The second number for a food is the number of chickenlegs it fills. Say, if i put 1 there, it would fill half a chickenleg.
@Override
public String getVersion() {
return "Joymod v1.2.5";
}
@Override
public void load()
{
ModLoader.registerEntityID(Entityjoy.class, "Joy", ModLoader.getUniqueEntityId(), 0xFFFFFF, 0xB57EDC); // the first hexdecimal is the background color for the spawner egg. The second hexdecimal is the dots on the spawner egg.
ModLoader.addSpawn(Entityjoy.class, 10, 0, 1, EnumCreatureType.monster);//The second number is minumum per. The third is maximum.
ModLoader.registerEntityID(Entityme.class, "Me", ModLoader.getUniqueEntityId(), 0xC0C0C0, 0x4876ff);
ModLoader.addSpawn(Entityme.class, 10, 0, 1, EnumCreatureType.monster);
ModLoader.registerBlock(TitaniumBlock);
ModLoader.registerBlock(ElementalBlock);
ModLoader.addName(TitaniumBlock, "Aluminum Ore");
ModLoader.addName(titaniumingotItem, "Aluminum Ingot");
ModLoader.addName(joydrinkItem, "Joy Drink");
ModLoader.addName(titaniumcanItem, "Aluminum Can");
ModLoader.addName(titaniumpickTool, "Aluminum Pickaxe");
ModLoader.addName(joybreadItem, "Joy Bread");
ModLoader.addName(joyteaItem, "Joy Tea");
ModLoader.addName(teaItem, "Tea Leaves");
ModLoader.addName(unfiredpotItem, "Unfired China");
ModLoader.addName(potItem, "China");
ModLoader.addName(plantcoalItem, "Plant-Coal");
ModLoader.addName(plantcharItem, "Plant-Charcoal");
ModLoader.addName(titaniumaxeTool, "Aluminum Axe");
ModLoader.addName(meatbitsItem, "Crushed Meat");
ModLoader.addName(pastaItem, "Spaghetti");
ModLoader.addName(cookedmeatbitsItem, "Cooked Crushed Meat");
ModLoader.addName(noodlesItem, "Linguini");
ModLoader.addName(titaniumswordItem, "Aluminum Sword");
ModLoader.addName(elementalingotItem, "Elemental Ingot");
ModLoader.addName(fireingotItem, "Elemental Ingot-Fire");
ModLoader.addName(elementalfireHelmet, "Elemental Helmet-Fire");
ModLoader.addName(elementalfireChest, "Elemental Chestplate-Fire");
ModLoader.addName(elementalfirePants, "Elemental Leggings-Fire");
ModLoader.addName(elementalfireBoots, "Elemental Boots-Fire");
TitaniumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "titaniumore.png");
ElementalBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "elementalore.png");
titaniumingotItem.iconIndex = ModLoader.addOverride("/gui/items.png", "titaniumingot.png");
joydrinkItem.iconIndex = ModLoader.addOverride("/gui/items.png", "joydrink.png");
titaniumcanItem.iconIndex = ModLoader.addOverride("/gui/items.png", "titaniumcan.png");
joybreadItem.iconIndex = ModLoader.addOverride("/gui/items.png", "joybread.png");
titaniumpickTool.iconIndex = ModLoader.addOverride("/gui/items.png", "titaniumpick.png");
joyteaItem.iconIndex = ModLoader.addOverride("/gui/items.png", "joytea.png");
teaItem.iconIndex = ModLoader.addOverride("/gui/items.png", "tea.png");
unfiredpotItem.iconIndex = ModLoader.addOverride("/gui/items.png", "unfiredchina.png");
potItem.iconIndex = ModLoader.addOverride("/gui/items.png", "china.png");
plantcoalItem.iconIndex = ModLoader.addOverride("/gui/items.png", "plantcoal.png");
plantcharItem.iconIndex = ModLoader.addOverride("/gui/items.png", "plantchar.png");
titaniumaxeTool.iconIndex = ModLoader.addOverride("/gui/items.png", "titaniumaxe.png");
meatbitsItem.iconIndex = ModLoader.addOverride("/gui/items.png", "meatbits.png");
pastaItem.iconIndex = ModLoader.addOverride("/gui/items.png", "pasta.png");
cookedmeatbitsItem.iconIndex = ModLoader.addOverride("/gui/items.png", "cookedmeatbits.png");
noodlesItem.iconIndex = ModLoader.addOverride("/gui/items.png", "noodles.png");
titaniumswordItem.iconIndex = ModLoader.addOverride("/gui/items.png", "titaniumsword.png");
elementalingotItem.iconIndex = ModLoader.addOverride("/gui/items.png", "elementalingot.png");
fireingotItem.iconIndex = ModLoader.addOverride("/gui/items.png", "fireingot.png");
// REMINDER! ModLoader.addSmelting(tutorialItem.shiftedIndex, new ItemStack(Item.diamond, 64));
ModLoader.addSmelting(TitaniumBlock.blockID, new ItemStack(titaniumingotItem, 1) );
ModLoader.addSmelting(unfiredpotItem.shiftedIndex, new ItemStack(potItem, 1));
ModLoader.addSmelting(meatbitsItem.shiftedIndex, new ItemStack(cookedmeatbitsItem, 1));
ModLoader.addSmelting(ElementalBlock.blockID, new ItemStack(elementalingotItem, 1));
ModLoader.addRecipe(new ItemStack (elementalfireChest, 1), (new Object[] {"X X", "XXX", "XXX", Character.valueOf('X'), fireingotItem}));
ModLoader.addRecipe(new ItemStack (elementalfirePants, 1), (new Object[] {"XXX", "X X", "X X", Character.valueOf('X'), fireingotItem}));
ModLoader.addRecipe(new ItemStack (elementalfireBoots, 1), (new Object[] {"X X", "X X", Character.valueOf('X'), fireingotItem}));
ModLoader.addRecipe(new ItemStack(elementalfireHelmet, 1), new Object[]{
"XXX", "X X",
'X', fireingotItem
});
ModLoader.addRecipe(new ItemStack(fireingotItem, 1), new Object[]{
"T", "E",
'T', elementalingotItem, 'E', Item.bucketLava
});
ModLoader.addRecipe(new ItemStack(titaniumswordItem, 1), new Object[]{
"T", "T", "W",
'T', titaniumingotItem, 'W', Item.stick
});
ModLoader.addRecipe(new ItemStack(pastaItem, 1), new Object[]{
"W", "D", "Q",
'W', noodlesItem, 'D', cookedmeatbitsItem, 'Q', Item.bowlEmpty
});
ModLoader.addRecipe(new ItemStack(noodlesItem, 4), new Object[]{
" W", " W ", "W ",
'W', Item.wheat
});
ModLoader.addRecipe(new ItemStack(noodlesItem, 4), new Object[]{
"W ", " W ", " W",
'W', Item.wheat
});
ModLoader.addRecipe(new ItemStack(pastaItem, 1), new Object[]{
"D", "W", "Q",
'D', cookedmeatbitsItem, 'W', noodlesItem, 'Q', Item.bowlEmpty
});
ModLoader.addRecipe(new ItemStack(titaniumaxeTool, 1), new Object[]{
" TT", " PT", " P ",
'T', titaniumingotItem, 'P', Item.stick
});
ModLoader.addRecipe(new ItemStack(meatbitsItem, 1), new Object[]{
"T",
'T', Item.beefRaw
});
ModLoader.addRecipe(new ItemStack(meatbitsItem, 1), new Object[]{
"T",
'T', Item.porkRaw
});
ModLoader.addRecipe(new ItemStack(meatbitsItem, 1), new Object[]{
"T",
'T', Item.chickenRaw
});
ModLoader.addRecipe(new ItemStack(titaniumaxeTool, 1), new Object[]{
"TT ", "TP ", " P ",
'T', titaniumingotItem, 'P', Item.stick
});
ModLoader.addRecipe(new ItemStack(plantcoalItem, 2), new Object[]{
"SSS", "SAS", "SSS",
'S', Item.seeds, 'A', Item.coal
});
ModLoader.addRecipe(new ItemStack(plantcharItem, 2), new Object[]{
"SSS", "SAS", "SSS",
'S', Item.seeds, 'A', new ItemStack(Item.coal, 1, 1)
});
ModLoader.addRecipe(new ItemStack(joyteaItem, 1), new Object[]{
"W", "T", "P",
'T', teaItem, 'W', Item.bucketWater, 'P', potItem
});
ModLoader.addRecipe(new ItemStack(joyteaItem, 1), new Object[]{
"T", "W", "P",
'T', teaItem, 'W', Item.bucketWater, 'P', potItem
});
ModLoader.addRecipe(new ItemStack(unfiredpotItem, 2), new Object[]{
"C C", "C C", "CCC",
'C', Item.clay
});
ModLoader.addRecipe(new ItemStack(teaItem, 1), new Object[]{
"L",
'L', Block.leaves
});
ModLoader.addRecipe(new ItemStack(titaniumpickTool, 1), new Object[]{
"TTT", " O ", " O ",
'T', titaniumingotItem, 'O', Item.stick
});
ModLoader.addRecipe(new ItemStack(joybreadItem, 2), new Object[]{
"S", "Q", "W",
'S', Item.sugar, 'Q', Item.bread,'W', Item.paper
});
ModLoader.addRecipe(new ItemStack(joydrinkItem, 1), new Object[]{
"W", "S", "T",
'S', Item.sugar, 'T', titaniumcanItem, 'W', Item.bucketWater
});
ModLoader.addRecipe(new ItemStack(joydrinkItem, 1), new Object[]{
"S", "W", "T",
'S', Item.sugar, 'T', titaniumcanItem, 'W', Item.bucketWater
});
ModLoader.addRecipe(new ItemStack(titaniumcanItem, 8), new Object[]{
"FFF", "F F", "FFF",
'F',titaniumingotItem
});
ModLoader.addRecipe(new ItemStack(TitaniumBlock, 2), new Object[]{
"DDD", "DDD", "DDD",
'D',Block.dirt
});
ModLoader.addSmelting(TitaniumBlock.blockID, new ItemStack(titaniumingotItem, 1));
}
public void addRenderer(Map map)
{
map.put(Entityjoy.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(Entityme.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public int addFuel(int q, int w)
{
if(q == plantcoalItem.shiftedIndex)
{
return 2000;
}
if(q == plantcharItem.shiftedIndex)
{
return 2000;
}
return 0;
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 6; i++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(TitaniumBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
for(int i2 = 0; i2 < 6; i2++)
{
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(ElementalBlock.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
Minecraft mc = ModLoader.getMinecraftInstance();
// RECORD JOYSOUND!!!!!!!!
//mc.installResource("newsound/joymod/joyhurt.ogg", new File(mc.mcDataDir, "resources/newsound/joymod/joyhurt.ogg"));
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOk, but what about him not running like he is supposed to?
You're missing a class, take another look at the tools section, you need the enum,toolname,and the actual tool.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBump: Can someone please help me resolve this issue ^^
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBumpedy Bump.
Look at the first spoiler. Thats the enumtoolmaterial thing
Change the 25 to a 7(the spawn amount for diamond) and the y to 16 so it only spawns at 16 or lower.
Oh wait, you're doing a sword only, correct? If so you only need the enum, and the tool.
In your enum, where it says "getEnchantability" change that to just enchantability.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBumpedy Bump Bump.
For the tools to be enchantable, register them like this in the mod_Namehere class.
public static final Item newsword = ItemSword(600).setItemName("Sword);Along with the EnumToolMaterial namehere. Didn't really work with forge much.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou may want to try putting the "avoid" task closer to the top (so, instead of task 6 and 7, you would have them as 1 and 2) not sure if it will work, but you can try it.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCool, I was thinking something like that, as I think that something like that happened when I was trying to make a mob with the new AI
And in the future, please try to be more patient, at least wait for Techguy to post before you bump your post
Thanks, my code finally works
on a side note, could some one provide me with an index of the blocks with their hardness, resistance, etc.?
looked at block. java but its hard trying to find everything.