Jump to content

Recommended Posts

Posted (edited)

Hello

 

Im trying to make a slingshot to use like the bow.

How do i create a munition-entity (based on the arrow-entity), that uses a renderer-class and a model-class?

I want to use my Angry Birds models from my living-entities for the munition too, just scale them down.

 

Actual i´m trying to reproduce, how arrows are made in the original vanilla-code and rename them as my birds

and than i thaught, i can use copies of the renderers and models, i use for my other Angry Birds, just put small numbers in the scale-method, i already use for some of them.

Here is such a renderer class:

package drachenbauer32.angrybirdsmod.entities.renderers;

import com.mojang.blaze3d.platform.GlStateManager;

import drachenbauer32.angrybirdsmod.entities.BluesEntity;
import drachenbauer32.angrybirdsmod.entities.models.BluesModel;
import drachenbauer32.angrybirdsmod.util.Reference;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.LivingRenderer;
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 BluesRenderer extends LivingRenderer<BluesEntity, BluesModel>
{
    private static final ResourceLocation BLUES_TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/entity/blues.png");
    
    public BluesRenderer(EntityRendererManager manager)
    {
        super(manager, new BluesModel(), 0.25f);
    }
    
    @Override
    public float prepareScale(BluesEntity entitylivingbaseIn, float partialTicks)
    {
        GlStateManager.scalef(0.5F, 0.5F, 0.5F);
        return super.prepareScale(entitylivingbaseIn, partialTicks);
    }
    
    @Override
    protected ResourceLocation getEntityTexture(BluesEntity arg0)
    {
        return BLUES_TEXTURE;
    }
	
    public static class RenderFactory implements IRenderFactory<BluesEntity>
    {
        @Override
        public EntityRenderer<? super BluesEntity> createRenderFor(EntityRendererManager manager)
        {
            return new BluesRenderer(manager);
        }
    }
}

It uses a model and scales it down to half size.

But it seams like it is not compatiple to the munition-entities

 

Is there any way to use a model and a scale-factor in a renderer, that´s compatiple with a munition-entity?

Edited by Drachenbauer
Posted

Now i try to make my own abstract renderer, that extends the EntityRenderer-class and uses a model and a scale-factor just like the LivingRenderer-class, but without any living stuff.

 

Maybe i can use any code from the LivingRenderer, but i´m not sure, wich parts of code i can remove in my variant to make it render a model without any living animations.

Posted

Ads long as you don't use ArrowItem for you munitions Item, you won't get them mixed up.

Creating a new AbstractRenderer won't be much work, but creating an Entity that essentially does the same thing as (or close to) AbstractArrow is going to be a really big pain.

Posted (edited)

now  my munition-class extends AbstactArrowEntity.

I have got a generic entity-class for my bird munitions, that´extends AbstactArrowEntity, and than i create specific entity-classes for each bird, wich extend my generic class for this.

So each bird get´s it´s own entity-, renderer- and model-class.

 

What must i do to use Red (the leader of the Angry Birds-flock) as the main munition, that can be used unlimited (much like the common arrow for the bow), and the others, if I hold them as an item in the other hand (item-stack, that decreases by one each shot, until empty)?

Edited by Drachenbauer
Posted (edited)

This is now the actual state of my mod:

AngryBirdsMod Github

 

My sligshot extends the bow now, but i override the method onPlayerStoppedUsing and still use it´s whoole content, where i replaced "ArrowItem" with my own munition item-class.

I see no other way to make it use onmy my own stuff

 

I wonder, why my slingshot doesn´t shoot any more (makes the pose, but doesn´t change it´s testure to the pulled state.)...

Is anything at the munition not registered correct?

 

 

 

Another question:

The common arrows get different colored arrow-heads, if enchanted.

How do i make my birds get that magic glow of other enchanted items instead?

Edited by Drachenbauer
Posted
  On 7/26/2019 at 3:30 PM, Drachenbauer said:

My sligshot extends the bow now, but i override the method onPlayerStoppedUsing and still use it´s whoole content, where i replaced "ArrowItem" with my own munition item-class.

I see no other way to make it use onmy my own stuff

Expand  

...and you just ignored all advices given to you previously.

Override BowItem#isArrow and return true if the given ItemStack is your custom ammo.

Some tips:

  Reveal hidden contents

 

Posted (edited)

my munition does not extend ArrowItem.

So it cannot find it, if it still uses ArrowItem in it´s onPlayerStoppedUsing method.

 

And i think, if my munition-item extends ArrowItem, the bow will be able to shoot it too.

But i looked for a way to make this unable, too

Edited by Drachenbauer
Posted
  On 7/27/2019 at 8:58 AM, Drachenbauer said:

my munition does not extend ArrowItem.

Expand  

No one mentioned extending ArrowItem.

 

  On 7/27/2019 at 8:58 AM, Drachenbauer said:

So it cannot find it

Expand  

