GithubHelp home page GithubHelp logo

darkhax-minecraft / mobstages Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 8.0 157 KB

Allows mob spawning to be put into stages

License: GNU Lesser General Public License v2.1

Java 100.00%
hacktoberfest

mobstages's Introduction

Mob Stages

This mod hooks in to the GameStage API, and allows mob spawning to be gated behind custom progression.

Nodecraft
This project is sponsored by Nodecraft. Use code Darkhax for 30% off your first month of service!

Description

This mod is an addon for the GameStage API. This allows for mob spawning to be put into a custom progression system. You should check out the GameStage API mod's description for more info. To give a brief run down, stages are parts of the progression system set up by the modpack or server. Stages are given to players through a command, which is typically ran by a questing mod, advancement, or even a Command Block.

Setup

This mod uses CraftTweaker for configuration.

Global Setup

  • mod.MobStages.addStage(String stage, String entityId); - Adds a mob to a stage. When it attempts to spawn in the world, it will check for nearby players that have this stage unlocked. If no valid players are found, the mob will not be able to spawn.
  • mob.MobStages.addReplacement(String entityId, String replacementId); - Adds a replacement for the mob. If it fails to spawn, the replacement will be spawned instead. This requires that you add the mob to a stage first. This is optional.
  • mob.MobStages.addRange(String entityId, int range); - Sets the range to search for players. The fault range is 256, and is automatically set for you. This is optional.
  • mob.MobStages.toggleSpawners(String entityId, boolean allow); - Allows for mob spawners to ignore the stage rules and spawn the mob anyway.

Dimensional Setup

This mod adds dimension specific versions of all the methods in the previous section. The dimension versions accept the numeric dimension id as an additional last parameter. For example, mod.MobStages.addStage(String stage, String entityId); becomes mod.MobStages.addStage(String stage, String entityId, int dimension);. If a mob has a dimensional entry, it will override the global entry.

Example Script

// Creepers require stage one to spawn
mods.MobStages.addStage("one", "minecraft:creeper");

// Skeletons require stage two, or any spawner.
mods.MobStages.addStage("two", "minecraft:skeleton");
mods.MobStages.toggleSpawner("minecraft:skeleton", true);

// Spiders require stage three in the nether.
mods.MobStages.addStage("three", "minecraft:spider", -1);

// Zombies can spawn from spawners in the nether
mods.MobStages.addStage("four", "minecraft:zombie", -1);
mods.MobStages.toggleSpawner("minecraft:zombie", true, -1);

// Zombies are replaced by bats in other dimensions.
mods.MobStages.addStage("four", "minecraft:zombie");
mods.MobStages.addReplacement("minecraft:zombie", "minecraft:bat");

mobstages's People

Contributors

darkhax avatar jaredlll08 avatar jriwanek avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mobstages's Issues

Range issue on mp servers

MobStages-1.12.2-2.0.8

Currently using MobStages on a server and it works perfectly aside from one thing.

I've left ranges at default, so from your CF page it should be 256 but end-game gated mobs are still spawning around my base even when I'm 2k+ blocks away from it.

I'm using FTB for chunk claiming/chunk loading, so it might be that it's counting as 'me' and continuing to spawn gated mobs around my base as if I was there?

Main problem is I've got end-game mobs unlocked while other players aren't as far along and don't have the gear to survive them.

Any advice on this Darkhax?

Issue enabling mob spawners for stage

script:

//Dimensions, Allow Overworld and Mining Dimension Only
mods.DimensionStages.addDimensionStage("ch1",6);

//Mob Spawning Control.  Chapter one is lightweight. We'll only have Zombies and Spiders
mods.MobStages.addStage("ch1","minecraft:zombie");
mods.MobStages.addStage("ch1","minecraft:spider");

//Allow Skelly spawners to work in Ch1 if they find one
mods.MobStages.toggleSpawner("minecraft:skeleton",true,0);

Crafttweaker log:

[INITIALIZATION][SERVER][INFO] [crafttweaker | SIDE_SERVER]: Loading Script: {[0:crafttweaker]: stage_chapter_1.zs}
[INITIALIZATION][SERVER][INFO] Dimension 6 has been added to stage ch1
[INITIALIZATION][SERVER][INFO] Adding minecraft:zombie to stage.ch1
[INITIALIZATION][SERVER][INFO] Adding minecraft:spider to stage.ch1
[INITIALIZATION][SERVER][INFO] Toggling spawners for minecraft:skeleton to true Dimension: 0
[INITIALIZATION][SERVER][ERROR] [crafttweaker]: Error executing {[0:crafttweaker]: stage_chapter_1.zs}: null
java.lang.NullPointerException
	at net.darkhax.mobstages.compat.crt.ActionOverlookSpawners.apply(ActionOverlookSpawners.java:37)
	at crafttweaker.runtime.CrTTweaker.apply(CrTTweaker.java:43)
	at crafttweaker.CraftTweakerAPI.apply(CraftTweakerAPI.java:131)
	at net.darkhax.mobstages.compat.crt.MobStagesCrT.toggleSpawner(MobStagesCrT.java:57)
	at Stage_chapter_1.__script__(stage_chapter_1.zs:10)
	at __ZenMain__.run(Stage_chapter_1)
	at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:147)
	at crafttweaker.runtime.CrTTweaker.load(CrTTweaker.java:54)
	at crafttweaker.CrafttweakerImplementationAPI.load(CrafttweakerImplementationAPI.java:115)
	at crafttweaker.mc1120.events.CommonEventHandler.registerRecipes(CommonEventHandler.java:50)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_310_CommonEventHandler_registerRecipes_Register.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:746)
	at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:622)
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:717)
	at net.minecraftforge.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:107)
	at net.minecraftforge.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:337)
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:219)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
	at java.lang.Thread.run(Thread.java:748)
[INITIALIZATION][SERVER][INFO] [crafttweaker | SIDE_SERVER]: Loading Script: {[0:crafttweaker]: stage_chapter_2.zs}
[INITIALIZATION][SERVER][INFO] Dimension -1 has been added to stage ch2
[INITIALIZATION][SERVER][INFO] Adding minecraft:creeper to stage.ch2
[INITIALIZATION][SERVER][INFO] Adding minecraft:skeleton to stage.ch2

Query - Weighting issue?

When a mob is Staged and becomes unlocked, myself and mypack players are finding that the mob just unlocked becomes heavily weighted with mob spawns. So for example, if spiders have just been unlocked, 90% of all spawning are now spiders, until the next mob is unlocked, then that becomes the main spawn.

Does MobStages work by dynamically adjusting the mob spawn weights? If so, could there be a typo on the weight being used to put the mobs back into the spawn pool?

There's nothing else in the pack that would adjust mob weights (as far as I'm aware) and I'm trying to work out where the issue originates (might be an obscure cross mod interaction going on).

Is there any way I can find out the mob spawn weights ingame?

can a mob with a nbt tag be spawned?

I have no idea if this mod can support a mob with a complex nbt tag.When i execute the command
/summon spider ~ ~ ~ {Passengers:[{id:"minecraft:skeleton",HandItems:[{id:"minecraft:bow",Count:1b}]}]}
I can spawn a spider jockey,but i do not know what will happen if i want to execute this command in your mod.

so btw... Can you share us an example to use the nbt in MobStages?

[Question] Can we toggle an entire mod?

I don't see a way to enable or disable mobs from an entire mod all at once . . . or to simply blanket allow all mobs to be spawned from spawners.

I'm making this a question rather than a feature request since I know most other Gamestage add ons can use blanket functions like this and I half expect it just got missed when the examples were being shown. :)

[1.12.2] I can't use it on a certain mob

Hello,

I coded that the Sun Spirit from Aether Legacy cannot spawn since we reach a certain stage
But when I launch the game, it says that this entity doesn't exist

I know I put the right ID because I can summon it with this ID, and I copy-pasted the line of code so I cannot be wrong through this

Villagers still spawn, even when staged.

Villagers will still spawn, even when staged correctly.

Here is my staging code:
mods.MobStages.addStage("nether_unlock", "minecraft:villager");

