Jump to content

How do i make an entity changing it´s model and scale if it gets damage?


Drachenbauer

Recommended Posts

Hello

 

I´m working on an Angry Birds-mod.

 

One of the birds (the orange one) is very small, but has the ability to inflate him self like a balloon.

 

For this one, i have 2 model-files.

 

Is there any way, how i can script, that he inflates him self for a few secconds by getting damage (by changing his model and scale from 0,5 to 1 and back to 0,5)?

 

I already managet to scale the very small birds down to 0.5 while spawning them

 

Link to comment
Share on other sites

... Like you've said, you can change the scale from 0.5 to 1 to simulate inflating.

 

Override

Entity#attackEntityFrom

.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Entity#setSize

 

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

1. If you just want to resize the rendered model, add an EventSubscriber for RenderLivingEvent.Pre and use GlStateManager#scale to resize the rendered model.

2. https://stackoverflow.com/questions/11247793/why-do-some-folks-use-classmethod-instead-of-class-method-in-correspondence (or, you know, Google is your friend)

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Why do you want to change the model?

To simulate the inflating you just need to change the size of your entity.

The 2 models are not necessary.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

How do you plan on going between the models?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Ok, but how do you plan to smoothly transfer between two static models? Or do you not care about transferring smoothly?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

  • 4 months later...

Now i have both model-classes with their renderer-classes.

 

How can i switch bitween the renderers, if the entity collides with the player (i think, that´s better than damage, so i can cause him to inflate, withouf damage him)?

I found this mothod for the collision.

    @Override
    public void onCollideWithPlayer(PlayerEntity entityIn)
    {
        super.onCollideWithPlayer(entityIn);
    }

What must i put in there to cause a change to the other renderer?

 

During another project, i found a way to make it first do stuff, than wait a time, than do other stuff:

With this i will make him inflate in the moment of the collision and deflate 4 seconds later:

    @Override
    public void onCollideWithPlayer(PlayerEntity entityIn)
    {
        //command for inflate
        timer.schedule(new TimerTask()
        {
            @Override
            public void run()
            {
                //command for deflate after 4 seconds
            }
        }
        , 4000);
        
        super.onCollideWithPlayer(entityIn);
    }

But what must i put above and inside the timer to change the renderer for this instance of the entity?

Edited by Drachenbauer
Link to comment
Share on other sites

5 hours ago, Drachenbauer said:

What must i put in there to cause a change to the other renderer?

I would have a field on my entity that would store the time since it was last hit, set it to 0 in that method and increment it each tick.

 

5 hours ago, Drachenbauer said:

