Jump to content

Create Entity in MC 1.16.5 (Entity/Model/Renderer)


Pandaw

Recommended Posts

Hi ! I've tried to create an entity, with its 3 classes, XEntity, XEntityModel, and XEntityRenderer.

I've looked into the vanilla classes, and even though there are differences, I don't see anything that would be critical missing or something (to the best of my knowledge obviously).

When I try to summon my entity, a crash occurs with the following crash report :

 

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 25/08/21 19:08
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
	at net.minecraft.util.math.shapes.EntitySelectionContext.<init>(EntitySelectionContext.java:41) ~[forge:?] {re:classloading}
	at net.minecraft.util.math.shapes.ISelectionContext.forEntity(ISelectionContext.java:15) ~[forge:?] {re:classloading}
	at net.minecraft.util.math.shapes.VoxelShapeSpliterator.<init>(VoxelShapeSpliterator.java:39) ~[forge:?] {re:classloading}
	at net.minecraft.world.ICollisionReader.func_241457_a_(ICollisionReader.java:77) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.isEntityInsideOpaqueBlock(Entity.java:1774) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.isEntityInsideOpaqueBlock(LivingEntity.java:3298) ~[forge:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.baseTick(LivingEntity.java:307) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.tick(Entity.java:412) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2260) ~[forge:?] {re:classloading}
	at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:623) ~[forge:?] {re:classloading}
	at net.minecraft.world.World.guardEntityTick(World.java:601) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:407) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:885) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:84) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:664) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at net.minecraft.util.math.shapes.EntitySelectionContext.<init>(EntitySelectionContext.java:41) ~[forge:?] {re:classloading}
	at net.minecraft.util.math.shapes.ISelectionContext.forEntity(ISelectionContext.java:15) ~[forge:?] {re:classloading}
	at net.minecraft.util.math.shapes.VoxelShapeSpliterator.<init>(VoxelShapeSpliterator.java:39) ~[forge:?] {re:classloading}
	at net.minecraft.world.ICollisionReader.func_241457_a_(ICollisionReader.java:77) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.isEntityInsideOpaqueBlock(Entity.java:1774) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.isEntityInsideOpaqueBlock(LivingEntity.java:3298) ~[forge:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.baseTick(LivingEntity.java:307) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.tick(Entity.java:412) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2260) ~[forge:?] {re:classloading}
	at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:623) ~[forge:?] {re:classloading}
-- Entity being ticked --
Details:
	Entity Type: magical_macrocosm:pixie (com.pandaw.magical_macrocosm.entities.PixieEntity)
	Entity ID: 61
	Entity Name: Pixie
	Entity's Exact location: 177.83, 52.00, 317.39
	Entity's Block location: World: (177,52,317), Chunk: (at 1,3,13 in 11,19; contains blocks 176,0,304 to 191,255,319), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Entity's Momentum: 0.00, 0.00, 0.00
	Entity's Passengers: []
	Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
	at net.minecraft.world.World.guardEntityTick(World.java:601) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:407) ~[forge:?] {re:classloading}


-- Affected level --
Details:
	All players: 1 total; [ServerPlayerEntity['Dev'/19, l='ServerLevel[New World]', x=177.83, y=52.00, z=317.39]]
	Chunk stats: ServerChunkCache: 2025
	Level dimension: minecraft:overworld
	Level spawn location: World: (180,51,344), Chunk: (at 4,3,8 in 11,21; contains blocks 176,0,336 to 191,255,351), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 152905 game time, 1304 day time
	Level name: New World
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
	Known server brands: forge
	Level was modded: true
	Level storage version: 0x04ABD - Anvil
Stacktrace:
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:885) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:84) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:664) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281] {}


