Jump to content

Recommended Posts

Posted (edited)

Hi guys, i really need an help. I can't correctly add a custom gui to an entity. MC crash every time I try to interact with that entity. I post below all the code (The code was for 1.8.9 and i'm trying to port it to 1.10.2). Thanks if someone will be able to help

 

Entity Class

Spoiler

package com.rickweek.entities;

import javax.annotation.Nullable;

import com.rickweek.init.MCItems;
import com.rickweek.init.MCSoundEvents;
import com.rickweek.main.MCW;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

public class CREEPSEntitySneakySal extends EntityMob
{
    World world;
    EntityPlayer entityplayer;
    public int salslots[];
    public static final Item[] salitems;
    public static final int salprices[] =
    {
        10, 200, 100, 20, 175, 150, 225, 50, 350, 100,
        150, 10, 200, 150, 250
    };
    public static final String saldescriptions[] =
    {
        "BLORP COLA", "ARMY GEM", "HORSE HEAD GEM", "BAND AID", "SHRINK RAY", "EXTINGUISHER", "GROW RAY", "FRISBEE", "LIFE GEM", "GUN",
        "RAYGUN", "POPSICLE", "EARTH GEM", "FIRE GEM", "SKY GEM"
    };
    public static final ItemStack itemstack[];
    private boolean foundplayer;
    protected Entity playerToAttack;

    /**
     * returns true if a creature has attacked recently only used for creepers and skeletons
     */
    protected boolean hasAttacked;
    private float distance;
    public boolean tamed;
    public int basehealth;
    public int tamedfood;
    public int attempts;
    public double dist;
    public double prevdist;
    public int facetime;
    public String basetexture;
    public int rockettime;
    public int rocketcount;
    public int galloptime;
    public String name;
    public int sale;
    public float saleprice;
    public int dissedmax;
    public ItemStack defaultHeldItem;
    private Entity targetedEntity;
    public int bulletTime;
    public float modelsize;
    public boolean shooting;
    public int shootingdelay;
    public int itemused;
    public int itemnew;
    public String texture;
    public double moveSpeed;
    public double attackStrength;
    public double health;

