A library mod that exposes KubeJS methods to restrict how players travel through dimensions. Built around Player Skills.
Player Skills | Block Skills | Dimension Skills | Fluid Skills | Item Skills | Mob Skills
This mod leans extensively on Player Skills by creating and consuming the Skill-based Restrictions. Out of the box, this mod can restrict whether a player can travel to a dimension or redirect to which dimension the player travels.
When creating restrictions, you have two avenues: replace
the destination with a different dimension or modify
how a
player can access the destination dimension. Replacements will trump other modifications. One example where you may want
to use both is in cascading progress: when the player starts, the dimension is completely inaccessible. After meeting
some criteria, the player must attempt to access the dimension with the correct criteria (i.e. from the correct
dimension or biome). Or maybe the portal redirects the player to a prerequisite dimension first. Finally, the dimension
can be fully accessible.
We use the DimensionSkillEvents.register
server event to register dimension restrictions. If the player
matches the criteria, the following restrictions are applied. This can cascade with other restrictions, so any
restrictions which replaces a dimension will trump any which only add restrictions to the dimension. Also, any
restrictions which deny the ability will trump any which allow it. We also expose these methods to indicate what
restrictions are in place for when a player meets that condition. By default, no restrictions are set, so be sure to set
actual
restrictions. See Player Skills documentation for the shared API.
replaceWith(dimension: string)
- Name of replacement dimension
nothing()
- shorthand to apply all "allow" restrictionsaccessible()
- the dimension is accessible
everything()
- shorthand to apply the below "deny" abilitiesinacessible()
- the dimension cannot be accessed
DimensionSkillEvents.register((event) => {
// Player cannot access the nether until they have gained the access_nether skill
event.restrict("minecraft:the_nether", (restrict) =>
restrict.inaccessible().if(player => player.cannot('access_nether'))
);
// Players whose dimensions_accessed skill is less than 5 will be redirected to The End rather than the Nether
event.restrict("the_nether", (restrict) =>
restrict.replaceWith("the_end").if(player => player.cannot('dimensions_accessed', 5))
);
// Players whose dimensions_accessed skill is less than 5 will be redirected to The End rather than the Ad Astra dimensions
event.restrict("#ad_astra", (restrict) =>
restrict.replaceWith("the_end").if(player => player.cannot('dimensions_accessed', 5))
);
// Player cannot access the overworld from the Nether if they have not gained the beat_some_boss skill. This does
// not prevent travel to other dimensions from the Nether or even travel to the Nether
event.restrict("minecraft:overworld", (restrict) =>
restrict.inaccessible().inDimension("the_nether").unless(player => player.can("beat_some_boss"))
);
});
A known error is that redirecting travel from the End to another dimension will crash the server with
an Entity colliding with block
error.
Add the following to your build.gradle
. I depend
on Architectury API, KubeJS,
and PlayerSkills, so you'll need those as well.
dependencies {
// Common should always be included
modImplementation "net.impleri:dimension-skills-${minecraft_version}:${dimensionskills_version}"
// Plus forge
modApi "net.impleri:dimension-skills-${minecraft_version}-forge:${dimensionskills_version}"
// Or fabric
modApi "net.impleri:dimension-skills-${minecraft_version}-fabric:${dimensionskills_version}"
}
repositories {
maven {
url = "https://maven.impleri.org/minecraft"
name = "Impleri Mods"
content {
includeGroup "net.impleri"
}
}
}
Want to use this in a modpack? Great! This was designed with modpack developers in mind. No need to ask.