Jump to content

Mob


Guest

Recommended Posts

Hello all again.

 

i am making a new mob.

i need him to have custom items in his inventory that players can buy.

i have followed a tutorial off youtube, and i am not to sure how far away i am.

 

ive got this error in my render class.

 

please help.

 

(((((((((((((((RENDERCLASS)))))))))))))))

 

 

package com.drmdgg.marijuanacraft.mobs;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

 

public class RenderPotHead extends RenderLiving  {

   

    private static final RenderManager RenderPotHead = null;

private static final ModelBase ModelPotHead = null;

 

public RenderPotHead(RenderManager p_i46153_1_, ModelBase p_i46153_2_, float p_i46153_3_) {

super(p_i46153_1_, p_i46153_2_, p_i46153_3_);

// TODO Auto-generated constructor stub

}

 

public RenderPotHead(ModelPotHeadMob modelPotHeadMob, float f) {

super(RenderPotHead, ModelPotHead, f);

// TODO Auto-generated constructor stub

}

 

private static final ResourceLocation CuffedFrankenstein = new ResourceLocation("mcraft:textures/entity/PotHead/phead.png");

   

@Override

    protected ResourceLocation getEntityTexture(Entity var1) {

         

            return null;

    }

 

}

 

 

((((((((((((MODELMOBCLASS)))))))))))))))))))))?????????

 

package com.drmdgg.marijuanacraft.mobs;

 

import java.util.Iterator;

import java.util.Random;

 

import com.google.common.base.Predicate;

 

import net.minecraft.enchantment.Enchantment;

import net.minecraft.enchantment.EnchantmentData;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.IEntityLivingData;

import net.minecraft.entity.IMerchant;

import net.minecraft.entity.INpc;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIAvoidEntity;

import net.minecraft.entity.ai.EntityAIEatGrass;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMoveIndoors;

import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAIOpenDoor;

import net.minecraft.entity.ai.EntityAIPanic;

import net.minecraft.entity.ai.EntityAIRestrictOpenDoor;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAITradePlayer;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.ai.EntityAIWatchClosest;

import net.minecraft.entity.ai.EntityAIWatchClosest2;

import net.minecraft.entity.effect.EntityLightningBolt;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.item.EntityXPOrb;

import net.minecraft.entity.monster.EntityWitch;

import net.minecraft.entity.monster.EntityZombie;

import net.minecraft.entity.monster.IMob;

import net.minecraft.entity.passive.EntityOcelot;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.inventory.InventoryBasic;

import net.minecraft.item.EnumDyeColor;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.nbt.NBTTagList;

import net.minecraft.pathfinding.PathNavigateGround;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.stats.StatList;

import net.minecraft.util.BlockPos;

import net.minecraft.util.ChatComponentText;

import net.minecraft.util.ChatComponentTranslation;

import net.minecraft.util.DamageSource;

import net.minecraft.util.EnumParticleTypes;

import net.minecraft.util.IChatComponent;

import net.minecraft.util.MathHelper;

import net.minecraft.util.Tuple;

import net.minecraft.village.MerchantRecipe;

import net.minecraft.village.MerchantRecipeList;

import net.minecraft.village.Village;

import net.minecraft.world.World;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

 

public class ModelPotHeadMob extends EntityAgeable implements INpc, IMerchant

{

    private int randomTickDivider;

    private boolean isMating;

    private boolean isPlaying;

    Village villageObj;

    /** This villager's current customer. */

    private EntityPlayer buyingPlayer;

    /** Initialises the MerchantRecipeList.java */

    private MerchantRecipeList buyingList;

    private int timeUntilReset;

    /** addDefaultEquipmentAndRecipies is called if this is true */

    private boolean needsInitilization;

    private boolean isWillingToTrade;

    private int wealth;

    /** Last player to trade with this villager, used for aggressivity. */

    private String lastBuyingPlayer;

    private int careerId;

    /** This is the EntityVillager's career level value */

    private int careerLevel;

    private boolean isLookingForHome;

    private boolean field_175564_by;

    private InventoryBasic villagerInventory;

    /** A multi-dimensional array mapping the various professions, careers and career levels that a Villager may offer */

    @Deprecated //Use VillagerRegistry

