Jump to content

Drachenbauer

Members
  • Posts

    725
  • Joined

  • Last visited

Everything posted by Drachenbauer

  1. In the minecraft-tester, the fin of this entity looks opaque. How do i make it transparent there?
  2. Now i use two models ant e texture, thad holds stuff for both models to simulate his inflating skill. This worked well. Then i thaught about resizing his boundingbox to fit the two different sizes. Now he disappears, if i run into him to make him inflate. I created theese boundingboxes: protected static final AxisAlignedBB BBUBBLES_AABB = new AxisAlignedBB(6.0D, 0.0D, 6.0D, 12.0D, 4.0D, 12.0D); protected static final AxisAlignedBB BBUBBLES_INFLATED_AABB = new AxisAlignedBB(-2.0D, 0.0D, -2.0D, 18.0D, 20.0D, 18.0D); and use them in theese methods: @Override public void livingTick() { if (timeUntilDeflating > 0) { timeUntilDeflating--; if (timeUntilDeflating == 0) { isInflated = false; setBoundingBox(BBUBBLES_AABB); } } else { super.livingTick(); } } @Override public void onCollideWithPlayer(PlayerEntity entityIn) { if (timeUntilDeflating == 0) { timeUntilDeflating = 80; isInflated = true; setBoundingBox(BBUBBLES_INFLATED_AABB); } } in ormal state he is a 4x4x4 pixels (1/4 block-edgelength) cube and inflated 20.2.x2.pixels (a bit bigger than a block) Is something wrong with my boundingboxes?
  3. Now the tail of my entity is invisible (maybe it´s rotated into the body) Entity-Class: /** ** This is Coral, an angler-fish-character from a not so well known Rovio-game called "Fruit-Nibblers". ** I added her here, because her game is from the creators of Angry Birds, too. ** I like her look and I think, it maybe a good idea to make her best friends with Stella **/ package drachenbauer32.angrybirdsmod.entities; import net.minecraft.entity.AgeableEntity; import net.minecraft.entity.EntityType; import net.minecraft.entity.Pose; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.goal.LookAtGoal; import net.minecraft.entity.ai.goal.LookRandomlyGoal; import net.minecraft.entity.ai.goal.RandomSwimmingGoal; import net.minecraft.entity.ai.goal.RandomWalkingGoal; import net.minecraft.entity.ai.goal.SwimGoal; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class CoralEntity extends AnimalEntity { public CoralEntity(EntityType<? extends CoralEntity> type, World worldIn) { super(type, worldIn); } @Override public AgeableEntity createChild(AgeableEntity arg0) { return null; } @Override public float getEyeHeight(Pose pose) { return this.getSize(pose).height / 2 + getSize(pose).height / 14; } @Override protected void registerGoals() { this.goalSelector.addGoal(0, new SwimGoal(this)); this.goalSelector.addGoal(1, new RandomSwimmingGoal(this, 0.2d, 10)); this.goalSelector.addGoal(2, new RandomWalkingGoal(this, 0.2d)); this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 6.0F)); this.goalSelector.addGoal(4, new LookRandomlyGoal(this)); } @Override public boolean canBreatheUnderwater() { return true; } @Override protected void registerAttributes() { super.registerAttributes(); this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D); } @OnlyIn(Dist.CLIENT) public float getTailRotation() { return (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * (float)Math.PI; } } Renderer-class: package drachenbauer32.angrybirdsmod.entities.renderers; import drachenbauer32.angrybirdsmod.entities.CoralEntity; import drachenbauer32.angrybirdsmod.entities.models.CoralModel; import drachenbauer32.angrybirdsmod.util.Reference; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.util.ResourceLocation; public class CoralRenderer extends MobRenderer<CoralEntity, EntityModel<CoralEntity>> { private static final ResourceLocation CORAL_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/coral.png"); public CoralRenderer(final EntityRendererManager manager) { super(manager, new CoralModel<>(), 0.625f); } @Override public ResourceLocation getEntityTexture(CoralEntity coral) { return CORAL_TEXTURE; } @Override protected float handleRotationFloat(CoralEntity coral, float partialTicks) { return coral.getTailRotation(); } /*public static class RenderFactory implements IRenderFactory<CoralEntity> { @Override public EntityRenderer<? super CoralEntity> createRenderFor(EntityRendererManager manager) { return new CoralRenderer(manager); } }*/ } Model-class package drachenbauer32.angrybirdsmod.entities.models; import com.google.common.collect.ImmutableList; import drachenbauer32.angrybirdsmod.entities.CoralEntity; import net.minecraft.client.renderer.entity.model.AgeableModel; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.util.math.MathHelper; public class CoralModel<T extends CoralEntity> extends AgeableModel<T> { private final ModelRenderer bone; private final ModelRenderer bone2; private final ModelRenderer bone3; private final ModelRenderer bone4; private final ModelRenderer bone5; private final ModelRenderer bone6; private final ModelRenderer bone7; public CoralModel() { textureWidth = 56; textureHeight = 32; bone = new ModelRenderer(this); bone.setRotationPoint(0.0F, 18.1F, 0.0F); bone.addBox("head", -4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F, 0, 0); bone.addBox("antenna_part_1", -0.5F, -12.0F, -4.0F, 1, 4, 1, 0.0F, 28, 0); bone.addBox("antenna_part_2", -0.5F, -12.0F, -6.0F, 1, 1, 2, 0.0F, 24, 5); bone.addBox("antenna_light", -1.0F, -12.0F, -8.0F, 2, 3, 2, 0.0F, 0, 0); bone.addBox("back_fin", 0.0F, -12.0F, 0.0F, 0, 12, 6, 0.0F, 38, 6); bone2 = new ModelRenderer(this); bone2.setRotationPoint(0.0F, 20.1F, 0.0F); bone2.addBox("body", -3.0F, -4.0F, -3.0F, 6, 6, 6, 0.0F, 32, 0); bone3 = new ModelRenderer(this); bone3.setRotationPoint(-2.0F, 22.1F, -2.0F); bone3.addBox("right_front_leg", -1.0F, 0.0F, -1.0F, 2, 2, 2, 0.0F, 0, 16); bone3.addBox("right_front_flipper", -1.0F, 2.0F, -2.0F, 2, 0, 1, 0.0F, 1, 20); bone4 = new ModelRenderer(this); bone4.setRotationPoint(2.0F, 22.1F, -2.0F); bone4.addBox("left_front_leg", -1.0F, 0.0F, -1.0F, 2, 2, 2, 0.0F, 8, 16); bone4.addBox("left_front_flipper", -1.0F, 2.0F, -2.0F, 2, 0, 1, 0.0F, 9, 20); bone5 = new ModelRenderer(this); bone5.setRotationPoint(-2.0F, 22.1F, 2.0F); bone5.addBox("right_hind_leg", -1.0F, 0.0F, -1.0F, 2, 2, 2, 0.0F, 16, 16); bone5.addBox("right_hind_flipper", -1.0F, 2.0F, -2.0F, 2, 0, 1, 0.0F, 17, 20); bone6 = new ModelRenderer(this); bone6.setRotationPoint(2.0F, 22.1F, 2.0F); bone6.addBox("left_hind_leg", -1.0F, 0.0F, -1.0F, 2, 2, 2, 0.0F, 24, 16); bone6.addBox("left_hind_flipper", -1.0F, 2.0F, -2.0F, 2, 0, 1, 0.0F, 25, 20); bone7 = new ModelRenderer(this); bone7.setRotationPoint(0.0F, 20.1F, 3.0F); bone7.addBox("tail_part_1", -2.0F, -2.0F, 0.0F, 4, 4, 4, 0.0F, 24, 16); bone7.addBox("tail_part_1", -1.0F, 0.0F, 4.0F, 2, 2, 2, 0.0F, 24, 16); bone7.addBox("tail_fin", 0.0F, -1.0F, 6.0f, 2, 0, 1, 0.0F, 25, 20); } @Override protected Iterable<ModelRenderer> getHeadParts() { return ImmutableList.of(bone); } @Override protected Iterable<ModelRenderer> getBodyParts() { return ImmutableList.of(bone2, bone3, bone4, bone5, bone6, bone7); } @Override public void setRotationAngles(CoralEntity coral, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { bone.rotateAngleX = headPitch * 0.017453292f; bone.rotateAngleY = netHeadYaw * 0.017453292f; /*this.bone3.rotateAngleX = 0.5235988f + MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount; this.bone4.rotateAngleX = -0.5235988f + -(MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount); this.bone5.rotateAngleX = -0.5235988f + -(MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount); this.bone6.rotateAngleX = 0.5235988f + MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount;*/ this.bone3.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.bone4.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.bone5.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.bone6.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.bone7.rotateAngleX = ageInTicks; } } bone7 is the tail, bone3-bone6 are the legs, where i´m trying different limbswing calculations. What´s wrong with the tail-movement?
  4. Now it works. But now i have a problem with my newest entity, that has limbs: I tried theese two variants of the limbSwing-calculation: this.bone3.rotateAngleX = 0.5235988f + MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount; this.bone4.rotateAngleX = -0.5235988f + -(MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount); this.bone5.rotateAngleX = -0.5235988f + -(MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount); this.bone6.rotateAngleX = 0.5235988f + MathHelper.cos(limbSwing * 5.0f) * 1.4f * limbSwingAmount; this.bone3.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.bone4.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.bone5.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.bone6.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; With the first set, one front leg stays more bended forward and the other backward, the hind-legs the same. And with the seccond one, the legs move very slow and not very far(it looks more like gliding, than walking). It´s a small character with short legs. I want the legs move faster to fit the walking-speed and bend about 45° to the front and rear from the vertical main-pose. How most i change theese lines?
  5. My constructor now looks like this: public StellaEntity(EntityType<? extends StellaEntity> type, World worldIn) { super(type, worldIn); } I saw it like this in vanilla-AnlmalEntities.
  6. For the entity-type-thing: I thaught the parent-class uses it with the super-constructor. Edit: now i looked into some vanilla-entities and try, what i see there as the constructor.
  7. For the first thing, should i replace the "?" with "STELLA", because this is my entitytype for this one? for the thing with the list, do you mean, like i made the head-parts thing, but just leave the bracets of the list empty?
  8. The Entity-class: package drachenbauer32.angrybirdsmod.entities; import drachenbauer32.angrybirdsmod.init.AngryBirdsEntities; import net.minecraft.entity.AgeableEntity; import net.minecraft.entity.EntityType; import net.minecraft.entity.Pose; import net.minecraft.entity.ai.goal.LookAtGoal; import net.minecraft.entity.ai.goal.LookRandomlyGoal; import net.minecraft.entity.ai.goal.RandomSwimmingGoal; import net.minecraft.entity.ai.goal.RandomWalkingGoal; import net.minecraft.entity.ai.goal.SwimGoal; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; public class StellaEntity extends AnimalEntity { public StellaEntity(EntityType<? extends AnimalEntity> type, World worldIn) { super((EntityType<? extends AnimalEntity>) AngryBirdsEntities.STELLA, worldIn); } @Override public AgeableEntity createChild(AgeableEntity arg0) { return null; } @Override public float getEyeHeight(Pose pose) { return this.getSize(pose).height / 2; } @Override protected void registerGoals() { this.goalSelector.addGoal(0, new SwimGoal(this)); this.goalSelector.addGoal(1, new RandomSwimmingGoal(this, 0.2d, 10)); this.goalSelector.addGoal(2, new RandomWalkingGoal(this, 0.2d)); this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 6.0F)); this.goalSelector.addGoal(4, new LookRandomlyGoal(this)); } @Override public boolean canBreatheUnderwater() { return true; } @Override protected void registerAttributes() { super.registerAttributes(); } } The Renderer-class: package drachenbauer32.angrybirdsmod.entities.renderers; import drachenbauer32.angrybirdsmod.entities.StellaEntity; import drachenbauer32.angrybirdsmod.entities.models.StellaModel; import drachenbauer32.angrybirdsmod.util.Reference; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class StellaRenderer extends MobRenderer<StellaEntity, EntityModel<StellaEntity>> { private static final ResourceLocation STELLA_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/stella.png"); public StellaRenderer(EntityRendererManager manager) { super(manager, new StellaModel<>(), 0.5f); } @Override public ResourceLocation getEntityTexture(StellaEntity stella) { return STELLA_TEXTURE; } /*public static class RenderFactory implements IRenderFactory<StellaEntity> { @Override public EntityRenderer<? super StellaEntity> createRenderFor(EntityRendererManager manager) { return new StellaRenderer(manager); } }*/ } i commented out the RenderFactory, because i didn´t see it in the vanilla-renderers any more. The Model-class: package drachenbauer32.angrybirdsmod.entities.models; import com.google.common.collect.ImmutableList; import drachenbauer32.angrybirdsmod.entities.StellaEntity; import net.minecraft.client.renderer.entity.model.AgeableModel; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class StellaModel<T extends StellaEntity> extends AgeableModel<T> { private final ModelRenderer bone; private final ModelRenderer bone2; private final ModelRenderer bone3; private final ModelRenderer bone4; private final ModelRenderer bone5; public StellaModel() { textureWidth = 32; textureHeight = 16; bone = new ModelRenderer(this); bone.setRotationPoint(0.0F, 20.0F, 0.0F); bone.addBox("body", -4.0F, -4.0F, -4.0F, 8, 8, 8, 0.0F, 0, 0); bone.addBox("beak", -1.0F, 2.0F, -5.0F, 2, 1, 1, 0.0F, 25, 0); bone.addBox("head_feather_1", 0.0F, -6.0F, -8.0F, 0, 2, 6, 0.0F, 10, 10); bone.addBox("tail_feather_1", 0.0F, 1.0F, 4.0F, 0, 1, 4, 0.0F, 24, 3); bone2 = new ModelRenderer(this); bone2.setRotationPoint(0.0F, -4.0F, -2.0F); setRotationAngle(bone2, -0.5236F, 0.0F, 0.0F); bone.addChild(bone2); bone2.addBox("head_feather_2", 0.0F, -2.0F, -6.0F, 0, 2, 6, 0.0F, 10, 10); bone3 = new ModelRenderer(this); bone3.setRotationPoint(0.0F, -4.0F, -2.0F); setRotationAngle(bone3, -1.0472F, 0.0F, 0.0F); bone.addChild(bone3); bone3.addBox("head_feather_3", 0.0F, -2.0F, -6.0F, 0, 2, 8, 0.0F, 8, 8); bone4 = new ModelRenderer(this); bone4.setRotationPoint(0.0F, 1.0F, 4.0F); setRotationAngle(bone4, 0.5236F, 0.0F, 0.0F); bone.addChild(bone4); bone4.addBox("tail_feather_2", 0.0F, 0.0F, 0.0F, 0, 1, 4, 0.0F, 24, 3); bone5 = new ModelRenderer(this); bone5.setRotationPoint(0.0F, 1.0F, 4.0F); setRotationAngle(bone5, -0.5236F, 0.0F, 0.0F); bone.addChild(bone5); bone5.addBox("tail_feather_3", 0.0F, 0.0F, 0.0F, 0, 1, 4, 0.0F, 24, 3); } @Override protected Iterable<ModelRenderer> getHeadParts() { return ImmutableList.of(bone); } @Override protected Iterable<ModelRenderer> getBodyParts() { return null; } @Override public void setRotationAngles(StellaEntity stella, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { bone.rotateAngleX = headPitch * 0.017453292f; bone.rotateAngleY = netHeadYaw * 0.017453292f; } private void setRotationAngle(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } } in the method getBodyParts i return null, because it´s a classic Angry Birds-character. they are not much more than bird-heads with some feathers stick out. So i only needed stuff as head-part
  9. Hello As i tried to run the AgryBirdsMod, i got this error: It seams like there is something wrong with one of my entities: the Angry Birds character Stella. But i cannot figure out, what exactly. Can you help me?
  10. I just want to know, how to change the boundingbox-size of the player. I just sayd, that i want to fit it to the size of my new model, not that i think, i have to do it in the model. I don´t know, how the code for sneaking/flying/crawling can help me here... And i still don´t know, how i keep the armour hidden, even if i wear it
  11. And how do i shrink the boundingbox of this small model to the size of it´s cube-body (to fit into 1 block high horizontal tunnels)?
  12. that´s what i dit now. For one variant: How do i keep the body-, arms, and legs-parts of the armour invisible while wearing them? Itßs a small and compact character, that is fully covered in the helmet. and how can i change the collision-box-size to fit to this model (should be able to enter one block high horizontal tunnels)
  13. Now i extendet Playermoder and my bodyparts start with lines like: bipedHead = new ModelRenderer(this); does this create a clean, empty instance of this part, where only mx new boxes are added to? And how do i hide the body-, arms- and leg-parts of armour, even if i wear theese items? This is for the seccond variant: A model as a classic Angry Bird. They are not much more than a bird-head with some outstanding feathers, so they can only wear head-wear.
  14. i want to change the model of the player. That means, i need no entity-class for it, i think.
  15. this method is not compatible with my model... How do i extend PlayerModel, without using any model-boxes, it already provides? I only want to use the model-boxes, wich i add in my own custom PlayerModel-class.  Sorry, i didn´t see your answer, as i edited my previous post to this... i had the post-editor open for a while, as i did other stuff.
  16. this method is not compatible with my model... How do i extend PlayerModel, without using any model-boxes, it already provides? I only want to use the model-boxes, wich i add in my own custom PlayerModel-class.
  17. i just thaught, my own player-models need their own renderers. how do i connect my renderer, that extends PlayerRenderer, with my own Player-Model
  18. but i don´t know, how to put my own renderer in one of them.
  19. Hello I have this to cancel the common player-model: @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { event.setCanceled(true); } What exectly most i add below the cancel-line to render my own player-model? And how can i create a set of buttons to switch between the official model and my own ones?
  20. It´s this line in the render-method: net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entityIn, this, partialTicks, matrixStackIn, bufferIn, packedLightIn)) It gives the syntax-error: for me it looks like the RenderPlayerEvent cannot use my custom PlayerRenderer as an input in it´s constructor, only the official vanilla-one.. So i still don´t know, how to fix this
  21. Now i updated my project to the latest snapshot and forge version. But the PlayerRenderer-class in the referenced librarys looks the same as before. also the two methods (wich call the RenderPlayerEvent-class) from the startpost are still the same. It still seams like the RenderPlayerEvent-class is only compatible with the vanilla PlayerRenderer-class. should i create my own RenderPlayerEvent-classes for my custom PlayerRenderer-classes? Cadiboo posted this link in one of the answers here: https://github.com/MinecraftForge/MinecraftForge/pull/6444 But i found nothing about this in the referenced librarys, i use now. And i found no mapped snapshot for 1.15.2 so i used the latest one for 1.15.1, that exist.
  22. Hello As i tried to create my own player-entity-class for my player-model, i copyed the content of the vanilla PlayerEntity-class (from the actual version of the code) into an own class and renamed it for my own player-charecter. But i get alot of syntax-errors, wich say, that some methods cannot use my customized class as input, or don´t exist here... Now i only found stuff on the web, that tells about the model-class and the renderer of a custom entity, but it tells nothing about a custom Entity-Class for a player. Does that mean, i nead no entity-classes for my custom Player-models?
  23. my earliest minecraft is 1.13.2 and i thaught, it´s a lonestanding program. i didn´t find any totorials for doing this in 1.15.1 so far
×
×
  • Create New...

Important Information

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