Jump to content

Recommended Posts

Posted

When my custom villager dies it turns into a regular zombie instead of turning into a zombie villager.

 

My custom villager class.

package orangeVillager61.MoDrops.villager;

import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityVillager.EmeraldForItems;
import net.minecraft.entity.passive.EntityVillager.ListItemForEmeralds;
import net.minecraft.entity.passive.EntityVillager.PriceInfo;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerCareer;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
import orangeVillager61.MoDrops.Config;
import orangeVillager61.MoDrops.items.MoDropsItems;


public class BioMaker{

public static final boolean enableSaltTrader = Config.enableCustomVillagers;
public static ItemStack Charcoal = new ItemStack (Items.COAL, 1, 1);
protected static final VillagerRegistry.VillagerProfession PROFESSION = new VillagerRegistry.VillagerProfession("md:BioMaker", "minecraft:textures/entity/villager/villager.png", "md:textures/entity/zombie_bioMaker.png");
    protected static final VillagerRegistry.VillagerCareer CAREER = new VillagerRegistry.VillagerCareer(PROFESSION, "md:BioMaker").addTrade(3, new ListItemForEmeralds(MoDropsItems.adaptive_egg, new PriceInfo(26, 33))).addTrade(1, new EmeraldForItems(Items.GOLD_INGOT, new PriceInfo(8, 9))).addTrade(1, new ListItemForEmeralds(MoDropsItems.biomatter, new PriceInfo(1, 1))).addTrade(2, new ListItemForEmeralds(MoDropsItems.compressed_biomatter, new PriceInfo(8, 10)))
    		.addTrade(2, new ListItemForEmeralds(Charcoal, new PriceInfo(1, 3)));   
    
    public static void onInit(FMLInitializationEvent event){
        VillagerRegistry.instance().register(PROFESSION);
        

    }
}

  • 4 weeks later...
Posted

Well, you should add the code:

 

    public void onDeath(DamageSource par1DamageSource)

{

        if (!this.worldObj.isRemote)

        {

            EntityZombie entityzombie = new EntityZombie(this.worldObj);

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

            this.worldObj.spawnEntityInWorld(entityzombie);

            this.setDead();

        }

    }

Haven't tried it myself, but this should work. If it doesn't look into zombie meta data.

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



×
×
  • Create New...

Important Information

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