You need to add the renderEquippedItem method from ModelBiped.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
wait, techguy, do you need modloader now if you want to use the newest version of forge in your mod?
Rollback Post to RevisionRollBack
The twilight warrior.
Master of darkness and light, bound to no element, this entity is ruthless, cruel, but fair, when he looks at you he sees your whole soul, and if your heart is tipped to the darkness, or to the light, run, and hope he doesn't think you're worthy....
wait, techguy, do you need modloader now if you want to use the newest version of forge in your mod?
Forge automatically installs ModLoader so you no longer need to do it yourself.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Master of darkness and light, bound to no element, this entity is ruthless, cruel, but fair, when he looks at you he sees your whole soul, and if your heart is tipped to the darkness, or to the light, run, and hope he doesn't think you're worthy....
package net.minecraft.src;
public class ItemGoldCoin extends Item
{
public ItemGoldCoin(int i)
{
super(i);
maxStackSize = 64;
}
}
now I want the wandering knight to behave the same as a wolf, whereas instead of giving it a bone, you it a gold coin and the knight becomes "tamed" if someone could give me a tutorial on how to do that it would be appreciated
also a tutorial on having a knight spawn with a sword, without me giving it to him
also for some reason when I try to say that the WanderingKnight drops a gold coin on death, it gives me the error "GoldCoin cannot be resolved or is not a field" any idea as to how to fix this?
thanks in advance for any help
Ok, I've decided to start all over again with my .java files, and I've opened them in Eclipse, but I've noticed that there are several errors such as "EntityNameHere cannot be resolved to a type" What should I do when this occurs?
Also, there were also only a few errors that said "The method preRenderScale(EntityNameHere, float) from the type RenderNameHere refers to the missing type EntityNameHere"
It saying that the word "chisel" is an error meaning its not defined oe something but yet I have the classes to go with it but still has the red lines under it heres the code.
package net.minecraft.src;
public class mod_stone1 extends BaseMod
{
public static final Block stone1 = new Block(160, 0, Material.rock).setBlockName("stone1").setHardness(3F).setResistance(4F).setLightValue(1F);
If anyone could help me, I would be very grateful. My mob isn't spawning and the console in eclipse says skipping entity with id Axe Man (my entity obviously) Here is my code:
public void load() {
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
ModLoader.registerEntityID(EntityHumanNPC.class, "HumanNPC", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHumanNPC.class, 50, 14, 18, EnumCreatureType.creature, new BiomeGenBase[]
{
BiomeGenBase.forest,
BiomeGenBase.extremeHills,
});
}
public void addRenderer(Map map)
{
map.put(EntityHumanNPC.class, new RenderBiped(new ModelBiped(), 0.5F));
}
And entityHumanNPC:
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class EntityHumanNPC extends EntityMob
{
public EntityHumanNPC(World world)
{
super(world);
texture = "/mob/Native Skin.png";
moveSpeed = 0.3F;
attackStrength = 2;
getNavigator().setBreakDoors(true);
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIAvoidEntity(this, net.minecraft.src.EntityCreeper.class, 8F, 0.3F, 0.35F));
tasks.addTask(2, new EntityAIOpenDoor(this, true));
tasks.addTask(3, new EntityAIAttackOnCollide(this, moveSpeed, true));
tasks.addTask(4, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 6F));
tasks.addTask(5, new EntityAIWander(this, 0.23F));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 16F, 0, true));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityZombie.class, 16F, 0, true));
}
protected 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()
{
return Item.ingotIron.shiftedIndex;
}
protected boolean canDespawn()
{
return false;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.axeStone);
}
private static final ItemStack defaultHeldItem;
protected void dropRareDrop(int par1)
{
switch (rand.nextInt(4))
{
case 0:
dropItem(Item.plateSteel.shiftedIndex, 1);
break;
case 1:
dropItem(Item.helmetSteel.shiftedIndex, 1);
break;
case 2:
dropItem(Item.legsSteel.shiftedIndex, 1);
break;
case 3:
dropItem(Item.bootsSteel.shiftedIndex, 1);
break;
}
}
}
I have no idea why the console is saying that and why it won't spawn. The weird thing is is that it used to in a earlier version of my code. But I don't have it anymore, so I was hoping someone here could see whats wrong because I've spent hours trying to. Thanks!
Please help! My block mod messes up if you use transparency, so I used the fix, and added a new block just for that purpose, and now every block acts transparent! Please help!
mod_Blocky
package net.minecraft.src;
import java.util.List;
import net.minecraft.client.Minecraft;
public class mod_Blocky extends BaseMod
{
public static final Block Blocky = (new BlockBlocky(200, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky1 = (new BlockBlocky(201, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky2 = (new BlockBlocky(202, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky3 = (new BlockBlocky(203, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky4 = (new BlockBlocky(204, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky5 = (new BlockBlocky(205, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky6 = (new BlockBlocky(206, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky7 = (new BlockBlocky(207, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky8 = (new BlockBlocky(208, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blocky9 = (new BlockBlocky(209, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F);
public static final Block Blockyt1 = (new BlockBlockytrans(210, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F);
public static final Block Blockyt2 = (new BlockBlockytrans(212, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F);
public static final Block Blockyt3 = (new BlockBlockytrans(213, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F);
private static GuiScreen creativeInventory;
public mod_Blocky()
{
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public void load()
{
Blocky.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block1.png");
ModLoader.registerBlock(Blocky);
ModLoader.addName(Blocky, "Block");
Blocky1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block2.png");
ModLoader.registerBlock(Blocky1);
ModLoader.addName(Blocky1, "Block");
Blocky2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block3.png");
ModLoader.registerBlock(Blocky2);
ModLoader.addName(Blocky2, "Block");
Blocky3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block4.png");
ModLoader.registerBlock(Blocky3);
ModLoader.addName(Blocky3, "Block");
Blocky4.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block5.png");
ModLoader.registerBlock(Blocky4);
ModLoader.addName(Blocky4, "Block");
Blocky5.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block6.png");
ModLoader.registerBlock(Blocky5);
ModLoader.addName(Blocky5, "Block");
Blocky6.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block7.png");
ModLoader.registerBlock(Blocky6);
ModLoader.addName(Blocky6, "Block");
Blocky7.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block8.png");
ModLoader.registerBlock(Blocky7);
ModLoader.addName(Blocky7, "BLock");
Blocky8.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block9.png");
ModLoader.registerBlock(Blocky8);
ModLoader.addName(Blocky8, "Block");
Blocky9.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block10.png");
ModLoader.registerBlock(Blocky9);
ModLoader.addName(Blocky9, "Block");
Blockyt1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block1.png");
ModLoader.registerBlock(Blockyt1);
ModLoader.addName(Blockyt1, "Transparent Block");
Blockyt2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block2.png");
ModLoader.registerBlock(Blockyt2);
ModLoader.addName(Blockyt2, "Transparent Block");
Blockyt3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block3.png");
ModLoader.registerBlock(Blockyt3);
ModLoader.addName(Blockyt3, "Transparent Block");
}
public String getVersion()
{
return "1.2.5";
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if (minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if ((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(Blocky, 1, i));
list.add(new ItemStack(Blocky1, 1, i));
list.add(new ItemStack(Blocky2, 1, i));
list.add(new ItemStack(Blocky3, 1, i));
list.add(new ItemStack(Blocky4, 1, i));
list.add(new ItemStack(Blocky5, 1, i));
list.add(new ItemStack(Blocky6, 1, i));
list.add(new ItemStack(Blocky7, 1, i));
list.add(new ItemStack(Blocky8, 1, i));
list.add(new ItemStack(Blocky9, 1, i));
list.add(new ItemStack(Blockyt1, 1, i));
list.add(new ItemStack(Blockyt2, 1, i));
list.add(new ItemStack(Blockyt3, 1, i));
}
creativeInventory = guiscreen;
return true;
}
}
Does anyone see a problem? and if so, then please help!
Read the following before spamming something like: "There is an easier way to do this, just add your block to ContainerCreative"
That is stupid and lazy. When you're modding, you should always aim not to edit ANY base class. If every mod was to edit ContainerCreative, only the mod that was last added would have its blocks added because the file would just get overridden each time. If you want to be an idiot, go right ahead and edit ContainerCreative, but don't leave a reply here saying something like "I know an easier way, add to ContainerCreative!". Leaving a reply like that just shows everyone that you have nothing better to do. I have an idea for you, go learn how to do stuff properly!
If you are smart and would like to add blocks to the creative inventory the proper way, keep reading. Spoiler
This will just be a snippet of code(with an explanation, of course). It won't include any parts from the block tutorial. It will have a very simple explanation.
All of the code below goes into your mod_ class.
Firstly, you need to import Minecraft and List.
import net.minecraft.client.Minecraft;
import java.util.List;Then this code:
As basically as I can put it, the code above checks if the creative inventory gui is open, then adds the blocks that you declare, into the inventory so you can get them.
list.add(new ItemStack(block1, 1, i));
The line above is what actually adds your block to the inventory after all the checks are done. You just replace block1, block2, block3, etc. with the name of your block which you declared in its public static final line.
Please ask if you need more of an explanation
It dousn't work for me it's errors in |
|
\/ and i don't know why (the error says: Multiple markers at this line
-Syntax error tonkens, delete these tokens
-Syntax error tonken(s), misplaced construct(s)
All of my files dont have any errors but I get this when I star minecraft.
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(Unknown Source)
at fr.a(SourceFile:549)
at ModLoader.addRecipe(ModLoader.java:401)
at mod_Chisel.load(mod_Chisel.java:11)
at ModLoader.init(ModLoader.java:891)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:77)
at ahu.<clinit>(ahu.java:8)
at net.minecraft.client.Minecraft.a(SourceFile:273)
at net.minecraft.client.Minecraft.run(SourceFile:657)
at java.lang.Thread.run(Unknown Source)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
You need to add the renderEquippedItem method from ModelBiped.
together they are powerful beyond imagination."
Forge automatically installs ModLoader so you no longer need to do it yourself.
together they are powerful beyond imagination."
package net.minecraft.src; import java.util.Map; public class mod_Block extends BaseMod { //State Blocks and Items public static final Block CobblestoneBrick = new BlockCobblestoneBrick(161, 0).setHardness(2.5F).setResistance(3F).setBlockName("Cobblestone Brick"); public static final Item GoldCoin = new ItemGoldCoin(5000).setItemName("Gold Coin"); public static final Item BeefStew = new ItemBeefStew(5001).setItemName("Beef Stew"); public void load() { //Block Cobblestone Brick CobblestoneBrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/CobblestoneBrick.png"); ModLoader.registerBlock(CobblestoneBrick); ModLoader.addName(CobblestoneBrick, "Cobblestone Brick"); ModLoader.addRecipe(new ItemStack(CobblestoneBrick, 4), new Object [] {"##", "##", Character.valueOf('#'), Block.cobblestone}); //Item Gold Coin GoldCoin.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/GoldCoin.png"); ModLoader.addName(GoldCoin, "Gold Coin"); ModLoader.addRecipe(new ItemStack(GoldCoin, 8), new Object [] {"GG", Character.valueOf('G'), Item.ingotGold}); //Item Beef Stew BeefStew.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Beefsoup.png"); ModLoader.addName(BeefStew, "Beef Stew"); ModLoader.addRecipe(new ItemStack(BeefStew, 1), new Object [] {"B", "O", "U", Character.valueOf('B'), Item.beefRaw, Character.valueOf('O'), Block.mushroomBrown, Character.valueOf('U'), Item.bowlEmpty}); ModLoader.addRecipe(new ItemStack(BeefStew, 1), new Object [] {"B", "O", "U", Character.valueOf('O'), Item.beefRaw, Character.valueOf('B'), Block.mushroomBrown, Character.valueOf('U'), Item.bowlEmpty}); //Entity Wandering Knight ModLoader.registerEntityID(EntityWanderingKnight.class, "Wandering Knight", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(EntityWanderingKnight.class, 50, 14, 18, EnumCreatureType.creature); } //Entity Wandering Knight public void addRenderer(Map map) { map.put(EntityWanderingKnight.class, new RenderBiped(new ModelBiped(), 0.5F)); } public String getVersion() { return "1.2.5"; } }package net.minecraft.src; import java.util.Random; public class EntityWanderingKnight extends EntityCreature { public EntityWanderingKnight(World world) { super(world); texture = "/mods/wanderingKnight.png"; moveSpeed = 0.5F; } 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() { return Item.ingotIron.shiftedIndex; } protected boolean canDespawn() { return false; } }package net.minecraft.src; public class ItemGoldCoin extends Item { public ItemGoldCoin(int i) { super(i); maxStackSize = 64; } }also a tutorial on having a knight spawn with a sword, without me giving it to him
also for some reason when I try to say that the WanderingKnight drops a gold coin on death, it gives me the error "GoldCoin cannot be resolved or is not a field" any idea as to how to fix this?
thanks in advance for any help
Also, there were also only a few errors that said "The method preRenderScale(EntityNameHere, float) from the type RenderNameHere refers to the missing type EntityNameHere"
Code for RenderSaxtonHale (RenderNameHere):
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
// RenderLiving, JWorld_EntityExample, ModelBase, EntityLiving,
// Entity
public class RenderSaxtonHale extends RenderLiving
{
public RenderSaxtonHale(ModelBase modelbase, float f)
{
super(modelbase, f);
}
public void renderSaxtonHale(EntitySaxtonHale entitySaxtonHale, double d, double d1, double d2,
float f, float f1)
{
super.doRenderLiving(entitySaxtonHale, d, d1, d2, f, f1);
}
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2,
float f, float f1)
{
renderSaxtonHale((EntitySaxtonHale)entityliving, d, d1, d2, f, f1);
}
public void doRender(Entity entity, double d, double d1, double d2,
float f, float f1)
{
renderSaxtonHale((EntitySaxtonHale)entity, d, d1, d2, f, f1);
}
//attempting to scale
protected void preRenderScale(EntitySaxtonHale entity, float f)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
}
protected void preRenderCallback(EntityLiving entityliving, float f)
{
preRenderScale((EntitySaxtonHale)entityliving, f);
}
}
Code for ModelSaxtonHale (ModelNameHere):
package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
public class mod_SaxtonHale extends BaseMod {
public mod_SaxtonHale()
{
ModLoader.registerEntityID(EntitySaxtonHale.class, "SaxtonHale", ModLoader.getUniqueEntityId());
ModLoader.addSpawn("SaxtonHale", 5, 6, 7, EnumCreatureType.creature);
}
public void addRenderer(Map map)
{
map.put(EntitySaxtonHale.class, new RenderSaxtonHale(new ModelSaxtonHale(), 0.2F));
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public void load() {
}
}
src\minecraft\net\minecraft\src\RenderGiantSheep.java:12: error: cannot find sym
bol
this(par1ModelGiantSheep, par2, 1.0F);
^
symbol: variable par1ModelGiantSheep
location: class RenderGiantSheep
src\minecraft\net\minecraft\src\RenderGiantSheep.java:13: error: cannot find sym
bol
modelGiantSheepMain = par1ModelGiantSheep;
^
symbol: variable par1ModelGiantSheep
location: class RenderGiantSheep
src\minecraft\net\minecraft\src\RenderGiantSheep.java:18: error: cannot find sym
bol
super(par1ModelGiantSheep, par2);
^
symbol: variable par1ModelGiantSheep
location: class RenderGiantSheep
src\minecraft\net\minecraft\src\RenderGiantSheep.java:19: error: cannot find sym
bol
modelGiantSheepMain = par1ModelGiantSheep;
^
symbol: variable par1ModelGiantSheep
location: class RenderGiantSheep
4 errors
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
I thought I did everything. What's wrong with "par1"?
ModLoader.addRecipe(new ItemStack(stone1, 6), new Object [] {" # ", " % ", "% %", Character.valueOf('#'), chisel, Character.valueOf('%'), Block.dirt});
^
symbol: variable chisel
location: class mod_stone1
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
I have made the mod_chisel and the chisel.java it self and did everything right so far please tell me what you need or what im doing wrong here :/
did you put "terrain.png", /modpathhere/yourimage"
or "terrain.png", "/modpathhere/yourimage.png"
if you did the first, add .png to the end of your imagename in the code. if you did the second then i cant help you.
Be sure to check out my texture pack: Easy Ores!
package net.minecraft.src;
public class mod_stone1 extends BaseMod
{
public static final Block stone1 = new Block(160, 0, Material.rock).setBlockName("stone1").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
stone1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/dec/1.png");
ModLoader.registerBlock(stone1);
ModLoader.addName(stone1, "StoneDecoration");
ModLoader.addRecipe(new ItemStack(stone1, 6), new Object [] {" # ", " % ", "% %", Character.valueOf('#'), chisel, Character.valueOf('%'), Block.dirt});
}
public String getVersion()
{
return "1.2.5";
}
}
It says "chisel" can not be resolved to a varible
public void load() { ModLoader.setInGameHook(this, true, false); ModLoader.setInGUIHook(this, true, false); ModLoader.registerEntityID(EntityHumanNPC.class, "HumanNPC", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(EntityHumanNPC.class, 50, 14, 18, EnumCreatureType.creature, new BiomeGenBase[] { BiomeGenBase.forest, BiomeGenBase.extremeHills, }); } public void addRenderer(Map map) { map.put(EntityHumanNPC.class, new RenderBiped(new ModelBiped(), 0.5F)); }And entityHumanNPC:
package net.minecraft.src; import java.util.List; import java.util.Random; public class EntityHumanNPC extends EntityMob { public EntityHumanNPC(World world) { super(world); texture = "/mob/Native Skin.png"; moveSpeed = 0.3F; attackStrength = 2; getNavigator().setBreakDoors(true); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIAvoidEntity(this, net.minecraft.src.EntityCreeper.class, 8F, 0.3F, 0.35F)); tasks.addTask(2, new EntityAIOpenDoor(this, true)); tasks.addTask(3, new EntityAIAttackOnCollide(this, moveSpeed, true)); tasks.addTask(4, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 6F)); tasks.addTask(5, new EntityAIWander(this, 0.23F)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 16F, 0, true)); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityZombie.class, 16F, 0, true)); } protected 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() { return Item.ingotIron.shiftedIndex; } protected boolean canDespawn() { return false; } public ItemStack getHeldItem() { return defaultHeldItem; } static { defaultHeldItem = new ItemStack(Item.axeStone); } private static final ItemStack defaultHeldItem; protected void dropRareDrop(int par1) { switch (rand.nextInt(4)) { case 0: dropItem(Item.plateSteel.shiftedIndex, 1); break; case 1: dropItem(Item.helmetSteel.shiftedIndex, 1); break; case 2: dropItem(Item.legsSteel.shiftedIndex, 1); break; case 3: dropItem(Item.bootsSteel.shiftedIndex, 1); break; } } }I have no idea why the console is saying that and why it won't spawn. The weird thing is is that it used to in a earlier version of my code. But I don't have it anymore, so I was hoping someone here could see whats wrong because I've spent hours trying to. Thanks!
http://www.youtube.com/user/pancakesimone
mod_Blocky
package net.minecraft.src; import java.util.List; import net.minecraft.client.Minecraft; public class mod_Blocky extends BaseMod { public static final Block Blocky = (new BlockBlocky(200, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky1 = (new BlockBlocky(201, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky2 = (new BlockBlocky(202, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky3 = (new BlockBlocky(203, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky4 = (new BlockBlocky(204, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky5 = (new BlockBlocky(205, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky6 = (new BlockBlocky(206, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky7 = (new BlockBlocky(207, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky8 = (new BlockBlocky(208, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blocky9 = (new BlockBlocky(209, 0)).setBlockName("Block").setHardness(1.5F).setResistance(10F); public static final Block Blockyt1 = (new BlockBlockytrans(210, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F); public static final Block Blockyt2 = (new BlockBlockytrans(212, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F); public static final Block Blockyt3 = (new BlockBlockytrans(213, 0)).setBlockName("Transparent Block").setHardness(1.5F).setResistance(10F); private static GuiScreen creativeInventory; public mod_Blocky() { ModLoader.setInGameHook(this, true, false); ModLoader.setInGUIHook(this, true, false); } public void load() { Blocky.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block1.png"); ModLoader.registerBlock(Blocky); ModLoader.addName(Blocky, "Block"); Blocky1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block2.png"); ModLoader.registerBlock(Blocky1); ModLoader.addName(Blocky1, "Block"); Blocky2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block3.png"); ModLoader.registerBlock(Blocky2); ModLoader.addName(Blocky2, "Block"); Blocky3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block4.png"); ModLoader.registerBlock(Blocky3); ModLoader.addName(Blocky3, "Block"); Blocky4.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block5.png"); ModLoader.registerBlock(Blocky4); ModLoader.addName(Blocky4, "Block"); Blocky5.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block6.png"); ModLoader.registerBlock(Blocky5); ModLoader.addName(Blocky5, "Block"); Blocky6.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block7.png"); ModLoader.registerBlock(Blocky6); ModLoader.addName(Blocky6, "Block"); Blocky7.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block8.png"); ModLoader.registerBlock(Blocky7); ModLoader.addName(Blocky7, "BLock"); Blocky8.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block9.png"); ModLoader.registerBlock(Blocky8); ModLoader.addName(Blocky8, "Block"); Blocky9.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Block10.png"); ModLoader.registerBlock(Blocky9); ModLoader.addName(Blocky9, "Block"); Blockyt1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block1.png"); ModLoader.registerBlock(Blockyt1); ModLoader.addName(Blockyt1, "Transparent Block"); Blockyt2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block2.png"); ModLoader.registerBlock(Blockyt2); ModLoader.addName(Blockyt2, "Transparent Block"); Blockyt3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocky/Transparent_Block3.png"); ModLoader.registerBlock(Blockyt3); ModLoader.addName(Blockyt3, "Transparent Block"); } public String getVersion() { return "1.2.5"; } public boolean onTickInGame(float f, Minecraft minecraft) { if (minecraft.currentScreen == null) { creativeInventory = null; } return true; } public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen) { if ((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote) { Container container = ((GuiContainer)guiscreen).inventorySlots; List list = ((ContainerCreative)container).itemList; int i = 0; list.add(new ItemStack(Blocky, 1, i)); list.add(new ItemStack(Blocky1, 1, i)); list.add(new ItemStack(Blocky2, 1, i)); list.add(new ItemStack(Blocky3, 1, i)); list.add(new ItemStack(Blocky4, 1, i)); list.add(new ItemStack(Blocky5, 1, i)); list.add(new ItemStack(Blocky6, 1, i)); list.add(new ItemStack(Blocky7, 1, i)); list.add(new ItemStack(Blocky8, 1, i)); list.add(new ItemStack(Blocky9, 1, i)); list.add(new ItemStack(Blockyt1, 1, i)); list.add(new ItemStack(Blockyt2, 1, i)); list.add(new ItemStack(Blockyt3, 1, i)); } creativeInventory = guiscreen; return true; } }Well MCP can only work with Java SE Development kit 6. Try This Page
Adding Blocks to Creative Inventory
Spoiler
Read the following before spamming something like: "There is an easier way to do this, just add your block to ContainerCreative"
That is stupid and lazy. When you're modding, you should always aim not to edit ANY base class. If every mod was to edit ContainerCreative, only the mod that was last added would have its blocks added because the file would just get overridden each time. If you want to be an idiot, go right ahead and edit ContainerCreative, but don't leave a reply here saying something like "I know an easier way, add to ContainerCreative!". Leaving a reply like that just shows everyone that you have nothing better to do. I have an idea for you, go learn how to do stuff properly!
If you are smart and would like to add blocks to the creative inventory the proper way, keep reading.
Spoiler
This will just be a snippet of code(with an explanation, of course). It won't include any parts from the block tutorial. It will have a very simple explanation.
All of the code below goes into your mod_ class.
Firstly, you need to import Minecraft and List.
import net.minecraft.client.Minecraft;
import java.util.List;Then this code:
public void load()
{
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if(minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(block1, 1, i));
list.add(new ItemStack(block2, 1, i));
list.add(new ItemStack(block3, 1, i));
}
creativeInventory = guiscreen;
return true;
}
private static GuiScreen creativeInventory;
Understanding the Code
- As basically as I can put it, the code above checks if the creative inventory gui is open, then adds the blocks that you declare, into the inventory so you can get them.
list.add(new ItemStack(block1, 1, i));- The line above is what actually adds your block to the inventory after all the checks are done. You just replace block1, block2, block3, etc. with the name of your block which you declared in its public static final line.
- Please ask if you need more of an explanation
It dousn't work for me it's errors in ||
\/ and i don't know why (the error says: Multiple markers at this line
-Syntax error tonkens, delete these tokens
-Syntax error tonken(s), misplaced construct(s)
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
Plz help!
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(Unknown Source)
at fr.a(SourceFile:549)
at ModLoader.addRecipe(ModLoader.java:401)
at mod_Chisel.load(mod_Chisel.java:11)
at ModLoader.init(ModLoader.java:891)
at ModLoader.addAllRenderers(ModLoader.java:189)
at ahu.<init>(ahu.java:77)
at ahu.<clinit>(ahu.java:8)
at net.minecraft.client.Minecraft.a(SourceFile:273)
at net.minecraft.client.Minecraft.run(SourceFile:657)
at java.lang.Thread.run(Unknown Source)