    public CREEPSEntitySneakySal(World world)
    {
        super(world);
        salslots = new int[30];
        basetexture = "mcw:textures/entity/sneakysal.png";
        texture = basetexture;
        moveSpeed = 0.65F;
        attackStrength = 3;
        basehealth = rand.nextInt(50) + 50;
        health = basehealth;
        hasAttacked = false;
        foundplayer = false;
        setSize(1.5F, 4F);
        dissedmax = rand.nextInt(4) + 1;
        // defaultHeldItem = new ItemStack(MoreCreepsAndWeirdos.gun, 1);
        sale = rand.nextInt(2000) + 100;
        saleprice = 0.0F;
        shooting = false;
        shootingdelay = 20;
        modelsize = 1.7F;
        // ((PathNavigateGround)this.getNavigator()).func_179688_b(true);
        tasks.addTask(0, new EntityAISwimming(this));
        tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 0.35D));
        tasks.addTask(5, new EntityAIWander(this, 0.35D));
        tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 16F));
        tasks.addTask(7, new EntityAILookIdle(this));
        targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    }
    
    public void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(rand.nextInt(50) + 50);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.24000000417232513D);
        this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3);
    }

    

    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    public void writeEntityToNBT(NBTTagCompound nbttagcompound)
    {
        super.writeEntityToNBT(nbttagcompound);
        nbttagcompound.setInteger("Sale", sale);
        nbttagcompound.setFloat("SalePrice", saleprice);
        nbttagcompound.setInteger("DissedMax", dissedmax);
        nbttagcompound.setFloat("ModelSize", modelsize);
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    public void readEntityFromNBT(NBTTagCompound nbttagcompound)
    {
        super.readEntityFromNBT(nbttagcompound);
        sale = nbttagcompound.getInteger("Sale");
        saleprice = nbttagcompound.getFloat("SalePrice");
        dissedmax = nbttagcompound.getInteger("DissedMax");
        modelsize = nbttagcompound.getFloat("ModelSize");
        saleprice = 0.0F;
    }

    /**
     * Called to update the entity's position/logic.
     */
    public void onUpdate()
    {
        if (playerToAttack instanceof CREEPSEntitySneakySal)
        {
            playerToAttack = null;
        }

        super.onUpdate();
    }

    /**
     * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
     */
    public boolean processInteract(EntityPlayer entityplayer, EnumHand hand, @Nullable ItemStack stack)
    {
        ItemStack itemstack1 = entityplayer.inventory.getCurrentItem();

        if (dissedmax > 0)
        {
            if (saleprice == 0.0F || sale < 1)
            {
                restockSal();
            }

            if (dissedmax > 0 && !(playerToAttack instanceof EntityPlayer))
            {
                entityplayer.openGui(MCW.instance, 6, world, (int)this.posX, (int)this.posY, (int)this.posZ);
                }
        }

        return super.processInteract(entityplayer, hand, stack);
    }

    /**
     * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
     * (Animals, Spiders at day, peaceful PigZombies).
     */
    protected Entity findPlayerToAttack()
    {
        if (dissedmax < 1)
        {
            EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, 16D);

            if (entityplayer != null && canEntityBeSeen(entityplayer))
            {
                return entityplayer;
            }
            else
            {
                return null;
            }
        }
        else
        {
            return null;
        }
    }

    /**
     * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
     */
    protected void attackEntity(Entity entity, float f)
    {
        if (dissedmax < 1)
        {
            double d = entity.posX - posX;
            double d1 = entity.posZ - posZ;
            float f1 = MathHelper.sqrt_double(d * d + d1 * d1);
            motionX = (d / (double)f1) * 0.40000000000000002D * 0.20000000192092895D + motionX * 0.18000000098023225D;
            motionZ = (d1 / (double)f1) * 0.40000000000000002D * 0.14000000192092896D + motionZ * 0.18000000098023225D;

            if ((double)f < 2.7999999999999998D && entity.getEntityBoundingBox().maxY > this.getEntityBoundingBox().minY && entity.getEntityBoundingBox().minY < this.getEntityBoundingBox().maxY)
            {
                //attackTime = 10;
                entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) attackStrength);
            }

            super.attackEntityAsMob(entity);
        }
    }

    /**
     * Called when the entity is attacked.
     */
    public boolean attackEntityFrom(DamageSource damagesource, int i)
    {
        Entity entity = damagesource.getEntity();

        if (entity instanceof EntityPlayer)
        {
            dissedmax = 0;
        }

        return super.attackEntityFrom(DamageSource.causeMobDamage(this), i);
    }

    /**
     * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
     * use this to react to sunlight and start to burn.
     */
    public void onLivingUpdate()
    {
        if (shootingdelay-- < 1)
        {
            shooting = false;
        }

        targetedEntity = worldObj.getClosestPlayerToEntity(this, 3D);

        if (targetedEntity != null && (targetedEntity instanceof EntityPlayer) && canEntityBeSeen(targetedEntity))
        {
            float f = rotationYaw;

            for (int i = 0; i < 360; i++)
            {
                rotationYaw = i;
            }

            if (rand.nextInt(4) == 0)
            {
                attackEntity(targetedEntity, 1.0F);
            }
        }

        if (bulletTime-- < 1 && dissedmax < 1)
        {
            bulletTime = rand.nextInt(50) + 25;
            double d = 64D;
            targetedEntity = worldObj.getClosestPlayerToEntity(this, 30D);

            if (targetedEntity != null && canEntityBeSeen(targetedEntity) && (targetedEntity instanceof EntityPlayer) && !isDead && !(targetedEntity instanceof CREEPSEntitySneakySal) && !(targetedEntity instanceof CREEPSEntityRatMan))
            {
                double d2 = targetedEntity.getDistanceSqToEntity(this);

                if (d2 < d * d && d2 > 3D)
                {
                    double d4 = targetedEntity.posX - posX;
                    double d5 = (targetedEntity.getEntityBoundingBox().minY + (double)(targetedEntity.height / 2.0F)) - (posY + (double)(height / 2.0F));
                    double d6 = targetedEntity.posZ - posZ;
                    renderYawOffset = rotationYaw = (-(float)Math.atan2(d4, d6) * 180F) / (float)Math.PI;
                    // worldObj.playSoundAtEntity(this, "morecreeps:bullet", 0.5F, 0.4F / (rand.nextFloat() * 0.4F + 0.8F));
                    world.playSound((EntityPlayer) null, entityplayer.getPosition(), MCSoundEvents.ITEM_BULLET, SoundCategory.PLAYERS, 0.5F, 0.4F / (rand.nextFloat() * 0.4F + 0.8F));
                    shooting = true;
                    shootingdelay = 10;
                    CREEPSEntityBullet creepsentitybullet = new CREEPSEntityBullet(worldObj, this, 0.0F);

                    if (creepsentitybullet != null)
                    {
                        worldObj.spawnEntityInWorld(creepsentitybullet);
                    }
                }
            }
        }

        sale--;

        /* TODO 
        if (rand.nextInt(10) == 0)
        {
            double d1 = -MathHelper.sin((rotationYaw * (float)Math.PI) / 180F);
            double d3 = MathHelper.cos((rotationYaw * (float)Math.PI) / 180F);
            CREEPSFxSmoke creepsfxsmoke = new CREEPSFxSmoke(worldObj, posX + d1 * 0.5D, posY + 2D, posZ + d3 * 0.5D, MoreCreepsAndWeirdos.partWhite, 0.5F, 0.5F);
            creepsfxsmoke.renderDistanceWeight = 15D;
            Minecraft.getMinecraft().effectRenderer.addEffect(creepsfxsmoke);
        } */

        if (dissedmax < 1 && playerToAttack == null)
        {
            findPlayerToAttack();
        }

        super.onLivingUpdate();
    }

    public void restockSal()
    {
        sale = rand.nextInt(2000) + 100;
        saleprice = 1.0F - (rand.nextFloat() * 0.25F - rand.nextFloat() * 0.25F);
        itemnew = rand.nextInt(salitems.length);
        itemused = 0;

        for (int i = 0; i < salitems.length; i++)
        {
            salslots = i;
        }

        for (int j = 0; j < salitems.length; j++)
        {
            int k = rand.nextInt(salitems.length);
            int l = salslots[j];
            salslots[j] = salslots[k];
            salslots[k] = l;
        }
    }

    /**
     * Returns the item that this EntityLiving is holding, if any.
     */
    public ItemStack getHeldItem()
    {
        return defaultHeldItem;
    }

    private void smoke()
    {
        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                double d = rand.nextGaussian() * 0.059999999999999998D;
                double d1 = rand.nextGaussian() * 0.059999999999999998D;
                double d2 = rand.nextGaussian() * 0.059999999999999998D;
                worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (posX + (double)(rand.nextFloat() * width * 2.0F)) - (double)width, posY + (double)(rand.nextFloat() * height) + (double)i, (posZ + (double)(rand.nextFloat() * width * 2.0F)) - (double)width, d, d1, d2);
            }
        }
    }

    /**
     * Returns the sound this mob makes while it's alive.
     */
    protected SoundEvent getAmbientSound()
    {
        if (rand.nextInt(10) == 0)
        {
            return MCSoundEvents.ENTITY_SNEAKSAL_GREETING;
        }
        else
        {
            return null;
        }
    }

    /**
     * Returns the sound this mob makes when it is hurt.
     */
    protected SoundEvent getHurtSound()
    {
        return MCSoundEvents.ENTITY_SNEAKSAL_HURT;
    }

    /**
     * Returns the sound this mob makes on death.
     */
    protected SoundEvent getDeathSound()
    {
        return MCSoundEvents.ENTITY_SNEAKSAL_DEATH;
    }

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

    /**
     * Called when the mob's health reaches 0.
     */
    public void onDeath(DamageSource damagesource)
    {
        smoke();

        if (rand.nextInt(10) == 0)
        {
            // TODO dropItem(MoreCreepsAndWeirdos.rocket, rand.nextInt(5) + 1);
        }

        super.onDeath(damagesource);
    }
    
    /* TODO
    public void confetti()
    {
        double d = -MathHelper.sin((((EntityPlayer)(entityplayer)).rotationYaw * (float)Math.PI) / 180F);
        double d1 = MathHelper.cos((((EntityPlayer)(entityplayer)).rotationYaw * (float)Math.PI) / 180F);
        CREEPSEntityTrophy creepsentitytrophy = new CREEPSEntityTrophy(world);
        creepsentitytrophy.setLocationAndAngles(((EntityPlayer)(entityplayer)).posX + d * 3D, ((EntityPlayer)(entityplayer)).posY - 2D, ((EntityPlayer)(entityplayer)).posZ + d1 * 3D, ((EntityPlayer)(entityplayer)).rotationYaw, 0.0F);
        world.spawnEntityInWorld(creepsentitytrophy);
    } */

    static
    {
        salitems = (new Item[]
                {
                    MCItems.Blorpcola, MCItems.Bandaid, MCItems.LifeGem,
                    MCItems.RayGun, MCItems.Popsicle, MCItems.EarthGem, MCItems.FireGem, MCItems.SkyGem
                });
        itemstack = (new ItemStack[]
                {
                    new ItemStack(MCItems.Blorpcola), new ItemStack(MCItems.Bandaid), new ItemStack(MCItems.LifeGem),
                    new ItemStack(MCItems.RayGun), new ItemStack(MCItems.Popsicle), new ItemStack(MCItems.EarthGem), new ItemStack(MCItems.FireGem), new ItemStack(MCItems.SkyGem)
                });
    }
}

 

