_Cruelar_ Posted August 12, 2018 Share Posted August 12, 2018 (edited) This might need some time as I only have an idea which I totally not know how to code. The Entity should have a Mainbody with one eye in the Head shooting lasers which deal 6 damage fully ignoring the Players armor. Additionally the Entity should have 6 legs with their own health which the Player can cut off by damaging them enough. My Idea for this is making the legs separate entities (is this actually possible?), but I'll accept all other working approaches. Also if the Entity is shot into its eye with any Arrow or a leg is cut off he'll get stunned for ~5sec. When the Entity detects the Player he'll start aiming at him with a thin red laser dealing no damage and after ~5 sec will then shoot a powerful blue laser at the Player. I have already a Model for the Mainbody and a model for the legs is almost done. What I mostly need help with is how to make that with the legs being part of the MainEntity and being able to be cut off, the Ai for this Entity and the actual laser beams. I know this much what I request here but working on that alone I woud get completly lost in Code and make tons of mistakes. I'll post new Code as soon as I can and hope that we all can get it working. Until then every help how to make this is appreciated My Code. MainBodyModel: package com.cruelar.cruelars_triforcemod.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * ModelGuardianStalkerBody - Cruelar * Created using Tabula 7.0.0 */ public class ModelGuardianStalkerBody extends ModelBase { public ModelRenderer MainBody; public ModelRenderer UpperBodyOne; public ModelRenderer LowerGear; public ModelRenderer UpperGear; public ModelRenderer UpperBodyTwo; public ModelRenderer Head; public ModelRenderer GuardianEye; public ModelRenderer HeadPieceLeft; public ModelRenderer HeadPieceRight; public ModelRenderer HeadPieceBack; public ModelGuardianStalkerBody() { this.textureWidth = 256; this.textureHeight = 128; this.UpperGear = new ModelRenderer(this, 186, 32); this.UpperGear.setRotationPoint(0.0F, -3.0F, 0.0F); this.UpperGear.addBox(-7.0F, -1.0F, -7.0F, 14, 2, 14, 0.0F); this.HeadPieceRight = new ModelRenderer(this, 22, 0); this.HeadPieceRight.mirror = true; this.HeadPieceRight.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceRight.addBox(-12.0F, -10.0F, -1.0F, 6, 6, 2, 0.0F); this.MainBody = new ModelRenderer(this, 0, 0); this.MainBody.setRotationPoint(0.0F, 16.0F, 0.0F); this.MainBody.addBox(-24.0F, -5.0F, -24.0F, 48, 13, 48, 0.0F); this.HeadPieceBack = new ModelRenderer(this, 144, 0); this.HeadPieceBack.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceBack.addBox(-1.0F, -10.0F, 6.0F, 2, 6, 6, 0.0F); this.Head = new ModelRenderer(this, 176, 48); this.Head.setRotationPoint(0.0F, -12.0F, 0.0F); this.Head.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16, 0.0F); this.UpperBodyTwo = new ModelRenderer(this, 0, 61); this.UpperBodyTwo.setRotationPoint(0.0F, 10.0F, 0.0F); this.UpperBodyTwo.addBox(-17.0F, -4.0F, -17.0F, 34, 6, 34, 0.0F); this.HeadPieceLeft = new ModelRenderer(this, 22, 0); this.HeadPieceLeft.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceLeft.addBox(6.0F, -10.0F, -1.0F, 6, 6, 2, 0.0F); this.GuardianEye = new ModelRenderer(this, 0, 0); this.GuardianEye.setRotationPoint(0.0F, -9.0F, 0.0F); this.GuardianEye.addBox(-2.0F, -2.0F, -9.0F, 4, 4, 1, 0.0F); this.UpperBodyOne = new ModelRenderer(this, 144, 0); this.UpperBodyOne.setRotationPoint(0.0F, 4.0F, 0.0F); this.UpperBodyOne.addBox(-12.0F, -4.0F, -12.0F, 24, 6, 24, 0.0F); this.LowerGear = new ModelRenderer(this, 144, 30); this.LowerGear.setRotationPoint(0.0F, -1.0F, 0.0F); this.LowerGear.addBox(-7.0F, -1.0F, -7.0F, 14, 2, 14, 0.0F); } @Override @SideOnly(Side.CLIENT) public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.UpperGear.render(f5); this.HeadPieceRight.render(f5); this.MainBody.render(f5); this.HeadPieceBack.render(f5); this.Head.render(f5); this.UpperBodyTwo.render(f5); this.HeadPieceLeft.render(f5); this.GuardianEye.render(f5); this.UpperBodyOne.render(f5); this.LowerGear.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } MainEntity: package com.cruelar.cruelars_triforcemod.entities.monster; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializer; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; import java.util.UUID; public class Guardian_Stalker extends EntityMob implements IRangedAttackMob/*,IEntityMultiPart*/{ public static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_stalker.png"); /*private static final DataSerializer<UUID> serializer = new DataSerializer<UUID>() { @Override public void write(@Nonnull PacketBuffer buf,@Nonnull UUID value) { buf.writeUniqueId(value); } @Override @Nonnull public UUID read(@Nonnull PacketBuffer buf) throws IOException { return buf.readUniqueId(); } @Override public DataParameter<UUID> createKey(int id) { return new DataParameter<>(id,this); } @Override @Nonnull public UUID copyValue(@Nonnull UUID value) { return value; } }; private static final DataParameter<UUID> Leg1 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg2 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg3 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg4 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg5 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg6 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer);*/ private LegGuardian leg1; private LegGuardian leg2; private LegGuardian leg3; private LegGuardian leg4; private LegGuardian leg5; private LegGuardian leg6; private LegGuardian[] legs; //private MultiPartEntityPart guardianEye = new MultiPartEntityPart(this,"eye",0.25F,0.25F); //private MultiPartEntityPart[] guardianParts; private float animTime; private float prevAnimTime; public Guardian_Stalker(World worldIn) { super(worldIn); setSize(2.8F,2F ); this.legs=new LegGuardian[]{leg1,leg2,leg3,leg4,leg5,leg6}; //this.guardianParts= new MultiPartEntityPart[]{this.guardianEye}; } @Override protected void entityInit(){ super.entityInit(); /*this.getDataManager().register(Leg1, leg1.getUniqueID()); this.getDataManager().register(Leg2, leg2.getUniqueID()); this.getDataManager().register(Leg3, leg3.getUniqueID()); this.getDataManager().register(Leg4, leg4.getUniqueID()); this.getDataManager().register(Leg5, leg5.getUniqueID()); this.getDataManager().register(Leg6, leg6.getUniqueID()); } public void setLeg1(LegGuardian legGuardian) { this.getDataManager().set(Leg1, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg1() { return this.getDataManager().get(Leg1); } public void setLeg2(LegGuardian legGuardian) { this.getDataManager().set(Leg2, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg2() { return this.getDataManager().get(Leg2); } public void setLeg3(LegGuardian legGuardian) { this.getDataManager().set(Leg3, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg3() { return this.getDataManager().get(Leg3); } public void setLeg4(LegGuardian legGuardian) { this.getDataManager().set(Leg4, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg4() { return this.getDataManager().get(Leg4); } public void setLeg5(LegGuardian legGuardian) { this.getDataManager().set(Leg5, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg5() { return this.getDataManager().get(Leg5); } public void setLeg6(LegGuardian legGuardian) { this.getDataManager().set(Leg6, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg6() { return this.getDataManager().get(Leg6);*/ } @Override protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1500.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(32.0D); this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D); } @Override protected void initEntityAI(){ this.tasks.addTask(5,new EntityAIMoveTowardsRestriction(this,1.0D)); this.tasks.addTask(7,new EntityAIWander(this,1.0D)); this.tasks.addTask(8,new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8,new EntityAILookIdle(this)); this.applyEntityAI(); } public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty,@Nullable IEntityLivingData livingdata){ livingdata = super.onInitialSpawn(difficulty, livingdata); leg1 = new LegGuardian(this.world); leg2 = new LegGuardian(this.world); leg3 = new LegGuardian(this.world); leg4 = new LegGuardian(this.world); leg5 = new LegGuardian(this.world); leg6 = new LegGuardian(this.world); leg1.setParent(this); leg2.setParent(this); leg3.setParent(this); leg4.setParent(this); leg5.setParent(this); leg6.setParent(this); leg1.setPartName("leg1"); leg2.setPartName("leg2"); leg3.setPartName("leg3"); leg4.setPartName("leg4"); leg5.setPartName("leg5"); leg6.setPartName("leg6"); legs= new LegGuardian[]{leg1,leg2,leg3,leg4,leg5,leg6}; for (int i = 0;i<legs.length;i++){ legs[i].setPositionAndRotation(this.posX, this.posY, this.posZ, i*MathHelper.wrapDegrees(60)+this.rotationYaw, 0); } this.world.spawnEntity(leg1); this.world.spawnEntity(leg2); this.world.spawnEntity(leg3); this.world.spawnEntity(leg4); this.world.spawnEntity(leg5); this.world.spawnEntity(leg6); return livingdata; } protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { for (LegGuardian leg : legs) { if (leg != null) { leg.setDead(); } } this.setDead(); for (int k = 0; k < 20; ++k) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, d2, d0, d1); } } } protected void applyEntityAI() { this.targetTasks.addTask(1,new EntityAIAttackRanged(this,0.25D,100,120,5)); } @Override public void attackEntityWithRangedAttack(@Nonnull EntityLivingBase target, float distanceFactor) { } public void onLivingUpdate() { if (this.world.isRemote) { this.setHealth(this.getHealth()); } this.prevAnimTime = this.animTime; if (this.getHealth() <= 0.0F) { float f12 = (this.rand.nextFloat() - 0.5F) * 8.0F; float f13 = (this.rand.nextFloat() - 0.5F) * 4.0F; float f15 = (this.rand.nextFloat() - 0.5F) * 8.0F; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX + (double)f12, this.posY + 2.0D + (double)f13, this.posZ + (double)f15, 0.0D, 0.0D, 0.0D); } else { float f11 = 0.2F / (MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); f11 = f11 * (float)Math.pow(2.0D, this.motionY); this.animTime += f11; this.rotationYaw = MathHelper.wrapDegrees(this.rotationYaw); if (this.isAIDisabled()) { this.animTime = 0.5F; } else { if (this.world.isRemote) { if (this.newPosRotationIncrements > 0) { double d5 = this.posX + (this.interpTargetX - this.posX) / (double)this.newPosRotationIncrements; double d0 = this.posY + (this.interpTargetY - this.posY) / (double)this.newPosRotationIncrements; double d1 = this.posZ + (this.interpTargetZ - this.posZ) / (double)this.newPosRotationIncrements; double d2 = MathHelper.wrapDegrees(this.interpTargetYaw - (double)this.rotationYaw); this.rotationYaw = (float)((double)this.rotationYaw + d2 / (double)this.newPosRotationIncrements); this.rotationPitch = (float)((double)this.rotationPitch + (this.interpTargetPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); --this.newPosRotationIncrements; this.setPosition(d5, d0, d1); this.setRotation(this.rotationYaw, this.rotationPitch); } } this.renderYawOffset = this.rotationYaw; float Yaw = this.rotationYaw; //this.guardianEye.width=0.25F; //this.guardianEye.height=0.25F; /*Vec3d[] avec3d = new Vec3d[this.guardianParts.length]; for (int j = 0; j < this.guardianParts.length; ++j) { avec3d[j] = new Vec3d(this.guardianParts[j].posX, this.guardianParts[j].posY, this.guardianParts[j].posZ); } float f17 = this.rotationYaw * 0.017453292F; float f3 = MathHelper.sin(f17); float f18 = MathHelper.cos(f17); this.guardianEye.onUpdate(); this.guardianEye.setLocationAndAngles(this.posX+0.5, this.posY+2, this.posZ, 0.0F, 0.0F); for (int l = 0; l < this.guardianParts.length; ++l) { this.guardianParts[l].prevPosX = avec3d[l].x; this.guardianParts[l].prevPosY = avec3d[l].y; this.guardianParts[l].prevPosZ = avec3d[l].z; }*/ for (int i=0;i<legs.length;i++) { legs[i].onUpdate(); legs[i].setLocationAndAngles(this.posX + 0.5, this.posY + 2, this.posZ, i*MathHelper.wrapDegrees(60)+Yaw, this.rotationPitch); } } } } public float getEyeHeight() { return 2.2F; } @Override public void setSwingingArms(boolean swingingArms) { } @Nonnull public World getWorld() { return this.world; } public void setNextLeg(LegGuardian leg){ for (int i = 0; i<legs.length;i++){ if (legs[i]==null){ legs[i]=leg; break; } } } /*@Override public boolean attackEntityFromPart(@Nonnull MultiPartEntityPart guardianPart,@Nonnull DamageSource source, float damage) { if (guardianPart==this.guardianEye){ damage=damage*2; } this.attackEntityFrom(source, damage); return true; }*/ public boolean attackEntityFromPart(LegGuardian legGuardian, DamageSource source, float damage) { if (damage < 0.01F) { return false; } else { if (source.getTrueSource() instanceof EntityPlayer || source.isExplosion()||source.getTrueSource() instanceof Guardian_Stalker) { float f = this.getHealth(); this.attackEntityFrom(source, damage); } return true; } } } MainEntityRenderer: package com.cruelar.cruelars_triforcemod.renderer; import com.cruelar.cruelars_triforcemod.entities.monster.Guardian_Stalker; import com.cruelar.cruelars_triforcemod.model.ModelGuardianStalkerBody; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class RenderGuardianStalker extends RenderLiving<Guardian_Stalker> { //Only basic stuff by now private ResourceLocation mobTexture = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_stalker.png"); public static final Factory FACTORY = new Factory(); public RenderGuardianStalker(RenderManager renderManager){ super(renderManager, new ModelGuardianStalkerBody(),2F); } @Nullable @Override protected ResourceLocation getEntityTexture(@Nonnull Guardian_Stalker entity) { return mobTexture; } public static class Factory implements IRenderFactory<Guardian_Stalker> { @Override public Render<? super Guardian_Stalker> createRenderFor(RenderManager manager){ return new RenderGuardianStalker(manager); } } } No Ai yet, only AI I made already since starting Modding were simple Copies of AINearestAttackableTarget LegEntityModel: package com.cruelar.cruelars_triforcemod.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * GuardianLeg - Cruelar * Created using Tabula 7.0.0 */ public class GuardianLeg extends ModelBase { public ModelRenderer shape1; public ModelRenderer shape2; public ModelRenderer shape3; public ModelRenderer shape4; public ModelRenderer shape5; public ModelRenderer shape6; public ModelRenderer shape7; public ModelRenderer shape8; public ModelRenderer shape9; public ModelRenderer shape10; public ModelRenderer Footmain; public ModelRenderer Footright; public ModelRenderer Footleft; public ModelRenderer Footfront; public GuardianLeg() { this.textureWidth = 64; this.textureHeight = 32; this.shape8 = new ModelRenderer(this, 0, 0); this.shape8.mirror = true; this.shape8.setRotationPoint(0.0F, 12.0F, -21.0F); this.shape8.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape8, 0.5235987755982988F, -0.5235987755982988F, 0.7853981633974483F); this.shape3 = new ModelRenderer(this, 0, 0); this.shape3.setRotationPoint(0.0F, 10.0F, -6.0F); this.shape3.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape3, 0.17453292519943295F, 0.0F, 0.0F); this.shape5 = new ModelRenderer(this, 0, 0); this.shape5.setRotationPoint(0.0F, 11.0F, -12.0F); this.shape5.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape5, 0.2617993877991494F, 0.0F, 0.0F); this.Footfront = new ModelRenderer(this, 0, 8); this.Footfront.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footfront.addBox(-2.0F, 0.0F, -7.0F, 4, 1, 5, 0.0F); this.setRotateAngle(Footfront, 0.5235987755982988F, -0.0F, 0.0F); this.shape2 = new ModelRenderer(this, 0, 0); this.shape2.mirror = true; this.shape2.setRotationPoint(0.0F, 10.0F, -3.0F); this.shape2.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape2, 0.08726646259971647F, -0.08726646259971647F, 0.7853981633974483F); this.shape7 = new ModelRenderer(this, 0, 0); this.shape7.setRotationPoint(0.0F, 12.0F, -18.0F); this.shape7.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape7, 0.3490658503988659F, 0.0F, 0.0F); this.shape4 = new ModelRenderer(this, 0, 0); this.shape4.mirror = true; this.shape4.setRotationPoint(0.0F, 10.0F, -9.0F); this.shape4.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape4, 0.17453292519943295F, -0.17453292519943295F, 0.7853981633974483F); this.Footleft = new ModelRenderer(this, 32, 0); this.Footleft.mirror = true; this.Footleft.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footleft.addBox(2.0F, 0.0F, -2.0F, 5, 1, 4, 0.0F); this.setRotateAngle(Footleft, 0.0F, -0.0F, 0.5235987755982988F); this.shape6 = new ModelRenderer(this, 0, 0); this.shape6.mirror = true; this.shape6.setRotationPoint(0.0F, 11.0F, -15.0F); this.shape6.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape6, 0.2617993877991494F, -0.2617993877991494F, 0.7853981633974483F); this.shape9 = new ModelRenderer(this, 0, 0); this.shape9.setRotationPoint(0.0F, 14.0F, -24.0F); this.shape9.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape9, 0.7853981633974483F, 0.0F, 0.0F); this.shape1 = new ModelRenderer(this, 0, 0); this.shape1.setRotationPoint(0.0F, 10.0F, 0.0F); this.shape1.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape1, 0.08726646259971647F, 0.0F, 0.0F); this.Footmain = new ModelRenderer(this, 16, 0); this.Footmain.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footmain.addBox(-2.0F, 0.0F, -2.0F, 4, 4, 4, 0.0F); this.Footright = new ModelRenderer(this, 32, 0); this.Footright.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footright.addBox(-7.0F, 0.0F, -2.0F, 5, 1, 4, 0.0F); this.setRotateAngle(Footright, 0.0F, -0.0F, -0.5235987755982988F); this.shape10 = new ModelRenderer(this, 0, 0); this.shape10.mirror = true; this.shape10.setRotationPoint(0.0F, 17.0F, -26.0F); this.shape10.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape10, 0.7853981633974483F, -0.7853981633974483F, 0.7853981633974483F); } @Override @SideOnly(Side.CLIENT) public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.shape8.render(f5); this.shape3.render(f5); this.shape5.render(f5); this.Footfront.render(f5); this.shape2.render(f5); this.shape7.render(f5); this.shape4.render(f5); this.Footleft.render(f5); this.shape6.render(f5); this.shape9.render(f5); this.shape1.render(f5); this.Footmain.render(f5); this.Footright.render(f5); this.shape10.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } Leg class: package com.cruelar.cruelars_triforcemod.entities.monster; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import java.util.List; import java.util.UUID; public class LegGuardian extends EntityMob{ public static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_leg.png"); public UUID parent; public String partName; public LegGuardian(World world){ super(world); init(); } @Override public String toString() { return String.format("%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName(), this.getEntityId(), this.world == null ? "~NULL~" : this.world.getWorldInfo().getWorldName(), this.posX, this.posY, this.posZ); } @Override protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(100.0D); this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(10.0D); } private void init() { this.setSize(1.5F, 1.0F); this.ignoreFrustumCheck = true; } public void setParent(Guardian_Stalker parent) { this.parent = parent.getUniqueID(); } public Guardian_Stalker getParent() { return this.getEntityByUUID(parent,this.world); } public void setPartName(String partName) { this.partName = partName; } public String getPartName() { return partName; } protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { if (parent!=null) { this.getEntityByUUID(parent, this.world).attackEntityFrom(DamageSource.causeIndirectDamage(this, this.getEntityByUUID(parent, this.world)), 100.0F); } this.setDead(); for (int k = 0; k < 20; ++k) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d2, d0, d1); } } } @Override protected void entityInit() { super.entityInit(); } @Override public void readEntityFromNBT(NBTTagCompound compound) { Entity entity = getEntityByUUID(compound.getUniqueId("parent"), world); if (entity != null) { ((Guardian_Stalker)entity).setNextLeg(this); parent = ((Guardian_Stalker)entity).getUniqueID(); } } @Override public void writeEntityToNBT(NBTTagCompound compound) { if (parent!=null) { compound.setUniqueId("parent", parent); } } public boolean isEntityEqual(Entity entityIn) { return parent != null && (this == entityIn || this.parent == entityIn.getUniqueID()); } private Guardian_Stalker getEntityByUUID(UUID entityUUID, World worldIn){ int lenght =worldIn.loadedEntityList.size(); List<Entity> loadedEntityList= worldIn.loadedEntityList; Guardian_Stalker foundEntity = null; for (int i = 0;i<lenght;i++){ if (loadedEntityList.get(i).getUniqueID()==entityUUID){ foundEntity = (Guardian_Stalker) loadedEntityList.get(i); } } return foundEntity; } } LegRenderer: package com.cruelar.cruelars_triforcemod.renderer; import com.cruelar.cruelars_triforcemod.entities.monster.LegGuardian; import com.cruelar.cruelars_triforcemod.model.ModelGuardianLeg; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class RenderGuardianLeg extends RenderLiving<LegGuardian> { //Only basic stuff by now private ResourceLocation mobTexture = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_leg.png"); public static final Factory FACTORY = new Factory(); public RenderGuardianLeg(RenderManager renderManager){ super(renderManager, new ModelGuardianLeg(),0.5F); } @Nullable @Override protected ResourceLocation getEntityTexture(@Nonnull LegGuardian entity) { return mobTexture; } public static class Factory implements IRenderFactory<LegGuardian> { @Override public Render<? super LegGuardian> createRenderFor(RenderManager manager){ return new RenderGuardianLeg(manager); } } } Rest I have'nt started yet Really any help is appreciated. I f the Way I use the Forum here to get lots of Information to this one thing dear moderators please just warn me. I'll then only ask for specific stuff but as this is a big project I thought I need all help I can get. Edited August 15, 2018 by _Cruelar_ Updated code Quote My Projects: Cruelars Triforcemod (1.12 release; 1.14 alpha soon coming) Important: As my mod is on at least 10 different third party sites without my permission, I want to warn you about that with a link to StopModReposts Link to comment Share on other sites More sharing options...
_Cruelar_ Posted August 13, 2018 Author Share Posted August 13, 2018 Updated code. When I start minecraft the debugger says me he can't evaluate it classname.toString() Quote Method threw 'java.lang.NullPointerException' exception. Cannot evaluate com.cruelar.cruelars_triforcemod.entities.monster.LegGuardian.toString() So what should I do to fix that without giving up on the Entity? Quote My Projects: Cruelars Triforcemod (1.12 release; 1.14 alpha soon coming) Important: As my mod is on at least 10 different third party sites without my permission, I want to warn you about that with a link to StopModReposts Link to comment Share on other sites More sharing options...
_Cruelar_ Posted August 15, 2018 Author Share Posted August 15, 2018 (edited) Updated code I was able to spawn the Entity for a short amount of time until I added th updating code for the Legs in onLivingUpdate in The MainEntity class. Comments are ideas I had to fix my Problems. Log Spoiler [18:05:16] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [18:05:28] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ---- // Would you like a cupcake? Time: 8/15/18 6:05 PM Description: Ticking entity java.lang.NullPointerException: Ticking entity at com.cruelar.cruelars_triforcemod.entities.monster.Guardian_Stalker.onLivingUpdate(Guardian_Stalker.java:300) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:346) at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) at net.minecraft.world.World.updateEntity(World.java:2127) at net.minecraft.world.World.updateEntities(World.java:1928) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Thread.java:748) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.cruelar.cruelars_triforcemod.entities.monster.Guardian_Stalker.onLivingUpdate(Guardian_Stalker.java:300) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:346) at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) at net.minecraft.world.World.updateEntity(World.java:2127) -- Entity being ticked -- Details: Entity Type: cruelars_triforcemod:textures/entity/guardian_stalker.png (com.cruelar.cruelars_triforcemod.entities.monster.Guardian_Stalker) Entity ID: 168 Entity Name: Guardian Stalker (doesn't work!) Entity's Exact location: 228.50, 95.00, 266.50 Entity's Block location: World: (228,95,266), Chunk: (at 4,5,10 in 14,16; contains blocks 224,0,256 to 239,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: -1.32, 0.00, -2.63 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.updateEntities(World.java:1928) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) -- Affected level -- Details: Level name: Triforce Test All players: 0 total; [] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: -7073363584905754142 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (172,64,212), Chunk: (at 12,4,4 in 10,13; contains blocks 160,0,208 to 175,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 2007341 game time, 4523 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_152, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 310326008 bytes (295 MB) / 861405184 bytes (821 MB) up to 1883242496 bytes (1796 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP 9.42 Powered by Forge 14.23.4.2705 9 mods loaded, 9 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:--------- |:-------------------- |:------------ |:-------------------------------- |:--------- | | UCHIJAAAA | minecraft | 1.12.2 | minecraft.jar | None | | UCHIJAAAA | mcp | 9.42 | minecraft.jar | None | | UCHIJAAAA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.4.2705.jar | None | | UCHIJAAAA | forge | 14.23.4.2705 | forgeSrc-1.12.2-14.23.4.2705.jar | None | | UCHIJAAAA | cruelars_triforcemod | 0.4.2 | Cruelars_Triforcemod_main | None | | UCHIJAAAA | journeymap | 1.12.2-5.5.2 | journeymap-1.12.2-5.5.2.jar | None | | UCHIJAAAA | baubles | 1.5.2 | Baubles-Mod-1.12.2.jar | None | | UCHIJAAAA | ichunutil | 7.1.4 | iChunUtil-1.12.2-7.1.4.jar | None | | UCHIJAAAA | tabula | 7.0.0 | Tabula-1.12.2-7.0.0-deobf.jar | None | Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [18:05:28] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2018-08-15_18.05.15-server.txt [18:05:28] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server Could anyone give me a other Solution for updating the Position of the Legs? Or at least an idea where to search. Note currently I use the EntityDragon code. Edited August 15, 2018 by _Cruelar_ Quote My Projects: Cruelars Triforcemod (1.12 release; 1.14 alpha soon coming) Important: As my mod is on at least 10 different third party sites without my permission, I want to warn you about that with a link to StopModReposts Link to comment Share on other sites More sharing options...
Recommended Posts
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.