    private static final ModelPotHeadMob.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new ModelPotHeadMob.ITradeList[][][][] {{{{new ModelPotHeadMob.EmeraldForItems(Items.wheat, new ModelPotHeadMob.PriceInfo(18, 22)), new ModelPotHeadMob.EmeraldForItems(Items.potato, new ModelPotHeadMob.PriceInfo(15, 19)), new ModelPotHeadMob.EmeraldForItems(Items.carrot, new ModelPotHeadMob.PriceInfo(15, 19)), new ModelPotHeadMob.ListItemForEmeralds(Items.bread, new ModelPotHeadMob.PriceInfo(-4, -2))}, {new ModelPotHeadMob.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new ModelPotHeadMob.PriceInfo(8, 13)), new ModelPotHeadMob.ListItemForEmeralds(Items.pumpkin_pie, new ModelPotHeadMob.PriceInfo(-3, -2))}, {new ModelPotHeadMob.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new ModelPotHeadMob.PriceInfo(7, 12)), new ModelPotHeadMob.ListItemForEmeralds(Items.apple, new ModelPotHeadMob.PriceInfo(-5, -7))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.cookie, new ModelPotHeadMob.PriceInfo(-6, -10)), new ModelPotHeadMob.ListItemForEmeralds(Items.cake, new ModelPotHeadMob.PriceInfo(1, 1))}}, {{new ModelPotHeadMob.EmeraldForItems(Items.string, new ModelPotHeadMob.PriceInfo(15, 20)), new ModelPotHeadMob.EmeraldForItems(Items.coal, new ModelPotHeadMob.PriceInfo(16, 24)), new ModelPotHeadMob.ItemAndEmeraldToItem(Items.fish, new ModelPotHeadMob.PriceInfo(6, 6), Items.cooked_fish, new ModelPotHeadMob.PriceInfo(6, 6))}, {new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.fishing_rod, new ModelPotHeadMob.PriceInfo(7, 8))}}, {{new ModelPotHeadMob.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new ModelPotHeadMob.PriceInfo(16, 22)), new ModelPotHeadMob.ListItemForEmeralds(Items.shears, new ModelPotHeadMob.PriceInfo(3, 4))}, {new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new ModelPotHeadMob.PriceInfo(1, 2)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new ModelPotHeadMob.PriceInfo(1, 2))}}, {{new ModelPotHeadMob.EmeraldForItems(Items.string, new ModelPotHeadMob.PriceInfo(15, 20)), new ModelPotHeadMob.ListItemForEmeralds(Items.arrow, new ModelPotHeadMob.PriceInfo(-12, -8))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.bow, new ModelPotHeadMob.PriceInfo(2, 3)), new ModelPotHeadMob.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new ModelPotHeadMob.PriceInfo(10, 10), Items.flint, new ModelPotHeadMob.PriceInfo(6, 10))}}}, {{{new ModelPotHeadMob.EmeraldForItems(Items.paper, new ModelPotHeadMob.PriceInfo(24, 36)), new ModelPotHeadMob.ListEnchantedBookForEmeralds()}, {new ModelPotHeadMob.EmeraldForItems(Items.book, new ModelPotHeadMob.PriceInfo(8, 10)), new ModelPotHeadMob.ListItemForEmeralds(Items.compass, new ModelPotHeadMob.PriceInfo(10, 12)), new ModelPotHeadMob.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new ModelPotHeadMob.PriceInfo(3, 4))}, {new ModelPotHeadMob.EmeraldForItems(Items.written_book, new ModelPotHeadMob.PriceInfo(2, 2)), new ModelPotHeadMob.ListItemForEmeralds(Items.clock, new ModelPotHeadMob.PriceInfo(10, 12)), new ModelPotHeadMob.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new ModelPotHeadMob.PriceInfo(-5, -3))}, {new ModelPotHeadMob.ListEnchantedBookForEmeralds()}, {new ModelPotHeadMob.ListEnchantedBookForEmeralds()}, {new ModelPotHeadMob.ListItemForEmeralds(Items.name_tag, new ModelPotHeadMob.PriceInfo(20, 22))}}}, {{{new ModelPotHeadMob.EmeraldForItems(Items.rotten_flesh, new ModelPotHeadMob.PriceInfo(36, 40)), new ModelPotHeadMob.EmeraldForItems(Items.gold_ingot, new ModelPotHeadMob.PriceInfo(8, 10))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.redstone, new ModelPotHeadMob.PriceInfo(-4, -1)), new ModelPotHeadMob.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ModelPotHeadMob.PriceInfo(-2, -1))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.ender_eye, new ModelPotHeadMob.PriceInfo(7, 11)), new ModelPotHeadMob.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new ModelPotHeadMob.PriceInfo(-3, -1))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.experience_bottle, new ModelPotHeadMob.PriceInfo(3, 11))}}}, {{{new ModelPotHeadMob.EmeraldForItems(Items.coal, new ModelPotHeadMob.PriceInfo(16, 24)), new ModelPotHeadMob.ListItemForEmeralds(Items.iron_helmet, new ModelPotHeadMob.PriceInfo(4, 6))}, {new ModelPotHeadMob.EmeraldForItems(Items.iron_ingot, new ModelPotHeadMob.PriceInfo(7, 9)), new ModelPotHeadMob.ListItemForEmeralds(Items.iron_chestplate, new ModelPotHeadMob.PriceInfo(10, 14))}, {new ModelPotHeadMob.EmeraldForItems(Items.diamond, new ModelPotHeadMob.PriceInfo(3, 4)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new ModelPotHeadMob.PriceInfo(16, 19))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.chainmail_boots, new ModelPotHeadMob.PriceInfo(5, 7)), new ModelPotHeadMob.ListItemForEmeralds(Items.chainmail_leggings, new ModelPotHeadMob.PriceInfo(9, 11)), new ModelPotHeadMob.ListItemForEmeralds(Items.chainmail_helmet, new ModelPotHeadMob.PriceInfo(5, 7)), new ModelPotHeadMob.ListItemForEmeralds(Items.chainmail_chestplate, new ModelPotHeadMob.PriceInfo(11, 15))}}, {{new ModelPotHeadMob.EmeraldForItems(Items.coal, new ModelPotHeadMob.PriceInfo(16, 24)), new ModelPotHeadMob.ListItemForEmeralds(Items.iron_axe, new ModelPotHeadMob.PriceInfo(6, 8))}, {new ModelPotHeadMob.EmeraldForItems(Items.iron_ingot, new ModelPotHeadMob.PriceInfo(7, 9)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.iron_sword, new ModelPotHeadMob.PriceInfo(9, 10))}, {new ModelPotHeadMob.EmeraldForItems(Items.diamond, new ModelPotHeadMob.PriceInfo(3, 4)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.diamond_sword, new ModelPotHeadMob.PriceInfo(12, 15)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.diamond_axe, new ModelPotHeadMob.PriceInfo(9, 12))}}, {{new ModelPotHeadMob.EmeraldForItems(Items.coal, new ModelPotHeadMob.PriceInfo(16, 24)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.iron_shovel, new ModelPotHeadMob.PriceInfo(5, 7))}, {new ModelPotHeadMob.EmeraldForItems(Items.iron_ingot, new ModelPotHeadMob.PriceInfo(7, 9)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new ModelPotHeadMob.PriceInfo(9, 11))}, {new ModelPotHeadMob.EmeraldForItems(Items.diamond, new ModelPotHeadMob.PriceInfo(3, 4)), new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new ModelPotHeadMob.PriceInfo(12, 15))}}}, {{{new ModelPotHeadMob.EmeraldForItems(Items.porkchop, new ModelPotHeadMob.PriceInfo(14, 18)), new ModelPotHeadMob.EmeraldForItems(Items.chicken, new ModelPotHeadMob.PriceInfo(14, 18))}, {new ModelPotHeadMob.EmeraldForItems(Items.coal, new ModelPotHeadMob.PriceInfo(16, 24)), new ModelPotHeadMob.ListItemForEmeralds(Items.cooked_porkchop, new ModelPotHeadMob.PriceInfo(-7, -5)), new ModelPotHeadMob.ListItemForEmeralds(Items.cooked_chicken, new ModelPotHeadMob.PriceInfo(-8, -6))}}, {{new ModelPotHeadMob.EmeraldForItems(Items.leather, new ModelPotHeadMob.PriceInfo(9, 12)), new ModelPotHeadMob.ListItemForEmeralds(Items.leather_leggings, new ModelPotHeadMob.PriceInfo(2, 4))}, {new ModelPotHeadMob.ListEnchantedItemForEmeralds(Items.leather_chestplate, new ModelPotHeadMob.PriceInfo(7, 12))}, {new ModelPotHeadMob.ListItemForEmeralds(Items.saddle, new ModelPotHeadMob.PriceInfo(8, 10))}}}};

    private static final String __OBFID = "CL_00001707";

 

    public ModelPotHeadMob(World worldIn)

    {

        this(worldIn, 0);

    }

 

    public ModelPotHeadMob(World worldIn, int professionId)

    {

        super(worldIn);

        this.villagerInventory = new InventoryBasic("Items", false, 8);

        this.setProfession(professionId);

        this.setSize(0.6F, 1.8F);

        ((PathNavigateGround)this.getNavigator()).func_179688_b(true);

        ((PathNavigateGround)this.getNavigator()).func_179690_a(true);

        this.tasks.addTask(0, new EntityAISwimming(this));

        this.tasks.addTask(1, new EntityAIAvoidEntity(this, new Predicate()

        {

            private static final String __OBFID = "CL_00002195";

            public boolean func_179530_a(Entity p_179530_1_)

            {

                return p_179530_1_ instanceof EntityZombie;

            }

            public boolean apply(Object p_apply_1_)

            {

                return this.func_179530_a((Entity)p_apply_1_);

            }

        }, 8.0F, 0.6D, 0.6D));

        this.tasks.addTask(1, new EntityAITradePlayer(null));

        this.tasks.addTask(2, new EntityAIMoveIndoors(this));

        this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this));

        this.tasks.addTask(4, new EntityAIOpenDoor(this, true));

        this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D));

        this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));

        this.tasks.addTask(9, new EntityAIWander(this, 0.6D));

        this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));

        this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntityOcelot.class, true));

        this.targetTasks.addTask(6, new EntityAIHurtByTarget(this, false));

        this.tasks.addTask(6, new EntityAIWander(this, 0.8D));

        this.tasks.addTask(8, new EntityAILookIdle(this));

        this.tasks.addTask(8, new EntityAISwimming(this));

        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityOcelot.class, 1.0D, false));

        this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityVillager.class, 6.0F));

        this.tasks.addTask(1, new EntityAIEatGrass(this));

        this.tasks.addTask(3, new EntityAIPanic(this, 1.2D));

        this.setCanPickUpLoot(true);

    }

 

    protected void applyEntityAttributes()

    {

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);

    }

 

    protected void updateAITasks()

    {

        if (--this.randomTickDivider <= 0)

        {

            BlockPos blockpos = new BlockPos(this);

            this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos);

            this.randomTickDivider = 70 + this.rand.nextInt(50);

            this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32);

 

            if (this.villageObj == null)

            {

                this.detachHome();

            }

            else

            {

                BlockPos blockpos1 = this.villageObj.getCenter();

                this.func_175449_a(blockpos1, (int)((float)this.villageObj.getVillageRadius() * 1.0F));

 

                if (this.isLookingForHome)

                {

                    this.isLookingForHome = false;

                    this.villageObj.setDefaultPlayerReputation(5);

                }

            }

        }

 

        if (!this.isTrading() && this.timeUntilReset > 0)

        {

            --this.timeUntilReset;

 

            if (this.timeUntilReset <= 0)

            {

                if (this.needsInitilization)

                {

                    Iterator iterator = this.buyingList.iterator();

 

                    while (iterator.hasNext())

                    {

                        MerchantRecipe merchantrecipe = (MerchantRecipe)iterator.next();

 

                        if (merchantrecipe.isRecipeDisabled())

                        {

                            merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);

                        }

                    }

 

                    this.populateBuyingList();

                    this.needsInitilization = false;

 

                    if (this.villageObj != null && this.lastBuyingPlayer != null)

                    {

                        this.worldObj.setEntityState(this, (byte)14);

                        this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1);

                    }

                }

 

                this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0));

            }

        }

 

        super.updateAITasks();

    }

 

    /**

    * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.

    */

    public boolean interact(EntityPlayer player)

    {

        ItemStack itemstack = player.inventory.getCurrentItem();

        boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;

 

        if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking())

        {

            if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0))

            {

                this.setCustomer(player);

                player.displayVillagerTradeGui(this);

            }

 

            player.triggerAchievement(StatList.timesTalkedToVillagerStat);

            return true;

        }

        else

        {

            return super.interact(player);

        }

    }

 

    protected void entityInit()

    {

        super.entityInit();

        this.dataWatcher.addObject(16, Integer.valueOf(0));

    }

 

    /**

    * (abstract) Protected helper method to write subclass entity data to NBT.

    */

    public void writeEntityToNBT(NBTTagCompound tagCompound)

    {

        super.writeEntityToNBT(tagCompound);

        tagCompound.setInteger("Profession", this.getProfession());

        tagCompound.setInteger("Riches", this.wealth);

        tagCompound.setInteger("Career", this.careerId);

        tagCompound.setInteger("CareerLevel", this.careerLevel);

        tagCompound.setBoolean("Willing", this.isWillingToTrade);

 

        if (this.buyingList != null)

        {

            tagCompound.setTag("Offers", this.buyingList.getRecipiesAsTags());

        }

 

        NBTTagList nbttaglist = new NBTTagList();

 

        for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)

        {

            ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

 

            if (itemstack != null)

            {

                nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound()));

            }

        }

 

        tagCompound.setTag("Inventory", nbttaglist);

    }

 

    /**

    * (abstract) Protected helper method to read subclass entity data from NBT.

    */

    public void readEntityFromNBT(NBTTagCompound tagCompund)

    {

        super.readEntityFromNBT(tagCompund);

        this.setProfession(tagCompund.getInteger("Profession"));

        this.wealth = tagCompund.getInteger("Riches");

        this.careerId = tagCompund.getInteger("Career");

        this.careerLevel = tagCompund.getInteger("CareerLevel");

        this.isWillingToTrade = tagCompund.getBoolean("Willing");

 

        if (tagCompund.hasKey("Offers", 10))

        {

            NBTTagCompound nbttagcompound1 = tagCompund.getCompoundTag("Offers");

            this.buyingList = new MerchantRecipeList(nbttagcompound1);

        }

 

        NBTTagList nbttaglist = tagCompund.getTagList("Inventory", 10);

 

        for (int i = 0; i < nbttaglist.tagCount(); ++i)

        {

            ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));

 

            if (itemstack != null)

            {

                this.villagerInventory.func_174894_a(itemstack);

            }

        }

 

        this.setCanPickUpLoot(true);

       

    }

 

    /**

    * Determines if an entity can be despawned, used on idle far away entities

    */

    protected boolean canDespawn()

    {

        return false;

    }

 

    /**

    * Returns the sound this mob makes while it's alive.

    */

    protected String getLivingSound()

    {

        return this.isTrading() ? "mob.villager.haggle" : "mob.villager.idle";

    }

 

    /**

    * Returns the sound this mob makes when it is hurt.

    */

    protected String getHurtSound()

    {

        return "mob.villager.hit";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.villager.death";

    }

 

    public void setProfession(int professionId)

    {

        this.dataWatcher.updateObject(16, Integer.valueOf(professionId));

    }

 

    public int getProfession()

    {

        return Math.max(this.dataWatcher.getWatchableObjectInt(16) % 5, 0);

    }

 

    public boolean isMating()

    {

        return this.isMating;

    }

 

    public void setMating(boolean mating)

    {

        this.isMating = mating;

    }

 

    public void setPlaying(boolean playing)

    {

        this.isPlaying = playing;

    }

 

    public boolean isPlaying()

    {

        return this.isPlaying;

    }

 

    public void setRevengeTarget(EntityLivingBase livingBase)

    {

        super.setRevengeTarget(livingBase);

 

        if (this.villageObj != null && livingBase != null)

        {

            this.villageObj.addOrRenewAgressor(livingBase);

 

            if (livingBase instanceof EntityPlayer)

            {

                byte b0 = -1;

 

                if (this.isChild())

                {

                    b0 = -3;

                }

 

                this.villageObj.setReputationForPlayer(livingBase.getName(), b0);

 

                if (this.isEntityAlive())

                {

                    this.worldObj.setEntityState(this, (byte)13);

                }

            }

        }

    }

 

    /**

    * Called when the mob's health reaches 0.

    */

    public void onDeath(DamageSource cause)

    {

        if (this.villageObj != null)

        {

            Entity entity = cause.getEntity();

 

            if (entity != null)

            {

                if (entity instanceof EntityPlayer)

                {

                    this.villageObj.setReputationForPlayer(entity.getName(), -2);

                }

                else if (entity instanceof IMob)

                {

                    this.villageObj.endMatingSeason();

                }

            }

            else

            {

                EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 16.0D);

 

                if (entityplayer != null)

                {

                    this.villageObj.endMatingSeason();

                }

            }

        }

 

        super.onDeath(cause);

    }

 

    public void setCustomer(EntityPlayer p_70932_1_)

    {

        this.buyingPlayer = p_70932_1_;

    }

 

    public EntityPlayer getCustomer()

    {

        return this.buyingPlayer;

    }

 

    public boolean isTrading()

    {

        return this.buyingPlayer != null;

    }

 

    public boolean func_175550_n(boolean p_175550_1_)

    {

        if (!this.isWillingToTrade && p_175550_1_ && this.func_175553_cp())

        {

            boolean flag1 = false;

 

            for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)

            {

                ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

 

                if (itemstack != null)

                {

                    if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3)

                    {

                        flag1 = true;

                        this.villagerInventory.decrStackSize(i, 3);

                    }

                    else if ((itemstack.getItem() == Items.potato || itemstack.getItem() == Items.carrot) && itemstack.stackSize >= 12)

                    {

                        flag1 = true;

                        this.villagerInventory.decrStackSize(i, 12);

                    }

                }

 

                if (flag1)

                {

                    this.worldObj.setEntityState(this, (byte)18);

                    this.isWillingToTrade = true;

                    break;

                }

            }

        }

 

        return this.isWillingToTrade;

    }

 

    public void func_175549_o(boolean p_175549_1_)

    {

        this.isWillingToTrade = p_175549_1_;

    }

 

    public void useRecipe(MerchantRecipe p_70933_1_)

    {

        p_70933_1_.incrementToolUses();

        this.livingSoundTime = -this.getTalkInterval();

        this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());

        int i = 3 + this.rand.nextInt(4);

 

        if (p_70933_1_.getToolUses() == 1 || this.rand.nextInt(5) == 0)

        {

            this.timeUntilReset = 40;

            this.needsInitilization = true;

            this.isWillingToTrade = true;

 

            if (this.buyingPlayer != null)

            {

                this.lastBuyingPlayer = this.buyingPlayer.getName();

            }

            else

            {

                this.lastBuyingPlayer = null;

            }

 

            i += 5;

        }

 

        if (p_70933_1_.getItemToBuy().getItem() == Items.emerald)

        {

            this.wealth += p_70933_1_.getItemToBuy().stackSize;

        }

 

        if (p_70933_1_.getRewardsExp())

        {

            this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i));

        }

    }

 

    /**

    * Notifies the merchant of a possible merchantrecipe being fulfilled or not. Usually, this is just a sound byte

    * being played depending if the suggested itemstack is not null.

    */

    public void verifySellingItem(ItemStack p_110297_1_)

    {

        if (!this.worldObj.isRemote && this.livingSoundTime > -this.getTalkInterval() + 20)

        {

            this.livingSoundTime = -this.getTalkInterval();

 

            if (p_110297_1_ != null)

            {

                this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch());

            }

            else

            {

                this.playSound("mob.villager.no", this.getSoundVolume(), this.getSoundPitch());

            }

        }

    }

 

    public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_)

    {

        if (this.buyingList == null)

        {

            this.populateBuyingList();

        }

 

        return this.buyingList;

    }

 

    private void populateBuyingList()

    {

        //TODO: Hook into VillagerRegistry

        ModelPotHeadMob.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()];

 

        if (this.careerId != 0 && this.careerLevel != 0)

        {

            ++this.careerLevel;

        }

        else

        {

            this.careerId = this.rand.nextInt(aitradelist.length) + 1;

            this.careerLevel = 1;

        }

 

        if (this.buyingList == null)

        {

            this.buyingList = new MerchantRecipeList();

        }

 

        int i = this.careerId - 1;

        int j = this.careerLevel - 1;

        ModelPotHeadMob.ITradeList[][] aitradelist1 = aitradelist;

 

        if (j < aitradelist1.length)

        {

            ModelPotHeadMob.ITradeList[] aitradelist2 = aitradelist1[j];

            ModelPotHeadMob.ITradeList[] aitradelist3 = aitradelist2;

            int k = aitradelist2.length;

 

            for (int l = 0; l < k; ++l)

            {

                ModelPotHeadMob.ITradeList itradelist = aitradelist3[l];

                itradelist.modifyMerchantRecipeList(this.buyingList, this.rand);

            }

        }

    }

 

    @SideOnly(Side.CLIENT)

    public void setRecipes(MerchantRecipeList p_70930_1_) {}

 

    public IChatComponent getDisplayName()

    {

        String s = this.getCustomNameTag();

 

        if (s != null && s.length() > 0)

        {

            return new ChatComponentText(s);

        }

        else

        {

            if (this.buyingList == null)

            {

                this.populateBuyingList();

            }

 

            String s1 = null;

 

            switch (this.getProfession())

            {

                case 0:

                    if (this.careerId == 1)

                    {

                        s1 = "farmer";

                    }

                    else if (this.careerId == 2)

                    {

                        s1 = "fisherman";

                    }

                    else if (this.careerId == 3)

                    {

                        s1 = "shepherd";

                    }

                    else if (this.careerId == 4)

                    {

                        s1 = "fletcher";

                    }

 

                    break;

                case 1:

                    s1 = "librarian";

                    break;

                case 2:

                    s1 = "cleric";

                    break;

                case 3:

                    if (this.careerId == 1)

                    {

                        s1 = "armor";

                    }

                    else if (this.careerId == 2)

                    {

                        s1 = "weapon";

                    }

                    else if (this.careerId == 3)

                    {

                        s1 = "tool";

                    }

 

                    break;

                case 4:

                    if (this.careerId == 1)

                    {

                        s1 = "butcher";

                    }

                    else if (this.careerId == 2)

                    {

                        s1 = "leather";

                    }

            }

 

            //TODO: Hook into VillagerRegistry to get name

            if (s1 != null)

            {

                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]);

                chatcomponenttranslation.getChatStyle().setChatHoverEvent(this.func_174823_aP());

                chatcomponenttranslation.getChatStyle().setInsertion(this.getUniqueID().toString());

                return chatcomponenttranslation;

            }

            else

            {

                return super.getDisplayName();

            }

        }

    }

 

    public float getEyeHeight()

    {

        float f = 1.62F;

 

        if (this.isChild())

        {

            f = (float)((double)f - 0.81D);

        }

 

        return f;

    }

 

    @SideOnly(Side.CLIENT)

    public void handleHealthUpdate(byte p_70103_1_)

    {

        if (p_70103_1_ == 12)

        {

            this.func_180489_a(EnumParticleTypes.HEART);

        }

        else if (p_70103_1_ == 13)

        {

            this.func_180489_a(EnumParticleTypes.VILLAGER_ANGRY);

        }

        else if (p_70103_1_ == 14)

        {

            this.func_180489_a(EnumParticleTypes.VILLAGER_HAPPY);

        }

        else

        {

            super.handleHealthUpdate(p_70103_1_);

        }

    }

 

    @SideOnly(Side.CLIENT)

    private void func_180489_a(EnumParticleTypes p_180489_1_)

    {

        for (int i = 0; i < 5; ++i)

        {

            double d0 = this.rand.nextGaussian() * 0.02D;

            double d1 = this.rand.nextGaussian() * 0.02D;

            double d2 = this.rand.nextGaussian() * 0.02D;

            this.worldObj.spawnParticle(p_180489_1_, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]);

        }

    }

 

    public void setLookingForHome()

    {

        this.isLookingForHome = true;

    }

 

    public ModelPotHeadMob func_180488_b(EntityAgeable p_180488_1_)

    {

        ModelPotHeadMob entityvillager = new ModelPotHeadMob(this.worldObj);

        entityvillager.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);

        return entityvillager;

    }

 

    public boolean allowLeashing()

    {

        return false;

    }

 

    /**

    * Called when a lightning bolt hits the entity.

    */

    public void onStruckByLightning(EntityLightningBolt lightningBolt)

    {

        if (!this.worldObj.isRemote)

        {

            EntityWitch entitywitch = new EntityWitch(this.worldObj);

            entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

            entitywitch.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);

            this.worldObj.spawnEntityInWorld(entitywitch);

            this.setDead();

        }

    }

 

    public InventoryBasic func_175551_co()

    {

        return this.villagerInventory;

    }

 

    protected void func_175445_a(EntityItem p_175445_1_)

    {

        ItemStack itemstack = p_175445_1_.getEntityItem();

        Item item = itemstack.getItem();

 

        if (this.func_175558_a(item))

        {

            ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack);

 

            if (itemstack1 == null)

            {

                p_175445_1_.setDead();

            }

            else

            {

                itemstack.stackSize = itemstack1.stackSize;

            }

        }

    }

 

    private boolean func_175558_a(Item p_175558_1_)

    {

        return p_175558_1_ == Items.bread || p_175558_1_ == Items.potato || p_175558_1_ == Items.carrot || p_175558_1_ == Items.wheat || p_175558_1_ == Items.wheat_seeds;

    }

 

    public boolean func_175553_cp()

    {

        return this.func_175559_s(1);

    }

 

    public boolean func_175555_cq()

    {

        return this.func_175559_s(2);

    }

 

    public boolean func_175557_cr()

    {

        boolean flag = this.getProfession() == 0;

        return flag ? !this.func_175559_s(5) : !this.func_175559_s(1);

    }

 

    private boolean func_175559_s(int p_175559_1_)

    {

        boolean flag = this.getProfession() == 0;

 

        for (int j = 0; j < this.villagerInventory.getSizeInventory(); ++j)

        {

            ItemStack itemstack = this.villagerInventory.getStackInSlot(j);

 

            if (itemstack != null)

            {

                if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3 * p_175559_1_ || itemstack.getItem() == Items.potato && itemstack.stackSize >= 12 * p_175559_1_ || itemstack.getItem() == Items.carrot && itemstack.stackSize >= 12 * p_175559_1_)

                {

                    return true;

                }

 

                if (flag && itemstack.getItem() == Items.wheat && itemstack.stackSize >= 9 * p_175559_1_)

                {

                    return true;

                }

            }

        }

 

        return false;

    }

 

    public boolean func_175556_cs()

    {

        for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)

        {

            ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

 

            if (itemstack != null && (itemstack.getItem() == Items.wheat_seeds || itemstack.getItem() == Items.potato || itemstack.getItem() == Items.carrot))

            {

                return true;

            }

        }

 

        return false;

    }

 

    public boolean replaceItemInInventory(int p_174820_1_, ItemStack p_174820_2_)

    {

        if (super.replaceItemInInventory(p_174820_1_, p_174820_2_))

        {

            return true;

        }

        else

        {

            int j = p_174820_1_ - 300;

 

            if (j >= 0 && j < this.villagerInventory.getSizeInventory())

            {

                this.villagerInventory.setInventorySlotContents(j, p_174820_2_);

                return true;

            }

            else

            {

                return false;

            }

        }

    }

 

    public EntityAgeable createChild(EntityAgeable ageable)

    {

        return this.func_180488_b(ageable);

    }

 

    public static class EmeraldForItems implements ModelPotHeadMob.ITradeList

        {

            public Item field_179405_a;

            public ModelPotHeadMob.PriceInfo field_179404_b;

            private static final String __OBFID = "CL_00002194";

 

            public EmeraldForItems(Item p_i45815_1_, ModelPotHeadMob.PriceInfo p_i45815_2_)

            {

                this.field_179405_a = p_i45815_1_;

                this.field_179404_b = p_i45815_2_;

            }

 

            /**

            * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

            */

            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)

            {

                int i = 1;

 

                if (this.field_179404_b != null)

                {

                    i = this.field_179404_b.func_179412_a(random);

                }

 

                recipeList.add(new MerchantRecipe(new ItemStack(this.field_179405_a, i, 0), Items.emerald));

            }

        }

 

    public interface ITradeList

    {

        /**

        * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

        */

        void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random);

    }

 

    public static class ItemAndEmeraldToItem implements ModelPotHeadMob.ITradeList

        {

            public ItemStack field_179411_a;

            public ModelPotHeadMob.PriceInfo field_179409_b;

            public ItemStack field_179410_c;

            public ModelPotHeadMob.PriceInfo field_179408_d;

            private static final String __OBFID = "CL_00002191";

 

            public ItemAndEmeraldToItem(Item p_i45813_1_, ModelPotHeadMob.PriceInfo p_i45813_2_, Item p_i45813_3_, ModelPotHeadMob.PriceInfo p_i45813_4_)

            {

                this.field_179411_a = new ItemStack(p_i45813_1_);

                this.field_179409_b = p_i45813_2_;

                this.field_179410_c = new ItemStack(p_i45813_3_);

                this.field_179408_d = p_i45813_4_;

            }

 

            /**

            * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

            */

            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)

            {

                int i = 1;

 

                if (this.field_179409_b != null)

                {

                    i = this.field_179409_b.func_179412_a(random);

                }

 

                int j = 1;

 

                if (this.field_179408_d != null)

                {

                    j = this.field_179408_d.func_179412_a(random);

                }

 

                recipeList.add(new MerchantRecipe(new ItemStack(this.field_179411_a.getItem(), i, this.field_179411_a.getMetadata()), new ItemStack(Items.emerald), new ItemStack(this.field_179410_c.getItem(), j, this.field_179410_c.getMetadata())));

            }

        }

 

    public static class ListEnchantedBookForEmeralds implements ModelPotHeadMob.ITradeList

        {

            private static final String __OBFID = "CL_00002193";

 

            /**

            * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

            */

            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)

            {

                Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)];

                int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel());

                ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i));

                int j = 2 + random.nextInt(5 + i * 10) + 3 * i;

 

                if (j > 64)

                {

                    j = 64;

                }

 

                recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(Items.emerald, j), itemstack));

            }

        }

 

    public static class ListEnchantedItemForEmeralds implements ModelPotHeadMob.ITradeList

        {

            public ItemStack field_179407_a;

            public ModelPotHeadMob.PriceInfo field_179406_b;

            private static final String __OBFID = "CL_00002192";

 

            public ListEnchantedItemForEmeralds(Item p_i45814_1_, ModelPotHeadMob.PriceInfo p_i45814_2_)

            {

                this.field_179407_a = new ItemStack(p_i45814_1_);

                this.field_179406_b = p_i45814_2_;

            }

 

            /**

            * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

            */

            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)

            {

                int i = 1;

 

                if (this.field_179406_b != null)

                {

                    i = this.field_179406_b.func_179412_a(random);

                }

 

                ItemStack itemstack = new ItemStack(Items.emerald, i, 0);

                ItemStack itemstack1 = new ItemStack(this.field_179407_a.getItem(), 1, this.field_179407_a.getMetadata());

                itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15));

                recipeList.add(new MerchantRecipe(itemstack, itemstack1));

            }

        }

 

    public static class ListItemForEmeralds implements ModelPotHeadMob.ITradeList

        {

            public ItemStack field_179403_a;

            public ModelPotHeadMob.PriceInfo field_179402_b;

            private static final String __OBFID = "CL_00002190";

 

            public ListItemForEmeralds(Item p_i45811_1_, ModelPotHeadMob.PriceInfo p_i45811_2_)

            {

                this.field_179403_a = new ItemStack(p_i45811_1_);

                this.field_179402_b = p_i45811_2_;

            }

 

            public ListItemForEmeralds(ItemStack p_i45812_1_, ModelPotHeadMob.PriceInfo p_i45812_2_)

            {

                this.field_179403_a = p_i45812_1_;

                this.field_179402_b = p_i45812_2_;

            }

 

            /**

            * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.

            */

            public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)

            {

                int i = 1;

 

                if (this.field_179402_b != null)

                {

                    i = this.field_179402_b.func_179412_a(random);

                }

 

                ItemStack itemstack;

                ItemStack itemstack1;

 

                if (i < 0)

                {

                    itemstack = new ItemStack(Items.emerald, 1, 0);

                    itemstack1 = new ItemStack(this.field_179403_a.getItem(), -i, this.field_179403_a.getMetadata());

                }

                else

                {

                    itemstack = new ItemStack(Items.emerald, i, 0);

                    itemstack1 = new ItemStack(this.field_179403_a.getItem(), 1, this.field_179403_a.getMetadata());

                }

 

                recipeList.add(new MerchantRecipe(itemstack, itemstack1));

            }

        }

 

    public static class PriceInfo extends Tuple

        {

            private static final String __OBFID = "CL_00002189";

 

            public PriceInfo(int p_i45810_1_, int p_i45810_2_)

            {

                super(Integer.valueOf(p_i45810_1_), Integer.valueOf(p_i45810_2_));

            }

 

            public int func_179412_a(Random p_179412_1_)

            {

                return ((Integer)this.getFirst()).intValue() >= ((Integer)this.getSecond()).intValue() ? ((Integer)this.getFirst()).intValue() : ((Integer)this.getFirst()).intValue() + p_179412_1_.nextInt(((Integer)this.getSecond()).intValue() - ((Integer)this.getFirst()).intValue() + 1);

            }

        }

}

 

 

 