EntityGUI Class

Spoiler

package com.rickweek.init.gui;

import java.io.IOException;
import java.util.Random;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.rickweek.entities.CREEPSEntityRatMan;
import com.rickweek.entities.CREEPSEntitySneakySal;
import com.rickweek.init.MCItems;
import com.rickweek.init.MCSoundEvents;

import net.java.games.input.Keyboard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

public class CREEPSGUISneakySal extends GuiScreen
{
    private CREEPSEntitySneakySal sneakysal;
    private GuiTextField namescreen;
    private static boolean field_28217_m = true;
    private float xSize_lo;
    private float ySize_lo;
    public int playercash;
    public float saleprice = 1;
    public static Random rand = new Random();
    protected int xSize;
    protected int ySize;
    private RenderItem itemRender;

    public CREEPSGUISneakySal(CREEPSEntitySneakySal creepsentitysneakysal)
    {
        sneakysal = creepsentitysneakysal;
        xSize = 512;
        ySize = 512;
        itemRender = Minecraft.getMinecraft().getRenderItem();
    }

    /**
     * Adds the buttons (and other controls) to the screen in question.
     */
    @Override
    public void initGui()
    {
        // Keyboard.enableRepeatEvents(true);
        super.initGui();
        buttonList.clear();
        // super.initGui();
        byte byte0 = -18;
        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
        World world = Minecraft.getMinecraft().theWorld;
        // world.playSoundAtEntity(entityplayersp, "morecreeps:salgreeting", 1.0F, 1.0F);
        world.playSound((EntityPlayer) null, entityplayersp.getPosition(), MCSoundEvents.ENTITY_SNEAKSAL_GREETING, SoundCategory.NEUTRAL, 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
        
        saleprice = sneakysal.saleprice;
        buttonList.add(new GuiButton(2, width / 2 - 170, height / 4 + 8 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[0]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[0]])).toString()));
        buttonList.add(new GuiButton(3, width / 2 + 2, height / 4 + 8 + byte0, 155, 20, (new StringBuilder()).append("   \2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[1]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[1]])).toString()));
        buttonList.add(new GuiButton(4, width / 2 - 170, height / 4 + 35 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[2]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[2]])).toString()));
        buttonList.add(new GuiButton(5, width / 2 + 2, height / 4 + 35 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[3]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[3]])).toString()));
        buttonList.add(new GuiButton(6, width / 2 - 170, height / 4 + 65 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[4]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[4]])).toString()));
        buttonList.add(new GuiButton(7, width / 2 + 2, height / 4 + 65 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[5]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[5]])).toString()));
        buttonList.add(new GuiButton(8, width / 2 - 170, height / 4 + 95 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[6]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[6]])).toString()));
        buttonList.add(new GuiButton(9, width / 2 + 2, height / 4 + 95 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[7]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[7]])).toString()));
        buttonList.add(new GuiButton(10, width / 2 - 170, height / 4 + 125 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[8]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[8]])).toString()));
        buttonList.add(new GuiButton(11, width / 2 + 2, height / 4 + 125 + byte0, 155, 20, (new StringBuilder()).append("\2472    $\2476").append(String.valueOf(Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[9]] * saleprice))).append("\247f ").append(String.valueOf(CREEPSEntitySneakySal.saldescriptions[sneakysal.salslots[9]])).toString()));
        buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 158 + byte0, 98, 20, "RIPOFF SAL"));
        buttonList.add(new GuiButton(1, width / 2 + 2, height / 4 + 158 + byte0, 98, 20, "DONE"));
    }
    
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
    {
        char c = '\260';
        char c1 = '\246';
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
        int j = (width - c) / 2;
        int k = (height - c1) / 2;
        drawTexturedModalRect(j, k, 0, 0, (int)xSize_lo, (int)ySize_lo);
        drawEntityOnScreen(j + 51, k + 75, 30, (float)(j + 51) - mouseX, (float)(k + 75 - 50) - mouseY, this.mc.thePlayer);
    }

    public static void drawEntityOnScreen(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.pushMatrix();
        GlStateManager.translate((float)p_147046_0_, (float)p_147046_1_, 50.0F);
        GlStateManager.scale((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_);
        GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        float f2 = p_147046_5_.renderYawOffset;
        float f3 = p_147046_5_.rotationYaw;
        float f4 = p_147046_5_.rotationPitch;
        float f5 = p_147046_5_.prevRotationYawHead;
        float f6 = p_147046_5_.rotationYawHead;
        GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
        RenderHelper.enableStandardItemLighting();
        GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
        p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F;
        p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F;
        p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F;
        p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw;
        p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw;
        GlStateManager.translate(0.0F, 0.0F, 0.0F);
        RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
        rendermanager.setPlayerViewY(180.0F);
        rendermanager.setRenderShadow(false);
        rendermanager.doRenderEntity(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, field_28217_m);
        rendermanager.setRenderShadow(true);
        p_147046_5_.renderYawOffset = f2;
        p_147046_5_.rotationYaw = f3;
        p_147046_5_.rotationPitch = f4;
        p_147046_5_.prevRotationYawHead = f5;
        p_147046_5_.rotationYawHead = f6;
        GlStateManager.popMatrix();
        RenderHelper.disableStandardItemLighting();
        GlStateManager.disableRescaleNormal();
        GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GlStateManager.disableTexture2D();
        GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }

    /**
     * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
     */
    protected void actionPerformed(GuiButton guibutton)
    {
        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
        World world = Minecraft.getMinecraft().theWorld;

        if (!guibutton.enabled)
        {
            return;
        }

        if (guibutton.id == 1)
        {
            mc.displayGuiScreen(null);
            return;
        }

        if (guibutton.id == 0)
        {
            sneakysal.dissedmax--;

            if (rand.nextInt(9) == 0)
            {
                // world.playSoundAtEntity(entityplayersp, "mob.chickenplop", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
                world.playSound((EntityPlayer) null, entityplayersp.getPosition(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.NEUTRAL, 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
                int i = rand.nextInt(15) + 1;

                switch (i)
                {
                    case 1:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.armygem, 1);
                        sneakysal.dropItem(MCItems.Blorpcola, 1);
                        break;

                    case 2:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.horseheadgem, 1);
                        sneakysal.dropItem(MCItems.EarthGem, 1);
                        break;

                    case 3:
                        sneakysal.dropItem(MCItems.Bandaid, 1);
                        break;

                    case 4:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.shrinkray, 1);
                        sneakysal.dropItem(MCItems.GooDonut, 1);
                        break;

                    case 5:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.extinguisher, 1);
                        sneakysal.dropItem(MCItems.Battery, 1);
                        break;

                    case 6:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.growray, 1);
                        sneakysal.dropItem(MCItems.Ram16K, 1);
                        break;

                    case 7:
                        // sneakysal.dropItem(MoreCreepsAndWeirdos.frisbee, 1);
                        sneakysal.dropItem(MCItems.CaveClub, 1);
                        break;

                    case 8:
                        sneakysal.dropItem(MCItems.LifeGem, 1);
                        break;

                    case 9:
                        sneakysal.dropItem(MCItems.Gun, 1);
                        break;

                    case 10:
                        sneakysal.dropItem(MCItems.RayGun, 1);
                        break;

                    default:
                        sneakysal.dropItem(MCItems.Bandaid, 1);
                        break;
                }

                mc.displayGuiScreen(null);
                return;
            }

            for (int j = 0; j < rand.nextInt(15) + 5; j++)
            {
                double d = -MathHelper.sin((sneakysal.rotationYaw * (float)Math.PI) / 180F);
                double d1 = MathHelper.cos((sneakysal.rotationYaw * (float)Math.PI) / 180F);
                CREEPSEntityRatMan creepsentityratman = new CREEPSEntityRatMan(world);
                creepsentityratman.setLocationAndAngles((sneakysal.posX + d * 1.0D + (double)rand.nextInt(4)) - 2D, sneakysal.posY - 1.0D, (sneakysal.posZ + d1 * 1.0D + (double)rand.nextInt(4)) - 2D, sneakysal.rotationYaw, 0.0F);
                creepsentityratman.motionY = 1.0D;
                world.spawnEntityInWorld(creepsentityratman);
            }

            // world.playSoundAtEntity(entityplayersp, "morecreeps:salrats", 1.0F, 1.0F);
            world.playSound((EntityPlayer) null, entityplayersp.getPosition(), MCSoundEvents.ENTITY_SNEAKSAL_RATS, SoundCategory.NEUTRAL, 1.0F, 1.0F);
            mc.displayGuiScreen(null);
            return;
        }

        int k = guibutton.id;

        if (k > 1 && k < 12)
        {
            k -= 2;
            CREEPSEntitySneakySal _tmp = sneakysal;
            int l = Math.round((float)CREEPSEntitySneakySal.salprices[sneakysal.salslots[k]] * saleprice);
            playercash = checkCash();

            if (playercash < l)
            {
                // world.playSoundAtEntity(entityplayersp, "morecreeps:salnomoney", 1.0F, 1.0F);
                world.playSound((EntityPlayer) null, entityplayersp.getPosition(), MCSoundEvents.ENTITY_SNEAKSAL_NOMONEY, SoundCategory.NEUTRAL, 1.0F, 1.0F);
            }
            else
            {
                removeCash(l);
                CREEPSEntitySneakySal _tmp1 = sneakysal;
                sneakysal.dropItem(CREEPSEntitySneakySal.salitems[sneakysal.salslots[k]], 1);
                // world.playSoundAtEntity(entityplayersp, "morecreeps:salsale", 1.0F, 1.0F);
                world.playSound((EntityPlayer) null, entityplayersp.getPosition(), MCSoundEvents.ENTITY_SNEAKSAL_SALE, SoundCategory.NEUTRAL, 1.0F, 1.0F);
            }
        }
    }

    public boolean removeCash(int i)
    {
        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
        Object obj = null;
        ItemStack aitemstack[] = ((EntityPlayer)(entityplayersp)).inventory.mainInventory;
        boolean flag = false;
        label0:

        for (int j = 0; j < aitemstack.length; j++)
        {
            ItemStack itemstack = aitemstack[j];

            if (itemstack == null || itemstack.getItem() != MCItems.Money)
            {
                continue;
            }

            do
            {
                if (itemstack.stackSize <= 0 || i <= 0)
                {
                    continue label0;
                }

                i--;

                if (itemstack.stackSize - 1 == 0)
                {
                    ((EntityPlayer)(entityplayersp)).inventory.mainInventory[j] = null;
                    continue label0;
                }

                itemstack.stackSize--;
            }
            while (true);
        }

        return true;
    }

    public int checkCash()
    {
        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
        Object obj = null;
        ItemStack aitemstack[] = ((EntityPlayer)(entityplayersp)).inventory.mainInventory;
        int i = 0;

        for (int j = 0; j < aitemstack.length; j++)
        {
            ItemStack itemstack = aitemstack[j];

            if (itemstack != null && itemstack.getItem() == MCItems.Money)
            {
                i += itemstack.stackSize;
            }
        }

        return i;
    }

    /**
     * Returns true if this GUI should pause the game when it is displayed in single-player
     */
    public boolean doesGuiPauseGame()
    {
        return true;
    }

    /**
     * Called when the mouse is clicked.
     */
    protected void mouseClicked(int i, int j, int k)
    {
        try {
            super.mouseClicked(i, j, k);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     * Draws the screen and all the components in it.
     */
    public void drawScreen(int i, int j, float f)
    {
        drawWorldBackground(0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        mc.renderEngine.bindTexture(new ResourceLocation("mcw:textures/gui/gui-screensal.png"));
        int l = (width - xSize) / 2;
        int i1 = (height - (ySize + 16)) / 2;
        drawTexturedModalRect(20, 20, 0, 0, xSize + 400, ySize);
        byte byte0 = -18;
        boolean flag = false;
        playercash = checkCash();
        drawCenteredString(fontRendererObj, "\2475******* \247fWELCOME TO SAL'S SHOP \2475*******", width / 2, height / 4 - 40, 0xffffff);
        drawCenteredString(fontRendererObj, (new StringBuilder()).append("\247eYour cash : \2472$\2476 ").append(String.valueOf(playercash)).toString(), width / 2, height / 4 - 25, 0xffffff);

        for (int j1 = 0; j1 < 5; j1++)
        {
            zLevel = 200F;
            itemRender.zLevel = 200F;
            RenderHelper.enableGUIStandardItemLighting();
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glEnable(GL11.GL_COLOR_MATERIAL);
            GL11.glEnable(GL11.GL_LIGHTING);
            CREEPSEntitySneakySal _tmp = sneakysal;
            itemRender.renderItemIntoGUI(CREEPSEntitySneakySal.itemstack[sneakysal.salslots[j1 * 2]], width / 2 - 160, height / 4 + 8 + byte0 + j1 * 30);
            CREEPSEntitySneakySal _tmp1 = sneakysal;
            itemRender.renderItemIntoGUI(CREEPSEntitySneakySal.itemstack[sneakysal.salslots[j1 * 2 + 1]], width / 2 + 12, height / 4 + 8 + byte0 + j1 * 30);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDepthMask(true);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            zLevel = 0.0F;
            itemRender.zLevel = 0.0F;
        }

        super.drawScreen(i, j, f);
        xSize_lo = i;
        ySize_lo = j;
    }
}

 

GUI Handler

Spoiler

package com.rickweek.init.gui.handler;

import com.rickweek.entities.CREEPSEntitySneakySal;
import com.rickweek.init.gui.CREEPSGUISneakySal;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class CREEPSGuiHandler implements IGuiHandler
{
    // private CREEPSEntityHotdog hotdog;
    // private CREEPSEntityGuineaPig guineapig;
    // private CREEPSEntityRocketGiraffe rocketgiraffe;
    private CREEPSEntitySneakySal sneakysal;
    // private CREEPSEntityZebra zebra;

    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) 
    {
        /*
        if (ID == 1){
            return new CREEPSGUICamelname();
        }
        
        if (ID == 2){
            //name hotdog
            return new CREEPSGUIHotdog(hotdog);
        }
        
        if (ID == 3){
            return new CREEPSGUIGuineaPigTraining(guineapig);
        }
        
        if (ID == 4){
            return new CREEPSGUIGuineaPig(guineapig);
        }
        
        if (ID == 5){
            return new CREEPSGUIGiraffename(rocketgiraffe);
        } */
        
        if (ID == 6){
            return new CREEPSGUISneakySal(sneakysal);
        }
        
        /*
        if (ID == 7){
            return new CREEPSGUIZebraname(zebra);
        } */

            return null;
    }

    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    {
           
        /*
        if (ID == 1){
            return new CREEPSGUICamelname();
        }
        
        if (ID == 2){
            //name hotdog
            return new CREEPSGUIHotdog(hotdog);
        }
        
        if (ID == 3){
            //gpig stats
            return new CREEPSGUIGuineaPigTraining(guineapig);
        }
        
        if (ID == 4){
            //name gpig
            return new CREEPSGUIGuineaPig(guineapig);
        }
        
        if (ID == 5){
            //name giraffe
            return new CREEPSGUIGiraffename(rocketgiraffe);
        } */
        
        if (ID == 6){
            return new CREEPSGUISneakySal(sneakysal);
        }
        
        /*
        if (ID == 7){
            return new CREEPSGUIZebraname(zebra);
        } */

            return null;
    }
}

 

Main Class

Spoiler

package com.rickweek.main;

import com.rickweek.entities.CREEPSEntityBullet;
import com.rickweek.entities.CREEPSEntityMoney;
import com.rickweek.entities.CREEPSEntityRay;
import com.rickweek.init.MCItems;
import com.rickweek.init.MCSoundEvents;
import com.rickweek.init.gui.handler.CREEPSGuiHandler;
import com.rickweek.main.proxies.CommonProxy;
import com.rickweek.main.utils.CREEPSRecipeHandler;
import com.rickweek.main.utils.CraftingHandlerEvent;
import com.rickweek.mobs.MobRegistry;
import com.rickweek.world.WorldGenStructures;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
public class MCW {

    @Mod.Instance(Reference.MODID)
    public static MCW instance;
    
    @SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)
    public static CommonProxy proxy;

    private int count;
    
    public int spittime = 500;
    
    public int currentJailX;
    public int currentJailY;
    public int currentJailZ;
    public boolean jailBuilt;
    
    public int currentfine;
    
    public int creepsTimer;
    
    public static int prisonercount = 0;
    public static int colacount = 0;
    public static int rocketcount = 0;
    public static int floobcount = 0;
    public static int goatcount = 0;
    public static int preachercount = 0;
    public static int cavemancount = 0;
    public static boolean cavemanbuilding = false;
    
    public static Item partBubble, partWhite, partRed, partBlack, partYellow, partBlue, partShrink, partBarf;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        // preInit register
        MCItems.init();
        MCItems.register();
        MCSoundEvents.registerSounds();
        GameRegistry.registerWorldGenerator(new WorldGenStructures(), 0);
        
        // Particles register
        partBarf = new Item().setUnlocalizedName("partBarf");
        GameRegistry.registerItem(partBarf, "partBarf");
        
        MinecraftForge.EVENT_BUS.register(new CraftingHandlerEvent());
        
        // Proxy register
        proxy.render();
        proxy.registerRenders();
        
    }
    
    @EventHandler
    public void Init(FMLInitializationEvent event) {
        MobRegistry.register();
        // proxy.render();
        
        MinecraftForge.EVENT_BUS.register(new CraftingHandlerEvent());
        NetworkRegistry.INSTANCE.registerGuiHandler(MCW.instance, new CREEPSGuiHandler());
        
        // Register Recipes
        CREEPSRecipeHandler.Init(event);
        
        // Register Projectiles 
        EntityRegistry.registerModEntity(CREEPSEntityMoney.class, "MoneyEnt", 500, this, 40, 1, true);
        EntityRegistry.registerModEntity(CREEPSEntityRay.class, "RayEnt", 501, this, 40, 1, true);
        EntityRegistry.registerModEntity(CREEPSEntityBullet.class, "BulletEnt", 502, this, 40, 1, true);
        
        // Render Projectiles
        RenderingRegistry.registerEntityRenderingHandler(CREEPSEntityMoney.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), MCItems.Money, Minecraft.getMinecraft().getRenderItem()));
        RenderingRegistry.registerEntityRenderingHandler(CREEPSEntityRay.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), MCItems.RayRay, Minecraft.getMinecraft().getRenderItem()));
        RenderingRegistry.registerEntityRenderingHandler(CREEPSEntityBullet.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), MCItems.Bullet, Minecraft.getMinecraft().getRenderItem()));
        
        // Proxy render
        proxy.renderModelItem();
        proxy.registerRenders();
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
        
    }
    
}
 

 

