• 0

    posted a message on Can't get value from entity

    Forget my idiocy, here's the solution from an older thread I made

    Link to solution

    Posted in: Modification Development
  • 0

    posted a message on Can't get value from entity

    So, I'm basically making my own variant of an XP Orb, but no matter what I try, I can't get the value from the Orb, and therefore can't set the proper texture per Orb.


    Here's the Entity file:


    package com.dialgex.SburbMod.Entities.Boondollars;

    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;

    import com.dialgex.SburbMod.Events.PlayerPickupBoondollarEvent;
    import com.dialgex.SburbMod.PlayerData.ExtendedPlayer;

    public class Boondollar extends Entity
    {
    /**
    * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow)
    */
    public int xpColor;
    /** The age of the XP orb in ticks. */
    public int xpOrbAge;
    public int field_70532_c;
    /** The health of this XP orb. */
    private int xpOrbHealth = 5;
    /** This is how much XP this orb has. */
    int boondollarValue;
    /** The closest EntityPlayer to this orb. */
    private EntityPlayer closestPlayer;
    /** Threshold color for tracking players */
    private int xpTargetColor;

    public Boondollar(World worldIn, double x, double y, double z, int boonValue)
    {
    super(worldIn);
    this.setSize(0.5F, 0.5F);
    this.setPosition(x, y, z);
    this.rotationYaw = (float)(Math.random() * 360.0D);
    this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
    this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F);
    this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
    this.boondollarValue = boonValue;
    }

    /**
    * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
    * prevent them from trampling crops
    */
    protected boolean canTriggerWalking()
    {
    return false;
    }

    public Boondollar(World worldIn)
    {
    super(worldIn);
    this.setSize(0.25F, 0.25F);
    }

    protected void entityInit() {}

    @SideOnly(Side.CLIENT)
    public int getBrightnessForRender(float p_70070_1_)
    {
    float f1 = 0.5F;

    if (f1 < 0.0F)
    {
    f1 = 0.0F;
    }

    if (f1 > 1.0F)
    {
    f1 = 1.0F;
    }

    int i = super.getBrightnessForRender(p_70070_1_);
    int j = i & 255;
    int k = i >> 16 & 255;
    j += (int)(f1 * 15.0F * 16.0F);

    if (j > 240)
    {
    j = 240;
    }

    return j | k << 16;
    }

    /**
    * Called to update the entity's position/logic.
    */
    public void onUpdate()
    {
    super.onUpdate();

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

    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.motionY -= 0.029999999329447746D;
    //System.out.println(this.boondollarValue);

    if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() == Material.lava)
    {
    this.motionY = 0.20000000298023224D;
    this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
    this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
    this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
    }

    this.pushOutOfBlocks(this.posX, (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D, this.posZ);
    double d0 = 8.0D;

    if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100)
    {
    if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0)
    {
    this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0);
    }

    this.xpTargetColor = this.xpColor;
    }

    if (this.closestPlayer != null)
    {
    double d1 = (this.closestPlayer.posX - this.posX) / d0;
    double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0;
    double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
    double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
    double d5 = 1.0D - d4;

    if (d5 > 0.0D)
    {
    d5 *= d5;
    this.motionX += d1 / d4 * d5 * 0.1D;
    this.motionY += d2 / d4 * d5 * 0.1D;
    this.motionZ += d3 / d4 * d5 * 0.1D;
    }
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    float f = 0.98F;

    if (this.onGround)
    {
    f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.98F;
    }

    this.motionX *= (double)f;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= (double)f;

    if (this.onGround)
    {
    this.motionY *= -0.8999999761581421D;
    }

    //++this.xpColor;
    ++this.xpOrbAge;

    if (this.xpOrbAge >= 6000)
    {
    this.setDead();
    }
    }

    /**
    * Returns if this entity is in water and will end up adding the waters velocity to the entity
    */
    public boolean handleWaterMovement()
    {
    return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this);
    }

    /**
    * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args:
    * amountDamage
    */
    protected void dealFireDamage(int p_70081_1_)
    {
    this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
    }

    /**
    * Called when the entity is attacked.
    */
    public boolean attackEntityFrom(DamageSource source, float amount)
    {
    if (this.isEntityInvulnerable(source))
    {
    return false;
    }
    else
    {
    this.setBeenAttacked();
    this.xpOrbHealth = (int)((float)this.xpOrbHealth - amount);

    if (this.xpOrbHealth <= 0)
    {
    this.setDead();
    }

    return false;
    }
    }

    /**
    * (abstract) Protected helper method to write subclass entity data to NBT.
    */
    public void writeEntityToNBT(NBTTagCompound p_70014_1_)
    {
    p_70014_1_.setShort("Health", (short)((byte)this.xpOrbHealth));
    p_70014_1_.setShort("Age", (short)this.xpOrbAge);
    p_70014_1_.setShort("Value", (short)this.boondollarValue);
    }

    /**
    * (abstract) Protected helper method to read subclass entity data from NBT.
    */
    public void readEntityFromNBT(NBTTagCompound p_70037_1_)
    {
    this.xpOrbHealth = p_70037_1_.getShort("Health") & 255;
    this.xpOrbAge = p_70037_1_.getShort("Age");
    this.boondollarValue = p_70037_1_.getShort("Value");
    }

    /**
    * Called by a player entity when they collide with an entity
    */
    public void onCollideWithPlayer(EntityPlayer entityIn)
    {
    if (!this.worldObj.isRemote)
    {
    ExtendedPlayer props = ExtendedPlayer.get(entityIn);
    if (this.field_70532_c == 0 && entityIn.xpCooldown == 0)
    {
    if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new com.dialgex.SburbMod.Events.PlayerPickupBoondollarEvent(entityIn, this))) return;
    entityIn.xpCooldown = 2;
    this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
    entityIn.onItemPickup(this, 1);
    props.addBoondollars(this.boondollarValue);
    //System.out.println(this.getBoondollarValue());
    this.setDead();
    }
    }
    }

    /**
    * Returns the XP value of this XP orb.
    */
    public int getBoondollarValue(){
    System.out.println(this.boondollarValue); // THIS F***ER GETS THE RIGHT VALUE
    return this.boondollarValue;
    }

    @SideOnly(Side.CLIENT)
    public int getTextureByValue(){
    System.out.println(this.getBoondollarValue()); // THIS F***ER WON'T GET THE RIGHT VALUE
    return this.boondollarValue >= 50 ? 3 : (this.boondollarValue >= 25 ? 2 : (this.boondollarValue >= 10 ? 1 : (this.boondollarValue >= 5 ? 0 : -1)));
    }
    /**
    int returnxp = -1;
    if(this.boondollarValue == 50){
    returnxp = 3;
    }else if(this.boondollarValue == 25){
    returnxp = 2;
    }else if(this.boondollarValue == 10){
    returnxp = 1;
    }else if(this.boondollarValue == 5){
    returnxp = 0;
    }else if(this.boondollarValue == 0){
    returnxp = 1;
    //System.out.println("Still Zero, but if/then works");
    }
    return returnxp;
    }

    /**
    * If returns false, the item will not inflict any damage against entities.
    */
    public boolean canAttackWithItem()
    {
    return false;
    }
    }


    I'm at such a loss of what to do.

    I've added System.outs over various places, and the only place that zero's out the value completely is the "getTextureByValue" part


    If needed, here's the render file:


    package com.dialgex.SburbMod.Client.Renderer;

    import com.dialgex.SburbMod.Entities.Boondollars.Boondollar;

    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.GlStateManager;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.WorldRenderer;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.client.renderer.entity.RenderManager;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;

    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
    private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbmod", "textures/entities/BoondollarTex.png");

    public RenderBoondollar(RenderManager p_i46178_1_)
    {
    super(p_i46178_1_);
    this.shadowSize = 0.15F;
    this.shadowOpaque = 0.75F;
    }

    public void doRender(Boondollar entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x, (float)y, (float)z);
    this.bindEntityTexture(entity);
    int i = entity.getTextureByValue();
    float f2 = (float)(i * 64 + 0) / 256.0F;
    float f3 = (float)(i * 64 + 64) / 256.0F;
    float f4 = (float)(i * 256 + 0) / 256.0F;
    float f5 = (float)(i * 256 + 256) / 256.0F;
    float f6 = 1.0F;
    float f7 = 0.5F;
    float f8 = 0.25F;
    int j = entity.getBrightnessForRender(partialTicks);
    int k = j % 65536;
    int l = j / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f10 = 255.0F;
    float f11 = ((float)entity.xpColor + partialTicks) / 2.0F;
    l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
    int i1 = (int)f10;
    int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
    int k1 = l << 16 | i1 << 8 | j1;
    GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    float f9 = 0.3F;
    GlStateManager.scale(f9, f9, f9);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.startDrawingQuads();
    worldrenderer.setColorRGBA_I(k1, 128);
    worldrenderer.setNormal(0.0F, 1.0F, 0.0F);
    worldrenderer.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
    worldrenderer.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
    worldrenderer.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
    worldrenderer.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
    tessellator.draw();
    GlStateManager.disableBlend();
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
    //System.out.println(i);
    }

    protected ResourceLocation getTexture(Boondollar p_180555_1_)
    {
    return BoondollarTextures;
    }

    protected ResourceLocation getEntityTexture(Entity entity)
    {
    return this.getTexture((Boondollar)entity);
    }

    public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    this.doRender((Boondollar)entity, x, y, z, p_76986_8_, partialTicks);
    }
    }

    /**

    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
    private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbmod", "textures/entities/BoondollarTex.png");

    public RenderBoondollar()
    {
    super(Minecraft.getMinecraft().getRenderManager());
    this.shadowSize = 0.15F;
    this.shadowOpaque = 0.75F;
    }

    /**
    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
    * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    *
    public void doRender(Boondollar entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x, (float)y, (float)z);
    this.bindEntityTexture(entity);
    int i = entity.getTextureByXP();
    float f2 = (float)(i * 64 + 0) / 256.0F;
    float f3 = (float)(i * 64 + 64) / 256.0F;
    float f4 = (float)(i * 256 + 0) / 256.0F;
    float f5 = (float)(i * 256 + 256) / 256.0F;
    float f6 = 1.0F;
    float f7 = 0.5F;
    float f8 = 0.25F;
    int j = entity.getBrightnessForRender(partialTicks);
    int k = j % 65536;
    int l = j / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f10 = 255.0F;
    float f11 = ((float)entity.xpColor + partialTicks) / 2.0F;
    l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
    int i1 = (int)f10;
    int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
    int k1 = l << 16 | i1 << 8 | j1;
    GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    float f9 = 0.3F;
    GlStateManager.scale(f9, f9, f9);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.startDrawingQuads();
    worldrenderer.setColorRGBA_I(k1, 128);
    worldrenderer.setNormal(0.0F, 1.0F, 0.0F);
    worldrenderer.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
    worldrenderer.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
    worldrenderer.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
    worldrenderer.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
    tessellator.draw();
    GlStateManager.disableBlend();
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
    }

    /**
    * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
    *
    protected ResourceLocation getEntityTexture(Boondollar p_110775_1_)
    {
    return BoondollarTextures;
    }

    /**
    * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
    *
    protected ResourceLocation getEntityTexture(Entity p_110775_1_)
    {
    return this.getEntityTexture((Boondollar)p_110775_1_);
    }

    /**
    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    * handing it off to a worker function which does the actual work. In all probability, the class Render is generic
    * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
    * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    *
    public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
    this.doRender((Boondollar)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }
    }
    */


    And the dropEvent File (a mess):


    package com.dialgex.SburbMod.Events;

    import java.util.Random;

    import com.sun.org.apache.bcel.internal.generic.INSTANCEOF;

    import net.minecraftforge.fml.common.FMLLog;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.passive.*;
    import net.minecraft.entity.monster.*;
    import net.minecraft.entity.boss.*;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;

    import com.dialgex.SburbMod.Client.Renderer.RenderBoondollar;
    import com.dialgex.SburbMod.Entities.Boondollars.Boondollar;

    public class BoondollarDropEvent{

    private static int rNum(int min, int max) {
    Random r = new Random();
    int randomNum = r.nextInt((max - min) + 1) + min;
    return randomNum;
    }

    public static double rand;

    @SubscribeEvent
    public void onEntityDrop(LivingDropsEvent event){
    World world = event.entity.worldObj;

    if (event.source.getDamageType().equals("player")){
    double tx = event.entityLiving.posX;
    double ty = event.entityLiving.posY;
    double tz = event.entityLiving.posZ;
    rand = Math.random();

    int cent3 = 0;
    int cent2 = 0;
    int cent1 = 0;
    int cent0 = 0;
    int val50 = 50;
    int val25 = 25;
    int val10 = 10;
    int val5 = 5;
    /**
    * Overworld Passives
    */
    if (event.entityLiving instanceof EntityPig||
    event.entityLiving instanceof EntityCow||
    event.entityLiving instanceof EntitySheep||
    event.entityLiving instanceof EntityOcelot||
    event.entityLiving instanceof EntitySquid||
    event.entityLiving instanceof EntityChicken||
    event.entityLiving instanceof EntityHorse||
    event.entityLiving instanceof EntityBat||
    event.entityLiving instanceof EntityMooshroom){
    int min3=1;
    int min2=2;
    int min1=5;
    int min0=10;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Overworld Hostiles
    */
    if (event.entityLiving instanceof EntityGolem||
    event.entityLiving instanceof EntitySpider||
    event.entityLiving instanceof EntityCaveSpider||
    event.entityLiving instanceof EntityZombie||
    (event.entityLiving instanceof EntitySkeleton && ((EntitySkeleton) event.entityLiving).getSkeletonType()!=1)||
    event.entityLiving instanceof EntitySilverfish||
    (event.entityLiving instanceof EntitySlime && ((EntitySlime) event.entityLiving).getSlimeSize()==1)||
    event.entityLiving instanceof EntityWitch||
    event.entityLiving instanceof EntityIronGolem||
    event.entityLiving instanceof EntityCreeper||
    event.entityLiving instanceof EntityBat){
    int min3=1;
    int min2=3;
    int min1=7;
    int min0=15;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    System.out.println(val5);
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Villagers
    */
    if (event.entityLiving instanceof EntityVillager){
    int min3=2;
    int min2=4;
    int min1=11;
    int min0=22;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Nether Mobs
    */
    if (event.entityLiving instanceof EntityMagmaCube||
    (event.entityLiving instanceof EntitySkeleton && ((EntitySkeleton) event.entityLiving).getSkeletonType()==1)||
    event.entityLiving instanceof EntityBlaze||
    event.entityLiving instanceof EntityPigZombie){
    int min3=2;
    int min2=5;
    int min1=12;
    int min0=25;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Endermen
    */
    if (event.entityLiving instanceof EntityEnderman){
    int min3=3;
    int min2=7;
    int min1=17;
    int min0=35;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Ghast
    */
    if (event.entityLiving instanceof EntityGhast){
    int min3=4;
    int min2=9;
    int min1=22;
    int min0=45;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i==cent3;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i==cent2;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i==cent1;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i==cent0;i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * Wither
    */
    if (event.entityLiving instanceof EntityWither){
    int min3=20;
    int min2=40;
    int min1=100;
    int min0=200;
    int f3=4;
    int f2=8;
    int f1=20;
    int f0=40;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }

    /**
    * End Dragon
    */
    if (event.entityLiving instanceof EntityDragon){
    int min3=25;
    int min2=50;
    int min1=125;
    int min0=250;
    int f3=5;
    int f2=10;
    int f1=25;
    int f0=50;
    for(int i=1; i<(min3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(min2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(min1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(min0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.83d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.66d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.50d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.33d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    if(rand < 0.16d){
    for(int i=1; i<(f3+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val50));
    }
    for(int i=1; i<(f2+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val25));
    }
    for(int i=1; i<(f1+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val10));
    }
    for(int i=1; i<(f0+1);i++){
    world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, val5));
    }
    }
    }
    }
    }
    }
    }


    ///////////////////////////////////////////
    }
    }
    }


    Please help me, I'm almost ripping my hair out

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    End-result code for people who want to do this kind of thing:

    Entity File:
     package dialgex.SburbCraft.Entities.Boondollars;
    
    import io.netty.buffer.ByteBuf;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import dialgex.SburbCraft.Events.PlayerPickupBoondollarEvent;
    
    public class Boondollar extends Entity implements IEntityAdditionalSpawnData
    {
     /**
     * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow)
     */
     public int xpColor;
     /** The age of the XP orb in ticks. */
     public int xpOrbAge;
     public int field_70532_c;
     /** The health of this XP orb. */
     private int xpOrbHealth = 5;
     /** This is how much XP this orb has. */
     public int xpValue;
     /** The closest EntityPlayer to this orb. */
     private EntityPlayer closestPlayer;
     /** Threshold color for tracking players */
     private int xpTargetColor;
     private static final String __OBFID = "CL_00001544";
    
     public Boondollar(World p_i1585_1_, double p_i1585_2_, double p_i1585_4_, double p_i1585_6_, int p_i1585_8_)
     {
     super(p_i1585_1_);
     this.setSize(0.5F, 0.5F);
     this.yOffset = this.height / 2.0F;
     this.setPosition(p_i1585_2_, p_i1585_4_, p_i1585_6_);
     this.rotationYaw = (float)(Math.random() * 360.0D);
     this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F);
     this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     xpValue = p_i1585_8_;
     }
    
     /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
     * prevent them from trampling crops
     */
     protected boolean canTriggerWalking()
     {
     return false;
     }
    
     public Boondollar(World p_i1586_1_)
     {
     super(p_i1586_1_);
     this.setSize(0.25F, 0.25F);
     this.yOffset = this.height / 2.0F;
     }
    
     protected void entityInit() {}
    
     @SideOnly(Side.CLIENT)
     public int getBrightnessForRender(float p_70070_1_)
     {
     float f1 = 0.5F;
    
     if (f1 < 0.0F)
     {
     f1 = 0.0F;
     }
    
     if (f1 > 1.0F)
     {
     f1 = 1.0F;
     }
    
     int i = super.getBrightnessForRender(p_70070_1_);
     int j = i & 255;
     int k = i >> 16 & 255;
     j += (int)(f1 * 15.0F * 16.0F);
    
     if (j > 240)
     {
     j = 240;
     }
    
     return j | k << 16;
     }
    
     /**
     * Called to update the entity's position/logic.
     */
     public void onUpdate()
     {
     super.onUpdate();
    
     if (this.field_70532_c > 0)
     {
     --this.field_70532_c;
     }
    
     this.prevPosX = this.posX;
     this.prevPosY = this.posY;
     this.prevPosZ = this.posZ;
     this.motionY -= 0.029999999329447746D;
    
     if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava)
     {
     this.motionY = 0.20000000298023224D;
     this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
     }
    
     this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
     double d0 = 8.0D;
     
     if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100)
     {
     if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0)
     {
     this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0);
     }
    
     this.xpTargetColor = this.xpColor;
     }
     
     if (this.closestPlayer != null)
     {
     double d1 = (this.closestPlayer.posX - this.posX) / d0;
     double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0;
     double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
     double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
     double d5 = 1.0D - d4;
    
     if (d5 > 0.0D)
     {
     d5 *= d5;
     this.motionX += d1 / d4 * d5 * 0.1D;
     this.motionY += d2 / d4 * d5 * 0.1D;
     this.motionZ += d3 / d4 * d5 * 0.1D;
     }
     }
    
     this.moveEntity(this.motionX, this.motionY, this.motionZ);
     float f = 0.98F;
    
     if (this.onGround)
     {
     f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
     }
    
     this.motionX *= (double)f;
     this.motionY *= 0.9800000190734863D;
     this.motionZ *= (double)f;
    
     if (this.onGround)
     {
     this.motionY *= -0.8999999761581421D;
     }
    
     //++this.xpColor;
     ++this.xpOrbAge;
    
     if (this.xpOrbAge >= 6000)
     {
     this.setDead();
     }
     }
    
     /**
     * Returns if this entity is in water and will end up adding the waters velocity to the entity
     */
     public boolean handleWaterMovement()
     {
     return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
     }
    
     /**
     * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args:
     * amountDamage
     */
     protected void dealFireDamage(int p_70081_1_)
     {
     this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
     }
    
     /**
     * Called when the entity is attacked.
     */
     public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
     {
     if (this.isEntityInvulnerable())
     {
     return false;
     }
     else
     {
     this.setBeenAttacked();
     this.xpOrbHealth = (int)((float)this.xpOrbHealth - p_70097_2_);
    
     if (this.xpOrbHealth <= 0)
     {
     this.setDead();
     }
    
     return false;
     }
     }
    
     /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
     public void writeEntityToNBT(NBTTagCompound p_70014_1_)
     {
     p_70014_1_.setShort("Health", (short)((byte)this.xpOrbHealth));
     p_70014_1_.setShort("Age", (short)this.xpOrbAge);
     p_70014_1_.setShort("Value", (short)this.xpValue);
     }
    
     /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
     public void readEntityFromNBT(NBTTagCompound p_70037_1_)
     {
     this.xpOrbHealth = p_70037_1_.getShort("Health") & 255;
     this.xpOrbAge = p_70037_1_.getShort("Age");
     this.xpValue = p_70037_1_.getShort("Value");
     }
    
     @Override
     public void writeSpawnData(ByteBuf buffer) {
     buffer.writeInt(this.xpValue);
     }
    
     @Override
     public void readSpawnData(ByteBuf buffer) {
     this.xpValue = buffer.readInt();
     }
    
     /**
     * Called by a player entity when they collide with an entity
     */
     public void onCollideWithPlayer(EntityPlayer p_70100_1_)
     {
     if (!this.worldObj.isRemote)
     {
     if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
     {
     if (MinecraftForge.EVENT_BUS.post(new PlayerPickupBoondollarEvent(p_70100_1_, this))) return;
     p_70100_1_.xpCooldown = 2;
     this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
     p_70100_1_.onItemPickup(this, 1);
     p_70100_1_.addExperience(this.xpValue);
     this.setDead();
     }
     }
     }
    
     /**
     * Returns the XP value of this XP orb.
     */
     public int getXpValue()
     {
     return this.xpValue;
     }
    
     /**
     * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine
     * what texture to use.
     */
     @SideOnly(Side.CLIENT)
     public int getTextureByXP(){
     int returnxp = -1;
     if(this.xpValue == 50){
     returnxp = 3;
     }else if(this.xpValue == 25){
     returnxp = 2;
     }else if(this.xpValue == 10){
     returnxp = 1;
     }else if(this.xpValue == 5){
     returnxp = 0;
     }
     return returnxp;
     }
    
     /**
     * Get a fragment of the maximum experience points value for the supplied value of experience points value.
     */
     public static int getXPSplit(int p_70527_0_)
     {
     return p_70527_0_ == 4 ? 4 : (p_70527_0_ == 3 ? 3 : (p_70527_0_ == 2 ? 2 : (p_70527_0_ == 1 ? 1 : 0)));
     }
    
     /**
     * If returns false, the item will not inflict any damage against entities.
     */
     public boolean canAttackWithItem()
     {
     return false;
     }
    }

    Render File:
     package dialgex.SburbCraft.Render;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import cpw.mods.fml.common.FMLLog;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    
    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
     private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbsurvival", "textures/entities/BoondollarTex.png");
     private static final String __OBFID = "CL_00000993";
    
     public RenderBoondollar()
     {
     this.shadowSize = 0.15F;
     this.shadowOpaque = 0.75F;
     }
    
     /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Boondollar p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     GL11.glPushMatrix();
     GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
     this.bindEntityTexture(p_76986_1_);
     int i = p_76986_1_.getTextureByXP();
     float f2 = (float)(i * 64 + 0) / 256.0F;
     float f3 = (float)(i * 64 + 64) / 256.0F;
     float f4 = (float)(i * 256 + 0) / 256.0F;
     float f5 = (float)(i * 256 + 256) / 256.0F;
     float f6 = 1.0F;
     float f7 = 0.5F;
     float f8 = 0.25F;
     int j = p_76986_1_.getBrightnessForRender(p_76986_9_);
     int k = j % 65536;
     int l = j / 65536;
     OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     float f10 = 255.0F;
     float f11 = ((float)p_76986_1_.xpColor + p_76986_9_) / 2.0F;
     l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
     int i1 = (int)f10;
     int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
     int k1 = l << 16 | i1 << 8 | j1;
     GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
     GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
     float f9 = 0.9F;
     GL11.glScalef(f9, f9, f9);
     Tessellator tessellator = Tessellator.instance;
     tessellator.startDrawingQuads();
     //tessellator.setColorRGBA_I(k1, 128);
     tessellator.setNormal(0.0F, 1.0F, 0.0F);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
     tessellator.draw();
     GL11.glDisable(GL11.GL_BLEND);
     GL11.glDisable(GL12.GL_RESCALE_NORMAL);
     GL11.glPopMatrix();
     }
    
     /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Boondollar p_110775_1_)
     {
     return BoondollarTextures;
     }
    
     /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Entity p_110775_1_)
     {
     return this.getEntityTexture((Boondollar)p_110775_1_);
     }
    
     /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probability, the class Render is generic
     * (Render * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     this.doRender((Boondollar)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
     }
    }

    ClientProxy File:
     package dialgex.SburbCraft.Proxies;
    
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    import dialgex.SburbCraft.Proxies.CommonProxy;
    import dialgex.SburbCraft.Render.*;
    
    public class ClientProxy extends CommonProxy{
     
     @Override
     public void registerRenderers(){
     RenderingRegistry.registerEntityRenderingHandler(Boondollar.class, new RenderBoondollar());
     }
    }

    DropEvent File:
     package dialgex.SburbCraft.Events;
    
    import java.util.Random;
    
    import com.sun.org.apache.bcel.internal.generic.INSTANCEOF;
    
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.passive.*;
    import net.minecraft.entity.monster.*;
    import net.minecraft.entity.boss.*;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import dialgex.SburbCraft.Render.RenderBoondollar;
    import dialgex.SburbCraft.Entities.Boondollars.*;
    import dialgex.SburbCraft.Items.Grist.*;
    
    
    public class BoondollarDropEvent{
     
     private static int rNum(int min, int max) {
     Random r = new Random();
     int randomNum = r.nextInt((max - min) + 1) + min;
     return randomNum;
     }
     
     public static double rand;
    
     @SubscribeEvent
     public void onEntityDrop(LivingDropsEvent event){
     World world = event.entity.worldObj;
     
     if (event.source.getDamageType().equals("player")){
     double tx = event.entityLiving.posX;
     double ty = event.entityLiving.posY;
     double tz = event.entityLiving.posZ;
     rand = Math.random();
     
     int cent3 = 0;
     int cent2 = 0;
     int cent1 = 0;
     int cent0 = 0;
     /**
     * Overworld Passives
     */
     if (event.entityLiving instanceof EntityPig||
     event.entityLiving instanceof EntityCow||
     event.entityLiving instanceof EntitySheep||
     event.entityLiving instanceof EntityOcelot||
     event.entityLiving instanceof EntitySquid||
     event.entityLiving instanceof EntityChicken||
     event.entityLiving instanceof EntityHorse||
     event.entityLiving instanceof EntityBat||
     event.entityLiving instanceof EntityMooshroom){
     int min3=1;
     int min2=2;
     int min1=5;
     int min0=10;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * Overworld Hostiles
     */
     if (event.entityLiving instanceof EntityGolem||
     event.entityLiving instanceof EntitySpider||
     event.entityLiving instanceof EntityCaveSpider||
     event.entityLiving instanceof EntityZombie||
     (event.entityLiving instanceof EntitySkeleton && ((EntitySkeleton) event.entityLiving).getSkeletonType()!=1)||
     event.entityLiving instanceof EntitySilverfish||
     event.entityLiving instanceof EntitySlime||
     event.entityLiving instanceof EntityWitch||
     event.entityLiving instanceof EntityIronGolem||
     event.entityLiving instanceof EntityCreeper||
     event.entityLiving instanceof EntityBat){
     int min3=1;
     int min2=3;
     int min1=7;
     int min0=15;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
     
     /**
     * Villagers
     */
     if (event.entityLiving instanceof EntityVillager){
     int min3=2;
     int min2=4;
     int min1=11;
     int min0=22;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * Nether Mobs
     */
     if (event.entityLiving instanceof EntityMagmaCube||
     (event.entityLiving instanceof EntitySkeleton && ((EntitySkeleton) event.entityLiving).getSkeletonType()==1)||
     event.entityLiving instanceof EntityBlaze||
     event.entityLiving instanceof EntityPigZombie){
     int min3=2;
     int min2=5;
     int min1=12;
     int min0=25;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * Endermen
     */
     if (event.entityLiving instanceof EntityEnderman){
     int min3=3;
     int min2=7;
     int min1=17;
     int min0=35;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * Ghast
     */
     if (event.entityLiving instanceof EntityGhast){
     int min3=4;
     int min2=9;
     int min1=22;
     int min0=45;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i==cent3;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i==cent2;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i==cent1;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i==cent0;i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * Wither
     */
     if (event.entityLiving instanceof EntityWither){
     int min3=20;
     int min2=40;
     int min1=100;
     int min0=200;
     int f3=4;
     int f2=8;
     int f1=20;
     int f0=40;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
    
     /**
     * End Dragon
     */
     if (event.entityLiving instanceof EntityDragon){
     int min3=25;
     int min2=50;
     int min1=125;
     int min0=250;
     int f3=5;
     int f2=10;
     int f1=25;
     int f0=50;
     for(int i=1; i<(min3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(min2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(min1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(min0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.83d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.66d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.50d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.33d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     if(rand < 0.16d){
     for(int i=1; i<(f3+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 50));
     }
     for(int i=1; i<(f2+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 25));
     }
     for(int i=1; i<(f1+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 10));
     }
     for(int i=1; i<(f0+1);i++){
     world.spawnEntityInWorld(new Boondollar(world, tx, ty, tz, 5));
     }
     }
     }
     }
     }
     }
     }
     
     
     ///////////////////////////////////////////
     }
     }
    }
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Well, I didn't know that. I tried looking it up and got nothing on the search.

    EDIT: Because it was miswritten.
    I was given
    IAdditionalEntitySpawnData
    Not
    IEntityAdditionalSpawnData
    And that's why my search found nothing

    EDIT2: Everything's working flawlessly now. Thanks a bunch!
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Okay, I've added everything and did some minor tinkering, and I've discovered that each orb does, in fact, retain its value now, yet the renderer is still not getting the values, so still no texture change.

    I even changed the variable to a solid number rather than the getTextureFromXp() method to test it, and that worked.
    That means the issue lies in the renderer getting the values.

    I'll post the updated-ish code:

    Render file:
    package dialgex.SburbCraft.Render;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import cpw.mods.fml.common.FMLLog;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    
    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
     private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbsurvival", "textures/entities/BoondollarTex.png");
     private static final String __OBFID = "CL_00000993";
    
     public RenderBoondollar()
     {
     this.shadowSize = 0.15F;
     this.shadowOpaque = 0.75F;
     }
    
     /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Boondollar p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     GL11.glPushMatrix();
     GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
     this.bindEntityTexture(p_76986_1_);
     int i = p_76986_1_.getTextureByXP();
     float f2 = (float)(i * 64 + 0) / 256.0F;
     float f3 = (float)(i * 64 + 64) / 256.0F;
     float f4 = (float)(i * 256 + 0) / 256.0F;
     float f5 = (float)(i * 256 + 256) / 256.0F;
     float f6 = 1.0F;
     float f7 = 0.5F;
     float f8 = 0.25F;
     int j = p_76986_1_.getBrightnessForRender(p_76986_9_);
     int k = j % 65536;
     int l = j / 65536;
     OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     float f10 = 255.0F;
     float f11 = ((float)p_76986_1_.xpColor + p_76986_9_) / 2.0F;
     l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
     int i1 = (int)f10;
     int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
     int k1 = l << 16 | i1 << 8 | j1;
     GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
     GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
     float f9 = 0.9F;
     GL11.glScalef(f9, f9, f9);
     Tessellator tessellator = Tessellator.instance;
     tessellator.startDrawingQuads();
     //tessellator.setColorRGBA_I(k1, 128);
     tessellator.setNormal(0.0F, 1.0F, 0.0F);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
     tessellator.draw();
     GL11.glDisable(GL11.GL_BLEND);
     GL11.glDisable(GL12.GL_RESCALE_NORMAL);
     GL11.glPopMatrix();
     }
    
     /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Boondollar p_110775_1_)
     {
     return BoondollarTextures;
     }
    
     /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Entity p_110775_1_)
     {
     return this.getEntityTexture((Boondollar)p_110775_1_);
     }
    
     /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probability, the class Render is generic
     * (Render * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     this.doRender((Boondollar)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
     }
    }
    Entity file:
    package dialgex.SburbCraft.Entities.Boondollars;
    
    import io.netty.buffer.ByteBuf;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import dialgex.SburbCraft.Events.PlayerPickupBoondollarEvent;
    
    public class Boondollar extends Entity implements IAdditionalEntitySpawnData
    {
     /**
     * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow)
     */
     public int xpColor;
     /** The age of the XP orb in ticks. */
     public int xpOrbAge;
     public int field_70532_c;
     /** The health of this XP orb. */
     private int xpOrbHealth = 5;
     /** This is how much XP this orb has. */
     public int xpValue;
     /** The closest EntityPlayer to this orb. */
     private EntityPlayer closestPlayer;
     /** Threshold color for tracking players */
     private int xpTargetColor;
     private static final String __OBFID = "CL_00001544";
    
     public Boondollar(World p_i1585_1_, double p_i1585_2_, double p_i1585_4_, double p_i1585_6_, int p_i1585_8_)
     {
     super(p_i1585_1_);
     this.setSize(0.5F, 0.5F);
     this.yOffset = this.height / 2.0F;
     this.setPosition(p_i1585_2_, p_i1585_4_, p_i1585_6_);
     this.rotationYaw = (float)(Math.random() * 360.0D);
     this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F);
     this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     xpValue = p_i1585_8_;
     }
    
     /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
     * prevent them from trampling crops
     */
     protected boolean canTriggerWalking()
     {
     return false;
     }
    
     public Boondollar(World p_i1586_1_)
     {
     super(p_i1586_1_);
     this.setSize(0.25F, 0.25F);
     this.yOffset = this.height / 2.0F;
     }
    
     protected void entityInit() {}
    
     @SideOnly(Side.CLIENT)
     public int getBrightnessForRender(float p_70070_1_)
     {
     float f1 = 0.5F;
    
     if (f1 < 0.0F)
     {
     f1 = 0.0F;
     }
    
     if (f1 > 1.0F)
     {
     f1 = 1.0F;
     }
    
     int i = super.getBrightnessForRender(p_70070_1_);
     int j = i & 255;
     int k = i >> 16 & 255;
     j += (int)(f1 * 15.0F * 16.0F);
    
     if (j > 240)
     {
     j = 240;
     }
    
     return j | k << 16;
     }
    
     /**
     * Called to update the entity's position/logic.
     */
     public void onUpdate()
     {
     super.onUpdate();
    
     if (this.field_70532_c > 0)
     {
     --this.field_70532_c;
     }
    
     this.prevPosX = this.posX;
     this.prevPosY = this.posY;
     this.prevPosZ = this.posZ;
     this.motionY -= 0.029999999329447746D;
    
     if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava)
     {
     this.motionY = 0.20000000298023224D;
     this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
     }
    
     this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
     double d0 = 8.0D;
     
     if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100)
     {
     if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0)
     {
     this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0);
     }
    
     this.xpTargetColor = this.xpColor;
     }
     
     if (this.closestPlayer != null)
     {
     double d1 = (this.closestPlayer.posX - this.posX) / d0;
     double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0;
     double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
     double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
     double d5 = 1.0D - d4;
    
     if (d5 > 0.0D)
     {
     d5 *= d5;
     this.motionX += d1 / d4 * d5 * 0.1D;
     this.motionY += d2 / d4 * d5 * 0.1D;
     this.motionZ += d3 / d4 * d5 * 0.1D;
     }
     }
    
     this.moveEntity(this.motionX, this.motionY, this.motionZ);
     float f = 0.98F;
    
     if (this.onGround)
     {
     f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
     }
    
     this.motionX *= (double)f;
     this.motionY *= 0.9800000190734863D;
     this.motionZ *= (double)f;
    
     if (this.onGround)
     {
     this.motionY *= -0.8999999761581421D;
     }
    
     //++this.xpColor;
     ++this.xpOrbAge;
    
     if (this.xpOrbAge >= 6000)
     {
     this.setDead();
     }
     }
    
     /**
     * Returns if this entity is in water and will end up adding the waters velocity to the entity
     */
     public boolean handleWaterMovement()
     {
     return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
     }
    
     /**
     * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args:
     * amountDamage
     */
     protected void dealFireDamage(int p_70081_1_)
     {
     this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
     }
    
     /**
     * Called when the entity is attacked.
     */
     public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
     {
     if (this.isEntityInvulnerable())
     {
     return false;
     }
     else
     {
     this.setBeenAttacked();
     this.xpOrbHealth = (int)((float)this.xpOrbHealth - p_70097_2_);
    
     if (this.xpOrbHealth <= 0)
     {
     this.setDead();
     }
    
     return false;
     }
     }
    
     /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
     public void writeEntityToNBT(NBTTagCompound p_70014_1_)
     {
     p_70014_1_.setShort("Health", (short)((byte)this.xpOrbHealth));
     p_70014_1_.setShort("Age", (short)this.xpOrbAge);
     p_70014_1_.setShort("Value", (short)this.xpValue);
     }
    
     /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
     public void readEntityFromNBT(NBTTagCompound p_70037_1_)
     {
     this.xpOrbHealth = p_70037_1_.getShort("Health") & 255;
     this.xpOrbAge = p_70037_1_.getShort("Age");
     this.xpValue = p_70037_1_.getShort("Value");
     }
    
     @Override
     public void writeSpawnData(ByteBuf buffer) {
     buffer.writeInt(this.xpValue);
     }
    
     @Override
     public void readSpawnData(ByteBuf buffer) {
     this.xpValue = buffer.readInt();
     }
    
     /**
     * Called by a player entity when they collide with an entity
     */
     public void onCollideWithPlayer(EntityPlayer p_70100_1_)
     {
     if (!this.worldObj.isRemote)
     {
     if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
     {
     if (MinecraftForge.EVENT_BUS.post(new PlayerPickupBoondollarEvent(p_70100_1_, this))) return;
     p_70100_1_.xpCooldown = 2;
     this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
     p_70100_1_.onItemPickup(this, 1);
     p_70100_1_.addExperience(this.xpValue);
     FMLLog.info("PlayerPickup "+this.xpValue);
     this.setDead();
     }
     }
     }
    
     /**
     * Returns the XP value of this XP orb.
     */
     public int getXpValue()
     {
     return this.xpValue;
     }
    
     /**
     * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine
     * what texture to use.
     */
     @SideOnly(Side.CLIENT)
     public int getTextureByXP(){
     int returnxp = -1;
     if(this.xpValue == 50){
     returnxp = 3;
     FMLLog.info("Entity "+returnxp);
     }else if(this.xpValue == 25){
     returnxp = 2;
     FMLLog.info("Entity "+returnxp);
     }else if(this.xpValue == 10){
     returnxp = 1;
     FMLLog.info("Entity "+returnxp);
     }else if(this.xpValue == 5){
     returnxp = 0;
     FMLLog.info("Entity "+returnxp);
     }
     return returnxp;
     }
    
     /**
     * Get a fragment of the maximum experience points value for the supplied value of experience points value.
     */
     public static int getXPSplit(int p_70527_0_)
     {
     return p_70527_0_ == 4 ? 4 : (p_70527_0_ == 3 ? 3 : (p_70527_0_ == 2 ? 2 : (p_70527_0_ == 1 ? 1 : 0)));
     }
    
     /**
     * If returns false, the item will not inflict any damage against entities.
     */
     public boolean canAttackWithItem()
     {
     return false;
     }
    }
    DropEvent file:
    package dialgex.SburbCraft.Events;
    
    import java.util.Random;
    
    import cpw.mods.fml.client.FMLClientHandler;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.item.Item;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import dialgex.SburbCraft.Entities.Boondollars.*;
    import dialgex.SburbCraft.Items.Grist.*;
    import dialgex.SburbCraft.Render.RenderBoondollar;
    import net.minecraft.entity.passive.*;
    
    
    public class GristDropEvent{
     
     private static int rNum(int min, int max) {
     Random r = new Random();
     int randomNum = r.nextInt((max - min) + 1) + min;
     return randomNum;
     }
     
     public static double rand;
    
     @SubscribeEvent
     public void onEntityDrop(LivingDropsEvent event){
     World world = event.entity.worldObj;
     
     int r4 = rNum(1,4);
     int r3 = rNum(1,3);
     int r2 = rNum(1,2);
     
     if (event.source.getDamageType().equals("player")){
    
     double tx = event.entityLiving.posX;
     double ty = event.entityLiving.posY;
     double tz = event.entityLiving.posZ;
    
     rand = Math.random();
     if (event.entityLiving instanceof EntityPig){
     
     Boondollar b0 = new Boondollar(world, tx, ty, tz, 5);
     Boondollar b1 = new Boondollar(world, tx, ty, tz, 10);
     Boondollar b2 = new Boondollar(world, tx, ty, tz, 25);
     Boondollar b3 = new Boondollar(world, tx, ty, tz, 50);
    
     world.spawnEntityInWorld(b0);
     world.spawnEntityInWorld(b1);
     world.spawnEntityInWorld(b2);
     world.spawnEntityInWorld(b3);
    
     /*if(rand < 0.66d){
     
     if(rand < 0.33d){
     Boondollar b4 = new Boondollar(world, tx, ty, tz, 10);
     world.spawnEntityInWorld(b4);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityCow){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityChicken){
     event.entityLiving.dropItem(Grist.BuildGrist, 3);
     /*event.entityLiving.dropItem(Boondollar.Boondollar25, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntitySheep){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityHorse){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar10, 2);
     event.entityLiving.dropItem(Boondollar.Boondollar50, 2);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     
     ///////////////////////////////////////////
     }
     }
    }
    ClientProxy file:
    package dialgex.SburbCraft.Proxies;
    
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    import dialgex.SburbCraft.Proxies.CommonProxy;
    import dialgex.SburbCraft.Render.*;
    
    public class ClientProxy extends CommonProxy{
     
     @Override
     public void registerRenderers(){
     RenderingRegistry.registerEntityRenderingHandler(Boondollar.class, new RenderBoondollar());
     }
    }
    IAdditionalEntitySpawnData file:
    package dialgex.SburbCraft.Entities.Boondollars;
    
    import io.netty.buffer.ByteBuf;
    
    public interface IAdditionalEntitySpawnData {
    
     void writeSpawnData(ByteBuf buffer);
    
     void readSpawnData(ByteBuf buffer);
    
    }

    Sorry for being such a total noob, but that's why I came here. For help.
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    I just followed what Eclipse recommended, but okay
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    It is registered with registerModEntity.
    First line in PreInit in the Mod file.

    Entity file:

     
    package dialgex.SburbCraft.Entities.Boondollars;
    
    import io.netty.buffer.ByteBuf;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import dialgex.SburbCraft.Events.PlayerPickupBoondollarEvent;
    
    public class Boondollar extends Entity
    {
     /**
     * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow)
     */
     public int xpColor;
     /** The age of the XP orb in ticks. */
     public int xpOrbAge;
     public int field_70532_c;
     /** The health of this XP orb. */
     private int xpOrbHealth = 5;
     /** This is how much XP this orb has. */
     public int xpValue;
     /** The closest EntityPlayer to this orb. */
     private EntityPlayer closestPlayer;
     /** Threshold color for tracking players */
     private int xpTargetColor;
     private static final String __OBFID = "CL_00001544";
    
    public Boondollar(World p_i1585_1_, double p_i1585_2_, double p_i1585_4_, double p_i1585_6_, int p_i1585_8_)
     {
     super(p_i1585_1_);
     this.setSize(0.5F, 0.5F);
     this.yOffset = this.height / 2.0F;
     this.setPosition(p_i1585_2_, p_i1585_4_, p_i1585_6_);
     this.rotationYaw = (float)(Math.random() * 360.0D);
     this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F);
     this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     xpValue = p_i1585_8_;
     }
    
    /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
     * prevent them from trampling crops
     */
     protected boolean canTriggerWalking()
     {
     return false;
     }
    
    public Boondollar(World p_i1586_1_)
     {
     super(p_i1586_1_);
     this.setSize(0.25F, 0.25F);
     this.yOffset = this.height / 2.0F;
     }
    
    protected void entityInit() {}
    
    @SideOnly(Side.CLIENT)
     public int getBrightnessForRender(float p_70070_1_)
     {
     float f1 = 0.5F;
    
    if (f1 < 0.0F)
     {
     f1 = 0.0F;
     }
    
    if (f1 > 1.0F)
     {
     f1 = 1.0F;
     }
    
    int i = super.getBrightnessForRender(p_70070_1_);
     int j = i & 255;
     int k = i >> 16 & 255;
     j += (int)(f1 * 15.0F * 16.0F);
    
    if (j > 240)
     {
     j = 240;
     }
    
    return j | k << 16;
     }
    
    /**
     * Called to update the entity's position/logic.
     */
     public void onUpdate()
     {
     super.onUpdate();
    
    if (this.field_70532_c > 0)
     {
     --this.field_70532_c;
     }
    
    this.prevPosX = this.posX;
     this.prevPosY = this.posY;
     this.prevPosZ = this.posZ;
     this.motionY -= 0.029999999329447746D;
    
    if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava)
     {
     this.motionY = 0.20000000298023224D;
     this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
     }
    
    this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
     double d0 = 8.0D;
    
    if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100)
     {
     if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0)
     {
     this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0);
     }
    
    this.xpTargetColor = this.xpColor;
     }
    
    if (this.closestPlayer != null)
     {
     double d1 = (this.closestPlayer.posX - this.posX) / d0;
     double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0;
     double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
     double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
     double d5 = 1.0D - d4;
    
    if (d5 > 0.0D)
     {
     d5 *= d5;
     this.motionX += d1 / d4 * d5 * 0.1D;
     this.motionY += d2 / d4 * d5 * 0.1D;
     this.motionZ += d3 / d4 * d5 * 0.1D;
     }
     }
    
    this.moveEntity(this.motionX, this.motionY, this.motionZ);
     float f = 0.98F;
    
    if (this.onGround)
     {
     f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
     }
    
    this.motionX *= (double)f;
     this.motionY *= 0.9800000190734863D;
     this.motionZ *= (double)f;
    
    if (this.onGround)
     {
     this.motionY *= -0.8999999761581421D;
     }
    
    ++this.xpColor;
     ++this.xpOrbAge;
    
    if (this.xpOrbAge >= 6000)
     {
     this.setDead();
     }
     }
    
    /**
     * Returns if this entity is in water and will end up adding the waters velocity to the entity
     */
     public boolean handleWaterMovement()
     {
     return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
     }
    
    /**
     * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args:
     * amountDamage
     */
     protected void dealFireDamage(int p_70081_1_)
     {
     this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
     }
    
    /**
     * Called when the entity is attacked.
     */
     public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
     {
     if (this.isEntityInvulnerable())
     {
     return false;
     }
     else
     {
     this.setBeenAttacked();
     this.xpOrbHealth = (int)((float)this.xpOrbHealth - p_70097_2_);
    
    if (this.xpOrbHealth <= 0)
     {
     this.setDead();
     }
    
    return false;
     }
     }
    
    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
     public void writeEntityToNBT(NBTTagCompound p_70014_1_)
     {
     p_70014_1_.setShort("Health", (short)((byte)this.xpOrbHealth));
     p_70014_1_.setShort("Age", (short)this.xpOrbAge);
     p_70014_1_.setShort("Value", (short)this.xpValue);
     }
    
    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
     public void readEntityFromNBT(NBTTagCompound p_70037_1_)
     {
     this.xpOrbHealth = p_70037_1_.getShort("Health") & 255;
     this.xpOrbAge = p_70037_1_.getShort("Age");
     this.xpValue = p_70037_1_.getShort("Value");
     }
    
    public void writeSpawnData(ByteBuf buffer) {
     buffer.writeInt(this.xpValue);
     }
    
    public void readSpawnData(ByteBuf buffer) {
     this.xpValue = buffer.readInt();
     }
    
    /**
     * Called by a player entity when they collide with an entity
     */
     public void onCollideWithPlayer(EntityPlayer p_70100_1_)
     {
     if (!this.worldObj.isRemote)
     {
     if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
     {
     if (MinecraftForge.EVENT_BUS.post(new PlayerPickupBoondollarEvent(p_70100_1_, this))) return;
     p_70100_1_.xpCooldown = 2;
     this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
     p_70100_1_.onItemPickup(this, 1);
     p_70100_1_.addExperience(this.xpValue);
     this.setDead();
     }
     }
     }
    
    /**
     * Returns the XP value of this XP orb.
     */
     public int getXpValue()
     {
     return this.xpValue;
     }
    
    /**
     * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine
     * what texture to use.
     */
     @SideOnly(Side.CLIENT)
     public int getTextureByXP(){
     int returnxp = 0;
     if(this.xpValue == 50){
     //FMLLog.info(""+this.xpValue);
     returnxp = 4;
     }else if(this.xpValue == 25){
     //FMLLog.info(""+this.xpValue);
     returnxp = 3;
     }else if(this.xpValue == 10){
     //FMLLog.info(""+this.xpValue);
     returnxp = 2;
     }else if(this.xpValue == 5){
     //FMLLog.info(""+this.xpValue);
     returnxp = 1;
     }else if(this.xpValue == 0){
     //FMLLog.info("Something is wrong here");
     returnxp = 0;
     }
     return returnxp;
     }
    
    /**
     * Get a fragment of the maximum experience points value for the supplied value of experience points value.
     */
     public static int getXPSplit(int p_70527_0_)
     {
     return p_70527_0_ == 4 ? 4 : (p_70527_0_ == 3 ? 3 : (p_70527_0_ == 2 ? 2 : (p_70527_0_ == 1 ? 1 : 0)));
     }
    
    /**
     * If returns false, the item will not inflict any damage against entities.
     */
     public boolean canAttackWithItem()
     {
     return false;
     }
    }
    
     




    Render file:

     
    package dialgex.SburbCraft.Render;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import cpw.mods.fml.common.FMLLog;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    
    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
     private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbsurvival", "textures/entities/BoondollarTex.png");
     private static final String __OBFID = "CL_00000993";
    
    public RenderBoondollar()
     {
     this.shadowSize = 0.15F;
     this.shadowOpaque = 0.75F;
     }
    
    /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Boondollar p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     GL11.glPushMatrix();
     GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
     this.bindEntityTexture(p_76986_1_);
     int i = p_76986_1_.getTextureByXP();
     float f2 = (float)(i * 64 + 0) / 256.0F;
     float f3 = (float)(i * 64 + 64) / 256.0F;
     float f4 = (float)(i * 256 + 0) / 256.0F;
     float f5 = (float)(i * 256 + 256) / 256.0F;
     float f6 = 1.0F;
     float f7 = 0.5F;
     float f8 = 0.25F;
     int j = p_76986_1_.getBrightnessForRender(p_76986_9_);
     int k = j % 65536;
     int l = j / 65536;
     OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     float f10 = 255.0F;
     float f11 = ((float)p_76986_1_.xpColor + p_76986_9_) / 2.0F;
     l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
     int i1 = (int)f10;
     int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
     int k1 = l << 16 | i1 << 8 | j1;
     GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
     GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
     float f9 = 0.9F;
     GL11.glScalef(f9, f9, f9);
     Tessellator tessellator = Tessellator.instance;
     tessellator.startDrawingQuads();
     tessellator.setColorRGBA_I(k1, 128);
     tessellator.setNormal(0.0F, 1.0F, 0.0F);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
     tessellator.draw();
     GL11.glDisable(GL11.GL_BLEND);
     GL11.glDisable(GL12.GL_RESCALE_NORMAL);
     GL11.glPopMatrix();
     }
    
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Boondollar p_110775_1_)
     {
     return BoondollarTextures;
     }
    
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Entity p_110775_1_)
     {
     return this.getEntityTexture((Boondollar)p_110775_1_);
     }
    
    /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probability, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     this.doRender((Boondollar)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
     }
    }




    DropEvent file:

     
    package dialgex.SburbCraft.Events;
    
    import java.util.Random;
    
    import cpw.mods.fml.client.FMLClientHandler;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.item.Item;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import dialgex.SburbCraft.Entities.Boondollars.*;
    import dialgex.SburbCraft.Items.Grist.*;
    import dialgex.SburbCraft.Render.RenderBoondollar;
    import net.minecraft.entity.passive.*;
    
    
    public class GristDropEvent{
     
     private static int rNum(int min, int max) {
     Random r = new Random();
     int randomNum = r.nextInt((max - min) + 1) + min;
     return randomNum;
     }
     
     public static double rand;
    
    @SubscribeEvent
     public void onEntityDrop(LivingDropsEvent event){
     World world = event.entity.worldObj;
     
     int r4 = rNum(1,4);
     int r3 = rNum(1,3);
     int r2 = rNum(1,2);
     
     if (event.source.getDamageType().equals("player")){
    
    double tx = event.entityLiving.posX;
     double ty = event.entityLiving.posY;
     double tz = event.entityLiving.posZ;
    
    rand = Math.random();
     if (event.entityLiving instanceof EntityPig){
     
     Boondollar b0 = new Boondollar(world, tx, ty, tz, 5);
     Boondollar b1 = new Boondollar(world, tx, ty, tz, 10);
     Boondollar b2 = new Boondollar(world, tx, ty, tz, 25);
     Boondollar b3 = new Boondollar(world, tx, ty, tz, 50);
     int bx0 = b0.getTextureByXP();
     int bx1 = b1.getTextureByXP();
     int bx2 = b2.getTextureByXP();
     int bx3 = b3.getTextureByXP();
     FMLLog.info(""+bx0);
     FMLLog.info(""+bx1);
     FMLLog.info(""+bx2);
     FMLLog.info(""+bx3);
     world.spawnEntityInWorld(b0);
     world.spawnEntityInWorld(b1);
     world.spawnEntityInWorld(b2);
     world.spawnEntityInWorld(b3);
    
    /*if(rand < 0.66d){
     
     if(rand < 0.33d){
     Boondollar b4 = new Boondollar(world, tx, ty, tz, 10);
     world.spawnEntityInWorld(b4);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityCow){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityChicken){
     event.entityLiving.dropItem(Grist.BuildGrist, 3);
     /*event.entityLiving.dropItem(Boondollar.Boondollar25, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntitySheep){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityHorse){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar10, 2);
     event.entityLiving.dropItem(Boondollar.Boondollar50, 2);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     
     ///////////////////////////////////////////
     }
     }
    }




    ClientProxy:

     
    package dialgex.SburbCraft.Proxies;
    
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    import dialgex.SburbCraft.Proxies.CommonProxy;
    import dialgex.SburbCraft.Render.*;
    
    public class ClientProxy extends CommonProxy{
     
     @Override
     public void registerRenderers(){
     RenderingRegistry.registerEntityRenderingHandler(Boondollar.class, new RenderBoondollar());
     }
    }


    Mod file:

    package dialgex.SburbCraft;
    
    import dialgex.lib.Constants;
    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.item.Item;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.common.config.Configuration;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.event.FMLEvent;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.network.FMLNetworkEvent;
    import cpw.mods.fml.common.network.NetworkRegistry;
    import cpw.mods.fml.common.registry.EntityRegistry;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    import dialgex.SburbCraft.Proxies.ClientProxy;
    import dialgex.SburbCraft.Proxies.CommonProxy;
    import dialgex.SburbCraft.Render.*;
    import dialgex.SburbCraft.Events.*;
    import dialgex.SburbCraft.ExtraMods.ExtraMods;
    import dialgex.SburbCraft.Entities.Boondollars.*;
    import dialgex.SburbCraft.Items.*;
    import dialgex.SburbCraft.Render.RenderBoondollar;
    
    @Mod(modid = Constants.MOD_ID, name = Constants.MOD_NAME, version = Constants.VERSION)
    
    public class SburbCraft {
     
     @Instance(Constants.MOD_ID)
     public static SburbCraft instance;
     @SidedProxy(clientSide="dialgex.SburbCraft.Proxies.ClientProxy", serverSide="dialgex.SburbCraft.Proxies.CommonProxy")
     public static CommonProxy proxy;
     
     
     @Mod.EventHandler
     public void preInit(FMLPreInitializationEvent event) {
     EntityRegistry.registerModEntity(Boondollar.class, "Boondollar", 1, this, 80, 3, true);
     proxy.registerRenderers();
     MinecraftForge.EVENT_BUS.register(new GristDropEvent());
     captchaCards.init();
     gristWallet.init();
     FMLLog.info("[SKAIANET]: "+ExtraMods.getNumberOfMods()+" supported mods have been found");
     }
     
     @Mod.EventHandler
     public void init(FMLInitializationEvent event) {
     
     }
     
     @Mod.EventHandler
     public void postInit(FMLPostInitializationEvent event) {
     
     }
    
    }
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    I'm still so confused because I added them to the entity file and literally nothing changed.

    The renderer still isn't getting the values, and the texture still isn't changing
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    I said I don't know where to use them.

    Writing is practically self-explanatory, but where do I use the read.

    How do I call them.
    How do I apply their use
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Okay, I have it in my entity file now, but nothing is different, and I have absolutely no idea where to use the read, and where to use the write
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    I'm confused on how to use it
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Do I implement these in the entity file?
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Can anyone at all help me out? (bump)
    Browser was being stupid and didn't update on refresh
    Boondollars should really only have 4 values:

    5, 10, 25, and 50
    Each different value has a different texture, and it isn't meant to change after spawning.

    My problem is that it's spawning, and with the proper values, but the renderer isn't getting the values, and so it isn't using the right textures
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Okay, need to revive this thread because a new issue came up.

    All the files and such are working flawlessly, but for some reason, the getTextureFromXP method isn't getting the xpValue, so the texture doesn't change in regards to the Renderer

    DropEvent:

     
    package dialgex.SburbCraft.Events;
    
    import java.util.Random;
    
    import cpw.mods.fml.client.FMLClientHandler;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.item.Item;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import dialgex.SburbCraft.Entities.Boondollars.*;
    import dialgex.SburbCraft.Items.Grist.*;
    import net.minecraft.entity.passive.*;
    
    
    public class GristDropEvent{
     
     private static int rNum(int min, int max) {
     Random r = new Random();
     int randomNum = r.nextInt((max - min) + 1) + min;
     return randomNum;
     }
     
     public static double rand;
    
    @SubscribeEvent
     public void onEntityDrop(LivingDropsEvent event){
     World world = event.entity.worldObj;
     
     int r4 = rNum(1,4);
     int r3 = rNum(1,3);
     int r2 = rNum(1,2);
     
     if (event.source.getDamageType().equals("player")){
    
    double tx = event.entityLiving.posX;
     double ty = event.entityLiving.posY;
     double tz = event.entityLiving.posZ;
    
    rand = Math.random();
     if (event.entityLiving instanceof EntityPig){
     
     Boondollar b0 = new Boondollar(world, tx, ty, tz, 5);
     Boondollar b1 = new Boondollar(world, tx, ty, tz, 10);
     Boondollar b2 = new Boondollar(world, tx, ty, tz, 25);
     Boondollar b3 = new Boondollar(world, tx, ty, tz, 50);
     world.spawnEntityInWorld(b0);
     world.spawnEntityInWorld(b1);
     world.spawnEntityInWorld(b2);
     world.spawnEntityInWorld(b3);
    
    /*if(rand < 0.66d){
     
     if(rand < 0.33d){
     Boondollar b4 = new Boondollar(world, tx, ty, tz, 10);
     world.spawnEntityInWorld(b4);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityCow){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityChicken){
     event.entityLiving.dropItem(Grist.BuildGrist, 3);
     /*event.entityLiving.dropItem(Boondollar.Boondollar25, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntitySheep){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar50, 1);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     if (event.entityLiving instanceof EntityHorse){
     event.entityLiving.dropItem(Grist.BuildGrist, 1);
     /*event.entityLiving.dropItem(Boondollar.Boondollar10, 2);
     event.entityLiving.dropItem(Boondollar.Boondollar50, 2);
     if(rand < 0.66d){
     event.entityLiving.dropItem(Boondollar.Boondollar5, r4);
     if(rand < 0.33d){
     event.entityLiving.dropItem(Boondollar.Boondollar10, r2);
     }
     }*/
     }
     
     
     ///////////////////////////////////////////
     }
     }
    }


    EntityFile (getTextureFromXp is here towards the bottom):

     
    package dialgex.SburbCraft.Entities.Boondollars;
    
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import dialgex.SburbCraft.Events.PlayerPickupBoondollarEvent;
    
    public class Boondollar extends Entity
    {
     /**
     * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow)
     */
     public int xpColor;
     /** The age of the XP orb in ticks. */
     public int xpOrbAge;
     public int field_70532_c;
     /** The health of this XP orb. */
     private int xpOrbHealth = 5;
     /** This is how much XP this orb has. */
     public int xpValue;
     /** The closest EntityPlayer to this orb. */
     private EntityPlayer closestPlayer;
     /** Threshold color for tracking players */
     private int xpTargetColor;
     private static final String __OBFID = "CL_00001544";
    
    public Boondollar(World p_i1585_1_, double p_i1585_2_, double p_i1585_4_, double p_i1585_6_, int p_i1585_8_)
     {
     super(p_i1585_1_);
     this.setSize(0.5F, 0.5F);
     this.yOffset = this.height / 2.0F;
     this.setPosition(p_i1585_2_, p_i1585_4_, p_i1585_6_);
     this.rotationYaw = (float)(Math.random() * 360.0D);
     this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F);
     this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F);
     xpValue = p_i1585_8_;
     }
    
    /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
     * prevent them from trampling crops
     */
     protected boolean canTriggerWalking()
     {
     return false;
     }
    
    public Boondollar(World p_i1586_1_)
     {
     super(p_i1586_1_);
     this.setSize(0.25F, 0.25F);
     this.yOffset = this.height / 2.0F;
     }
    
    protected void entityInit() {}
    
    @SideOnly(Side.CLIENT)
     public int getBrightnessForRender(float p_70070_1_)
     {
     float f1 = 0.5F;
    
    if (f1 < 0.0F)
     {
     f1 = 0.0F;
     }
    
    if (f1 > 1.0F)
     {
     f1 = 1.0F;
     }
    
    int i = super.getBrightnessForRender(p_70070_1_);
     int j = i & 255;
     int k = i >> 16 & 255;
     j += (int)(f1 * 15.0F * 16.0F);
    
    if (j > 240)
     {
     j = 240;
     }
    
    return j | k << 16;
     }
    
    /**
     * Called to update the entity's position/logic.
     */
     public void onUpdate()
     {
     super.onUpdate();
    
    if (this.field_70532_c > 0)
     {
     --this.field_70532_c;
     }
    
    this.prevPosX = this.posX;
     this.prevPosY = this.posY;
     this.prevPosZ = this.posZ;
     this.motionY -= 0.029999999329447746D;
    
    if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava)
     {
     this.motionY = 0.20000000298023224D;
     this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
     this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
     }
    
    this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
     double d0 = 8.0D;
    
    if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100)
     {
     if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0)
     {
     this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0);
     }
    
    this.xpTargetColor = this.xpColor;
     }
    
    if (this.closestPlayer != null)
     {
     double d1 = (this.closestPlayer.posX - this.posX) / d0;
     double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0;
     double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
     double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
     double d5 = 1.0D - d4;
    
    if (d5 > 0.0D)
     {
     d5 *= d5;
     this.motionX += d1 / d4 * d5 * 0.1D;
     this.motionY += d2 / d4 * d5 * 0.1D;
     this.motionZ += d3 / d4 * d5 * 0.1D;
     }
     }
    
    this.moveEntity(this.motionX, this.motionY, this.motionZ);
     float f = 0.98F;
    
    if (this.onGround)
     {
     f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
     }
    
    this.motionX *= (double)f;
     this.motionY *= 0.9800000190734863D;
     this.motionZ *= (double)f;
    
    if (this.onGround)
     {
     this.motionY *= -0.8999999761581421D;
     }
    
    ++this.xpColor;
     ++this.xpOrbAge;
    
    if (this.xpOrbAge >= 6000)
     {
     this.setDead();
     }
     }
    
    /**
     * Returns if this entity is in water and will end up adding the waters velocity to the entity
     */
     public boolean handleWaterMovement()
     {
     return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
     }
    
    /**
     * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args:
     * amountDamage
     */
     protected void dealFireDamage(int p_70081_1_)
     {
     this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
     }
    
    /**
     * Called when the entity is attacked.
     */
     public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
     {
     if (this.isEntityInvulnerable())
     {
     return false;
     }
     else
     {
     this.setBeenAttacked();
     this.xpOrbHealth = (int)((float)this.xpOrbHealth - p_70097_2_);
    
    if (this.xpOrbHealth <= 0)
     {
     this.setDead();
     }
    
    return false;
     }
     }
    
    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
     public void writeEntityToNBT(NBTTagCompound p_70014_1_)
     {
     p_70014_1_.setShort("Health", (short)((byte)this.xpOrbHealth));
     p_70014_1_.setShort("Age", (short)this.xpOrbAge);
     p_70014_1_.setShort("Value", (short)this.xpValue);
     }
    
    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
     public void readEntityFromNBT(NBTTagCompound p_70037_1_)
     {
     this.xpOrbHealth = p_70037_1_.getShort("Health") & 255;
     this.xpOrbAge = p_70037_1_.getShort("Age");
     this.xpValue = p_70037_1_.getShort("Value");
     }
    
    /**
     * Called by a player entity when they collide with an entity
     */
     public void onCollideWithPlayer(EntityPlayer p_70100_1_)
     {
     if (!this.worldObj.isRemote)
     {
     if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
     {
     if (MinecraftForge.EVENT_BUS.post(new PlayerPickupBoondollarEvent(p_70100_1_, this))) return;
     p_70100_1_.xpCooldown = 2;
     this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
     p_70100_1_.onItemPickup(this, 1);
     p_70100_1_.addExperience(this.xpValue);
     this.setDead();
     }
     }
     }
    
    /**
     * Returns the XP value of this XP orb.
     */
     public int getXpValue()
     {
     return this.xpValue;
     }
    
    /**
     * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine
     * what texture to use.
     */
     @SideOnly(Side.CLIENT)
     public int getTextureByXP(){
     int returnxp = 0;
     if(this.xpValue == 50){
     FMLLog.info(""+this.xpValue);
     returnxp = 4;
     }else if(this.xpValue == 25){
     FMLLog.info(""+this.xpValue);
     returnxp = 3;
     }else if(this.xpValue == 10){
     FMLLog.info(""+this.xpValue);
     returnxp = 2;
     }else if(this.xpValue == 5){
     FMLLog.info(""+this.xpValue);
     returnxp = 1;
     }else if(this.xpValue == 0){
     FMLLog.info("Something is wrong here");
     returnxp = 0;
     }
     return returnxp;
     }
    
    /**
     * Get a fragment of the maximum experience points value for the supplied value of experience points value.
     */
     public static int getXPSplit(int p_70527_0_)
     {
     return p_70527_0_ == 4 ? 4 : (p_70527_0_ == 3 ? 3 : (p_70527_0_ == 2 ? 2 : (p_70527_0_ == 1 ? 1 : 0)));
     }
    
    /**
     * If returns false, the item will not inflict any damage against entities.
     */
     public boolean canAttackWithItem()
     {
     return false;
     }
    }
    
     


    RenderFile:

     
    package dialgex.SburbCraft.Render;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.ResourceLocation;
    import cpw.mods.fml.common.FMLLog;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import dialgex.SburbCraft.Entities.Boondollars.Boondollar;
    
    @SideOnly(Side.CLIENT)
    public class RenderBoondollar extends Render
    {
     private static final ResourceLocation BoondollarTextures = new ResourceLocation("sburbsurvival", "textures/entities/BoondollarTex.png");
     private static final String __OBFID = "CL_00000993";
    
    public RenderBoondollar()
     {
     this.shadowSize = 0.15F;
     this.shadowOpaque = 0.75F;
     }
    
    /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Boondollar p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     GL11.glPushMatrix();
     GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
     this.bindEntityTexture(p_76986_1_);
     int i = p_76986_1_.getTextureByXP();
     FMLLog.info("i = "+i);
     float f2 = (float)(i * 64 + 0) / 256.0F;
     float f3 = (float)(i * 64 + 64) / 256.0F;
     float f4 = (float)(i * 256 + 0) / 256.0F;
     float f5 = (float)(i * 256 + 256) / 256.0F;
     float f6 = 1.0F;
     float f7 = 0.5F;
     float f8 = 0.25F;
     int j = p_76986_1_.getBrightnessForRender(p_76986_9_);
     int k = j % 65536;
     int l = j / 65536;
     OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     float f10 = 255.0F;
     float f11 = ((float)p_76986_1_.xpColor + p_76986_9_) / 2.0F;
     l = (int)((MathHelper.sin(f11 + 0.0F) + 1.0F) * 0.5F * f10);
     int i1 = (int)f10;
     int j1 = (int)((MathHelper.sin(f11 + 4.1887903F) + 1.0F) * 0.1F * f10);
     int k1 = l << 16 | i1 << 8 | j1;
     GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
     GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
     float f9 = 0.9F;
     GL11.glScalef(f9, f9, f9);
     Tessellator tessellator = Tessellator.instance;
     tessellator.startDrawingQuads();
     tessellator.setColorRGBA_I(k1, 128);
     tessellator.setNormal(0.0F, 1.0F, 0.0F);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, (double)f2, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, (double)f3, (double)f5);
     tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, (double)f3, (double)f4);
     tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, (double)f2, (double)f4);
     tessellator.draw();
     GL11.glDisable(GL11.GL_BLEND);
     GL11.glDisable(GL12.GL_RESCALE_NORMAL);
     GL11.glPopMatrix();
     }
    
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Boondollar p_110775_1_)
     {
     return BoondollarTextures;
     }
    
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
     protected ResourceLocation getEntityTexture(Entity p_110775_1_)
     {
     return this.getEntityTexture((Boondollar)p_110775_1_);
     }
    
    /**
     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probability, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
     */
     public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
     {
     this.doRender((Boondollar)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
     }
    }


    Further help would be much appreciated
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Custom XP/Currency
    Nah, I'll just tinker with the XP code, because each different Boondollar has a different texture.
    I'm sure I can figure this one out on my own. Thanks for all the help thus far!

    [PLACEHOLDER FOR END-RESULT CODE]
    Posted in: Modification Development
  • To post a comment, please .