Hey James, do you know any PHP or HTML? Cuzz my team is building websites and were going to make them for people for MONEY! In the future I can Gerrente that we can make MONEY!
Hi, one question, when you create a new mob, if I want that he dropds for example sticks and diamond, how I can put a % for drop sticks and a % for drop diamonds??
I mean, % for mobs drop ...
Thanks
You could use this code:
protected void dropFewItems(boolean par1, int par2){
int var3;
int var4;
int var5;
var5 = this.rand.nextInt(5);
var3 = this.rand.nextInt(3 + par2 + 1);
for (var4 = 0; var4 < var3; ++var4){
if(var5 == 0){
this.dropItem(Item.stick.itemID, 1);
}
}
var3 = this.rand.nextInt(3 + par2 + 1);
for (var4 = 0; var4 < var3; ++var4){
if(var5 == 0){
this.dropItem(Item.diamond.itemID, 1);
}
}
}
To change the percent
var5 = this.rand.nextInt(4);
Change the 4 in the code to 100 divided by the percent you want
The Meaning of Life, the Universe, and Everything.
Join Date:
2/17/2012
Posts:
127
Minecraft:
PaulBGD
Xbox:
ToxicBurner
Member Details
So I am starting, reading your guide (next time, remove all the newbie stuff for people who don't have java and link to java tutorials) and I got everything in my jars folder. I then try to decompile it, and I get some error. Inside of my eclipse folder, I have nothing. I'll get the error in a second. But anyway, do you know what could have caused this? I am suppose to compile with the minecraft jar patched with ModLoader correct?
So I am starting, reading your guide (next time, remove all the newbie stuff for people who don't have java and link to java tutorials) and I got everything in my jars folder. I then try to decompile it, and I get some error. Inside of my eclipse folder, I have nothing. I'll get the error in a second. But anyway, do you know what could have caused this? I am suppose to compile with the minecraft jar patched with ModLoader correct?
Error 1 (Hunk failures) are normal as long as there are 2 or less, but error 2 seems to be a problem with your CanvasMojangLogo.java, it seems you have it written differently, try making a clean minecraft.jar with modloader, place it in jars and decompile again
Error 1 (Hunk failures) are normal as long as there are 2 or less, but error 2 seems to be a problem with your CanvasMojangLogo.java, it seems you have it written differently, try making a clean minecraft.jar with modloader, place it in jars and decompile again
The Meaning of Life, the Universe, and Everything.
Join Date:
10/9/2012
Posts:
274
Location:
The City of New Townsville
Minecraft:
SyntaxError73
Member Details
I know someone already asked this. But my grenade is invisible only when flying through the air. It shows up when it is in my hand but goes invisible when I throw it.
Rollback Post to RevisionRollBack
Now for a limited time you can try Mirkwood for free for a month. Mirkwood is not for everyone, especially children, women who are pregnant, or may become pregnant. Side effects include: nausea, vomiting, loss of bowel control, urges to speak German at random moments, explosive radiation poisoning, mutation, itchy, watery eyes, protein denaturalization, high fever, gooifying, potty-mouth, loss of charisma, and death. You must be 18 or over to be eligible to take Mirkwood. Ask your doctor if Mirkwood is right for you.
I know someone already asked this. But my grenade is invisible only when flying through the air. It shows up when it is in my hand but goes invisible when I throw it.
I didn't add how to render, if you like you can use mrgreen33gamer's tutorials to help you render it
public static final Item striker = new ItemStriker(1042).setUnlocalizedName("striker").setCreativeTab(CreativeTabs.tabTools);
Then add this as ItemStriker.java:
package net.minecraft.src;
import java.util.Random;
public class ItemStriker extends Item{
public ItemStriker(int par1){
super(par1);
this.maxStackSize = 1;
this.setCreativeTab(CreativeTabs.tabTools);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){
EntityLightningBolt var6 = new EntityLightningBolt(world, entityplayer.posX, entityplayer.posY, entityplayer.posZ);
world.spawnEntityInWorld(var6);
return itemstack;
}
}
It tells it to spawn a lightning bolt at your position with a right click
What would I do to make it not have the lightning spawn on me, but where I was pointing? Or better yet, have a small chance of spawning on the player but mostly spawn where the player was pointing? Also how would I give the Item durability?
Hey there! Very simple question, how can I add custom texture paths? (eg the texture files are in a separate new folder which just lands in the minecraft.jar, not the minecraft.jar-textures-ect.)
Thanks!
And I used to do a ton of modding, (eskimo mod FTW :D) but your tutorials are teaching me new things still! Favoriting this page!
What would I do to make it not have the lightning spawn on me, but where I was pointing? Or better yet, have a small chance of spawning on the player but mostly spawn where the player was pointing? Also how would I give the Item durability?
Spawning an object where you are looking is a hard thing to do but here is the code (might over/undershoot slightly), I also added the chance of spawning on the player and durability
Item:
public static final Item striker = new ItemStriker(1042).setUnlocalizedName("striker").setCreativeTab(CreativeTabs.tabTools);
ItemStriker:
package net.minecraft.src;
import java.util.Random;
public class ItemStriker extends Item{
Random rand = new Random();
public ItemStriker(int par1){
super(par1);
this.maxStackSize = 1;
this.setMaxDamage(30); //Durability (30 uses)
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EntityStriker target = new EntityStriker(par2World, par3EntityPlayer);
if (!par3EntityPlayer.capabilities.isCreativeMode){
par1ItemStack.damageItem(1, par3EntityPlayer);
if (!par2World.isRemote){
switch (this.rand.nextInt(3))
{
case 0:
par2World.spawnEntityInWorld(target);
break;
case 1:
EntityLightningBolt var6 = new EntityLightningBolt(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
par2World.spawnEntityInWorld(var6);
break;
case 2:
EntityLightningBolt var7 = new EntityLightningBolt(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
par2World.spawnEntityInWorld(var7);
}
}
}
if (par3EntityPlayer.capabilities.isCreativeMode){
if (!par2World.isRemote){
par2World.spawnEntityInWorld(target);
}
}
return par1ItemStack;
}
}
As you can see in itemstriker you have this line:
this.setMaxDamage(30);
which is the durability (30 uses)
and also this:
par1ItemStack.damageItem(1, par3EntityPlayer);
tells it to damage the item by 1 point. For it to spawn where you are looking, it uses an entity with 0 gravity
Add this as EntityStriker.java
package net.minecraft.src;
public class EntityStriker extends EntityThrowable{
public EntityStriker(World par1World){
super(par1World);
}
public EntityStriker(World par1World, EntityLiving par2EntityLiving){
super(par1World, par2EntityLiving);
}
public EntityStriker(World par1World, double par2, double par4, double par6){
super(par1World, par2, par4, par6);
}
public void setVelocity(){
this.motionX *= 0.0D;
this.motionY *= -0.0D;
this.motionZ *= -0.0D;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition){
EntityLightningBolt var6 = new EntityLightningBolt(this.worldObj, par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ);
this.worldObj.spawnEntityInWorld(var6);
if (!this.worldObj.isRemote){
this.setDead();
}
}
}
now, back to ItemStriker.java, you have this:
switch (this.rand.nextInt(3))
{
case 0:
par2World.spawnEntityInWorld(target);
break;
case 1:
EntityLightningBolt var6 = new EntityLightningBolt(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
par2World.spawnEntityInWorld(var6);
break;
case 2:
EntityLightningBolt var7 = new EntityLightningBolt(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
par2World.spawnEntityInWorld(var7);
}
Which adds a 1 in 3 chance of striking yourself and a 2 in 3 chance of striking where you are looking at. To make it a 50/50 chance you would do this:
switch (this.rand.nextInt(2))
{
case 0:
par2World.spawnEntityInWorld(target);
break;
case 1:
EntityLightningBolt var6 = new EntityLightningBolt(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
par2World.spawnEntityInWorld(var6);
}
This line here:
if (par3EntityPlayer.capabilities.isCreativeMode){
if (!par2World.isRemote){
par2World.spawnEntityInWorld(target);
}
}
tells it not to strike you in creative at all or damage the item
Hey there! Very simple question, how can I add custom texture paths? (eg the texture files are in a separate new folder which just lands in the minecraft.jar, not the minecraft.jar-textures-ect.)
Thanks!
And I used to do a ton of modding, (eskimo mod FTW ) but your tutorials are teaching me new things still! Favoriting this page!
The only place you can put it without modifying the minecraft.jar is in MCP/Eclipse/Client/bin/Textures/, however the folder gets deleted often, so if you're planning to obfuscate place it in the minecraft.jar instead of there
how do you make a 3d model, my example would be a gun?
What do you mean by 3d model, is it an item that rotates in 3d on the ground, a block, a mob/entity, an item which when held looks bigger than an average item?
You may want to add this to your jetpack tut so that there is no glitchy fall damage.
Under the motion ++ (or whatever it was ) add this: entityplayer.fallDistance = (float) entityplayer.motionY;
that way, your speed is how much damage you take, not the amount of blocks you have fallen. (So you can soften your landing by hitting the thrust a bit )
I Have MCP801 and ModLoader setup for Minecraft 1.6.1.
I'm having trouble using ModLoader with MCP. Did you just open the 1.6.1.jar and insert all of the ModLoader class files then decompile with MCP? I keep getting errors.
Rollback Post to RevisionRollBack
My Bukkit plugin for IP-banning offline players, logging addresses, and more:
PM me for a YES or NO
If there is someone else feel free to PM me also
Sorry for posting this on your topic, Free Bump!
You could use this code:
To change the percent
Change the 4 in the code to 100 divided by the percent you want
So for a 20% chance to drop, you would do
100 / 20 = 5
and change the code to
EDIT: http://pastebin.com/27i8Rwmt
Error 1 (Hunk failures) are normal as long as there are 2 or less, but error 2 seems to be a problem with your CanvasMojangLogo.java, it seems you have it written differently, try making a clean minecraft.jar with modloader, place it in jars and decompile again
Sure I'll try that again.
EDIT: Same errors
Now for a limited time you can try Mirkwood for free for a month. Mirkwood is not for everyone, especially children, women who are pregnant, or may become pregnant. Side effects include: nausea, vomiting, loss of bowel control, urges to speak German at random moments, explosive radiation poisoning, mutation, itchy, watery eyes, protein denaturalization, high fever, gooifying, potty-mouth, loss of charisma, and death. You must be 18 or over to be eligible to take Mirkwood. Ask your doctor if Mirkwood is right for you.
:/ I don't know why it's like that, maybe you have a downgraded version
I didn't add how to render, if you like you can use mrgreen33gamer's tutorials to help you render it
You would add this code:
Add this as an item:
Then add this as ItemStriker.java:
It tells it to spawn a lightning bolt at your position with a right click
What would I do to make it not have the lightning spawn on me, but where I was pointing? Or better yet, have a small chance of spawning on the player but mostly spawn where the player was pointing? Also how would I give the Item durability?
Thanks!
And I used to do a ton of modding, (eskimo mod FTW :D) but your tutorials are teaching me new things still! Favoriting this page!
Spawning an object where you are looking is a hard thing to do but here is the code (might over/undershoot slightly), I also added the chance of spawning on the player and durability
Item:
ItemStriker:
As you can see in itemstriker you have this line:
which is the durability (30 uses)
and also this:
tells it to damage the item by 1 point. For it to spawn where you are looking, it uses an entity with 0 gravity
Add this as EntityStriker.java
now, back to ItemStriker.java, you have this:
Which adds a 1 in 3 chance of striking yourself and a 2 in 3 chance of striking where you are looking at. To make it a 50/50 chance you would do this:
This line here:
tells it not to strike you in creative at all or damage the item
The only place you can put it without modifying the minecraft.jar is in MCP/Eclipse/Client/bin/Textures/, however the folder gets deleted often, so if you're planning to obfuscate place it in the minecraft.jar instead of there
What do you mean by 3d model, is it an item that rotates in 3d on the ground, a block, a mob/entity, an item which when held looks bigger than an average item?
Under the motion ++ (or whatever it was ) add this: entityplayer.fallDistance = (float) entityplayer.motionY;
that way, your speed is how much damage you take, not the amount of blocks you have fallen. (So you can soften your landing by hitting the thrust a bit )
Nice tut still
Cannot wait until modloader comes for 1.6....
I'm having trouble using ModLoader with MCP. Did you just open the 1.6.1.jar and insert all of the ModLoader class files then decompile with MCP? I keep getting errors.
I would gladly appreciate it!
http://www.planetminecraft.com/mod/couple-of-new-mobs/