((((((((((((((((((((((((((MODELCLASS))))))))))))))))))))))))))))))))))

 

// Date: 3/12/2016 1:42:08 PM

// Template version 1.1

// Java generated by Techne

// Keep in mind that you still need to fill in some blanks

// - ZeuX

package com.drmdgg.marijuanacraft.mobs;

//fromTECHNE

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelPotHead extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer rightarm;

    ModelRenderer leftarm;

    ModelRenderer rightleg;

    ModelRenderer leftleg;

 

  public ModelPotHead()

  {

    textureWidth = 64;

    textureHeight = 32;

   

      head = new ModelRenderer(this, 0, 0);

      head.addBox(-4F, -8F, -4F, 8, 8, 8);

      head.setRotationPoint(0F, 0F, 0F);

      head.setTextureSize(64, 32);

      head.mirror = true;

      setRotation(head, 0F, 0F, 0F);

      body = new ModelRenderer(this, 16, 16);

      body.addBox(-4F, 0F, -2F, 8, 12, 4);

      body.setRotationPoint(0F, 0F, 0F);

      body.setTextureSize(64, 32);

      body.mirror = true;

      setRotation(body, 0F, 0F, 0F);

      rightarm = new ModelRenderer(this, 40, 16);

      rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);

      rightarm.setRotationPoint(-5F, 2F, 0F);

      rightarm.setTextureSize(64, 32);

      rightarm.mirror = true;

      setRotation(rightarm, 0F, 0F, 0F);

      leftarm = new ModelRenderer(this, 40, 16);

      leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);

      leftarm.setRotationPoint(5F, 2F, 0F);

      leftarm.setTextureSize(64, 32);

      leftarm.mirror = true;

      setRotation(leftarm, 0F, 0F, 0F);

      rightleg = new ModelRenderer(this, 0, 16);

      rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);

      rightleg.setRotationPoint(-2F, 12F, 0F);

      rightleg.setTextureSize(64, 32);

      rightleg.mirror = true;

      setRotation(rightleg, 0F, 0F, 0F);

      leftleg = new ModelRenderer(this, 0, 16);

      leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);

      leftleg.setRotationPoint(2F, 12F, 0F);

      leftleg.setTextureSize(64, 32);

      leftleg.mirror = true;

      setRotation(leftleg, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    head.render(f5);

    body.render(f5);

    rightarm.render(f5);

    leftarm.render(f5);

    rightleg.render(f5);

    leftleg.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

}

 

 

 