Edited by RickWeek
Posted

Post the FML log (logs/fml-client-latest.log in the game directory) using Gist or Pastebin. This will tell us why and where it's crashing.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
32 minutes ago, Animefan8888 said:

What is line 72?

This is the line 72:

saleprice = sneakysal.saleprice;

And the original declaration is (i have already tried to inizialied it to 1) :

public float saleprice;

Posted
Just now, RickWeek said:

This is the line 72:

saleprice = sneakysal.saleprice;

And the original declaration is (i have already tried to inizialied it to 1) :

public float saleprice;

The null variable is "sneakysal". Gui#initGui is called in the Gui classes constructor which gets called before your constructor and therefore it is not initialized. To fix this you can add a != null check and call Gui#initGui in your Guis constructor.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
12 minutes ago, Animefan8888 said:

The null variable is "sneakysal". Gui#initGui is called in the Gui classes constructor which gets called before your constructor and therefore it is not initialized. To fix this you can add a != null check and call Gui#initGui in your Guis constructor.

I tried to initialized the saleprice variable in the EntityClass and now the crashlog is this: https://pastebin.com/26ax3xYH

Posted
2 minutes ago, RickWeek said:

I tried to initialized the saleprice variable in the EntityClass and now the crashlog is this: https://pastebin.com/26ax3xYH

