Arrrrrr Minecolonies got some new Mobs!

4개월 전

Repository:

https://github.com/ldtteam/minecolonies
Hi everyone,

While this has been a few days ago I finally got the time to write about our newest mob!

The Pirates

I could talk a lot about them but I believe a video is more insightful

Gratulations to our graphics team on the design of the pirates and pirate armor parts.

Preparation:

Now, since we had barbarians for a while already most of the code related to raiders was basically fixed on barbarians.

My idea was to generalize all this code in this process which will allow us to add a lot of other types of raiders in the future.

So manager classes for barbarians were renamed to

Kill commands were changed to include all raiders


And the abstract barbarian class became the abstract raider class

This update is difficult to describe since a lot of the work was generalizing the classes by removing specific code and moving it into the specific classes.

One of these classes was the event utils where I separated it in MobEventUtils, BarbarianEventUtils, and PirateEventUtils to separate the concerns better.

Where MobEventUtils would call the specific methods of the other two utility classes.

Pirates Spawning:

As you probably saw in the videos the pirate events spawn these ships with spawners on them.

These will spawn if the spawn point for the raid is in the water.

The central pirate event method would load the structure of a matching ship (which we calculate previously) and then try to spawn it at a certain position in the world.

Then it would load the spawners and send a message to the player.

The spawner code is mainly manually defined based on the type of the ship.

Where it would place the spawner and set the spawning entity.

To make sure they arrive in time at the colony we'd also increase their swim speed significantly.

Assets:

Since we implemented the custom armor and weapons all of these had to be created also in code.

One general gear class.

Then the two sets would be defined regarding merchantability, durability, toughness, and how they are rendered from an asset file.

Similar to the iron scimitar.

And then I would have to make sure to register the items.

Register render handler for the entities

And create the custom models for the items

Then, registering the entities themselves

the loot tables

and the spawn eggs

And the ship?

Now the ship would spawn in as explained earlier, what had to be added now is that it would have to despawn again later as well.

For that, I created a method in the structure handling code to despawn a structure and unload it.

public static void unloadStructure(@NotNull final World world, @NotNull final BlockPos pos, @NotNull final String first, final int rotation, @NotNull final Mirror mirror)
    {
        @NotNull final StructureWrapper structureWrapper = new StructureWrapper(world, first);
        structureWrapper.position = pos;
        structureWrapper.rotate(rotation, world, pos, mirror);
        structureWrapper.removeStructure(pos.subtract(structureWrapper.getOffset()));
    }

For that, we would register the ship earlier with the colony and save it on a map.

And then every few ticks we would check if it is already time to despawn any of the ships and then unload them accordingly.

Pull request :

https://github.com/ldtteam/minecolonies/pull/3027

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
STEEMKR.COM IS SPONSORED BY
Sort Order:  trending
  • Love the video, great visuals.
  • It's very satisfying to reuse code.
  • I can see getSpeed() getting used more and more for other types of raiders.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

·

Thank you for your review, @helo! Keep up the good work!

logo.png

Congratulations, your post was discovered and featured in our Daily Curation Report 24/11/2018 and has been upvoted for free by @ignis-witness Curation Trial !


Accounts used to curate your post:
ignis-witness , txmek, voxmortis, cyrusik , theodosiskatq , anggaariska , skorup87 , kingnosa , gpcx86


You can vote for @ignis-witness with SteemConnect or on Steemit Witnesses to help support undervalued authors!

Hi, @raycoms!

You just got a 11.87% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @raycoms!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @raycoms!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!