Jump to content

Drachenbauer

Members
  • Posts

    724
  • Joined

  • Last visited

Everything posted by Drachenbauer

  1. 1. i want him to stay in place without movement,as long as he is inflated. 2. How do i get the data, wich entity calls the method? How do i call the method the non static way?
  2. This is now the renderer-class: package drachenbauer32.angrybirdsmod.entities.renderers; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import drachenbauer32.angrybirdsmod.entities.BubblesEntity; import drachenbauer32.angrybirdsmod.entities.models.BubblesInflatedModel; import drachenbauer32.angrybirdsmod.entities.models.BubblesModel; import drachenbauer32.angrybirdsmod.util.Reference; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.EntityRenderer; 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; import net.minecraftforge.fml.client.registry.IRenderFactory; @OnlyIn(Dist.CLIENT) public class BubblesRenderer extends MobRenderer<BubblesEntity, EntityModel<BubblesEntity>> { private static final ResourceLocation BUBBLES_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/bubbles.png"); private final BubblesModel<BubblesEntity> BUBBLES_MODEL= new BubblesModel<>(); private final BubblesInflatedModel<BubblesEntity> BUBBLES_INFLATED_MODEL= new BubblesInflatedModel<>(); public BubblesRenderer(EntityRendererManager manager) { super(manager, new BubblesModel<>(), 0.25f); } @Override public ResourceLocation getEntityTexture(BubblesEntity arg0) { return BUBBLES_TEXTURE; } @Override protected void func_225629_a_(BubblesEntity p_225629_1_, String p_225629_2_, MatrixStack p_225629_3_, IRenderTypeBuffer p_225629_4_, int p_225629_5_) { RenderSystem.scalef(0.5f, 0.5f, 0.5f); } public void setInflated(boolean inflated) { if (inflated) { entityModel = BUBBLES_INFLATED_MODEL; } else { entityModel = BUBBLES_MODEL; } } public static class RenderFactory implements IRenderFactory<BubblesEntity> { @Override public EntityRenderer<? super BubblesEntity> createRenderFor(EntityRendererManager manager) { return new BubblesRenderer(manager); } } } For controlling the inflating by collision with my player-character, i created this in the BubblesEntity-class: @Override public void livingTick() { if (timeUntilDeflating > 0) { timeUntilDeflating--; if (timeUntilDeflating == 0) { //method-call for deflate } } else { super.livingTick(); } } @Override public void onCollideWithPlayer(PlayerEntity entityIn) { if (timeUntilDeflating == 0) { timeUntilDeflating = 80; //method-call for inflate } } But now i have a question: If i spawn an entity, it generates it´s own instances from it´s entity-class and renderer-clas. If i spawn 2 or more, there must be instances like this: Bubbles-bird 1: BubblesEntity-class-instance 1 BubblesRenderer-class-instance 1 Bubbles-bird 2: BubblesEntity-class-instance 2 BubblesRenderer-class-instance 2 ... So how do i call my method from the renderer in the shown code in the entity-class, that it calls it from the matching renderer-instance? Collision with Bubbles-bird 1: BubblesEntity-class-instance 1 --- calls --> method in BubblesRenderer-class-instance 1 Collision with Bubbles-bird 2 BubblesEntity-class-instance 2 --- calls --> method in BubblesRenderer-class-instance 2 ... I think, if i call it the static way, all of them will inflate, if i collide with one. So how do i make it find the right instance from the renderer to call the method?
  3. And what must i put inte the render-method in the model? I have to create it before i can use it there, because it´s not more part from the normal model-classes. For the texture i looked at the pufferfish. there i saw, that they placed the textures for all sizes in one single graphic file. So i made it for this bird the same way. I just hat to place the texture for his normal sized body into the texture for the inflated state. If inflated, he is five times as big as normal. So the normal body-texture fit´s in one of the top-squares, that the inflated state-texture leaves empty. I can use the textures for beak and feathers for both states, because theese parts do not grow or shrink, if he inflates or deflates..
  4. Now i asked for your way. How do you switch models in the renderer? maybe i can have this in my renderer: public static void setInflated(boolean inflated) { if (inflated) { } else { } } but i don´t know, what to insert into the "if"-"else"-statement to load the different models...
  5. somewhere else it looks like it´s the basic type for models, like "T" is the basic for EitityTypes.
  6. I´m not sure, how to do this in my renderer? Can you please tell me more? Can i switch between two models in the renderer, and control this in the entity-class (where i already created a control-structure, where i just need to call the right methods inside)
  7. Hello i already asked about how to show Bubbles (the orange bird of Angry Birds) inflated. Now i think about making a layer-class out of the inflated model- Is this possible? if yes, how?
  8. Hello If i update my mod to the latest version of minecraft, i copy the mod-folder with tha minecraft-version as name to keep a mod version, that is compatible with the previous minecraft-version. Now it shows the repository-stuff in the project explorer in eclipse, but my changes don´t appear in github desktop. how do i now connect the actual version of my mod with this repository instead of the previous one?
  9. Hello I want to update thr renderer for my Angry Birds slingshot-munition. package drachenbauer32.angrybirdsmod.entities.renderers; import java.nio.FloatBuffer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.vertex.IVertexBuilder; import drachenbauer32.angrybirdsmod.entities.BirdShotEntity; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.Matrix3f; import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.IEntityRenderer; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; public abstract class AbstractBirdStotRenderer<T extends BirdShotEntity> extends EntityRenderer<T> { protected M entityModel; protected boolean renderMarker; public AbstractBirdStotRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn); } public M getEntityModel() { return this.entityModel; } public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { p_225623_4_.func_227860_a_(); p_225623_4_.func_227863_a_(Vector3f.field_229181_d_.func_229187_a_(MathHelper.lerp(p_225623_3_, p_225623_1_.prevRotationYaw, p_225623_1_.rotationYaw) - 90.0F)); p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(MathHelper.lerp(p_225623_3_, p_225623_1_.prevRotationPitch, p_225623_1_.rotationPitch))); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = 0.0F; float f3 = 0.15625F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = 0.15625F; float f7 = 0.3125F; float f8 = 0.05625F; float f9 = (float)p_225623_1_.arrowShake - p_225623_3_; if (f9 > 0.0F) { float f10 = -MathHelper.sin(f9 * 3.0F) * f9; p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(f10)); } p_225623_4_.func_227863_a_(Vector3f.field_229179_b_.func_229187_a_(45.0F)); p_225623_4_.func_227862_a_(0.05625F, 0.05625F, 0.05625F); p_225623_4_.func_227861_a_(-4.0D, 0.0D, 0.0D); IVertexBuilder ivertexbuilder = p_225623_5_.getBuffer(RenderType.func_228638_b_(this.getEntityTexture(p_225623_1_))); MatrixStack.Entry matrixstack$entry = p_225623_4_.func_227866_c_(); Matrix4f matrix4f = matrixstack$entry.func_227870_a_(); Matrix3f matrix3f = matrixstack$entry.func_227872_b_(); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, p_225623_6_); for(int j = 0; j < 4; ++j) { p_225623_4_.func_227863_a_(Vector3f.field_229179_b_.func_229187_a_(90.0F)); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, p_225623_6_); this.func_229039_a_(matrix4f, matrix3f, ivertexbuilder, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, p_225623_6_); } p_225623_4_.func_227865_b_(); super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); } public void func_229039_a_(Matrix4f p_229039_1_, Matrix3f p_229039_2_, IVertexBuilder p_229039_3_, int p_229039_4_, int p_229039_5_, int p_229039_6_, float p_229039_7_, float p_229039_8_, int p_229039_9_, int p_229039_10_, int p_229039_11_, int p_229039_12_) { p_229039_3_.func_227888_a_(p_229039_1_, (float)p_229039_4_, (float)p_229039_5_, (float)p_229039_6_).func_225586_a_(255, 255, 255, 255).func_225583_a_(p_229039_7_, p_229039_8_).func_227891_b_(OverlayTexture.field_229196_a_).func_227886_a_(p_229039_12_).func_227887_a_(p_229039_2_, (float)p_229039_9_, (float)p_229039_11_, (float)p_229039_10_).endVertex(); } } But it shows errors on "M entityModel". I don´t know why... Can you please help me find out, why it´s wrong?
  10. I still don´t know how to mirror the texture from just one model-cube now without creating a new bodypart (ModelRenderer) for it...
  11. Thanks, but as i edited the startpost, i already found something like that and separated the part of the line, that i needed.
  12. Hello A while ago, i noticed, that my entities drown, if they land in water. How can i make them immune against drowning,even if the eyehight sinks under the water line? At first i thaught, entities only can drown, if i use the BreatheAirGoal. but i don´t use it in my entities, and they still can drown. What else is the use of this Goal? And is there a Goal for survive under water? edit: I think, i found, what i needed: @Override public boolean canBreatheUnderwater() { return true; }
  13. Hello My new Entity has got an antenna with a glowing tip on it´s head (like an angler-fish). How can i make it emmit it´s own light, that moves with it?
  14. Hello In the entity-class of the wolf, i founf a method for it´s tail to show it´s health. @OnlyIn(Dist.CLIENT) public float getTailRotation() { if (this.isAngry()) { return 1.5393804F; } else { return this.isTamed() ? (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F); } } I reduced it to this for my own entity: @OnlyIn(Dist.CLIENT) public float getTailRotation() { return this.isTamed() ? (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F); } Now, i want to remove the "isTamed"-part of the line, because i don´t work with taming theese entities. But, if i try this, an error appears on the first position of Math.PI. So i wonder, what "?" and ":" mean and how i can get rid of "isTamed" here... Can you help? Edit: After alot of google i gound out, that "?" and ":" used together in such a case are another version of "if" and "else". So i just hat to keep the part between them and remove the rest. This is the result: @OnlyIn(Dist.CLIENT) public float getTailRotation() { return (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * (float)Math.PI; }
  15. Ai i now used a texture with semi-transparencys on an entity-model in BlockBench, i can see cubes, located inside the same bodypart(bones) through this transparent part, but not parts of an other bodypart. In this sample the purple fin on the head of the model has such transharencies, wich show the part of the head, that´s behind the fin. But at the bottom end of the fin (red arrow), a part of the big tail-cube is also hidden behind the fin and appears invisible. Does this happen in minecraft, too? If yes, what can i do, that it does not happen?
  16. Hello Theese are two modelboxes in 1.14.3 style: bone.cubeList.add(new ModelBox(bone, 0, 2, -3.0F, -10.0F, 0.0F, 2, 6, 0, 0.0F, false)); bone.cubeList.add(new ModelBox(bone, 0, 2, 1.0F, -10.0F, 0.0F, 2, 6, 0, 0.0F, true)); the boolean at the end means, that the seccond one has the texture mirrored. How do i set this property now? At the iron golem i found this: this.ironGolemRightLeg.mirror = true; But this mirrors the textures of the whoole body-part. I only want to mirror the texture of one cube. I don´t want to put it into a new ModelRenderer, only to mirror it´s texture.
  17. There are so many methods, wich have weird coded names, that the forge-people not have renamed yet. This makes it difficult for me to find the right one.
  18. I have no place for it any more, so i need to find a new pace, that does not exist in my code so far. Can you please tell me for example, wich method replaces public float prepareScale now? Then this will be the place now.
  19. I don´t know, where to call it since i don´t have the method any more, where i called it bevore. Can you please tell me, where exactly i can call MatrixStack#scale now?
  20. I created my Entitytypes like this in my EntityTypes-class: public static EntityType<?> STELLA; In 1.14 it worked, and now it still shows no errors there. So i thaught, no changes are needed here.
  21. That was the method in the startpost, but it does not exist any more... This is, why i ask.
×
×
  • Create New...

Important Information

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