Im making an item that can be thrown. When I throw it you can hear the sound but just can't see it I do not know why this is happening can you help me?
mod_Weapons
package net.minecraft.src;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class mod_Weapons extends BaseMod
{
//Weapons
public static final Item Kunai = new ItemNinjaWeapon (10550).setItemName ("Kunai");
public static final Item Shuriken = new ItemNinjaWeapon (10551).setItemName ("Shuriken");
public static final Item Katana = new ItemSword (10552, EnumToolMaterial.GOLD).setItemName ("Katana");
//Items
public static final Item CarbonSteel = new ItemCarbon (10750).setItemName("CarbonSteel");
public static final Item CarbonBlade = new ItemCarbon (10751).setItemName("CarbonBlade");
public static final Item Handle = new ItemCarbon (10752).setItemName("Handle");
public void addRenderer(Map map)
{
map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Shuriken.iconIndex));
map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Kunai.iconIndex));
}
public void load()
{
//Weapon Names
ModLoader.addName(Kunai, "Kunai");
ModLoader.addName(Shuriken, "Shuriken");
ModLoader.addName(Katana, "Katana");
//Item Names
ModLoader.addName(CarbonSteel, "CarbonSteel");
ModLoader.addName(CarbonBlade, "Carbon Blade");
ModLoader.addName(Handle, "Handle");
//Item Images
CarbonSteel.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonSteel.png");
CarbonBlade.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonBlade.png");
Handle.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/Handle.png");
//Weapon Images
Kunai.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Kunai.png");
Shuriken.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Shuriken.png");
Katana.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Katana.png");
}
public String getVersion()
{
return "Weapons v0.0.1";
}
}
EntityThrow
package net.minecraft.src;
public class EntityThrow extends EntityThrowable
{
public EntityThrow(World par1World)
{
super(par1World);
}
public EntityThrow(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityThrow(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
/**
* NOTE TO SELF! 10 = 5 Hearts 20 = 10 Hearts
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
byte var2 = 5;
if (par1MovingObjectPosition.entityHit instanceof EntityBlaze)
{
var2 = 0;
}
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_85052_h()), var2);
}
for (int var3 = 0; var3 < 8; ++var3)
{
this.worldObj.spawnParticle("Snowpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}
ItemNinjaWeapons
package net.minecraft.src;
public class ItemNinjaWeapon extends Item
{
public ItemNinjaWeapon(int i)
{
super(i);
maxStackSize = 16;
setMaxDamage(0);
this.setCreativeTab(CreativeTabs.tabCombat);
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
EntityPlayer par3EntityPlayer) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
--par1ItemStack.stackSize;
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F,
0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote) {
par2World.spawnEntityInWorld(new EntityThrow(par2World,
par3EntityPlayer));
}
return par1ItemStack;
}
}
Im making an item that can be thrown. When I throw it you can hear the sound but just can't see it I do not know why this is happening can you help me?
mod_Weapons
package net.minecraft.src;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class mod_Weapons extends BaseMod
{
//Weapons
public static final Item Kunai = new ItemNinjaWeapon (10550).setItemName ("Kunai");
public static final Item Shuriken = new ItemNinjaWeapon (10551).setItemName ("Shuriken");
public static final Item Katana = new ItemSword (10552, EnumToolMaterial.GOLD).setItemName ("Katana");
//Items
public static final Item CarbonSteel = new ItemCarbon (10750).setItemName("CarbonSteel");
public static final Item CarbonBlade = new ItemCarbon (10751).setItemName("CarbonBlade");
public static final Item Handle = new ItemCarbon (10752).setItemName("Handle");
public void addRenderer(Map map)
{
map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Shuriken.iconIndex));
map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Kunai.iconIndex));
}
public void load()
{
//Weapon Names
ModLoader.addName(Kunai, "Kunai");
ModLoader.addName(Shuriken, "Shuriken");
ModLoader.addName(Katana, "Katana");
//Item Names
ModLoader.addName(CarbonSteel, "CarbonSteel");
ModLoader.addName(CarbonBlade, "Carbon Blade");
ModLoader.addName(Handle, "Handle");
//Item Images
CarbonSteel.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonSteel.png");
CarbonBlade.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonBlade.png");
Handle.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/Handle.png");
//Weapon Images
Kunai.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Kunai.png");
Shuriken.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Shuriken.png");
Katana.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Katana.png");
}
public String getVersion()
{
return "Weapons v0.0.1";
}
}
EntityThrow
package net.minecraft.src;
public class EntityThrow extends EntityThrowable
{
public EntityThrow(World par1World)
{
super(par1World);
}
public EntityThrow(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityThrow(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
/**
* NOTE TO SELF! 10 = 5 Hearts 20 = 10 Hearts
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
byte var2 = 5;
if (par1MovingObjectPosition.entityHit instanceof EntityBlaze)
{
var2 = 0;
}
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_85052_h()), var2);
}
for (int var3 = 0; var3 < 8; ++var3)
{
this.worldObj.spawnParticle("Snowpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}
ItemNinjaWeapons
package net.minecraft.src;
public class ItemNinjaWeapon extends Item
{
public ItemNinjaWeapon(int i)
{
super(i);
maxStackSize = 16;
setMaxDamage(0);
this.setCreativeTab(CreativeTabs.tabCombat);
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
EntityPlayer par3EntityPlayer) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
--par1ItemStack.stackSize;
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F,
0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote) {
par2World.spawnEntityInWorld(new EntityThrow(par2World,
par3EntityPlayer));
}
return par1ItemStack;
}
}
Can you please help
make your entity extends entity snowball see if that helps
popgalop how would i go about to find someones spawncoordinates, like the bed location and such, i have tried par3EntityPlayer.getBedLocation().posX/Y/Z and many many other tries to find the induviduals spawnlocation but all it does is sending me to the maps starting spawnlocation.
Edit:
also if i go to far so the place i teleport to unloads it will stay unloaded when teleporting to it (until you exit out of the game and log in again) how do i force load the area around me?
i think get bed location should work i don't know why its not working ill look into it
Good job on the throwable items. Is there a way you could manipulate the code to work for arrows? It halfway works, just the arrow tumbles through the air like a potion would.... I can't seem to figure it out. Any help would be great.
Also, is there a way to add custom sounds without AudioMod and such? There was a way before 1.3, but it doesn't work now. Any ideas?
I am just starting a mod that generates a really big structure and i figured out how to do the generation myself.. then i realized that doing it the same way as tutorial/what i was doing would be so hard because its a very big structure. is there a way to get modloader to put a mcedit schematic into the world? if so how??
i need help with a particularly devious glitch thats happning with my mod...
whenever i spawn a lagcreeper (yes this mod includes creepers with an x100 explosion radius) as such it glitches real bad.
my intentions is to add a new creeper called a "Lag Creeper" that is 100x more powerful than an ordinary creeper.
heres the source code...
mod_lagcreepers.java\
package net.minecraft.src;
import java.util.Random;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.awt.Color;
public class mod_Lagcreepers extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityLagCreeper.class, "LagCreeper",30);//registers the mobs name and id
ModLoader.addSpawn("LagCreeper", 15, -5, 1, EnumCreatureType.monster);
ModLoader.addLocalization("entity.LagCreeper.name", "LagCreeper");
EntityList.entityEggs.put(Integer.valueOf(30), new EntityEggInfo(30, 894731, (new Color(21, 15, 6)).getRGB()));
}
//renderer for lagcreeper
public void addRenderer(Map map)
{
map.put(EntityLagCreeper.class, new RenderLiving(new ModelCreeper(),.5f));
}
//get version
public String getVersion()
{
return "Lag Creepers Mod For 1.4.7";
}
}
EntityLagCreeper.java
package net.minecraft.src;
import java.util.Random;
public class EntityLagCreeper extends EntityMob
{
private int lastActiveTime;
private int timeSinceIgnited;
private int field_82225_f = 30;
private int explosionRadius = 50;
public EntityLagCreeper(World world)
{
super(world);
this.texture = "/hxad3cmal/Lag Creeper Mod/mob/Lagcreeper.png";
this.moveSpeed = 0.35F;
isImmuneToFire = false;
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAILagCreeperSwell(this));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.25F, false));
this.tasks.addTask(5, new EntityAIWander(this, 0.2F));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
}
/**
* Returns true if the newer Entity AI code should be run
*/
protected boolean isAIEnabled()
{
return true;
}
protected void fall(float par1)
{
super.fall(par1);
this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + par1 * 1.5F);
if (this.timeSinceIgnited > this.field_82225_f - 5)
{
this.timeSinceIgnited = this.field_82225_f - 5;
}
}
public int getMaxHealth()
{
return 20;
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1));
this.dataWatcher.addObject(17, Byte.valueOf((byte)0));
}
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
if (this.dataWatcher.getWatchableObjectByte(17) == 1)
{
par1NBTTagCompound.setBoolean("powered", true);
}
par1NBTTagCompound.setShort("Fuse", (short)this.field_82225_f);
par1NBTTagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius);
}
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1NBTTagCompound.getBoolean("powered") ? 1 : 0)));
if (par1NBTTagCompound.hasKey("Fuse"))
{
this.field_82225_f = par1NBTTagCompound.getShort("Fuse");
}
if (par1NBTTagCompound.hasKey("ExplosionRadius"))
{
this.explosionRadius = par1NBTTagCompound.getByte("ExplosionRadius");
}
}
public void onUpdate()
{
if (this.isEntityAlive())
{
this.lastActiveTime = this.timeSinceIgnited;
int var1 = this.getCreeperState();
if (var1 > 0 && this.timeSinceIgnited == 0)
{
this.playSound("random.fuse", 1.0F, 0.5F);
}
this.timeSinceIgnited += var1;
if (this.timeSinceIgnited < 0)
{
this.timeSinceIgnited = 0;
}
if (this.timeSinceIgnited >= this.field_82225_f)
{
this.timeSinceIgnited = this.field_82225_f;
if (!this.worldObj.isRemote)
{
boolean var2 = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
if (this.getPowered())
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), var2);
}
else
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, var2);
}
this.setDead();
}
}
}}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.creeper.say";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.creeper.death";
}
public boolean attackEntityAsMob(Entity par1Entity)
{
return true;
}
public boolean getPowered()
{
return this.dataWatcher.getWatchableObjectByte(17) == 1;
}
public float getCreeperFlashIntensity(float par1)
{
return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * par1) / (float)(this.field_82225_f - 2);
}
protected int getDropItemId()
{
return Item.gunpowder.itemID;
}
public int getCreeperState()
{
return this.dataWatcher.getWatchableObjectByte(16);
}
public void setCreeperState(int par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1));
}
public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt)
{
super.onStruckByLightning(par1EntityLightningBolt);
this.dataWatcher.updateObject(17, Byte.valueOf((byte)1));
}
}
EntityAILagCreeperSwell
package net.minecraft.src;
public class EntityAILagCreeperSwell extends EntityAIBase
{
EntityLagCreeper swellingCreeper;
/**
* The creeper's attack target. This is used for the changing of the creeper's state.
*/
EntityLiving creeperAttackTarget;
public EntityAILagCreeperSwell(EntityLagCreeper par1EntityLagCreeper)
{
this.swellingCreeper = par1EntityLagCreeper;
this.setMutexBits(1);
}
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
EntityLiving var1 = this.swellingCreeper.getAttackTarget();
return this.swellingCreeper.getCreeperState() > 0 || var1 != null && this.swellingCreeper.getDistanceSqToEntity(var1) < 9.0D;
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
this.swellingCreeper.getNavigator().clearPathEntity();
this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
}
/**
* Resets the task
*/
public void resetTask()
{
this.creeperAttackTarget = null;
}
/**
* Updates the task
*/
public void updateTask()
{
if (this.creeperAttackTarget == null)
{
this.swellingCreeper.setCreeperState(-1);
}
else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D)
{
this.swellingCreeper.setCreeperState(-1);
}
else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget))
{
this.swellingCreeper.setCreeperState(-1);
}
else
{
this.swellingCreeper.setCreeperState(1);
}
}
}
Thank you so much for making this tutorial set! I am just wondering if you get around to it to make a tutorial for making a structure spawn only on the ground and a tutorial for making a entity spawn only there. Thanks again! ~n1nja2na
I am just starting a mod that generates a really big structure and i figured out how to do the generation myself.. then i realized that doing it the same way as tutorial/what i was doing would be so hard because its a very big structure. is there a way to get modloader to put a mcedit schematic into the world? if so how??
i need help with a particularly devious glitch thats happning with my mod...
whenever i spawn a lagcreeper (yes this mod includes creepers with an x100 explosion radius) as such it glitches real bad.
my intentions is to add a new creeper called a "Lag Creeper" that is 100x more powerful than an ordinary creeper.
heres the source code...
mod_lagcreepers.java\
package net.minecraft.src;
import java.util.Random;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.awt.Color;
public class mod_Lagcreepers extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityLagCreeper.class, "LagCreeper",30);//registers the mobs name and id
ModLoader.addSpawn("LagCreeper", 15, -5, 1, EnumCreatureType.monster);
ModLoader.addLocalization("entity.LagCreeper.name", "LagCreeper");
EntityList.entityEggs.put(Integer.valueOf(30), new EntityEggInfo(30, 894731, (new Color(21, 15, 6)).getRGB()));
}
//renderer for lagcreeper
public void addRenderer(Map map)
{
map.put(EntityLagCreeper.class, new RenderLiving(new ModelCreeper(),.5f));
}
//get version
public String getVersion()
{
return "Lag Creepers Mod For 1.4.7";
}
}
EntityLagCreeper.java
package net.minecraft.src;
import java.util.Random;
public class EntityLagCreeper extends EntityMob
{
private int lastActiveTime;
private int timeSinceIgnited;
private int field_82225_f = 30;
private int explosionRadius = 50;
public EntityLagCreeper(World world)
{
super(world);
this.texture = "/hxad3cmal/Lag Creeper Mod/mob/Lagcreeper.png";
this.moveSpeed = 0.35F;
isImmuneToFire = false;
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAILagCreeperSwell(this));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.25F, false));
this.tasks.addTask(5, new EntityAIWander(this, 0.2F));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
}
/**
* Returns true if the newer Entity AI code should be run
*/
protected boolean isAIEnabled()
{
return true;
}
protected void fall(float par1)
{
super.fall(par1);
this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + par1 * 1.5F);
if (this.timeSinceIgnited > this.field_82225_f - 5)
{
this.timeSinceIgnited = this.field_82225_f - 5;
}
}
public int getMaxHealth()
{
return 20;
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1));
this.dataWatcher.addObject(17, Byte.valueOf((byte)0));
}
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
if (this.dataWatcher.getWatchableObjectByte(17) == 1)
{
par1NBTTagCompound.setBoolean("powered", true);
}
par1NBTTagCompound.setShort("Fuse", (short)this.field_82225_f);
par1NBTTagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius);
}
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1NBTTagCompound.getBoolean("powered") ? 1 : 0)));
if (par1NBTTagCompound.hasKey("Fuse"))
{
this.field_82225_f = par1NBTTagCompound.getShort("Fuse");
}
if (par1NBTTagCompound.hasKey("ExplosionRadius"))
{
this.explosionRadius = par1NBTTagCompound.getByte("ExplosionRadius");
}
}
public void onUpdate()
{
if (this.isEntityAlive())
{
this.lastActiveTime = this.timeSinceIgnited;
int var1 = this.getCreeperState();
if (var1 > 0 && this.timeSinceIgnited == 0)
{
this.playSound("random.fuse", 1.0F, 0.5F);
}
this.timeSinceIgnited += var1;
if (this.timeSinceIgnited < 0)
{
this.timeSinceIgnited = 0;
}
if (this.timeSinceIgnited >= this.field_82225_f)
{
this.timeSinceIgnited = this.field_82225_f;
if (!this.worldObj.isRemote)
{
boolean var2 = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
if (this.getPowered())
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), var2);
}
else
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, var2);
}
this.setDead();
}
}
}}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.creeper.say";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.creeper.death";
}
public boolean attackEntityAsMob(Entity par1Entity)
{
return true;
}
public boolean getPowered()
{
return this.dataWatcher.getWatchableObjectByte(17) == 1;
}
public float getCreeperFlashIntensity(float par1)
{
return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * par1) / (float)(this.field_82225_f - 2);
}
protected int getDropItemId()
{
return Item.gunpowder.itemID;
}
public int getCreeperState()
{
return this.dataWatcher.getWatchableObjectByte(16);
}
public void setCreeperState(int par1)
{
this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1));
}
public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt)
{
super.onStruckByLightning(par1EntityLightningBolt);
this.dataWatcher.updateObject(17, Byte.valueOf((byte)1));
}
}
EntityAILagCreeperSwell
package net.minecraft.src;
public class EntityAILagCreeperSwell extends EntityAIBase
{
EntityLagCreeper swellingCreeper;
/**
* The creeper's attack target. This is used for the changing of the creeper's state.
*/
EntityLiving creeperAttackTarget;
public EntityAILagCreeperSwell(EntityLagCreeper par1EntityLagCreeper)
{
this.swellingCreeper = par1EntityLagCreeper;
this.setMutexBits(1);
}
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
EntityLiving var1 = this.swellingCreeper.getAttackTarget();
return this.swellingCreeper.getCreeperState() > 0 || var1 != null && this.swellingCreeper.getDistanceSqToEntity(var1) < 9.0D;
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
this.swellingCreeper.getNavigator().clearPathEntity();
this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
}
/**
* Resets the task
*/
public void resetTask()
{
this.creeperAttackTarget = null;
}
/**
* Updates the task
*/
public void updateTask()
{
if (this.creeperAttackTarget == null)
{
this.swellingCreeper.setCreeperState(-1);
}
else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D)
{
this.swellingCreeper.setCreeperState(-1);
}
else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget))
{
this.swellingCreeper.setCreeperState(-1);
}
else
{
this.swellingCreeper.setCreeperState(1);
}
}
}
Dimension, yes! If it could somehow not use forge, that would be the best thing in the world
Bleach Mod
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumModLoader.addRecipe(new ItemStack(itemtoreceive, quantity), new Object [] {"###", " $ ", " $ ", Character.valueOf('#'), Block.name, Character.valueOf('§'), Block.name});
I know, but when I want the recipe to receive a new item or block, it gives me errors.
Planet Minecraft: GLStudios
mod_Weapons
package net.minecraft.src; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Random; public class mod_Weapons extends BaseMod { //Weapons public static final Item Kunai = new ItemNinjaWeapon (10550).setItemName ("Kunai"); public static final Item Shuriken = new ItemNinjaWeapon (10551).setItemName ("Shuriken"); public static final Item Katana = new ItemSword (10552, EnumToolMaterial.GOLD).setItemName ("Katana"); //Items public static final Item CarbonSteel = new ItemCarbon (10750).setItemName("CarbonSteel"); public static final Item CarbonBlade = new ItemCarbon (10751).setItemName("CarbonBlade"); public static final Item Handle = new ItemCarbon (10752).setItemName("Handle"); public void addRenderer(Map map) { map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Shuriken.iconIndex)); map.put(net.minecraft.src.EntityThrow.class, new RenderSnowball(mod_Naruto.Kunai.iconIndex)); } public void load() { //Weapon Names ModLoader.addName(Kunai, "Kunai"); ModLoader.addName(Shuriken, "Shuriken"); ModLoader.addName(Katana, "Katana"); //Item Names ModLoader.addName(CarbonSteel, "CarbonSteel"); ModLoader.addName(CarbonBlade, "Carbon Blade"); ModLoader.addName(Handle, "Handle"); //Item Images CarbonSteel.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonSteel.png"); CarbonBlade.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/CarbonBlade.png"); Handle.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Items/Handle.png"); //Weapon Images Kunai.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Kunai.png"); Shuriken.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Shuriken.png"); Katana.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mod/Weapons/Katana.png"); } public String getVersion() { return "Weapons v0.0.1"; } }EntityThrow
package net.minecraft.src; public class EntityThrow extends EntityThrowable { public EntityThrow(World par1World) { super(par1World); } public EntityThrow(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityThrow(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } /** * Called when this EntityThrowable hits a block or entity. */ /** * NOTE TO SELF! 10 = 5 Hearts 20 = 10 Hearts */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { byte var2 = 5; if (par1MovingObjectPosition.entityHit instanceof EntityBlaze) { var2 = 0; } par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_85052_h()), var2); } for (int var3 = 0; var3 < 8; ++var3) { this.worldObj.spawnParticle("Snowpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } if (!this.worldObj.isRemote) { this.setDead(); } } }ItemNinjaWeapons
package net.minecraft.src; public class ItemNinjaWeapon extends Item { public ItemNinjaWeapon(int i) { super(i); maxStackSize = 16; setMaxDamage(0); this.setCreativeTab(CreativeTabs.tabCombat); } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityThrow(par2World, par3EntityPlayer)); } return par1ItemStack; } }Can you please help
Ok now something shows up but when I throw it instead of my item snowballs come out
Also, is there a way to add custom sounds without AudioMod and such? There was a way before 1.3, but it doesn't work now. Any ideas?
Bleach Mod
whenever i spawn a lagcreeper (yes this mod includes creepers with an x100 explosion radius) as such it glitches real bad.
my intentions is to add a new creeper called a "Lag Creeper" that is 100x more powerful than an ordinary creeper.
heres the source code...
mod_lagcreepers.java\
package net.minecraft.src; import java.util.Random; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.awt.Color; public class mod_Lagcreepers extends BaseMod { public void load() { ModLoader.registerEntityID(EntityLagCreeper.class, "LagCreeper",30);//registers the mobs name and id ModLoader.addSpawn("LagCreeper", 15, -5, 1, EnumCreatureType.monster); ModLoader.addLocalization("entity.LagCreeper.name", "LagCreeper"); EntityList.entityEggs.put(Integer.valueOf(30), new EntityEggInfo(30, 894731, (new Color(21, 15, 6)).getRGB())); } //renderer for lagcreeper public void addRenderer(Map map) { map.put(EntityLagCreeper.class, new RenderLiving(new ModelCreeper(),.5f)); } //get version public String getVersion() { return "Lag Creepers Mod For 1.4.7"; } }EntityLagCreeper.java
package net.minecraft.src; import java.util.Random; public class EntityLagCreeper extends EntityMob { private int lastActiveTime; private int timeSinceIgnited; private int field_82225_f = 30; private int explosionRadius = 50; public EntityLagCreeper(World world) { super(world); this.texture = "/hxad3cmal/Lag Creeper Mod/mob/Lagcreeper.png"; this.moveSpeed = 0.35F; isImmuneToFire = false; this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAILagCreeperSwell(this)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.25F, false)); this.tasks.addTask(5, new EntityAIWander(this, 0.2F)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); } /** * Returns true if the newer Entity AI code should be run */ protected boolean isAIEnabled() { return true; } protected void fall(float par1) { super.fall(par1); this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + par1 * 1.5F); if (this.timeSinceIgnited > this.field_82225_f - 5) { this.timeSinceIgnited = this.field_82225_f - 5; } } public int getMaxHealth() { return 20; } protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); } public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); if (this.dataWatcher.getWatchableObjectByte(17) == 1) { par1NBTTagCompound.setBoolean("powered", true); } par1NBTTagCompound.setShort("Fuse", (short)this.field_82225_f); par1NBTTagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius); } public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1NBTTagCompound.getBoolean("powered") ? 1 : 0))); if (par1NBTTagCompound.hasKey("Fuse")) { this.field_82225_f = par1NBTTagCompound.getShort("Fuse"); } if (par1NBTTagCompound.hasKey("ExplosionRadius")) { this.explosionRadius = par1NBTTagCompound.getByte("ExplosionRadius"); } } public void onUpdate() { if (this.isEntityAlive()) { this.lastActiveTime = this.timeSinceIgnited; int var1 = this.getCreeperState(); if (var1 > 0 && this.timeSinceIgnited == 0) { this.playSound("random.fuse", 1.0F, 0.5F); } this.timeSinceIgnited += var1; if (this.timeSinceIgnited < 0) { this.timeSinceIgnited = 0; } if (this.timeSinceIgnited >= this.field_82225_f) { this.timeSinceIgnited = this.field_82225_f; if (!this.worldObj.isRemote) { boolean var2 = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); if (this.getPowered()) { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), var2); } else { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, var2); } this.setDead(); } } }} /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "mob.creeper.say"; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "mob.creeper.death"; } public boolean attackEntityAsMob(Entity par1Entity) { return true; } public boolean getPowered() { return this.dataWatcher.getWatchableObjectByte(17) == 1; } public float getCreeperFlashIntensity(float par1) { return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * par1) / (float)(this.field_82225_f - 2); } protected int getDropItemId() { return Item.gunpowder.itemID; } public int getCreeperState() { return this.dataWatcher.getWatchableObjectByte(16); } public void setCreeperState(int par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1)); } public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt) { super.onStruckByLightning(par1EntityLightningBolt); this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); } }EntityAILagCreeperSwell
package net.minecraft.src; public class EntityAILagCreeperSwell extends EntityAIBase { EntityLagCreeper swellingCreeper; /** * The creeper's attack target. This is used for the changing of the creeper's state. */ EntityLiving creeperAttackTarget; public EntityAILagCreeperSwell(EntityLagCreeper par1EntityLagCreeper) { this.swellingCreeper = par1EntityLagCreeper; this.setMutexBits(1); } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { EntityLiving var1 = this.swellingCreeper.getAttackTarget(); return this.swellingCreeper.getCreeperState() > 0 || var1 != null && this.swellingCreeper.getDistanceSqToEntity(var1) < 9.0D; } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.swellingCreeper.getNavigator().clearPathEntity(); this.creeperAttackTarget = this.swellingCreeper.getAttackTarget(); } /** * Resets the task */ public void resetTask() { this.creeperAttackTarget = null; } /** * Updates the task */ public void updateTask() { if (this.creeperAttackTarget == null) { this.swellingCreeper.setCreeperState(-1); } else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D) { this.swellingCreeper.setCreeperState(-1); } else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget)) { this.swellingCreeper.setCreeperState(-1); } else { this.swellingCreeper.setCreeperState(1); } } }please help me asap