(((((((((ENTITYCLASS))))))))

 

package com.drmdgg.marijuanacraft.mobs;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class PotHead extends ModelBase

{

  //fields

    ModelRenderer boltleft;

    ModelRenderer boltright;

    ModelRenderer leftcuffs;

    ModelRenderer cuffChain;

    ModelRenderer rightcuffs;

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer rightarm;

    ModelRenderer leftarm;

    ModelRenderer rightleg;

    ModelRenderer leftleg;

 

  public PotHead()

  {

    textureWidth = 64;

    textureHeight = 64;

 

      boltleft = new ModelRenderer(this, 40, 0);

      boltleft.addBox(0F, 0F, 0F, 2, 2, 1);

      boltleft.setRotationPoint(5F, -4F, -2F);

      boltleft.setTextureSize(64, 32);

      boltleft.mirror = true;

      setRotation(boltleft, 0F, -1.570796F, 0F);

      boltright = new ModelRenderer(this, 40, 0);

      boltright.addBox(0F, 0F, 0F, 2, 2, 1);

      boltright.setRotationPoint(-5F, -4F, 1F);

      boltright.setTextureSize(64, 32);

      boltright.mirror = true;

      setRotation(boltright, 0F, 1.570796F, 0F);

      leftcuffs = new ModelRenderer(this, 24, 0);

      leftcuffs.addBox(-5F, -1F, 0F, 6, 6, 2);

      leftcuffs.setRotationPoint(-4F, 0F, -9F);

      leftcuffs.setTextureSize(64, 32);

      leftcuffs.mirror = true;

      setRotation(leftcuffs, 0F, 0F, 0F);

      cuffChain = new ModelRenderer(this, 40, 3);

      cuffChain.addBox(0F, 0F, 0F, 6, 1, 1);

      cuffChain.setRotationPoint(-3F, 1F, -9F);

      cuffChain.setTextureSize(64, 32);

      cuffChain.mirror = true;

      setRotation(cuffChain, 0F, 0F, 0F);

      rightcuffs = new ModelRenderer(this, 24, 0);

      rightcuffs.addBox(0F, 0F, 0F, 6, 6, 2);

      rightcuffs.setRotationPoint(3F, -1F, -9F);

      rightcuffs.setTextureSize(64, 32);

      rightcuffs.mirror = true;

      setRotation(rightcuffs, 0F, 0F, 0F);

      head = new ModelRenderer(this, 0, 0);

      head.addBox(-4F, -8F, -4F, 8, 8, 8);

      head.setRotationPoint(0F, 0F, 0F);

      head.setTextureSize(64, 32);

      head.mirror = true;

      setRotation(head, 0F, 0F, 0F);

      body = new ModelRenderer(this, 16, 16);

      body.addBox(-4F, 0F, -2F, 8, 12, 4);

      body.setRotationPoint(0F, 0F, 0F);

      body.setTextureSize(64, 32);

      body.mirror = true;

      setRotation(body, 0F, 0F, 0F);

      rightarm = new ModelRenderer(this, 40, 16);

      rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);

      rightarm.setRotationPoint(-5F, 2F, 0F);

      rightarm.setTextureSize(64, 32);

      rightarm.mirror = true;

      setRotation(rightarm, -1.570796F, 0F, 0F);

      leftarm = new ModelRenderer(this, 40, 16);

      leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);

      leftarm.setRotationPoint(5F, 2F, 0F);

      leftarm.setTextureSize(64, 32);

      leftarm.mirror = true;

      setRotation(leftarm, -1.570796F, 0F, 0F);

      rightleg = new ModelRenderer(this, 0, 16);

      rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);

      rightleg.setRotationPoint(-2F, 12F, 0F);

      rightleg.setTextureSize(64, 32);

      rightleg.mirror = true;

      setRotation(rightleg, 0F, 0F, 0F);

      leftleg = new ModelRenderer(this, 0, 16);

      leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);

      leftleg.setRotationPoint(2F, 12F, 0F);

      leftleg.setTextureSize(64, 32);

      leftleg.mirror = true;

      setRotation(leftleg, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    boltleft.render(f5);

    boltright.render(f5);

    leftcuffs.render(f5);

    cuffChain.render(f5);

    rightcuffs.render(f5);

    head.render(f5);

    body.render(f5);

    rightarm.render(f5);

    leftarm.render(f5);

    rightleg.render(f5);

    leftleg.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

 

}

 

 

 

 

 