What is line 73 of your Gui now?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
27 minutes ago, RickWeek said:

Then do you have permission to use their code?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
Just now, RickWeek said:

Medium, not of the best

Ok, that is fine then you should know what a NullPointerException is. Look at the crash report where the error is printed it will be towards the bottom. It will point you towards the line that is making the error.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi, i'm really having problems trying to set the texture to my custom item. I thought i'm doing everything correctly, but all i see is the missing texture block for my item. I am trying this for over a week now and getting really frustrated. The only time i could make the texture work, was when i used an older Forge version (52.0.1) for Minecraft (1.21.4). Was there a fundamental change for textures and models somewhere between versions that i'm missing? I started with Forge 54.1.0 and had this problem, so in my frustration i tried many things: Upgrading to Forge 54.1.1, created multiple new projects, workspaces, redownloaded everything and setting things up multiple times, as it was suggested in an older thread. Therea are no errors in the console logs, but maybe i'm blind, so i pasted the console logs to pastebin anyway: https://pastebin.com/zAM8RiUN The only time i see an error is when i change the models JSON file to an incorrect JSON which makes sense and that suggests to me it is actually reading the JSON file.   I set the github repository to public, i would be so thankful if anyone could take a look and tell me what i did wrong: https://github.com/xLorkin/teleport_pug_forge   As a note: i'm pretty new to modding, this is my first mod ever. But i'm used to programming. I had some up and downs, but through reading the documentation, using google and experimenting, i could solve all other problems. I only started modding for Minecraft because my son is such a big fan and wanted this mod.
    • Please read the FAQ (link in orange bar at top of page), and post logs as described there.
    • Hello fellow Minecrafters! I recently returned to Minecraft and realized I needed a wiki that displays basic information easily and had great user navigation. That’s why I decided to build: MinecraftSearch — a site by a Minecraft fan, for Minecraft fans. Key Features So Far Straight-to-the-Point Info: No extra fluff; just the essentials on items, mobs, recipes, loot and more. Clean & Intuitive Layout: Easy navigation so you spend less time scrolling and more time playing. Optimized Search: Search for anything—items, mobs, blocks—and get results instantly. What I’m Thinking of Adding More data/information: Catch chances for fishing rod, traveling villager trades, biomes info and a lot more. The website is still under development and need a lot more data added. Community Contributions: Potential for user-uploaded tips for items/mobs/blocks in the future. Feature Requests Welcome: Your ideas could shape how the wiki evolves! You can see my roadmap at the About page https://minecraftsearch.com/about I’d love for you to check out MinecraftSearch and see if it helps you find the info you need faster. Feedback is crucial—I want to develop this further based on what the community needs most, so please let me know what you think. Thanks, and happy crafting!
    • Instructions on how to install newer Java can be found in the FAQ
    • That's just plain wrong... newer versions are much better optimised and start a lot faster than 1.8.9, both Forge and Minecraft itself. Comparing Fabric 1.21 with Forge 1.8 is like comparing apples and oranges... one's brand new and the other's over a decade old.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.