Hey. I am New to coding. Know most of the basics. And i have an Item that spawns my mob. . Maybe you can use the code in Gui code.
Heres the code btw
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
EntityNAME entityspawning = new EntityNAME(world);
entityspawning.setPosition(entityplayer.posX + 1, entityplayer.posY + 1, entityplayer.posZ + 1);
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("IF YOU WANT MASSAGE, PUT IT HERE, IF NOT DELETE.");
world.spawnEntityInWorld(entityspawning);
return itemstack;
}
You will have to change the public ItemStack.
Maybe something like
If Button1 = on
{
CODE
}
i dont know. I havnt tried that out. Change the code as much as you want. This code spawns the mobs with an item though.
First off. Please tell at least one idea so we know what your going to make. I know few coders that never look at topics like this if the name doesn't say anything. + if the description doesn't say what the idea is. Let me know what thouse idea's is. And maybe i'll apply. (( Im just a beginner coder though. But i know most of the basics.Blocks,/Items,Mobs,Gui )).;)
Hello there!
Thanks for taking a moment to read this.
I am a Beginner Coder and I'm looking for few people to help with a mod that I'm creating.
I need a few coders, beginners or advanced, doesn't matter.
I also need a modeler, texturer and someone who gives ideas!
The main idea is a Dinosaur Mod.
I know there are Dinosaur Mods...
What you are asking is extremely complicated. The GUI not so much, there are a lot of tutorials explaining how to add a custom GUI with buttons. However, you are asking for complicated tasks for the mob to accomplish.
I suggest you start by learning java as QuantumMonkey said, then try to accomplish something less challenging. What have you managed to code until now?
You might want to learn something, it's called Java. Yeah.
Thats not what i meant really. I am a beginner in java coding. I HAVE A MOB. AND IM WORKING ON THE GUI. dont need help with that. And yes its complicated thats why i asked on the forums Thansk though guys
Hey. Iv'e added a custom Mob. And everything is working fine. But i'm Working on GUI atm. And i want to make the mob go mining or farming and stuff.Like when Right clicked teh gui opens. When pressed Go Mining the mob goes mining? Could anyone help me . Or send me a link of a Tutorial ?. Thanks
-vorensHD
Heey. so i need help with audiomod. I know where to put the sounds (.ogg) but dont know where in the entity i should set a code. Also i dont know what to code. I whant my Mob to play the sound when right clicked. Anyone out there that can help me ? :/
Okei thanks guys. But still. How do i make it Growable like wheat ?. It still spawns as fully grown. + It doesn't drop the item or not even the seed again :/
Yes do it please ...
Do you have a BlockmyCrop.java like this :
package net.minecraft.src;
import java.util.Random;
public class BlockNewCrop extends BlockFlower
{
protected BlockNewCrop(int i, int j)
{
super(i, j);
setTickOnLoad(true); // If you copied and pasted you'll notice I took out the BlockInTexture part.
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_EXAMPLE.newCrop1;
}
if(j == 2)
{
return mod_EXAMPLE.newCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_EXAMPLE.newCrop2;
}
if(j == 4)
{
return mod_EXAMPLE.newCrop2;
}
if(j == 5)
{
return mod_EXAMPLE.newCrop3;
}
if(j == 6)
{
return mod_EXAMPLE.newCrop3;
}
if(j == 7)
{
return mod_EXAMPLE.newCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
if(world.multiplayerWorld)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(world.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_EXAMPLE.newSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
world.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_EXAMPLE.newVegetable.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1; // How many veggie you want? 1, 2, 50?
}
}
Ok i copied that blockfile into mine. And change'd it to my stuff. Then it gives me 2 errors.
if(world.multiplayerWorld)
And
setTickOnLoad(true);
Buthere is my
Mod_File
package net.minecraft.src;
import java.util.Map;
public class mod_Brocraft extends BaseMod
{
public static final Item GlgKush = new ItemFood(160, 1, 1f, false).setPotionEffect(Potion.poison.id, 30, 0, 1F).setItemName("GLG Kush");
public static final Item Kush = new ItemFood(161, 1, 1F, false).setPotionEffect(Potion.confusion.id, 60, 0, 1F).setPotionEffect(Potion.weakness.id, 60, 0, 1F).setItemName("Kush");
public static final Block GLGPlant = new BlockGLGPlant(162, 0).setBlockName("GLGPlant").setStepSound(Block.soundGrassFootstep);
public static final Item Seeds1 = new ItemSeeds(4000, mod_Brocraft.GLGPlant.blockID, Block.tilledField.blockID).setItemName("GLG Plant Seed");
public static int GLGPlant1;
public static int GLGPlant2;
public static int GLGPlant3;
public static int GLGPlant4;
public static int GLGPlant5;
public static int GLGPlant6;
public static int GLGPlant7;
public static int GLGPlant8;
public void load()
{
ModLoader.addName(GLGPlant, "GLGPlant");
ModLoader.addName(Seeds1, "GLG Plant Seed");
GLGPlant.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant.png");
Seeds1.iconIndex = ModLoader.addOverride("/gui/items.png", "/texture/Seeds1.png");
GLGPlant1 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant1.png");
GLGPlant2 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant2.png");
GLGPlant3 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant3.png");
GLGPlant4 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant4.png");
GLGPlant5 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant5.png");
GLGPlant6 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant6.png");
GLGPlant7 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant7.png");
GLGPlant8 = ModLoader.addOverride("/terrain.png", "/texture/GLGPlant8.png");
//EntityRegister
ModLoader.registerEntityID(EntityIamtheattack.class, "Iamtheattack", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityIamtheattack.class, 12, 14, 18, EnumCreatureType.creature);
ModLoader.registerEntityID(EntityxRpMx13.class, "xRpMx13", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityxRpMx13.class, 12, 14, 18, EnumCreatureType.creature);
ModLoader.registerEntityID(EntityDavidbrownTV.class, "DavidbrownTV", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityDavidbrownTV.class, 12, 14, 18, EnumCreatureType.creature);
//addName
ModLoader.addName(GlgKush, "Glg Kush");
ModLoader.addName(Kush, "Kush");
//Texture
GlgKush.iconIndex = ModLoader.addOverride("/gui/items.png", "/texture/GlgKush.png");
Kush.iconIndex = ModLoader.addOverride("/gui/items.png", "/texture/Kush.png");
//Recipe
ModLoader.addRecipe(new ItemStack(Kush, 3), new Object[]
{
"###", "$$$", "###", Character.valueOf('#'), Item.paper, Character.valueOf('$'), GlgKush
});
ModLoader.addRecipe(new ItemStack(GlgKush, 3), new Object[]
{
"#", ('#'), Block.dirt
});
}
public void addRenderer(Map map)
{
map.put(EntityIamtheattack.class, new RenderIamtheattack(new ModelBiped(), 0.5F));
map.put(EntityxRpMx13.class, new RenderxRpMx13(new ModelBiped(), 0.5F));
map.put(EntityDavidbrownTV.class, new RenderDavidbrownTV(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.5";
}
}
And my BlockFile
package net.minecraft.src;
import java.util.Random;
public class BlockGLGPlant extends BlockFlower
{
protected BlockGLGPlant(int i, int j)
{
super(i, j);
setTickOnLoad(true); // If you copied and pasted you'll notice I took out the BlockInTexture part.
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Brocraft.GLGPlant1;
}
if(j == 2)
{
return mod_Brocraft.GLGPlant1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_Brocraft.GLGPlant2;
}
if(j == 4)
{
return mod_Brocraft.GLGPlant2;
}
if(j == 5)
{
return mod_Brocraft.GLGPlant3;
}
if(j == 6)
{
return mod_Brocraft.GLGPlant3;
}
if(j == 7)
{
return mod_Brocraft.GLGPlant4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
if(world.multiplayerWorld)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(world.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_Brocraft.Seeds1)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
world.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_Brocraft.GlgKush.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1; // How many veggie you want? 1, 2, 50?
}
}
public static final Item Seeds1 = new ItemSeeds(4000, mod_FILE.crop.blockID, Block.tilledField.blockID).setItemName("Seeds1");
Okei thanks. Now you fixed the problem. And now when i right click with my seed. It goes Fully grown. i want it to work like the wheat seed :/ I can paste the files in a spoiler if you guys want :/
[code]Description Resource Path Location Type
The constructor ItemSeeds(int, int) is undefined mod_Brocraft.java /Client/src/net/minecraft/src line 12 Java Problem[/code]
Thats the error i get. When i change it to "this" it tells me i cant have a this statement in a static statement. ? :/
Yes. I Watched this video before i posted this topic. The thing is. I was gonna say that in this topic but it seems like i forgot. Butthe thing was i got an error in the Mod_FILE. on the
public static final Item Seeds1 = new ItemSeeds(4000, mod_FILE.crop.blockID).setItemName("Seeds1");
So what i was going to ask is. How do i fix that problem ?
Hello all, I have a slight problem with my code. Whenever I run it, there are no errors AT ALL, except that when I try the crafting recipes, they simply don't work.
This is the code for the crafting recipes (no bugs in eclipse, its all set up properly):
ModLoader.addRecipe(new ItemStack(Haybale, 1), new Object [] {"###", "###", '#', Item.wheat});
ModLoader.addRecipe(new ItemStack(Haybale, 1), new Object [] {"###", "###", '#', Block.tallGrass});
No errors, I have no idea why this is happening. Any help?
Is Haybale in the same class as this recipe?. If so. i dont know. But if its not. You have to make it. (new ItemStack(NAMEOFCLASS.Haybale, 1)
Ouh andyeah. Make Character.valueOf('#'), Item.wheat. and the same for grass
0
Welcome to the team. if you can sign up on skype that would be Awesome. If not thats okey. I'll contact you when stuff starts to happen.
0
Heres the code btw
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
EntityNAME entityspawning = new EntityNAME(world);
entityspawning.setPosition(entityplayer.posX + 1, entityplayer.posY + 1, entityplayer.posZ + 1);
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("IF YOU WANT MASSAGE, PUT IT HERE, IF NOT DELETE.");
world.spawnEntityInWorld(entityspawning);
return itemstack;
}
You will have to change the public ItemStack.
Maybe something like
If Button1 = on
{
CODE
}
i dont know. I havnt tried that out. Change the code as much as you want. This code spawns the mobs with an item though.
0
0
Thanks for taking a moment to read this.
I am a Beginner Coder and I'm looking for few people to help with a mod that I'm creating.
I need a few coders, beginners or advanced, doesn't matter.
I also need a modeler, texturer and someone who gives ideas!
The main idea is a Dinosaur Mod.
I know there are Dinosaur Mods...
Its just a little mod, nothing too big.
Team:
Coders:
VorensHD
Haxman12
HoBoS_TaCo
Textureres:
Haxman12
HoBoS_TaCo
Modelers:
HoBoS_TaCo
Ideas:
If you want to join please use this form:
0
Thats not what i meant really. I am a beginner in java coding. I HAVE A MOB. AND IM WORKING ON THE GUI. dont need help with that. And yes its complicated thats why i asked on the forums Thansk though guys
0
-vorensHD
0
0
0
Okei thanks guys. But still. How do i make it Growable like wheat ?. It still spawns as fully grown. + It doesn't drop the item or not even the seed again :/
0
Ok i copied that blockfile into mine. And change'd it to my stuff. Then it gives me 2 errors.
And
Buthere is my
Mod_File
And my BlockFile
These are my files.
0
Okei thanks. Now you fixed the problem. And now when i right click with my seed. It goes Fully grown. i want it to work like the wheat seed :/ I can paste the files in a spoiler if you guys want :/
0
[code]Description Resource Path Location Type The constructor ItemSeeds(int, int) is undefined mod_Brocraft.java /Client/src/net/minecraft/src line 12 Java Problem[/code]
Thats the error i get. When i change it to "this" it tells me i cant have a this statement in a static statement. ? :/
0
Yes. I Watched this video before i posted this topic. The thing is. I was gonna say that in this topic but it seems like i forgot. Butthe thing was i got an error in the Mod_FILE. on the
So what i was going to ask is. How do i fix that problem ?
0
P.S. i Know how to code basics. so im not a COMPLETE beginner.
0
Is Haybale in the same class as this recipe?. If so. i dont know. But if its not. You have to make it. (new ItemStack(NAMEOFCLASS.Haybale, 1)
Ouh andyeah. Make Character.valueOf('#'), Item.wheat. and the same for grass