Jump to content

ZyEx

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ZyEx's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi! I've encountered a problem where my entity's collision boz is way larger than it's model, is there anyway to fix this? In 1.12 setting the size for an entity was easy, but now I can't seem to find the way to do it. Thanks in advance.
  2. Hi, I was just wondering if there is anyway to get the block class that an entity is standing on? Any sugestions?
  3. Hi, I have been trying to implement a way in which my entity would be able to switch wandering states randomly, switch between walking and flying after a random tick time. I've tried to find a solution for some time but nothing works. Please give sugestions and ideas, anything helps. Some of the solutions I tried: When the entity changes the boolean that dictates if it is flying, to true, this.moveVertical would increment by 2 and while it is with boolean flying == true it would increment by a random number between 0 and 2 every tick(the results were really strange, having the entity jump randomly even when it wasn't supposed to be "flying"); Have two static final goals(walk = WaterAvoidingRandomWalkingGoal() and fly = WaterAvoidingRandomFlyingGoal()) that are added and removed from the goalSelector depending on the flying boolean value when it changes(this didn't even allow the entities to be spawned): //... this.switchWanderState(); if(this.isFlying) { this.goalSelector.removeGoal(walk); this.goalSelector.addGoal(2, fly); } else { this.goalSelector.removeGoal(fly); this.goalSelector.addGoal(2, walk); } //... (Sorry for the bad english, I'm not a native english speaker)
  4. Hello, i was wondering how could I have my entity spawn with one of multiple variants of it's texture picked at random (textures already pre-made and in the textures folder). I've tried having a final random value on the entity class, assigned in entityInit, that dictates which texture to be picked later in the render class but, unfortunatly, that didn't work. Any sugestions? Any idea helps.
  5. Hello, i was wondering how could I have my entity spawn with one of multiple variants of it's texture picked at random (textures already pre-made and in the textures folder). I've tried having a final random value on the entity class, assigned in entityInit, that dictates which texture to be picked later in the render class but, unfortunatly, that didn't work. Any sugestions? Any idea helps.
  6. Hi, so I'm having some problems when trying to implement an attack animation for my entity. I've even went through the IrongGolem's entity and model class to try and find answers ending up using a portion of that exact code on mine but, unfortunatly, it doesn't seem to work either. The problem that I'm having is not that the entity isn't animating when attacking, the problem is that all the entities animate in sync when one does. Basicly when one instance of my entity attacks all the the entities play the attack animation at the same time. Please help, I've looked through every tutorial and forum I could find but I still can't find any answers to my problem. Any sugestion helps. Thanks you for your time Entity Code: protected int attackTicks; public EntityTRex(World worldIn) { super(worldIn); this.experienceValue = 5; this.setSize(2.8F, 4.4F); ambientSounds.add(SoundsHandler.ENTITY_TREX_AMBIENT1); ambientSounds.add(SoundsHandler.ENTITY_TREX_AMBIENT2); ambientSounds.add(SoundsHandler.ENTITY_TREX_AMBIENT3); } @Override protected void initEntityAI() { this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F)); this.tasks.addTask(4, new EntityAILookIdle(this)); this.tasks.addTask(0, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(0, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(0, new EntityAIMoveTowardsTarget(this, 1.0D, 50.0F)); this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityTRex.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityCow.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntitySheep.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityPig.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityHorse.class, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.453D); this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(8.0D); } public static void registerFixesGuardian(DataFixer fixer) { EntityLiving.registerFixesMob(fixer, EntityGuardian.class); } protected void collideWithEntity(Entity entityIn) { if (entityIn instanceof IMob && !(entityIn instanceof EntityCreeper) && this.getRNG().nextInt(20) == 0) { this.setAttackTarget((EntityLivingBase)entityIn); } super.collideWithEntity(entityIn); } public static void registerFixesTRex(DataFixer fixer) { EntityLiving.registerFixesMob(fixer, EntityTRex.class); } public void onLivingUpdate() { super.onLivingUpdate(); if (this.attackTicks > 0) { --this.attackTicks; } if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) { int i = MathHelper.floor(this.posX); int j = MathHelper.floor(this.posY - 0.20000000298023224D); int k = MathHelper.floor(this.posZ); IBlockState iblockstate = this.world.getBlockState(new BlockPos(i, j, k)); if (iblockstate.getMaterial() != Material.AIR) { this.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D, Block.getStateId(iblockstate)); } } } public boolean attackEntityAsMob(Entity entityIn) { this.attackTicks = 20; this.world.setEntityState(this, (byte)8); boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10 + this.rand.nextInt(15))); if (flag) { entityIn.motionY += 0.3500000059604645D; } return flag; } @SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == { this.attackTicks = 20; } else { super.handleStatusUpdate(id); } } @SideOnly(Side.CLIENT) public int getAttackTicks() { return this.attackTicks; } Model Code: @SideOnly(Side.CLIENT) public class ModelTRex extends ZyExAnimations { //... public ModelTRex() { //... } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); head.render(f5); middlebody.render(f5); rightleg.render(f5); leftleg.render(f5); rightarm.render(f5); leftarm.render(f5); tail.render(f5); } public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } @Override public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.rightleg.rotateAngleX = MathHelper.cos(limbSwing * 0.332F + (float)Math.PI) * 0.3F * limbSwingAmount; this.leftleg.rotateAngleX = MathHelper.cos(limbSwing * 0.332F) * 0.3F * limbSwingAmount; this.head.rotateAngleY = netHeadYaw * 0.017453292F; this.head.rotateAngleX = headPitch * 0.017453292F; } public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTickTime) { EntityTRex entityTrex = (EntityTRex)entitylivingbaseIn; int i = entityTrex.getAttackTicks(); if (i > 0) { // Attack Animation } } }
×
×
  • Create New...

Important Information

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