• 0

    posted a message on Updating function

    i fixed it and i'm sorry for being stupid


    and thank you Jabelar for this tutorial

    and everyone that post on this thread


    there is the code


    @Override
    public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
    {
    super.onUpdate(stack, world, entity, par4, par5);

    EntityPlayer player = (EntityPlayer)entity;
    ItemStack equipped = player.getCurrentEquippedItem();

    if(equipped == stack) {
    player.addPotionEffect(new PotionEffect(13, 3));
    player.addPotionEffect(new PotionEffect(14, 3));
    }

    }

    Posted in: Modification Development
  • 0

    posted a message on Updating function

    okay what dose the event handler implements ? and dose this code okay?



    package ZTheDragonz.TAM2.proxy;

    import ZTheDragonz.TAM2.items.AmItems;
    import net.minecraft.block.Block;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.util.EnumChatFormatting;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
    import net.minecraftforge.event.entity.player.PlayerEvent;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;

    public class TickHandler {

    @SubscribeEvent
    public void PEvent(PlayerEvent player) {
    if(player.entityPlayer.getItemInUse().equals(AmItems.DragonWing)) {

    player.entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "YESSSSSSSSSSSSSSSSSSSSS"));
    }
    }
    }

    Posted in: Modification Development
  • 0

    posted a message on Updating function

    did i do it right



    public boolean PEvent(PlayerEvent event, EntityPlayer player) {
    if(event.entityPlayer.getItemInUse().equals(AmItems.DragonWing)) {
    player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "YESSSSSSSSSSSSSSSSSSSSS"));
    return true;
    }
    player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "NOOOOOOOOOOOOOOOOOOOOOO"));
    return false;
    }

    Posted in: Modification Development
  • 0

    posted a message on Updating function
    Quote from HappyKiller1O1»

    Yes it will. It should run every tick considering it is simply "PlayerEvent". If this doesn't work, try using tick events.


    Thanks every one for helping

    Posted in: Modification Development
  • 0

    posted a message on Updating function
    Quote from ERBF»

    maybe:


    public boolean PEvent(PlayerEvent event) {
    if(event.entityPlayer.getItemInUse().equals(Items.diamond)) {
    return true;
    }
    return false;
    }


    This code will check if an item is on hand right?

    Posted in: Modification Development
  • 0

    posted a message on Updating function
    Quote from NoggsCraft»

    I think there is an event for item equip. Then you can see if the item is a certain item. That would be better can constant look through 10 slots.


    What is the name of this event

    Posted in: Modification Development
  • 0

    posted a message on Updating function
    Quote from ERBF»

    so check if a certain item is in the players hand? (hot bar slot numbers are 0-8)


    yes do you know thee function for that

    Posted in: Modification Development
  • 0

    posted a message on Updating function

    I want to check if a boolean went true or false if he is holding an item

    Posted in: Modification Development
  • 0

    posted a message on Updating function

    How to create a function in java that update the code inside of it Constantly

    Posted in: Modification Development
  • 0

    posted a message on The Amazing Mod v2.7

    Hello Every One I'm Back A I'm Working On The Amazing Mod 2 (TAM2) If You What Suggest Any Idea You TAM2 Just Send Me A Massage Or Post A Reply


    I Know The Amazing Mod Was A Little Bit Bad 0_0 And When I Fix It My Computer Broke So Here I Again Starting Form The Scratch *(Reply)*


    -Z

    Posted in: Minecraft Mods
  • 0

    posted a message on The Amazing Mod v2.7
    Quote from NoName099»
    Can you add some awesome bows to this mod,like maybe a bow called the amazing bow?

    The Thing Is I Lost All My Work So I Will Try To Make A New Mod Because I Can't Redo Every Thing I Did In The Mod So I Will Make A New One Soon

    And I Hope It Turn Out Better Than This Mod And More Amazing ^_^
    Posted in: Minecraft Mods
  • 0

    posted a message on The Amazing Mod v2.7
    Quote from puddingtaken»
    when will y update this mod?

    As Soon As Possible
    Posted in: Minecraft Mods
  • 0

    posted a message on So Much Mobs
    I Set My Entity To Spawn In The Nether But It Spawned A lot Of Them I Can't Decreasing It

    HELP PLEASE

    Entity Code



    package com.Amazing.TheAmazingMod.entity;

    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityFlying;
    import net.minecraft.entity.IEntityMultiPart;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.boss.IBossDisplayData;
    import net.minecraft.entity.monster.IMob;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityLargeFireball;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.EnumDifficulty;
    import net.minecraft.world.World;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;

    public class SmilyGhast extends EntityFlying implements IBossDisplayData, IMob
    {
    public int courseChangeCooldown;
    public double waypointX;
    public double waypointY;
    public double waypointZ;
    private Entity targetedEntity;
    /** Cooldown time between target loss and new target aquirement. */
    private int aggroCooldown;
    public int prevAttackCounter;
    public int attackCounter;
    /** The explosion radius of spawned fireballs. */
    private int explosionStrength = 4;
    private static final String __OBFID = "CL_00001689";

    public SmilyGhast(World par1World)
    {
    super(par1World);
    this.setSize(4.0F, 4.0F);
    this.isImmuneToFire = true;
    this.experienceValue = 20;
    }

    @SideOnly(Side.CLIENT)
    public boolean func_110182_bF()
    {
    return this.dataWatcher.getWatchableObjectByte(16) != 0;
    }

    /**
    * Called when the entity is attacked.
    */
    public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
    {
    if (this.isEntityInvulnerable())
    {
    return false;
    }
    else if ("fireball".equals(par1DamageSource.getDamageType()) && par1DamageSource.getEntity() instanceof EntityPlayer)
    {
    super.attackEntityFrom(par1DamageSource, 42.0F);
    return true;
    }
    else
    {
    return super.attackEntityFrom(par1DamageSource, par2);
    }
    }

    protected void entityInit()
    {
    super.entityInit();
    this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
    }

    protected void applyEntityAttributes()
    {
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(420.0D);
    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.40F);;
    }

    protected void updateEntityActionState()
    {
    if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
    {
    this.setDead();
    }

    this.spawnExplosionParticle();
    this.prevAttackCounter = this.attackCounter;
    double d0 = this.waypointX - this.posX;
    double d1 = this.waypointY - this.posY;
    double d2 = this.waypointZ - this.posZ;
    double d3 = d0 * d0 + d1 * d1 + d2 * d2;

    if (d3 < 1.0D || d3 > 3600.0D)
    {
    this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 10.0F);
    this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 10.0F);
    this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 10.0F);
    }

    if (this.courseChangeCooldown-- <= 0)
    {
    this.courseChangeCooldown += this.rand.nextInt(5) + 1;
    d3 = (double)MathHelper.sqrt_double(d3);

    if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
    {
    this.motionX += d0 / d3 * 0.1D;
    this.motionY += d1 / d3 * 0.1D;
    this.motionZ += d2 / d3 * 0.1D;
    }
    else
    {
    this.waypointX = this.posX;
    this.waypointY = this.posY;
    this.waypointZ = this.posZ;
    }
    }

    if (this.targetedEntity != null && this.targetedEntity.isDead)
    {
    this.targetedEntity = null;
    }

    if (this.targetedEntity == null || this.aggroCooldown-- <= 0)
    {
    this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D);

    if (this.targetedEntity != null)
    {
    this.aggroCooldown = 20;
    }
    }

    double d4 = 64.0D;

    if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4)
    {
    double d5 = this.targetedEntity.posX - this.posX;
    double d6 = this.targetedEntity.boundingBox.minY + (double)(this.targetedEntity.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
    double d7 = this.targetedEntity.posZ - this.posZ;
    this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(d5, d7)) * 180.0F / (float)Math.PI;

    if (this.canEntityBeSeen(this.targetedEntity))
    {
    if (this.attackCounter == 10)
    {
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1007, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }

    ++this.attackCounter;

    if (this.attackCounter == 20)
    {
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7);
    entitylargefireball.field_92057_e = this.explosionStrength;
    double d8 = 4.0D;
    Vec3 vec3 = this.getLook(1.0F);
    entitylargefireball.posX = this.posX + vec3.xCoord * d8;
    entitylargefireball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;
    entitylargefireball.posZ = this.posZ + vec3.zCoord * d8;
    this.worldObj.spawnEntityInWorld(entitylargefireball);
    this.attackCounter = -40;
    }
    }
    else if (this.attackCounter > 0)
    {
    --this.attackCounter;
    }
    }
    else
    {
    this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;

    if (this.attackCounter > 0)
    {
    --this.attackCounter;
    }
    }

    if (!this.worldObj.isRemote)
    {
    byte b1 = this.dataWatcher.getWatchableObjectByte(16);
    byte b0 = (byte)(this.attackCounter > 10 ? 1 : 0);

    if (b1 != b0)
    {
    this.dataWatcher.updateObject(16, Byte.valueOf(b0));
    }
    }
    }

    @Override
    public boolean getCanSpawnHere()
    {
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.boundingBox.minY);
    int k = MathHelper.floor_double(this.posZ);
    return this.worldObj.getBlock(i, j - 1, k) == Blocks.nether_brick && this.worldObj.getFullBlockLightValue(i, j, k) < 8 && super.getCanSpawnHere();
    }

    private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
    {
    double d4 = (this.waypointX - this.posX) / par7;
    double d5 = (this.waypointY - this.posY) / par7;
    double d6 = (this.waypointZ - this.posZ) / par7;
    AxisAlignedBB axisalignedbb = this.boundingBox.copy();

    for (int i = 1; (double)i < par7; ++i)
    {
    axisalignedbb.offset(d4, d5, d6);

    if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
    {
    return false;
    }
    }

    return true;
    }

    /**
    * Returns the sound this mob makes while it's alive.
    */
    protected String getLivingSound()
    {
    return "mob.ghast.moan";
    }

    /**
    * Returns the sound this mob makes when it is hurt.
    */
    protected String getHurtSound()
    {
    return "mob.ghast.scream";
    }

    /**
    * Returns the sound this mob makes on death.
    */
    protected String getDeathSound()
    {
    return "mob.ghast.death";
    }

    protected Item getDropItem()
    {
    return Items.gunpowder;
    }

    /**
    * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param
    * par2 - Level of Looting used to kill this mob.
    */
    protected void dropFewItems(boolean par1, int par2)
    {
    int j = this.rand.nextInt(2) + this.rand.nextInt(1 + par2);
    int k;

    for (k = 0; k < j; ++k)
    {
    this.dropItem(Items.ghast_tear, 1);
    }

    j = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);

    for (k = 0; k < j; ++k)
    {
    this.dropItem(Items.gunpowder, 1);
    }
    }

    /**
    * Returns the volume for the sounds this mob makes.
    */
    protected float getSoundVolume()
    {
    return 10.0F;
    }

    /**
    * Checks if the entity's current position is a valid location to spawn this entity.
    */

    /**
    * Will return how many at most can spawn in a chunk at once.
    */
    public int getMaxSpawnedInChunk()
    {
    return 1;
    }

    /**
    * (abstract) Protected helper method to write subclass entity data to NBT.
    */
    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.writeEntityToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setInteger("ExplosionPower", this.explosionStrength);
    }

    /**
    * (abstract) Protected helper method to read subclass entity data from NBT.
    */
    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.readEntityFromNBT(par1NBTTagCompound);

    if (par1NBTTagCompound.hasKey("ExplosionPower", 99))
    {
    this.explosionStrength = par1NBTTagCompound.getInteger("ExplosionPower");
    }
    }

    }


    Entity Code In The Main Code






    EntityRegistry.addSpawn(SmilyGhast.class, 1, 1, 1, EnumCreatureType.ambient,BiomeDictionary.getBiomesForType(Type.NETHER));
    EntityRegistry.registerGlobalEntityID(SmilyGhast.class, "SmilyGhast", EntityRegistry.findGlobalUniqueEntityId(),Color.BLACK.getRGB(),Color.RED.getRGB());



    Posted in: Modification Development
  • 0

    posted a message on The Amazing Mod v2.7
    Quote from Cosmin08»
    It's crashing on 1.7.2 :( ,I would love to play with this mod :(

    I Will Fix It But It Will Take A While Because My Computer Broke And All My Work Gone

    I Hope I Finish Soon
    Posted in: Minecraft Mods
  • To post a comment, please .