-- System Details --
Details:
	Minecraft Version: 1.16.5
	Minecraft Version ID: 1.16.5
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_281, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 375448848 bytes (358 MB) / 1834483712 bytes (1749 MB) up to 3625975808 bytes (3458 MB)
	CPUs: 2
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 8.0.9+86+master.3cf110c
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/mixin-0.8.2.jar mixin PLUGINSERVICE 
		/eventbus-4.0.0.jar eventbus PLUGINSERVICE 
		/forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16.5-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16.5-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE 
		/forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16.5-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16.5-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE 
		/forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16.5-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 36.0
	Forge: net.minecraftforge:36.0.42
	FML Language Providers: 
		[email protected]
		minecraft@1
	Mod List: 
		client-extra.jar                                  |Minecraft                     |minecraft                     |1.16.5              |DONE      |a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		forge-1.16.5-36.0.42_mapped_snapshot_20210309-1.16|Forge                         |forge                         |36.0.42             |DONE      |NOSIGNATURE
		main                                              |Magical Macrocosm             |magical_macrocosm             |1.16.5-1.0.0        |DONE      |NOSIGNATURE
	Crash Report UUID: 953b0279-462c-4e4f-bcb4-f34aeca3b9ec
	Player Count: 1 / 8; [ServerPlayerEntity['Dev'/19, l='ServerLevel[New World]', x=177.83, y=52.00, z=317.39]]
	Data Packs: vanilla, mod:forge, mod:magical_macrocosm
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'forge'

 

Here is the relevant code :

package com.pandaw.magical_macrocosm.entities;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.HandSide;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.world.World;

import javax.annotation.Nullable;

public class PixieEntity extends LivingEntity {

    public PixieEntity(EntityType<? extends LivingEntity> type, World worldIn) {
        super(type, worldIn);
    }

    public static AttributeModifierMap.MutableAttribute setAttribute() {
        return MobEntity.func_233666_p_()
                .createMutableAttribute(Attributes.MAX_HEALTH, 4.0f)
                .createMutableAttribute(Attributes.FLYING_SPEED, 10.0f);
    }





    @Override
    protected int getExperiencePoints(PlayerEntity player) {
        return 2;
    }

    @Nullable
    @Override
    protected SoundEvent getDeathSound() {
        return SoundEvents.ENTITY_BEE_DEATH;
    }

    @Override
    public Iterable<ItemStack> getArmorInventoryList() {
        return null;
    }

    @Override
    public ItemStack getItemStackFromSlot(EquipmentSlotType slotIn) {
        return null;
    }

    @Override
    public void setItemStackToSlot(EquipmentSlotType slotIn, ItemStack stack) {

    }

    @Override
    public HandSide getPrimaryHand() {
        return null;
    }

}

 

