Jump to content

Recommended Posts

Posted

I was wondering what was the best way to go about making a list of just the monster entities? Essentially, I want to randomly spawn a monster type enemy from a list. After looking through, I saw that monsters had an EntityClassification, but wasn't sure if I could use that to compile a list of just monsters.

Posted

Hmm, I see. I've been searching for the spawning the method to spawn an Entity in the overworld too, but I'm not sure how to find that if someone could point me in the right direction?

Posted
On 5/5/2021 at 5:41 PM, poopoodice said:

Create an instance of the entity (iirc there's a method in EntityType called create() or something), and then add it through world.addEntity.

Hmm, any chance you can provide or are aware of an example for how this works?

Posted (edited)
List<EntityType<?>> MONSTERS = new ArrayList<>();

void summonRandomMonster()
{
  if (MONSTERS.isEmpty())
    MONSTERS.addAll(ForgeRegistries.ENTITIES.getValues().filter((type) -> is type classification monster))
  Entity entity = (random EntityType from MONSTERS).create(world);
  if (entity != null)
  {
    entity.setPosition(x, y, z);
    world.addEntity(entity);
  }
}

 

Edited by poopoodice
  • Like 1
Posted
On 5/10/2021 at 7:38 PM, poopoodice said:

List<EntityType<?>> MONSTERS = new ArrayList<>();

void summonRandomMonster()
{
  if (MONSTERS.isEmpty())
    MONSTERS.addAll(ForgeRegistries.ENTITIES.getValues().filter((type) -> is type classification monster))
  Entity entity = (random EntityType from MONSTERS).create(world);
  if (entity != null)
  {
    entity.setPosition(x, y, z);
    world.addEntity(entity);
  }
}

 

Appreciated, got it working. Just realized I need to filter out the big bosses now as I didn't consider it until the Ender Dragon was spawned, but that is simply just doing another filter over the list.

  • 3 weeks later...
Posted

Just to add on this - if I wanted to add a cooldown to the enemy spawning (since I'm doing the enemy spawning based on an enchantment being on an armor piece) - would it be best to do through NBT on the armor piece for a cooldown?

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

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

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