timer.schedule(new TimerTask()

do NOT do this. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

15 hours ago, Cadiboo said:

I would have a field on my entity that would store the time since it was last hit, set it to 0 in that method and increment it each tick.

 

do NOT do this. 

Why i should not do this timer thing?

In my other project (a simple sokoban-game, nothing about minecraft) it works fine.

 

And how do i increase a time-field by tick?

Edited by Drachenbauer
Link to comment
Share on other sites

Is this better:

    @Override
    public void livingTick()
    {
        timeUntilDeflating++;
        
        if (timeUntilDeflating >= 80)
        {
            //command or deflating here
        }
        
        super.livingTick();
    }
    
    @Override
    public void onCollideWithPlayer(PlayerEntity entityIn)
    {
        timeUntilDeflating = 0;
        //command for inflating here
    }
Edited by Drachenbauer
Link to comment
Share on other sites

On 2/16/2019 at 9:52 PM, Drachenbauer said:

Hello

 

I´m working on an Angry Birds-mod.

 

One of the birds (the orange one) is very small, but has the ability to inflate him self like a balloon.

 

For this one, i have 2 model-files.

 

Is there any way, how i can script, that he inflates him self for a few secconds by getting damage (by changing his model and scale from 0,5 to 1 and back to 0,5)?

 

I already managet to scale the very small birds down to 0.5 while spawning them

 

Angry zombies in Thaumcraft grow larger when they damaged by players.
you can view Thaumcraft source aswell  :\

Link to comment
Share on other sites

what i need is, how to change the renderer for this instance, because the proportions of this bird change, if he inflates himself.

His body expands, but his face and feathers stax the same size.

So i have two renderers, wich use different models.

If i register both in my render-handler, the seccond one is used for the entity.

At first i thaught, maybe it will render both at the same place, doing the same stuff in the same moment.

But that isn´t the case.

 

so what must i put in the command-spots of the piece of code in my last post to change the renderer for this instance?

Link to comment
Share on other sites

I have got an idea:

I can create the inflated version as an own entity without living animations.

And in the original entity of the bird, it should spawn the inflated version at it´s position, if i collide with him and despawn it after the four secconds, i declared in the living-tick.

And while theese four secconds, the normal one should do no living animations to stay hidden inside the inflated model.

 

My code in the entity-class for this so far:

    @Override
    public void livingTick()
    {
        if (timeUntilDeflating > 0)
        {
            timeUntilDeflating--;
            
            if (timeUntilDeflating == 0)
            {
                //command for deflating here
            }
        }
        else
        {
            super.livingTick();
        }
    }
    
    @Override
    public void onCollideWithPlayer(PlayerEntity entityIn)
    {
        if (timeUntilDeflating == 0)
        {
            timeUntilDeflating = 80;
            //command for inflating here
        }
    }

It actually makes the entity stop it´s whoole movement and animations for four secconds after a collision with the player.

I´ll use this effect to keep the normal model hidden inside the inflated one.

 

I´m still working on an abstract renderer, that uses a model-class and scalefactor, but no living-animations (for the inflated variant).

 

How do i write a command, that spawns the inflated entity and fits in here?

And one that despawns it?

It should be spawned in the actual position of the normal one (to encase it) and with it´s rotation-angle around the vertical axis.

Edited by Drachenbauer
Link to comment
Share on other sites

  • 6 months later...

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?

Edited by Drachenbauer
Link to comment
Share on other sites

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

    • KLIK DISINI >>> LINK LOGIN & DAFTAR KLIK DISINI >>>   DAFTAR AKUN GACOR KLIK DISINI >>> DAFTAR AKUN VVIP KLIK DISINI >>> DAFTAR AKUN SLOT ANTI RUNGKAD KLIK DISINI >>>  LINK ALTERNATIF KLIK DISINI >>> AKUN GACOR SCATTER HITAM SLOT888 adalah slot gacor winrate 100% dengan server thailand dan akun pro. Dapatkan akses menuju kemenangan ke puluhan sampai ratusan juta rupiah hanya dalam hitungan menit. 3 web yang kami hadirkan ini adalah yang terbaik dengan histori kemenangan tertinggi di satu Asia Tenggara. Member-member dari web ini selalu kembali karena tim admin dan CS yang profesional serta kemenangan berapapun pasti akan dibayar. RTP slot gacor juga sudah disiapkan agar kalian tidak bingung lagi mau main apa dan di jam berapa. Semua fasilitas seperti deposit dana dan pulsa sudah disiapkan juga untuk kemudahan para slotters. Jadi tunggu apalagi? Raih kemenangan kalian disini sekarang juga!
    • Winning303 menyediakan berbagai jenis permainan dengan kemenangan yang tinggi , slot gacor dengan winrate 100% , hanya dengan modal receh sudah bisa meraih jutaan  Nikmati berbagai permainan judi online yang menarik dengan jaminan keamanan dan kenyamanan di WINNING303 LINK ALTERNATIF => https://w303.pink/ref1x    
    • RELATED: Horror Games Inspired By Movies Still, there are some options for a Wizard if it comes to melee combat, and there also are some alternatives on the subject of the catalyst they use to solid Spells. For each, those alternatives are first-class: Spellbook: All three spellcasting options, the Staff, Spellbook, and Crystal Ball can all have a whole lot of extra advantages of Dark And Darker Gold on them depending on rarity. But, at a base degree, the Spellbook is the catalyst option gamers appeared to gravitate to. This spell-casting catalyst will increase a Wizard's movement velocity by using the maximum overall, which clearly makes a large distinction. Crystal Ball: The distinction among the three Spell catalysts is quite easy. The Staff is the default option and has melee assaults of its own, the Spellbook is faster all around however offers no melee alternatives, and the Crystal Ball is the center ground between the 2 in regard to motion velocity, however gamers may also equip a Dagger or something in their other hand at the identical time. Crossbow: That's right, Wizards can really run Crossbows, but it is without a doubt simplest well worth the usage of once or at maximum twice at some stage in a suit, and best as soon as a Wizard is out of Spell casts. Still, tricking an enemy into thinking a Wizard is out of Spells, simplest to tug out a Crossbow and launch a bolt into them is a surprisingly effective strategy. Rondel Dagger: Again, if it ever does come right down to melee combat, a Wizard loses ninety percent of the time. But, having a Rondel Dagger as a secondary or geared up alongside the Crystal Ball improves the ones odds at least a bit bit. The Wizard's Expansive Repertoire Of Spells. Moving on to the category all and sundry became in all likelihood anticipating when studying approximately the Wizard magnificence, the Spells. Which Spells are the quality to use on the Wizard and why? Or, not less than, which of them are the maximum 'meta'? Are those professional kind Wizards, together with ones that use White, Green, Red, or even Blue magic, or are they a piece extra stereotypical? Well, after doing a little research, those appear to be the consequences, listed from least to most used: Slow: Slows an opponent for a duration, maximum of the time is changed by means of Haste, but a few gamers choose to slow others in preference to velocity themselves up. Haste: Speeds the Wizard up by way of a quite noticeable amount for a brief duration. This is the important thing device Wizards use to usually maintain their combatants at variety, and the use of this they can outrun just about everybody in the game (outside of projectile guns or different Spells). Invisibility: One of the fine Spells to apply on Wizard, but only veteran players appear to be utilizing it to the maximum. Basically permits the Wizard to use the identical strategies as a Rogue does with their Hide capability. Fireball: The Spell everyone makes use of before everything, tends to reveal up in each game, and is nearly usually extraordinarily suitable. But, in Dark and Darker, gamers will fast realizes that it is straightforward to hit allies with and there are better options for normal damage. Chain Lightning: Likely the pleasant alternative damage-sensible, and the friendly-fireplace element of it's far a chunk misleading (would not clearly chain to allies find it irresistible says it does). When aimed well, can decimate an unaware foe. Magic Missile: The most iconic 'Wizard Spell', Magic Missile, is tremendously right in Dark and Darker as properly. It's extraordinary for NPC enemies, excellent for region denial in a PvP fight, and it is the pleasant Spell to apply if the enemy manages to shut the space as it may speedy soften via their HP earlier than their swing connects. Last-Second General Wizard Tips. And it is pretty a great deal the whole thing gamers want to realize about constructing Wizards in Dark and Darker. This class, out of all of the instructions the sport currently gives Darker Gold, might be one of the maximum challenging ones to play for a newcomer.
    • Sakura38 Menghadirkan Situs Link Slot Deposit 1000 Gampang Menang Di Tahun 2024 Anda Memiliki Peluang Lebih Tinggi Untuk Meraih Kemenangan. Jadilah Bagian Dari Kesuksesan Kami Dan Bergabunglah Sekarang Untuk Memenangkan Hadiah-hadiah Fantastis   ▶️▶️ KLIK DISINI DAFTAR SEKARANG ◀️◀️ ▶️▶️ KLIK DISINI LINK ALTERNATIF DAFTAR AKUN 1 ◀️◀️ ▶️▶️ KLIK DISINI LINK ALTERNATIF DAFTAR AKUN 2 ◀️◀️ 💥Rahasia Mudah Dapat Perkalian Besar💥 💸Modal Receh Jamin AUTO JEPE 💸 ⚡Deposit Scan QRIS Proses Hanya 2 Detik !, WD Pasti LAND Kilat⚡ 🎰RTP & Pola GACOR Akurat🎰
    • Jagex held the Winter Summit towards the end of the year, where it revealed its content plans for 2023. Old School RuneScape recently got its Grandmaster Quest which serves as an expansion of Desert Treasure, a quest which is nearly twenty years old. If you were in the game the time Desert Treasure came out, you can imagine how thrilled a lot of players of OSRS gold were when the sequel was revealed. Desert Treasure II will make its way into Old School RuneScape during the summer of 2023. it's expected to introduce new bosses and content. There will be even more social elements that will be added to the Woodcutting game that has been a favorite with gamers. There's a new quest called the Secret of the North, which is a master-level quest is now available in the game and comes with some amazing boss fights that are only for solo players. Additionally, the Bounty Hunters miniature game returning to the game, which is sure to delight PvP players. I am sure there will be more games to come out by 2024 or later. RuneScape will not be going away and there's plenty of new content available to enjoy each year. The gameplay, the content, advancement systems, environments and even the music do not need introduction. I'd lie if I claimed that the game doesn't show its age. However, OSRS remains an enjoyable experience loved by the players and hasn't changed for over two decades. I've had plenty of unpleasant experiences in RuneScape and was cheated to death by "friends" earlier in the days, but we grow and learn. Even though it's a long-running MMORPG The game has a huge player base and there are many loyal players who have played for a long time. I had been away playing for a long time and yet it took me just a few minutes to locate helpful players who came together and assisted me. RuneScape is one of the most friendly communities I've seen across all gaming. my experience as a player was mostly positive, even in 2023. We're all aware of how much of the community devotes itself to skills, and it appears that we aren't seeing the final of the skills system yet. The new skill still to be announced and will be available in the coming months. Additionally, the minigames and side-activities are not left out by the game's developers, and they are constantly adding more features to the game. Over two decades of material is available, and, at the rate that it is going I'm not able to even guess how long the game will flourish. The community is active in its part in providing feedback and requests for more features for the old game. In the age of next-generation gaming, OSRS and RuneScape still retain the interest of a lot of players and keep them returning every day. I would highly suggest RuneScape in addition to Old School RuneScape to new players of 2023. but there's a caveat. The MMORPG genre has changed dramatically throughout the years, and it isn't easy to suggest RuneScape to those who are familiar with contemporary graphics and the extravagant environments that many of MMORPGs and live-services have to offer. However, if graphics aren't important to you and you are looking for a game that is fun, then consider giving it a shot and it's definitely worth the time. If you're a veteran who gave up RuneScape and cheap OSRS gold and is contemplating returning it, I highly recommend that you play the latest game's content. Like I said, RuneScape respects your time and, even if it's been more than a decade since the last time you played, you'll not have any issues jumping in to the action and starting it over and over. The process of preparing for new features took approximately a week. I had the chance to play the brand-new Secrets of the North content even after a lengthy hiatus.
  • Topics

×
×
  • Create New...

Important Information

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