// Made with Blockbench 3.8.4
// Exported for Minecraft version 1.15 - 1.16
// Paste this class into your mod and generate all required imports
package com.pandaw.magical_macrocosm.entities;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.pandaw.magical_macrocosm.entities.PixieEntity;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class PixieEntityModel<T extends PixieEntity> extends EntityModel<T> {
    private final ModelRenderer Head;
    private final ModelRenderer Body;
    private final ModelRenderer RightArm;
    private final ModelRenderer LeftArm;
    private final ModelRenderer RightLeg;
    private final ModelRenderer LeftLeg;
    private final ModelRenderer LeftWing;
    private final ModelRenderer LeftWing_r1;
    private final ModelRenderer RightWing;
    private final ModelRenderer RightWing_r1;

    public PixieEntityModel() {
        textureWidth = 64;
        textureHeight = 64;

        Head = new ModelRenderer(this);
        Head.setRotationPoint(0.0F, 0.0F, 0.0F);
        Head.setTextureOffset(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, 0.0F, false);
        Head.setTextureOffset(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, 0.5F, false);

        Body = new ModelRenderer(this);
        Body.setRotationPoint(0.0F, 0.0F, 0.0F);
        Body.setTextureOffset(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 0.0F, false);
        Body.setTextureOffset(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 0.25F, false);

        RightArm = new ModelRenderer(this);
        RightArm.setRotationPoint(-5.0F, 2.5F, 0.0F);
        RightArm.setTextureOffset(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, 0.0F, false);

        LeftArm = new ModelRenderer(this);
        LeftArm.setRotationPoint(5.0F, 2.5F, 0.0F);
        LeftArm.setTextureOffset(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, 0.0F, false);

        RightLeg = new ModelRenderer(this);
        RightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
        RightLeg.setTextureOffset(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
        RightLeg.setTextureOffset(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);

        LeftLeg = new ModelRenderer(this);
        LeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
        LeftLeg.setTextureOffset(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
        LeftLeg.setTextureOffset(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);

        LeftWing = new ModelRenderer(this);
        LeftWing.setRotationPoint(0.0F, 24.0F, 0.0F);


        LeftWing_r1 = new ModelRenderer(this);
        LeftWing_r1.setRotationPoint(0.0F, -17.0F, 0.0F);
        LeftWing.addChild(LeftWing_r1);
        setRotationAngle(LeftWing_r1, 0.0F, 0.6545F, 0.0F);
        LeftWing_r1.setTextureOffset(42, 32).addBox(-13.0F, -11.0F, 1.0F, 11.0F, 19.0F, 0.0F, 0.0F, false);

        RightWing = new ModelRenderer(this);
        RightWing.setRotationPoint(0.0F, 24.0F, 0.0F);


        RightWing_r1 = new ModelRenderer(this);
        RightWing_r1.setRotationPoint(0.0F, -17.0F, 0.0F);
        RightWing.addChild(RightWing_r1);
        setRotationAngle(RightWing_r1, 0.0F, 2.4871F, 0.0F);
        RightWing_r1.setTextureOffset(42, 32).addBox(-13.0F, -11.0F, -1.0F, 11.0F, 19.0F, 0.0F, 0.0F, false);
    }

    @Override
    public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {

    }


    /*public void setRotationAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
    }*/

    @Override
    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
        Head.render(matrixStack, buffer, packedLight, packedOverlay);
        Body.render(matrixStack, buffer, packedLight, packedOverlay);
        RightArm.render(matrixStack, buffer, packedLight, packedOverlay);
        LeftArm.render(matrixStack, buffer, packedLight, packedOverlay);
        RightLeg.render(matrixStack, buffer, packedLight, packedOverlay);
        LeftLeg.render(matrixStack, buffer, packedLight, packedOverlay);
        LeftWing.render(matrixStack, buffer, packedLight, packedOverlay);
        RightWing.render(matrixStack, buffer, packedLight, packedOverlay);
    }

    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }

 

package com.pandaw.magical_macrocosm.entities;

import com.pandaw.magical_macrocosm.MagicalMacrocosm;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.LivingRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(modid = MagicalMacrocosm.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class PixieEntityRenderer extends LivingRenderer<PixieEntity, PixieEntityModel<PixieEntity>> {

    public static final ResourceLocation TEXTURE = new ResourceLocation(MagicalMacrocosm.MOD_ID, "textures/entities/pixie1.png");

    public PixieEntityRenderer(EntityRendererManager manager) {
        super(manager, new PixieEntityModel<>(), 0.3f);
    }

    @Override
    public ResourceLocation getEntityTexture(PixieEntity entity) {
        return TEXTURE;
    }
}

 

package com.pandaw.magical_macrocosm.init;

import com.pandaw.magical_macrocosm.MagicalMacrocosm;
import com.pandaw.magical_macrocosm.entities.PixieEntity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class ModEntityTypes {

    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MagicalMacrocosm.MOD_ID);

    public static final RegistryObject<EntityType<PixieEntity>> PIXIE = ENTITY_TYPES.register("pixie",
            ()-> EntityType.Builder.create(PixieEntity::new, EntityClassification.CREATURE)
                    .size(0.4f, 0.5f)
                    .trackingRange(10)
                    .build(new ResourceLocation(MagicalMacrocosm.MOD_ID, "pixie").toString()));

}

Did I forget something, or made something wrong ? I mean, obviously, but could you explain it to me, please ?

Entities may be more than my current level, but it's also by trying that we learn :)

Link to comment
Share on other sites

I've checked several Entity classes and they either don't have those methods (Chicken,  Sheep, Zombie etc), or don't implement them a way that would work here. I've looked the Player Entity and it has those methods but when I try to rewrite them the same way, I get errors.

 

Honestly, I'm just lost. How should I implement them ? When I try to remove them, it says the class needs to be abstract or implement those abstract methods.

I've tried to look on different forums and stuff, and I just can't find what to do.

 

Also, I don't know where to put goals ? When I try the registerGoals() method, it doesnt show what should be put next (I've tried to do it as in the Entity classes I've looked at).

Edited by Pandaw
Link to comment
Share on other sites

7 minutes ago, diesieben07 said:

They are implemented in MobEntity.

You mean like :

public Iterable<ItemStack> getArmorInventoryList() {
      return this.inventoryArmor;
   }

public ItemStack getItemStackFromSlot(EquipmentSlotType slotIn) {
      switch(slotIn.getSlotType()) {
      case HAND:
         return this.inventoryHands.get(slotIn.getIndex());
      case ARMOR:
         return this.inventoryArmor.get(slotIn.getIndex());
      default:
         return ItemStack.EMPTY;
      }
   }

public void setItemStackToSlot(EquipmentSlotType slotIn, ItemStack stack) {
      switch(slotIn.getSlotType()) {
      case HAND:
         this.inventoryHands.set(slotIn.getIndex(), stack);
         break;
      case ARMOR:
         this.inventoryArmor.set(slotIn.getIndex(), stack);
      }

   }

public HandSide getPrimaryHand() {
      return this.isLeftHanded() ? HandSide.LEFT : HandSide.RIGHT;
   }

?

That's what happens when I say

20 minutes ago, Pandaw said:

when I try to rewrite them the same way, I get errors

; It cannot resolve inventoryArmor/Hands and isLeftHanded.

Link to comment
Share on other sites

I noticed the stupid reason why it didn't resolve them 

Here's my new code, tho I don't know if I should personnalize it or leave it like that ?

package com.pandaw.magical_macrocosm.entities;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.*;
import net.minecraft.world.World;

import javax.annotation.Nullable;

public class PixieEntity extends LivingEntity {

    private static final DataParameter<Byte> AI_FLAGS = EntityDataManager.createKey(MobEntity.class, DataSerializers.BYTE);
    
    private final NonNullList<ItemStack> inventoryHands = NonNullList.withSize(2, ItemStack.EMPTY);
    private final NonNullList<ItemStack> inventoryArmor = NonNullList.withSize(4, ItemStack.EMPTY);

    public boolean isLeftHanded() {
        return (this.dataManager.get(AI_FLAGS) & 2) != 0;
    }


    public PixieEntity(EntityType<? extends LivingEntity> type, World worldIn) {
        super(type, worldIn);
    }

    protected void registerGoals() {

    }


    public static AttributeModifierMap.MutableAttribute setAttribute() {
        return MobEntity.func_233666_p_()
                .createMutableAttribute(Attributes.MAX_HEALTH, 4.0f)
                .createMutableAttribute(Attributes.FLYING_SPEED, 10.0f);
    }





    @Override
    protected int getExperiencePoints(PlayerEntity player) {
        return 2;
    }



    protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_BEE_POLLINATE; }

    @Override
    protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
        return SoundEvents.ENTITY_BEE_HURT;
    }

    @Nullable
    @Override
    protected SoundEvent getDeathSound() {
        return SoundEvents.ENTITY_BEE_DEATH;
    }


    /*@Override
    public Iterable<ItemStack> getArmorInventoryList() {
        return null;
    }*/

    public Iterable<ItemStack> getArmorInventoryList() {
        return this.inventoryArmor;
    }

    /*@Override
    public ItemStack getItemStackFromSlot(EquipmentSlotType slotIn) {
        return null;
    }*/

    public ItemStack getItemStackFromSlot(EquipmentSlotType slotIn) {
        switch(slotIn.getSlotType()) {
            case HAND:
                return this.inventoryHands.get(slotIn.getIndex());
            case ARMOR:
                return this.inventoryArmor.get(slotIn.getIndex());
            default:
                return ItemStack.EMPTY;
        }
    }

    /*@Override
    public void setItemStackToSlot(EquipmentSlotType slotIn, ItemStack stack) {

    }*/

    public void setItemStackToSlot(EquipmentSlotType slotIn, ItemStack stack) {
        switch(slotIn.getSlotType()) {
            case HAND:
                this.inventoryHands.set(slotIn.getIndex(), stack);
                break;
            case ARMOR:
                this.inventoryArmor.set(slotIn.getIndex(), stack);
        }

    }

    /*@Override
    public HandSide getPrimaryHand() {
        return null;
    }*/

    public HandSide getPrimaryHand() {
        return this.isLeftHanded() ? HandSide.LEFT : HandSide.RIGHT;
    }

}

 

I still don't know how to put goals tho.

Edited by Pandaw
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



×
×
  • Create New...

Important Information

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