(((((((((((((((((((((((((((CLIENT))))))))))))))))))))))))))

 

package com.drmdgg.marijuanacraft.proxy;

 

import com.drmdgg.marijuanacraft.Mblocks.TrashBlock;

import com.drmdgg.marijuanacraft.Mitems.Food.mFood;

import com.drmdgg.marijuanacraft.Mitems.GrowTools.Light;

import com.drmdgg.marijuanacraft.Mitems.PlantItems.MarijuanaBud;

import com.drmdgg.marijuanacraft.Mitems.tools.Tools;

import com.drmdgg.marijuanacraft.mobs.ModelPotHeadMob;

import com.drmdgg.marijuanacraft.mobs.RenderPotHead;

 

import net.minecraft.entity.Entity;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

public class ClientProxy extends CommonProxy {

 

private Class<? extends Entity> ModelPotHead;

 

@Override

public void registerRenders() {

MarijuanaBud.registerRenders();

Light.registerRenders();

mFood.registerRenders();

TrashBlock.registerRenders();

Tools.registerRenders();

RenderingRegistry.registerEntityRenderingHandler(ModelPotHead, new RenderPotHead(new ModelPotHeadMob(null), (float) 0.5));

RenderingRegistry.registerEntityRenderingHandler(ModelPotHead, new RenderPotHead(new ModelPotHeadMob(null, 0), (float) 0.5));

}

 

@Override

public void preInit(FMLPreInitializationEvent e) {

super.preInit(e);

 

}

 

 

@Override

public void init(FMLInitializationEvent e) {

super.init(e);

 

 

}

 

@Override

public void postInit(FMLPostInitializationEvent e) {

super.postInit(e);

}

 

 

 

}

 

 

 

 

(((((((((((AND this is wht i have in my main class))))))))))

 

//mobs

registerEntity1(ModelPotHeadMob.class, "phead", 0xeaeae8, 0xc99a13); }

 

 

private void registerEntity(Class<ModelPotHeadMob> entityClass, String entityName,

                        int bkEggColor, int fgEggColor) {

                int id = EntityRegistry.findGlobalUniqueEntityId();

 

        EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);

        EntityList.entityEggs.put(Integer.valueOf(id), new EntityEggInfo(id, bkEggColor, fgEggColor));

        }

          public void addSpawn(Class<ModelPotHeadMob> entityClass, int spawnProb, int min, int max, BiomeGenBase[] biomes) {

          if (spawnProb > 0) {

                  EntityRegistry.addSpawn(entityClass, spawnProb, min, max, EnumCreatureType.CREATURE, biomes);

          }

          }

 