Yes, which is why I've told you like 3 times to

  On 7/26/2019 at 11:37 PM, DavidM said:

Override BowItem#isArrow and return true if the given ItemStack is your custom ammo.

Expand  

 

Some tips:

  Reveal hidden contents

 

Posted (edited)
  Quote

Override BowItem#isArrow and return true if the given ItemStack is your custom ammo.

Expand  

I cannot understend, how this will make it use my munition, if it still uses "ArrowItem" in it´s "onPlayerStoppedUsing"-method.

And i cannot find this method in the list, that i open with Strg + Space (what´s my common way to override stuff).

And i also cannot find this method in the classes "BowItem" and "ShootableItem"

 

Are you sure, that this is the way to do it in 1.14.3?

Edited by Drachenbauer
Posted

My bad. It is called BowItem#getInventoryAmmoPredicate in 1.14.3.

Some tips:

  Reveal hidden contents

 

Posted

This i already have in my class and i created my own item group tag with json file, that i use there.

I declared a Predicate for ItemStack (like i found in the ShootebleItem-class) and placed the created item group tag in it:

    public static final Predicate<ItemStack> BIRD_SHOTS = (p_220002_0_) ->
    {
        return p_220002_0_.getItem().isIn(AngryBirdsItems.BIRD_SHOTS);
    }
    ;

And then i used it for the method, you sayd:

    public Predicate<ItemStack> getInventoryAmmoPredicate()
    {
        return BIRD_SHOTS;
    }

 

But i still don´t understand, how this should be able to work, if i remove my modifications in the "onPlayerStoppedUsing"-method.

As i sayd, it uses "ArrowItem" in muptiple positions in this method (where i have placed my own munition-item), and my munition-item does not extend ArrowItem.

I already noticed any time earlyer any where, that a java-code can only use a specific java-class, if it asks for the name of a class in the direct extension-line of the class to use.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Ignore shrimple, it doesn't work with Oculus. Also, enableShaders was alr true when it said that towards the end of the log. If you could also figure out why my tags are messed up that'd be cool too, but that's a later issue. https://drive.google.com/drive/folders/1ovEKDZECUCl7zZxGfpyQcS4s5PZPQyfa?usp=drive_link
    • accidental duplicate mesage cuz lag
    • https://gnomebot.dev/paste/231527759279685634/1372324909073563730/1372324908629102716 https://gnomebot.dev/paste/231527759279685634/1372320454861262908/1372320454299090996 seems like theres a registry sync error, not sure what that means though, however in an old pack i played on, i actually had a registry sync error happen whenever the world tried too save and it would suddenly stop loading chunks, is there a mod fix for this or some way too bypass registry syncing? is this a server problem? i have no issues with the pack on pc, only on my server.
    • i think the problem is the player animator library but i need it for one of my main mods is there any way i can fix this? The game crashed: rendering overlay Error: java.lang.IllegalArgumentException: Failed to create player model for default heres the crash report: https://pastebin.com/U5Wp8ysb
    • I have been an enthusiastic investor in crypt0currencies for several years, and my digital assets have been integral to my financial strategy. A few months ago, I encountered a distressing predicament when I lost access to my primary cryptocurrency walleet after clicking on an airdrop link that inadvertently connected to my walleet. The dread of potentially losing all my hard-earned funds was overwhelming, leaving me uncertain about where to seek assistance. In my pursuit of solutions, I stumbled upon ChainDigger Retrievers. From our initial consultation to the triumphant recovery of my assets, the team exhibited exceptional expertise. They provided comprehensive explanations of the recovery process, ensuring I was informed at every stage and offering reassurance during this tumultuous time. Their approach was not only meticulous but also compassionate, which significantly alleviated my anxiety. ChainDigger Retrievers unwavering commitment to resolving my issue was evident throughout the process. Leveraging their profound understanding of crypt0currency technology and digital forensics, they initiated an exhaustive investigation to trace the transactions linked to my compromised wallet. Their meticulous analysis and relentless determination were apparent as they left no stone unturned in their quest to recover my funds. After several days of diligent investigation, the team successfully recovered everything I had lost. They uncovered that the link I had clicked contained malware, which scammeers had used to infiltrate my walleet. This revelation was both alarming and enlightening, underscoring the inherent risks associated with crypt0currency transactions when proper precautions are not taken.Thanks to ChainDigger Retrievers, I not only regained everything but also acquired invaluable knowledge about safeguarding my investments. Their expertise and steadfast support transformed a daunting situation into a manageable one, and I am profoundly grateful for their assistance. I can now continue my investment journey with renewed confidence, knowing that I have a trustworthy ally in ChainDigger Retrievers. Their client satisfaction is truly commendable, and I wholeheartedly recommend their services to anyone facing similar challenges in the crypt0currency realm. With their help, I was able to turn a distressing time into a positive outcome, and I will forever be grateful for their support.  
  • Topics

×
×
  • Create New...

Important Information

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