Fixed the addRecipe issue, it was in the wrong section of my mod_Class. Still getting the same issue with /image.png not getting found. I opened minecraft.jar with WinRar and put in my 3 image files.
Here is my current code (Yes I realize that I shouldn't have capitalized the first letter of the image name, but that's what it's named right now.)
Yeah. The Ore, Fragment, and Powder all worked fine. The fragment and powder were in the materials tab, and the ore was in the blocks tab
I guess paste your stuff and the full error message. I'll try to figger something out.
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.
Fixed the addRecipe issue, it was in the wrong section of my mod_Class. Still getting the same issue with /image.png not getting found. I opened minecraft.jar with WinRar and put in my 3 image files.
Here is my current code (Yes I realize that I shouldn't have capitalized the first letter of the image name, but that's what it's named right now.)
I cant get Items to appear in my minecraft game
Here is my code
I receive errors at setCreativeTab saying that the method is undefined for the type Item
help please
Your definition for the FireGem item should be,
public static final Item FireGem = new ItemFireGem(2000).setItemName("FireGem").setCreativeTab(CreativeTabs.tabMisc);
I marked in red what needs to be added.
It has to be the same as the class you created, ItemFireGem, otherwise it will think it is supposed to call a different class. Messing up your whole thing. (Love that song btw)
The Meaning of Life, the Universe, and Everything.
Join Date:
10/17/2011
Posts:
44
Member Details
Hey guys. Any ideas on how I would go about lighting a block on fire when powered by redstone, or activation? I'm trying things out, but they aren't going my way currently.
so i want to add a special effect to a piece of armor in this case its a zombie mask and i want the player to catch fire when the player wears it - heres the code
package net.minecraft.src;
import java.util.Random;
public class mod_CrystalMod extends BaseMod {
//Items
public static final Item CrystalPowder = new ItemCrystalPowder(4001).setItemName("CrystalPowder");
public static final Item CrystalFragment = new Item(4000).setItemName("CrystalFragment");
//Blocks
public static final Block CrystalOre = new BlockCrystalOre(160, 0).setBlockName("CrystalOre").setHardness(3F).setResistance(5F).setLightValue(0.5F).setCreativeTab(CreativeTabs.tabBlock).setStepSound(Block.soundStoneFootstep);
//Tools
public static final Item CrystalPickAxe = new ItemCrystalPickaxe(4002, EnumToolMaterialCrystal.CRYSTAL).setItemName("CrystalPickaxe");
public static final Item CrystalAxe = new ItemCrystalAxe(4003, EnumToolMaterialCrystal.CRYSTAL).setItemName("CrystalAxe");
public static final Item CrystalShovel = new ItemCrystalShovel(4004, EnumToolMaterialCrystal.CRYSTAL).setItemName("CrystalShovel");
public static final Item CrystalSword = new ItemCrystalSword(4005, EnumToolMaterialCrystal.CRYSTAL).setItemName("CrystalSword");
public static final Item CrystalHoe = new ItemCrystalHoe(4006, EnumToolMaterialCrystal.CRYSTAL).setItemName("CrystalHoe");
public void load() {
//Tools Texture
CrystalPickAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalpickaxe.png");
CrystalAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalaxe.png");
CrystalShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalshovel.png");
CrystalSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalsword.png");
CrystalHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalhoe.png");
//Items and Blocks texture
CrystalPowder.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalpowder.png");
CrystalFragment.iconIndex = ModLoader.addOverride("/gui/items.png", "/crystalfragment.png");
CrystalOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/crystalore.png");
//Tools Names
ModLoader.addName(CrystalPickAxe, "Crystal Pickaxe");
ModLoader.addName(CrystalAxe, "Crystal Axe");
ModLoader.addName(CrystalShovel, "Crystal Shovel");
ModLoader.addName(CrystalSword, "Crystal Sword");
ModLoader.addName(CrystalHoe, "Crystal Hoe");
//Items and Blocks
ModLoader.addName(CrystalPowder, "Crystal Powder");
ModLoader.addShapelessRecipe(new ItemStack(CrystalPowder, 4), new Object [] {CrystalFragment});
ModLoader.registerBlock(CrystalOre);
ModLoader.addName(CrystalOre, "Crystal Ore");
ModLoader.addName(CrystalFragment, "Crystal Fragment");
//Tools Recipes
ModLoader.addRecipe(new ItemStack(CrystalPickAxe, 1), new Object [] {"###", " % ", " % ", '#', Item.CrystalFragment, '%', Item.stick});
ModLoader.addRecipe(new ItemStack(CrystalAxe, 1), new Object [] {"##", "#%", " %", '#', Item.CrystalFragment, '%', Item.stick});
ModLoader.addRecipe(new ItemStack(CrystalShovel, 1), new Object [] {"#", "%", "%", '#', Item.CrystalFragment, '%', Item.stick});
ModLoader.addRecipe(new ItemStack(CrystalSword, 1), new Object [] {"#", "#", "%", '#', Item.CrystalFragment, '%', Item.stick});
ModLoader.addRecipe(new ItemStack(CrystalHoe, 1), new Object [] {"##", " %", " %", '#', Item.CrystalFragment, '%', Item.stick});
}
//Crystal Ore world generation
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 5; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(CrystalOre.blockID, 5)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion() {
return null;
}
}
EnumToolMaterialCrystal:
package net.minecraft.src;
public enum EnumToolMaterialCrystal
{
CRYSTAL(3, 1000, 7.0F, 4, 25);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private EnumToolMaterialCrystal(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;
}
}
ItemCrystalTools:
package net.minecraft.src;
public class ItemCrystalTools
{
private Block blocksEffectiveAgainst[];
protected float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterialCrystal toolMaterial;
protected ItemCrystalTools(int i, int j, EnumToolMaterialCrystal par3EnumToolMaterialCrystal, Block par4ArrayOfBlock[])
{
super();
efficiencyOnProperMaterial = 4F;
toolMaterial = par3EnumToolMaterialCrystal;
blocksEffectiveAgainst = par4ArrayOfBlock;
int maxStackSize = 1;
setMaxDamage(par3EnumToolMaterialCrystal.getMaxUses());
efficiencyOnProperMaterial = par3EnumToolMaterialCrystal.getEfficiencyOnProperMaterial();
damageVsEntity = j + par3EnumToolMaterialCrystal.getDamageVsEntity();
}
private void setMaxDamage(int maxUses) {
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct block type, 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 func_77660_a(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(1, par7EntityLiving);
}
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 enchantment factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
ItemCrystalPickaxe:
package net.minecraft.src;
public class ItemCrystalPickaxe extends ItemCrystalTools
{
private static Block blocksEffectiveAgainst[];
protected ItemCrystalPickaxe(int par1, EnumToolMaterialCrystal par2EnumToolMaterialCrystal)
{
super(par1, 2, par2EnumToolMaterialCrystal, 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.stairCompactCobblestone, Block.stairsStoneBrickSmooth, Block.stairsNetherBrick, Block.stairsBrick, 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, Block.dragonEgg, Block.fenceIron, Block.redstoneLampIdle, Block.redstoneLampActive, Block.oreEmerald, Block.blockEmerald, Block.enderChest, Block.stairsSandStone, Block.endPortal, Block.endPortalFrame,
Block.netherBrick, Block.netherFence, Block.mobSpawner,
});
}
public Item setItemName(String string) {
return null;
}
}
ItemCrystalAxe:
package net.minecraft.src;
public class ItemCrystalAxe extends ItemCrystalTools
{
private static Block blocksEffectiveAgainst[];
protected ItemCrystalAxe(int par1, EnumToolMaterialCrystal par2EnumToolMaterialCrystal)
{
super(par1, 3, par2EnumToolMaterialCrystal, blocksEffectiveAgainst);
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct block type, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block != null && par2Block.blockMaterial == Material.wood)
{
return efficiencyOnProperMaterial;
}
else
{
return super.getStrVsBlock(par1ItemStack, par2Block);
}
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Block.planks, Block.bookShelf, Block.wood, Block.chest, Block.doorWood, Block.workbench, Block.pumpkin, Block.pumpkinLantern,
Block.ladder, Block.pressurePlatePlanks, Block.fenceGate, Block.fence, Block.woodDoubleSlab, Block.woodSingleSlab, Block.stairsWoodSpruce,
Block.stairsWoodBirch, Block.stairsWoodJungle, Block.signWall, Block.bed,
});
}
public Item setItemName(String string) {
return null;
}
}
ItemCrystalShovel:
package net.minecraft.src;
public class ItemCrystalShovel extends ItemCrystalTools
{
private static Block blocksEffectiveAgainst[];
public ItemCrystalShovel(int par1, EnumToolMaterialCrystal par2EnumToolMaterialCrystal)
{
super(par1, 1, par2EnumToolMaterialCrystal, blocksEffectiveAgainst);
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
if (par1Block == Block.snow)
{
return true;
}
return par1Block == 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
});
}
public Item setItemName(String string) {
return null;
}
}
ItemCrystalSword:
package net.minecraft.src;
public class ItemCrystalSword extends Item
{
private int weaponDamage;
private final EnumToolMaterialCrystal toolMaterial;
public ItemCrystalSword(int par1, EnumToolMaterialCrystal par2EnumToolMaterialCrystal)
{
super(par1);
toolMaterial = par2EnumToolMaterialCrystal;
maxStackSize = 1;
setMaxDamage(par2EnumToolMaterialCrystal.getMaxUses());
weaponDamage = 4 + par2EnumToolMaterialCrystal.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;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 0x11940;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
ItemCrystalHoe:
package net.minecraft.src;
public class ItemCrystalHoe extends Item
{
public ItemCrystalHoe(int par1, EnumToolMaterialCrystal par2EnumToolMaterialCrystal)
{
super(par1);
maxStackSize = 1;
setMaxDamage(par2EnumToolMaterialCrystal.getMaxUses());
}
public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
ItemCrystalFragment:
package net.minecraft.src;
public class ItemCrystalFragment extends Item
{
public ItemCrystalFragment(int i)
{
super(i);
maxStackSize = 64;
this.setTabToDisplayOn(CreativeTabs.tabMaterials);
}
}
ItemCrystalPowder:
package net.minecraft.src;
public class ItemCrystalPowder extends Item
{
public ItemCrystalPowder(int i)
{
super(i);
maxStackSize = 64;
this.setTabToDisplayOn(CreativeTabs.tabMaterials);
}
}
BlockCrystalOre:
package net.minecraft.src;
import java.util.Random;
public class BlockCrystalOre extends Block
{
public BlockCrystalOre(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
return mod_CrystalMod.CrystalFragment.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 1;
}
}
The images:
The error message:
--- BEGIN ERROR REPORT 4c14e83d --------
Generated 9/7/12 2:35 AM
java.lang.NullPointerException
at net.minecraft.src.mod_CrystalMod.load(mod_CrystalMod.java:24)
at net.minecraft.src.ModLoader.init(ModLoader.java:952)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:186)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
--- END ERROR REPORT b14aa363 ----------
It's gotta be something with the textures. Otherwise the stack trace wouldn't have brought up the RenderEngine...
Nice textures, though.
And, I got my named changed. Woo!
Edit: Wait, what version are you modding in? It looks like your tool code may be out of date...
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.
Maybe if I just take the texture overrides and put them under the modloader.addnames?
And thank you I can't say they're the most creative textures xD but they're ethical I guess.
And woot for the name change
I guess so.
Also, I see you've added CrystalFragment to Item.java. You don't have to do that. You can access your item from your mod_ class.
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.
because it has a tree tutorial already it also has a few different ones that this one isnt even planning
Well, there's no point in advertising on already fargone threads. You're just going to **** people off.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
I think that happened when there was an error with the fragment about defining it and I just did a quick fix and it stuck it in the item.java
also i'm modding 1.3.2 I made sure to completely erase everything from MCP 7.0 and upgrade to 7.2 and I also made double sure to get a clean .minecraft to start off. I tried to avoid every problem I could xD
Edit: I tried rearranging the lines and put the texture overrides on the bottom and I got a new error message.
java.lang.NullPointerException
at net.minecraft.src.ModLoader.addName(ModLoader.java:436)
at net.minecraft.src.ModLoader.addName(ModLoader.java:398)
at net.minecraft.src.mod_CrystalMod.load(mod_CrystalMod.java:31)
It's not new, just a new line number. What's line 31 of your mod_CrystalMod file?
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.
Question with the world generation, how do you make it so that the position of the world gen follows that of a specific block? what I'm doing is the following: -have a custom block called Keep -upon clicking on the block a gui pops up with a button that says "Build Level 1 Castle" -upon clicking that a castle will pop up (Using world generation methods) so how do I make so that the generation will occur when I click that button and go according to the position of the Block keep that I selected?
Hey, TechGuy, I have a few questions about making mobs. How do you make mobs:
*Change skins when doing certain actions (e.g. ghasts changing skin when firing)
*Have armour points
*Make the custom model move when hard-coding the model instead of using Techne (I have a mac, and AnonymousJohn's MCModeler doesn't seem to work properly on my computer
*Pick up/place blocks
*Teleport
*Explode
*Climb walls (just like a spider)
*Have attacks that inflict potion effects
AI traits:
*Avoiding hazards (e.g. lava, cliffs, cacti)
*Preventing damage (e.g. running for water when on fire)
*Pathfinding
Here's my code, which is coloured blue (I had to do this because I don't know how to make spoilers):
mod_TFreakMimic
package net.minecraft.src;
import java.util.Map;
public class mod_TFreakMimic extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityTFreakMimic.class, "TFreakMimic", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityTFreakMimic.class, 15, 0, 1, EnumCreatureType.monster, new BiomeGenBase[]
{
BiomeGenBase.extremeHills,
BiomeGenBase.extremeHillsEdge
});
}
public void addRenderer(Map map)
{
map.put(EntityTFreakMimic.class, new RenderTFreakMimic(new ModelTFreakMimic(), 0.5F));
}
public String getVersion()
{
return "1.3.2";
}
}
EntityTFreakMimic
package net.minecraft.src;
import java.util.Random;
public class EntityTFreakMimic extends EntityMob
{
public EntityTFreakMimic(World world)
{
super(world);
texture = "/mimicgraphics/mimicskins/mimic.png";
moveSpeed = 5.0F;
attackStrength = 5;
tasks.addTask(0, new EntityAIWander(this, moveSpeed));
tasks.addTask(1, new EntityAIAttackOnCollide(this, net.minecraft.src.EntityPlayer.class, moveSpeed, false));
tasks.addTask(2, new EntityAIArrowAttack(this, moveSpeed, 1, 60));
tasks.addTask(3, new EntityAIFleeSun(this, moveSpeed));
tasks.addTask(4, new EntityAIBreakDoor(this));
tasks.addTask(5, new EntityAIMoveTowardsTarget(this, moveSpeed, 64F));
tasks.addTask(6, new EntityAIBreakDoor(this));
tasks.addTask(7, new EntityAIBreakDoor(this));
tasks.addTask(8, new EntityAIBreakDoor(this));
tasks.addTask(9, new EntityAIBreakDoor(this));
tasks.addTask(10, new EntityAIBreakDoor(this));
tasks.addTask(11, new EntityAIBreakDoor(this));
tasks.addTask(12, new EntityAIBreakDoor(this));
tasks.addTask(13, new EntityAIBreakDoor(this));
tasks.addTask(14, new EntityAIBreakDoor(this));
tasks.addTask(15, new EntityAIBreakDoor(this));
tasks.addTask(16, new EntityAIBreakDoor(this));
targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 64F, 0, true));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
}
so i want to add a special effect to a piece of armor in this case its a zombie mask and i want the player to catch fire when the player wears it - heres the code
Question with the world generation, how do you make it so that the position of the world gen follows that of a specific block?
what I'm doing is the following:
-have a custom block called Keep
-upon clicking on the block a gui pops up with a button that says "Build Level 1 Castle"
-upon clicking that a castle will pop up (Using world generation methods)
so how do I make so that the generation will occur when I click that button and go according to the position of the Block keep that I selected?
Thanks in advance
You would probably need to make that block have a TileEntity and make the structure position itself relevant to the position of the TileEntity.
Hey, TechGuy, I have a few questions about making mobs. How do you make mobs:
*Change skins when doing certain actions (e.g. ghasts changing skin when firing)
*Have armour points
*Make the custom model move when hard-coding the model instead of using Techne (I have a mac, and AnonymousJohn's MCModeler doesn't seem to work properly on my computer
*Pick up/place blocks
*Teleport
*Explode
*Climb walls (just like a spider)
*Have attacks that inflict potion effects
AI traits:
*Avoiding hazards (e.g. lava, cliffs, cacti)
*Preventing damage (e.g. running for water when on fire)
*Pathfinding
Here's my code, which is coloured blue (I had to do this because I don't know how to make spoilers):
mod_TFreakMimic
package net.minecraft.src;
import java.util.Map;
public class mod_TFreakMimic extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityTFreakMimic.class, "TFreakMimic", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityTFreakMimic.class, 15, 0, 1, EnumCreatureType.monster, new BiomeGenBase[]
{
BiomeGenBase.extremeHills,
BiomeGenBase.extremeHillsEdge
});
}
public void addRenderer(Map map)
{
map.put(EntityTFreakMimic.class, new RenderTFreakMimic(new ModelTFreakMimic(), 0.5F));
}
public String getVersion()
{
return "1.3.2";
}
}
EntityTFreakMimic
package net.minecraft.src;
import java.util.Random;
public class EntityTFreakMimic extends EntityMob
{
public EntityTFreakMimic(World world)
{
super(world);
texture = "/mimicgraphics/mimicskins/mimic.png";
moveSpeed = 5.0F;
attackStrength = 5;
tasks.addTask(0, new EntityAIWander(this, moveSpeed));
tasks.addTask(1, new EntityAIAttackOnCollide(this, net.minecraft.src.EntityPlayer.class, moveSpeed, false));
tasks.addTask(2, new EntityAIArrowAttack(this, moveSpeed, 1, 60));
tasks.addTask(3, new EntityAIFleeSun(this, moveSpeed));
tasks.addTask(4, new EntityAIBreakDoor(this));
tasks.addTask(5, new EntityAIMoveTowardsTarget(this, moveSpeed, 64F));
tasks.addTask(6, new EntityAIBreakDoor(this));
tasks.addTask(7, new EntityAIBreakDoor(this));
tasks.addTask(8, new EntityAIBreakDoor(this));
tasks.addTask(9, new EntityAIBreakDoor(this));
tasks.addTask(10, new EntityAIBreakDoor(this));
tasks.addTask(11, new EntityAIBreakDoor(this));
tasks.addTask(12, new EntityAIBreakDoor(this));
tasks.addTask(13, new EntityAIBreakDoor(this));
tasks.addTask(14, new EntityAIBreakDoor(this));
tasks.addTask(15, new EntityAIBreakDoor(this));
tasks.addTask(16, new EntityAIBreakDoor(this));
targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 64F, 0, true));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
}
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
For the specific functions / abilities of a mob you should look into the entities like spider, ghasts, etc.
Yeah, Saphir, but if you read all of it carefully, you might have noticed I said that MCP doesn't seem to work properly on my computer, so I try to make do without. But if anyone ever makes a group of all the source files for those who don't have MCP, then notify me.
could you make a tutorial on custom potion effects?
Well, I think I could help. What do you mean like potion effects (eating causes it, or brewing it in to a potion)?
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.
When I start the MCP client and get the block, the bottom and top textures are how they are supposed to be, but the side textures are the purple null textures in terrain.png.
I checked the texture paths and they're correct, I also checked the "mod_" thing in the block file for where it finds the textures, and the names in it and the mod_ file, and they're both correct, and I get no errors, so I'm not sure whats wrong.
My mod_file includes more than one block, but I don't think that should be a problem, and the second block (I am adding more, though.) just uses the side texture, and it finds the texture like a regular block would.(The second one is stairs.)
My block file:
package net.minecraft.src;
public class BlockCandyCornBlock extends Block
{
public BlockCandyCornBlock(int i, int j)
{
super(i, j, Material.wood);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
return getBlockTextureFromSide(i);
}
public int getBlockTextureFromSide(int i)
{
if (i == 0)
{
return mod_CandyCornModBlocks.CandyCornBlockBottom;
}
if (i == 1)
{
return mod_CandyCornModBlocks.CandyCornBlockTop;
}
else
{
return mod_CandyCornModBlocks.CandyCornBlockSides;
}
}
}
My mod_ file:
package net.minecraft.src;
public class mod_CandyCornModBlocks extends BaseMod
{
public static final Block CandyCornBlock = new BlockCandyCornBlock(234, 0).setBlockName("Candy Corn Block").setHardness(4F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabDeco).setStepSound(Block.soundWoodFootstep);
public static final Block CandyCornStairs = new BlockCandyCornStairs(235, 0).setBlockName("Candy Corn Stairs").setHardness(4F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabDeco).setStepSound(Block.soundWoodFootstep);
public static int CandyCornBlockBottom = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockBottom.png");
public static int CandyCornBlockTop = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockTop.png");
public static int CandyCornBlockSides = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png");
public void load()
{
CandyCornBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png");
ModLoader.registerBlock(CandyCornBlock);
ModLoader.addName(CandyCornBlock, "Candy Corn Block");
ModLoader.addRecipe(new ItemStack(CandyCornBlock, 1), new Object [] {"CCC","CCC","CCC", Character.valueOf('C'), mod_CandyCornModItems.CandyCorn });
CandyCornStairs.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png");
ModLoader.registerBlock(CandyCornStairs);
ModLoader.addName(CandyCornStairs, "Candy Corn Stairs");
ModLoader.addRecipe(new ItemStack(CandyCornStairs, 1), new Object [] {"C ","CC ","CCC", Character.valueOf('C'), mod_CandyCornModItems.CandyCorn });
}
public String getVersion()
{
return "1.3.2";
}
}
Fixed the addRecipe issue, it was in the wrong section of my mod_Class. Still getting the same issue with /image.png not getting found. I opened minecraft.jar with WinRar and put in my 3 image files.
Here is my current code (Yes I realize that I shouldn't have capitalized the first letter of the image name, but that's what it's named right now.)
Ruby.iconIndex = ModLoader.addOverride("/items.png", "/Ruby.png"); RubyPick.iconIndex = ModLoader.addOverride("/items.png", "/RubyPickaxe.png"); RubyOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/RubyOre.png");-
View User Profile
-
View Posts
-
Send Message
Retired StaffI guess paste your stuff and the full error message. I'll try to figger something out.
You didn't say items.png was in gui.
Should be, "/gui/items.png"
Your definition for the FireGem item should be,
public static final Item FireGem = new ItemFireGem(2000).setItemName("FireGem").setCreativeTab(CreativeTabs.tabMisc);
I marked in red what needs to be added.
It has to be the same as the class you created, ItemFireGem, otherwise it will think it is supposed to call a different class. Messing up your whole thing. (Love that song btw)
Haha, well we all gotta screw something up sometime. Least you're not like, raging and trolling because of it! XD
I'm spewing! Thank you so much, I had a hanch that it had to do with something near the begining. Thank you once again.
public boolean onTickInGame(float f, Minecraft mc) { ItemStack helm = mc.thePlayer.inventory.armorInventory[3]; if (helm != null) { if (helm.itemID == mod_*****.zombiemask.shiftedIndex) { if (mc.thePlayer.worldObj.isDaytime() && !mc.thePlayer.worldObj.isRemote) { float var1 = mc.thePlayer.getBrightness(1.0F); if (var1 > 0.5F && mc.thePlayer.worldObj.canBlockSeeTheSky(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posY), MathHelper.floor_double(mc.thePlayer.posZ)) && mc.thePlayer.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F) { mc.thePlayer.setFire(8); } } } } return true; }from what i understand it should be work but it doesn't D: i just copied the code out of the zombie for when it catches fire when its in the sun.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffIt's gotta be something with the textures. Otherwise the stack trace wouldn't have brought up the RenderEngine...
Nice textures, though.
And, I got my named changed. Woo!
Edit: Wait, what version are you modding in? It looks like your tool code may be out of date...
-
View User Profile
-
View Posts
-
Send Message
Retired StaffI guess so.
Also, I see you've added CrystalFragment to Item.java. You don't have to do that. You can access your item from your mod_ class.
because it has a tree tutorial already it also has a few different ones that this one isnt even planning
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWell, there's no point in advertising on already fargone threads. You're just going to **** people off.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffIt's not new, just a new line number. What's line 31 of your mod_CrystalMod file?
what I'm doing is the following:
-have a custom block called Keep
-upon clicking on the block a gui pops up with a button that says "Build Level 1 Castle"
-upon clicking that a castle will pop up (Using world generation methods)
so how do I make so that the generation will occur when I click that button and go according to the position of the Block keep that I selected?
Thanks in advance
*Change skins when doing certain actions (e.g. ghasts changing skin when firing)
*Have armour points
*Make the custom model move when hard-coding the model instead of using Techne (I have a mac, and AnonymousJohn's MCModeler doesn't seem to work properly on my computer
*Pick up/place blocks
*Teleport
*Explode
*Climb walls (just like a spider)
*Have attacks that inflict potion effects
AI traits:
*Avoiding hazards (e.g. lava, cliffs, cacti)
*Preventing damage (e.g. running for water when on fire)
*Pathfinding
Here's my code, which is coloured blue (I had to do this because I don't know how to make spoilers):
mod_TFreakMimic
package net.minecraft.src;
import java.util.Map;
public class mod_TFreakMimic extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityTFreakMimic.class, "TFreakMimic", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityTFreakMimic.class, 15, 0, 1, EnumCreatureType.monster, new BiomeGenBase[]
{
BiomeGenBase.extremeHills,
BiomeGenBase.extremeHillsEdge
});
}
public void addRenderer(Map map)
{
map.put(EntityTFreakMimic.class, new RenderTFreakMimic(new ModelTFreakMimic(), 0.5F));
}
public String getVersion()
{
return "1.3.2";
}
}
EntityTFreakMimic
package net.minecraft.src;
import java.util.Random;
public class EntityTFreakMimic extends EntityMob
{
public EntityTFreakMimic(World world)
{
super(world);
texture = "/mimicgraphics/mimicskins/mimic.png";
moveSpeed = 5.0F;
attackStrength = 5;
tasks.addTask(0, new EntityAIWander(this, moveSpeed));
tasks.addTask(1, new EntityAIAttackOnCollide(this, net.minecraft.src.EntityPlayer.class, moveSpeed, false));
tasks.addTask(2, new EntityAIArrowAttack(this, moveSpeed, 1, 60));
tasks.addTask(3, new EntityAIFleeSun(this, moveSpeed));
tasks.addTask(4, new EntityAIBreakDoor(this));
tasks.addTask(5, new EntityAIMoveTowardsTarget(this, moveSpeed, 64F));
tasks.addTask(6, new EntityAIBreakDoor(this));
tasks.addTask(7, new EntityAIBreakDoor(this));
tasks.addTask(8, new EntityAIBreakDoor(this));
tasks.addTask(9, new EntityAIBreakDoor(this));
tasks.addTask(10, new EntityAIBreakDoor(this));
tasks.addTask(11, new EntityAIBreakDoor(this));
tasks.addTask(12, new EntityAIBreakDoor(this));
tasks.addTask(13, new EntityAIBreakDoor(this));
tasks.addTask(14, new EntityAIBreakDoor(this));
tasks.addTask(15, new EntityAIBreakDoor(this));
tasks.addTask(16, new EntityAIBreakDoor(this));
targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 64F, 0, true));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
}
public int getMaxHealth()
{
return 20;
}
public int getTotalArmorValue()
{
return 20;
}
protected String getLivingSound()
{
return "mimicsounds.living";
}
protected String getHurtSound()
{
return "mimicsounds.hurt";
}
protected String getDeathSound()
{
return "mimicsounds.death";
}
protected int getDropItemId()
{
return Item.emerald.shiftedIndex, 1;
}
protected boolean canDespawn()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
}
ModelTFreakMimic
package net.minecraft.src
public class ModelTFreakMimic extends ModelBase
{
ModelRenderer Head
ModelRenderer Torso
ModelRenderer armLeft
ModelRenderer armRight
ModelRenderer legLeft
ModelRenderer legRight
public ModelTFreakMimic
{
textureWidth = 64;
textureHeight = 32;
Head = new ModelRenderer(this, 0, 0);
Head.addBox(-4F, 32F, -4F, 8, 8, 8);
Head.setRotationPoint(4F, 8F, 4F);
Head.setTextureSize(32, 16);
Head.mirror = false;
setRotation(Head, 0F, 0F, 0F);
Torso = new ModelRenderer(this, 8, 16);
Torso.addBox(-4F, 20F, -2F, 8, 12, 4);
Torso.setRotationPoint(4F, 8F, 4F);
Torso.setTextureSize(24, 16);
Torso.mirror = false;
setRotation(Torso, 0F, 0F, 0F);
armLeft = new ModelRenderer(this, 48, 8);
armLeft.addBox(4F, 12F, -2F, 4, 20, 4);
armLeft.setRotationPoint(4F, 8F, 4F);
armLeft.setTextureSize(16, 24);
armLeft.mirror = true;
setRotation(armLeft, 0F, 0F, 0F);
armRight = new ModelRenderer(this, 48, 8);
armRight.addBox(-8F, 12F, -2F, 4, 20, 4);
armRight.setRotationPoint(4F, 8F, 4F);
armRight.setTextureSize(16, 24);
armRight.mirror = false;
setRotation(armRight, 0F, 0F, 0F);
legLeft = new ModelRenderer(this, 32, 8);
legLeft.addBox(0F, 0F, -2F, 4, 20, 4);
legLeft.setRotationPoint(4F, 8F, 4F);
legLeft.setTextureSize(16, 24);
legLeft.mirror = true;
setRotation(legLeft, 0F, 0F, 0F);
legRight = new ModelRenderer(this, 32, 8);
legRight.addBox(-4F, 0F, -2F, 4, 20, 4);
legRight.setRotationPoint(4F, 8F, 4F);
legRight.setTextureSize(16, 24);
legRight.mirror = false;
setRotation(legRight, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5);
Head.render(f5);
Torso.render(f5);
armLeft.render(f5);
armRight.render(f5);
legLeft.render(f5);
legRight.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5);
}
}
RenderTFreakMimic
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class RenderTFreakMimic extends RenderLiving
{
protected ModelNamehere modelMimicMain;
protected float field_40296_d;
public RenderNamehere(ModelTFreakMimic par1ModelTFreakMimic, float par2)
{
this(par1ModelNamehere, par2, 1.0F);
modelTFreakMimicMain = par1ModelTFreakMimic;
}
public RenderTFreakMimic(ModelTFreakMimic par1ModelTFreakMimic, float par2, float par3)
{
super(par1ModelTFreakMimic, par2);
modelTFreakMimicMain = par1ModelTFreakMimic;
field_40296_d = par3;
}
}
MCP doesn't seem to work properly on my computer, so I'm trying to make do as much as possible without it. Please reply soon!
~Technofreak301
This is unrelated to my current tutorials so I am not helping.
You would probably need to make that block have a TileEntity and make the structure position itself relevant to the position of the TileEntity.
This is unrelated to my current tutorials so I am not helping.
together they are powerful beyond imagination."
Yeah, Saphir, but if you read all of it carefully, you might have noticed I said that MCP doesn't seem to work properly on my computer, so I try to make do without. But if anyone ever makes a group of all the source files for those who don't have MCP, then notify me.
Dude I said ITEMS not blocks. I'm not stupid.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWell, I think I could help. What do you mean like potion effects (eating causes it, or brewing it in to a potion)?
When I start the MCP client and get the block, the bottom and top textures are how they are supposed to be, but the side textures are the purple null textures in terrain.png.
I checked the texture paths and they're correct, I also checked the "mod_" thing in the block file for where it finds the textures, and the names in it and the mod_ file, and they're both correct, and I get no errors, so I'm not sure whats wrong.
My mod_file includes more than one block, but I don't think that should be a problem, and the second block (I am adding more, though.) just uses the side texture, and it finds the texture like a regular block would.(The second one is stairs.)
My block file:
package net.minecraft.src; public class BlockCandyCornBlock extends Block { public BlockCandyCornBlock(int i, int j) { super(i, j, Material.wood); } public int getBlockTextureFromSideAndMetadata(int i, int j) { return getBlockTextureFromSide(i); } public int getBlockTextureFromSide(int i) { if (i == 0) { return mod_CandyCornModBlocks.CandyCornBlockBottom; } if (i == 1) { return mod_CandyCornModBlocks.CandyCornBlockTop; } else { return mod_CandyCornModBlocks.CandyCornBlockSides; } } }My mod_ file:
package net.minecraft.src; public class mod_CandyCornModBlocks extends BaseMod { public static final Block CandyCornBlock = new BlockCandyCornBlock(234, 0).setBlockName("Candy Corn Block").setHardness(4F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabDeco).setStepSound(Block.soundWoodFootstep); public static final Block CandyCornStairs = new BlockCandyCornStairs(235, 0).setBlockName("Candy Corn Stairs").setHardness(4F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabDeco).setStepSound(Block.soundWoodFootstep); public static int CandyCornBlockBottom = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockBottom.png"); public static int CandyCornBlockTop = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockTop.png"); public static int CandyCornBlockSides = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png"); public void load() { CandyCornBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png"); ModLoader.registerBlock(CandyCornBlock); ModLoader.addName(CandyCornBlock, "Candy Corn Block"); ModLoader.addRecipe(new ItemStack(CandyCornBlock, 1), new Object [] {"CCC","CCC","CCC", Character.valueOf('C'), mod_CandyCornModItems.CandyCorn }); CandyCornStairs.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CandyCornMod/CandyCornBlockSides.png"); ModLoader.registerBlock(CandyCornStairs); ModLoader.addName(CandyCornStairs, "Candy Corn Stairs"); ModLoader.addRecipe(new ItemStack(CandyCornStairs, 1), new Object [] {"C ","CC ","CCC", Character.valueOf('C'), mod_CandyCornModItems.CandyCorn }); } public String getVersion() { return "1.3.2"; } }