private void registerEntity1(Class<ModelPotHeadMob> class1, String string, int i, int j) {

 

 

 

 

 

THANKS IN ADVANCE

 

Link to comment
Share on other sites

Ok, step by step.

 

Renderer

  • RenderPotHead

    ,

    ModelPotHead

    - What is the purpose of these fields? They are always null. And using them in the constructor below will cause a crash most likely since, well, they are null.

  • // TODO Auto-generated constructor stub

    - Why is this crap still there? I know eclipse generates it for you and it doesn't really cause any harm, but it makes your code look like shit.

  • p_i46153_1_

    - Seriously? Is that what you call a variable? Probably not, you just copied it. So, fix it. You want proper variable names in your code.

  • return null;

    - Why are you just returning

    null

    in

    getEntityTexture

    ? I mean, you are declaring a constant for your

    ResourceLocation

    right above... why are you not using it? Also, variable names again,

    CuffedFrankenstein

    does not follow any kind of Java naming convention.

 

"Model"

You called this thing

ModelPotHeadMob

, but it extends

EntityAgeable

and is a straight copypasta of vanilla's villager class. It is most certainly not a model. I will not help you with your copy-pasted code that you yourself do not even understand.

 

Model

Ah, so another model? Wait, the first one wasn't actually a model, so yeah. Not going to comment on this since it's the crap that Techne spits out (hint: don't use Techne).

 

"Entity"

This is supposed to be an entity? No, it is another model, generated by Techne, yay.

 

ClientProxy

  • private Class<? extends Entity> ModelPotHead

    - What. What are you even trying to do here? You never initialize this field to any value, so it will always be null. Also Java naming conventions again.

  • registerEntityRenderingHandler

    - Why is this here twice? And why do you pass

    null

    as the first argument (remember, it's the field from above, which you never initialize)?

 

Main class

  • findGlobalUniqueEntityId

    ,

    registerGlobalEntityID

    - Do not use then, ever. Use

    registerModEntity

    instead, which also has a version which takes entity egg colors and will create one for you. Do not mess with

    EntityList

    directly!

  • addSpawn

    - Why do you have this pointless wrapper method around

    EntityRegistry.addSpawn

    ?

  • registerEntity1

    - I don't even know what this is. The method isn't even complete, your code just stops after the method header.

 

Overall conclusion: You cannot mod without knowing at least the absolute bare minimum of Java / Programming. And it is blatantly obvious from your "code" that you do not have the slightest clue of what you are doing. You need to go learn Java, outside of modding and then come back to making a mod. A modding tutorial will not help you unless you understand programming.

Link to comment
Share on other sites

before i continue trying to fix this shit. i would like to point out that i am simply following a tutorial.

i will gladly start all over yet again if you can point me to a decent custom villager tutorial that i can add my tasks too.

they're all fucking animals.

Link to comment
Share on other sites

FFS just give him a damn tutorial

No. That will not fix the actual problem.

He will go follow that tutorial (the parts I have watched from MrCrayfish are horrendous btw. but that's besides the point), but in a couple days I guarantee you we will see another thread of this kind (showing absolute lack of programming knowledge) by DrMDGG on this forum.

Link to comment
Share on other sites

FFS just give him a damn tutorial.

 

Telling the man he sucks does nothing to help anyone. The one trying to learn or the forge community. For all you know he could be Gods gift to forge modding and just needs a nudge, He even asked for some tutorials and so far no one has given him any. Just saying "Herp derp lrn to java first"

 

HERE!

 

MrCrayfish is what I used to get started.

 

Good luck dude, welcome to the forge community.

 

These guys are damn smart, but they also put up with a lot of stupid posts all day so they have a bit of an edge, and they WILL NOT pull punches....EVER. Don't hold it against them, and don't let it bother you.

 

Best thing you can do is find a mod that has something you want and find that mods Github repositories and read.

 

Id recomend CoolAlias's Zelda Sword Skills. He does just about everything from monsters to blocks to items....don't use his packets tho, I got an earful from him when I tired to emulate what he had, spent an hour in skype with him trying to fix my mess.

 

thanks for all that, but i have a working mod. adding this Mob is the last step (aside from a few items i haven't thought of yet.

 

it's not my problem if people would rather igve round-about answers that dont really answer anything. but t this point, i have such little help (not willingness to learn) that i am just going to drop it and work on some of the other aspects.

thanks

Link to comment
Share on other sites

do you really think i didnt try that first?

 

seriously?

 

i just figured that id ask the people who knew what they were doing questions i needed answered that i didnt feel the reputable google could give me.

 

Link to comment
Share on other sites

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
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.



×
×
  • Create New...

Important Information

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