Jump to content

Trying to make a mob, what am I missing?


kmccmk9

Recommended Posts

Hello, so I'm trying to make a mob, but I can't find a good updated tutorial on what exactly is needed. So far I have what's below, what am I missing?

 

package kmccmk9.witchCraft;

import net.minecraft.entity.EntityLiving;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraft.src.*;

public class EntityBee extends EntityLiving {

public EntityBee(World par1World) {
	super(par1World);
	this.getNavigator().setAvoidsWater(true);
	this.setSize(0.5F, 0.5F);
}

protected int getDropItemId()
    {
        return this.isBurning() ? Item.porkCooked.itemID : Item.porkRaw.itemID;
    }

public int getMaxHealth() {
	return 15;
}

public String getTexture() {
	return "textures/bee.png";
}

}

Link to comment
Share on other sites

If you are on 1.6, those are useless:

public int getMaxHealth() {
	return 15;
}

public String getTexture() {
	return "textures/bee.png";
}

 

Really? Okay cause the tutorial I was following had some other things like this.texture=""; which is no longer available. What should I be using then?

 

EDIT: this.setEntityHealth(15F); I used this instead of the health one.

Link to comment
Share on other sites

entities are no longer handling their textures, so the entity does not have a texture field or any texture methods :)

 

the EntityRenderer handles the texture.

It's using the new resource pack system.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

entities are no longer handling their textures, so the entity does not have a texture field or any texture methods :)

 

the EntityRenderer handles the texture.

It's using the new resource pack system.

 

Oh okay, so the texture code would go...where? Also, I'm having a hard time debugging my code from within eclipse. All of a sudden for some strange reason, none of my mods are working. They are causing a crash relating to proxy injectors.

 

EDIT: Sorry for the newbieness, I just started making mods. My previous mod was a crafting recipe, but for some reason now is causing the wrapped game to crash.

Link to comment
Share on other sites

Put the texture info in your entity renderer. Like RenderMob or such.

 

Okay I dont' have that, or is the same as this?

package kmccmk9.witchCraft.client;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelBee extends ModelBase
{
  //fields
    ModelRenderer BeeBody;
    ModelRenderer BeeHead;
    ModelRenderer ant1;
    ModelRenderer ant2;
    ModelRenderer wing2;
    ModelRenderer wing1;
  
  public ModelBee()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      BeeBody = new ModelRenderer(this, 0, 0);
      BeeBody.addBox(0F, 0F, 0F, 5, 4, ;
      BeeBody.setRotationPoint(-3F, -3F, -4F);
      BeeBody.setTextureSize(64, 32);
      BeeBody.mirror = true;
      setRotation(BeeBody, 0F, 0F, 0F);
      BeeHead = new ModelRenderer(this, 19, 2);
      BeeHead.addBox(0F, 0F, 0F, 3, 3, 2);
      BeeHead.setRotationPoint(-2F, -4F, -6F);
      BeeHead.setTextureSize(64, 32);
      BeeHead.mirror = true;
      setRotation(BeeHead, 0F, 0F, 0F);
      ant1 = new ModelRenderer(this, 0, 0);
      ant1.addBox(0F, 0F, 0F, 1, 4, 1);
      ant1.setRotationPoint(1F, -7F, -5F);
      ant1.setTextureSize(64, 32);
      ant1.mirror = true;
      setRotation(ant1, 0F, 0F, 0.2722714F);
      ant2 = new ModelRenderer(this, 0, 0);
      ant2.addBox(0F, 0F, 0F, 1, 4, 1);
      ant2.setRotationPoint(-3F, -7F, -5F);
      ant2.setTextureSize(64, 32);
      ant2.mirror = true;
      setRotation(ant2, 0F, 0F, -0.2617994F);
      wing2 = new ModelRenderer(this, 29, 0);
      wing2.addBox(0F, 0F, 0F, 4, 1, 3);
      wing2.setRotationPoint(-7F, -3F, -1F);
      wing2.setTextureSize(64, 32);
      wing2.mirror = true;
      setRotation(wing2, 0F, 0F, 0.1745329F);
      wing1 = new ModelRenderer(this, 29, 0);
      wing1.addBox(0F, 0F, 0F, 4, 1, 3);
      wing1.setRotationPoint(2F, -2F, -1F);
      wing1.setTextureSize(64, 32);
      wing1.mirror = true;
      setRotation(wing1, 0F, 0F, -0.1745329F);
  }
  
  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);
    BeeBody.render(f5);
    BeeHead.render(f5);
    ant1.render(f5);
    ant2.render(f5);
    wing2.render(f5);
    wing1.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);
  }

}

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

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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