• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Please keep this forum in English. Also, we don't support 1.12.2 anymore, sorry.
    • Are bumps allowed on this forum?
    • now i try a layer as for the slime.   i made it almost the same, , just replaced all about the slime-model with my model.   But i cannot add it to the renderer, jike i saw  at the slime. I get the error in the Renderer-class at this line: this.addLayer(new CoralFinLayer<>(this));   The Renderer-class: package drachenbauer32.angrybirdsmod.entities.renderers; import drachenbauer32.angrybirdsmod.entities.CoralEntity; import drachenbauer32.angrybirdsmod.entities.layers.CoralFinLayer; 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<T> extends MobRenderer<CoralEntity, EntityModel<CoralEntity>> { private static final ResourceLocation CORAL_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/coral.png"); private static final CoralModel<CoralEntity> CORAL_MODEL = new CoralModel<>(false); public CoralRenderer(EntityRendererManager manager) { super(manager, CORAL_MODEL, 0.5f); this.addLayer(new CoralFinLayer<>(this)); } @Override public ResourceLocation getEntityTexture(CoralEntity coral) { return CORAL_TEXTURE; } @Override protected float handleRotationFloat(CoralEntity coral, float partialTicks) { return coral.getTailRotation(); } }   the Layer-class: package drachenbauer32.angrybirdsmod.entities.layers; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import drachenbauer32.angrybirdsmod.entities.models.CoralModel; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.IEntityRenderer; import net.minecraft.client.renderer.entity.LivingRenderer; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.entity.LivingEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class CoralFinLayer<T extends LivingEntity> extends LayerRenderer<T, CoralModel<T>> { private final EntityModel<T> coralModel = new CoralModel<>(true); public CoralFinLayer(IEntityRenderer<T, CoralModel<T>> coral) { super(coral); } public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { if (!entitylivingbaseIn.isInvisible()) { this.getEntityModel().copyModelAttributesTo(this.coralModel); this.coralModel.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); this.coralModel.setRotationAngles(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); IVertexBuilder ivertexbuilder = bufferIn.getBuffer(RenderType.getEntityTranslucent(this.getEntityTexture(entitylivingbaseIn))); this.coralModel.render(matrixStackIn, ivertexbuilder, packedLightIn, LivingRenderer.getPackedOverlay(entitylivingbaseIn, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F); } } } The constructor of my Layer-class is the same, as at the slime-Layer-class, i only replaced the slime-model with my own Model-class, where i use a boolean-argument to chose, if it should render the fin or the other parts... So i wonder, why i cannot add the layer, like in the slime-renderer...
    • Yes, that's what I'm going to continue to do. I misunderstood the following:   to mean that the currently used mappings were available by default somewhere in my IDE.
    • class Provider implements ICapabilityProvider { private Supplier<IMultitool> multitoolSup; Provider() { this(() -> Capabilities.MULTITOOL_CAPABILITY.getDefaultInstance()); } Provider(Supplier<IMultitool> sup) { multitoolSup = sup; } private LazyOptional<IMultitool> capability = LazyOptional.of(() -> multitoolSup.get()); @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { return cap == Capabilities.MULTITOOL_CAPABILITY ? capability.cast() : LazyOptional.empty(); } } I had the advantage that my capability currently just acts as a flag, so I don't care about storing it for later use (i.e. I can just create a new instance every time with no issues). You will probably want to save the value of `supplier.get()` if you interact with it outside of the LazyOptional.
  • Topics

  • Who's Online (See full list)