Here is crafttweaker log saying it's staged correctly:
[INITIALIZATION][CLIENT][INFO] Adding minecraft:villager to stage.nether_unlock

Here is the print out in game saying I do not have the stage:
image

Here's a screenshot of a villager (taken just after the stage printout):
image

I was wondering if it was something to do with the villager professions. Regardless, they are being marked as stage, but still spawning.

Versions:

Forge: 14.23.4.2756
Game Stages: 2.0.98
Mob Stages: 2.0.8
CraftTweaker: 4.1.9

[suggestion] Being able to toggle mobs by biome

I love that we can toggle creatures on and off specifically based on what dimension the player is in. I'm using that a lot in my current project . . . and then I thought that it might be nice to toggle on certain mobs depending just for one biome or just for another.

I'm not sure if this is something anyone else would want but it seemed like a worthwhile idea to bring up. :)

add.Replacement not working as intended?

Using the last version of mob stages, MobStages-1.12.2-2.0.8.
Trying to spawn giant rats from various oddities instead of zombies doesnt works as intended. It spawn an enormous quantity of replacement mobs.

The giant rat does not have a natural spawn enabled in this mod. Maybe is something realated to that?

here's the script

mods.MobStages.addStage("monster_from_the_depths", "minecraft:zombie");
mods.MobStages.addRange("minecraft:zombie", 32);
mods.MobStages.addReplacement("minecraft:zombie", "varodd:rat_giant");

immagine

Mob Replacement not respecting Spawning Rules?

I tried using MobReplacement in conjunction with the addStage so that early game hostile mobs were replaced by passives. But my gameworld just filled up with Passives, and they just kept spawning. I had to use the Kill command to get rid of them all, killing 2k of each type of passive replacement!

I've then scrapped that idea, just using MobStages, but I used one replacement. Replacing Witch Spawns with Silverfish, but Silverfish are spawning very frequently. Even when all the other hostile mobs are unlocked, Silverfish are very common. Given how rare Witches do spawn, I wasn't expecting this.

This is just a gut feeling, but it feels like the replacements are not then following the spawning rules.

I'm also using a mod that blacklists blocks for spawning, so I've made the surface blocks blacklisted (grass, sand, gravel) but these Silverfish will spawn on these blocks which does support the idea the spawning rules are not being followed.

Am I misunderstanding how it works, or have I found a bug, or some weird cross mod interaction?

This is the simple code:
mods.MobStages.addStage("XXXXX", "minecraft:witch");
mods.MobStages.addReplacement("minecraft:witch", "minecraft:silverfish");

Question(s) on mob replacement

I'd like to limit the number of different mobs that can spawn in each biome and then change them as the player progresses through the pack . . . I imagine doing this by using mob replacement as follows:

The game rolls a zombie as one of the mobs that can spawn . . . but zombies are blocked because the player has moved on to stage two and so it is replaced by a husk which won't burn up in the daylight . . .

The player moves on to stage three . . . again a zombie is rolled and the game looks to replace it with a husk but now husks are blocked . . . I've set husks to be replaced by Ghouls from another mod so the ghoul spawns instead.

In all of these instances, I've only had one hostile mob spawn rolled for by the game: A zombie. But due to replacement rules as the player advances further and further into the game that zombie keeps getting replaced by other mobs as the previous level locks and the new one opens up.

Is this something that would work?

Also, can you set up several replacement mobs that could validly replace something like a zombie?

For example, what would happen if I wanted to randomly replace zombies with one of several different successor creatures? Would I be able to do that just by writing multiple lines of code like this:

mods.MobStages.addReplacement("minecraft:zombie", "minecraft:bat");
mods.MobStages.addReplacement("minecraft:zombie", "minecraft:skeleton");

Or would only the last replacement be kept?

Thaumcraft portals not being staged

Thaumcraft portals register as entities as "thaumcraft:cultistportallesser" and "thaumcraft:cultistportalgreater". I have them staged via the
mods.MobStages.addStage("thaumcraft", "thaumcraft:cultistportalgreater");
method, but they are still spawning and allowing Cultists to spawn despite the stage being lock. Any suggestion on what to do about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.